You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devicemap.apache.org by bd...@apache.org on 2012/10/02 15:34:35 UTC

svn commit: r1392912 [8/8] - in /incubator/devicemap/trunk/openddr/csharp: ./ DDR-Simple-API/ DDR-Simple-API/Exceptions/ DDR-Simple-API/Models/ DDR-Simple-API/Properties/ DDR-Simple-API/Simple/ OpenDDR-CSharp/ OpenDDR-CSharp/Builders/ OpenDDR-CSharp/Bu...

Added: incubator/devicemap/trunk/openddr/csharp/OpenDDRTest/OpenDDRTest.csproj
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/csharp/OpenDDRTest/OpenDDRTest.csproj?rev=1392912&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/csharp/OpenDDRTest/OpenDDRTest.csproj (added)
+++ incubator/devicemap/trunk/openddr/csharp/OpenDDRTest/OpenDDRTest.csproj Tue Oct  2 13:34:31 2012
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+    <ProductVersion>8.0.30703</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{C1ECDE8F-0B77-422D-B4B6-0CF2239C7FA2}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>OpenDDRTest</RootNamespace>
+    <AssemblyName>OpenDDRTest</AssemblyName>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <TargetFrameworkProfile>
+    </TargetFrameworkProfile>
+    <FileAlignment>512</FileAlignment>
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+    <PlatformTarget>x86</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+    <PlatformTarget>x86</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup>
+    <StartupObject>OpenDDRTest.SimpleTest</StartupObject>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="log4net, Version=1.2.11.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>lib\log4net.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="SimpleTest.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\DDR-Simple-API\DDR-Simple-API.csproj">
+      <Project>{F802E34F-10F1-4334-9099-3F1579DC4F06}</Project>
+      <Name>DDR-Simple-API</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\OpenDDR-CSharp\OpenDDR-CSharp.csproj">
+      <Project>{67A3A231-64F0-49F2-BD02-316995E7A737}</Project>
+      <Name>OpenDDR-CSharp</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+      <Visible>False</Visible>
+      <ProductName>Windows Installer 3.1</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config">
+      <SubType>Designer</SubType>
+    </None>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file

Added: incubator/devicemap/trunk/openddr/csharp/OpenDDRTest/Properties/AssemblyInfo.cs
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/csharp/OpenDDRTest/Properties/AssemblyInfo.cs?rev=1392912&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/csharp/OpenDDRTest/Properties/AssemblyInfo.cs (added)
+++ incubator/devicemap/trunk/openddr/csharp/OpenDDRTest/Properties/AssemblyInfo.cs Tue Oct  2 13:34:31 2012
@@ -0,0 +1,42 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// Le informazioni generali relative a un assembly sono controllate dal seguente 
+// set di attributi. Per modificare le informazioni associate a un assembly
+// occorre quindi modificare i valori di questi attributi.
+[assembly: AssemblyTitle("OpenDDRTest")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("OpenDDRTest")]
+[assembly: AssemblyCopyright("Copyright ©  2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili 
+// ai componenti COM. Se è necessario accedere a un tipo in questo assembly da 
+// COM, impostare su true l'attributo ComVisible per tale tipo.
+[assembly: ComVisible(false)]
+
+// Se il progetto viene esposto a COM, il GUID che segue verrà utilizzato per creare l'ID della libreria dei tipi
+[assembly: Guid("4842f2e8-b7dd-4546-9241-26a5f01483ef")]
+
+// Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
+//
+//      Numero di versione principale
+//      Numero di versione secondario 
+//      Numero build
+//      Revisione
+//
+// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build 
+// utilizzando l'asterisco (*) come descritto di seguito:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
+
+// This will cause log4net to look for a configuration file 
+// called [ThisApp].exe.config in the application base 
+// directory (i.e. the directory containing [ThisApp].exe) 
+// The config file will be watched for changes. 
+[assembly: log4net.Config.XmlConfigurator(Watch = true)]

Added: incubator/devicemap/trunk/openddr/csharp/OpenDDRTest/SimpleTest.cs
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/csharp/OpenDDRTest/SimpleTest.cs?rev=1392912&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/csharp/OpenDDRTest/SimpleTest.cs (added)
+++ incubator/devicemap/trunk/openddr/csharp/OpenDDRTest/SimpleTest.cs Tue Oct  2 13:34:31 2012
@@ -0,0 +1,67 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using W3c.Ddr.Models;
+using W3c.Ddr.Simple;
+using Oddr.Models;
+
+namespace OpenDDRTest
+{
+    public class SimpleTest
+    {
+        public static void Main(string[] args)
+        {
+            string oddrPropertiesPath = args[0];
+            string userAgent = args[1];
+
+            Properties props = new Properties(oddrPropertiesPath);
+
+            Type stype = Type.GetType("Oddr.ODDRService, OpenDdr");
+
+            IService openDDRService = ServiceFactory.newService(stype, props.GetProperty("oddr.vocabulary.device"), props);
+
+            IPropertyName vendorDevicePropertyName = openDDRService.NewPropertyName("vendor", @"http://www.openddr.org/oddr-vocabulary");
+            IPropertyRef vendorDeviceRef = openDDRService.NewPropertyRef(vendorDevicePropertyName, "device");
+
+            IPropertyName modelDevicePropertyName = openDDRService.NewPropertyName("model", @"http://www.openddr.org/oddr-vocabulary");
+            IPropertyRef modelDeviceRef = openDDRService.NewPropertyRef(modelDevicePropertyName, "device");
+
+            IPropertyName vendorBrowserPropertyName = openDDRService.NewPropertyName("vendor", @"http://www.openddr.org/oddr-vocabulary");
+            IPropertyRef vendorBrowserRef = openDDRService.NewPropertyRef(vendorBrowserPropertyName, "webBrowser");
+
+            IPropertyName modelBrowserPropertyName = openDDRService.NewPropertyName("model", @"http://www.openddr.org/oddr-vocabulary");
+            IPropertyRef modelBrowserRef = openDDRService.NewPropertyRef(modelBrowserPropertyName, "webBrowser");
+
+            IPropertyRef[] propertyRefs = new IPropertyRef[] { vendorDeviceRef, modelDeviceRef, vendorBrowserRef, modelBrowserRef };
+
+            IEvidence e = new BufferedODDRHTTPEvidence();
+            e.Put("User-Agent", userAgent);
+
+            IPropertyValues propertyValues = openDDRService.GetPropertyValues(e, propertyRefs);
+            if (propertyValues.GetValue(vendorDeviceRef).Exists())
+            {
+                Console.WriteLine(propertyValues.GetValue(vendorDeviceRef).GetString());
+            }
+
+            if (propertyValues.GetValue(modelDeviceRef).Exists())
+            {
+                Console.WriteLine(propertyValues.GetValue(modelDeviceRef).GetString());
+            }
+
+            if (propertyValues.GetValue(vendorBrowserRef).Exists())
+            {
+                Console.WriteLine(propertyValues.GetValue(vendorBrowserRef).GetString());
+            }
+
+            if (propertyValues.GetValue(modelBrowserRef).Exists())
+            {
+                Console.WriteLine(propertyValues.GetValue(modelBrowserRef).GetString());
+            }
+
+            Console.WriteLine(((BufferedODDRHTTPEvidence) e).deviceFound.Get("is_wireless_device"));
+
+            Console.ReadKey();
+        }
+    }
+}

Added: incubator/devicemap/trunk/openddr/csharp/README.md
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/csharp/README.md?rev=1392912&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/csharp/README.md (added)
+++ incubator/devicemap/trunk/openddr/csharp/README.md Tue Oct  2 13:34:31 2012
@@ -0,0 +1,91 @@
+OpenDDR-CSharp
+==============
+Dear OpenDDR user, 
+
+this is the ALPHA version of the C# porting of OpenDDR!
+
+We implemented all the features of OpenDDR Java version (except Group Aspect Identification), but we still need to improve performance.
+
+All contributions are welcome.
+Thanks for your helping OpenDDR growing!
+
+
+Below a description of the directory tree:
+* __DDR-Simple-API__: contains the porting of the W3C's Device Description Repository Simple API 
+* __OpenDDR-CSharp__: contains the porting of the Java version of OpenDDR
+* __OpenDDRTest__: contains a simple test project of the C# version of OpenDDR
+
+
+A basic explanation of the properties in oddr.properties:
+* __oddr.ua.device.builder.path__: Path of the file that explains how to identify the devices. In this, for each builder, are specified the device IDs that the builder handles and the identification rules
+* __oddr.ua.device.datasource.path__: Path of the device datasource
+* __oddr.ua.device.builder.patch.paths__: Path of the patch file for the builder file
+* __oddr.ua.device.datasource.patch.paths__: Path of the patch file for the device data source
+* __oddr.ua.browser.datasource.path__: Path of the browser data source
+* __oddr.ua.operatingSystem.datasource.path__: Path of the operating system data source
+* __ddr.vocabulary.core.path__: Path of the W3C vocabulary file
+* __oddr.vocabulary.path__: Path of the OpenDDR vocabulary
+* __oddr.limited.vocabulary.path__: Path of the reduced vocabulary. This vocabulary is usefull to limitate the memory load. It can be safely left unspecified.
+* __oddr.vocabulary.device__: IRI of the default vocabulary. It is the target namespace specified in a vocabulary
+* __oddr.threshold__: Identification threshold. It is used to balance the request evaluation time and identification matching.
+
+The sample class below shows how to use OpenDDR: 
+
+<pre><code>
+public class SimpleTest
+{
+	public static void Main(string[] args)
+	{
+		string oddrPropertiesPath = args[0];
+		string userAgent = args[1];
+
+		Properties props = new Properties(oddrPropertiesPath);
+
+		Type stype = Type.GetType("Oddr.ODDRService, OpenDdr");
+
+		IService openDDRService = ServiceFactory.newService(stype, props.GetProperty("oddr.vocabulary.device"), props);
+
+		IPropertyName vendorDevicePropertyName = openDDRService.NewPropertyName("vendor", @"http://www.openddr.org/oddr-vocabulary");
+		IPropertyRef vendorDeviceRef = openDDRService.NewPropertyRef(vendorDevicePropertyName, "device");
+
+		IPropertyName modelDevicePropertyName = openDDRService.NewPropertyName("model", @"http://www.openddr.org/oddr-vocabulary");
+		IPropertyRef modelDeviceRef = openDDRService.NewPropertyRef(modelDevicePropertyName, "device");
+
+		IPropertyName vendorBrowserPropertyName = openDDRService.NewPropertyName("vendor", @"http://www.openddr.org/oddr-vocabulary");
+		IPropertyRef vendorBrowserRef = openDDRService.NewPropertyRef(vendorBrowserPropertyName, "webBrowser");
+
+		IPropertyName modelBrowserPropertyName = openDDRService.NewPropertyName("model", @"http://www.openddr.org/oddr-vocabulary");
+		IPropertyRef modelBrowserRef = openDDRService.NewPropertyRef(modelBrowserPropertyName, "webBrowser");
+
+		IPropertyRef[] propertyRefs = new IPropertyRef[] { vendorDeviceRef, modelDeviceRef, vendorBrowserRef, modelBrowserRef };
+
+		IEvidence e = new BufferedODDRHTTPEvidence();
+		e.Put("User-Agent", userAgent);
+
+		IPropertyValues propertyValues = openDDRService.GetPropertyValues(e, propertyRefs);
+		if (propertyValues.GetValue(vendorDeviceRef).Exists())
+		{
+			Console.WriteLine(propertyValues.GetValue(vendorDeviceRef).GetString());
+		}
+
+		if (propertyValues.GetValue(modelDeviceRef).Exists())
+		{
+			Console.WriteLine(propertyValues.GetValue(modelDeviceRef).GetString());
+		}
+
+		if (propertyValues.GetValue(vendorBrowserRef).Exists())
+		{
+			Console.WriteLine(propertyValues.GetValue(vendorBrowserRef).GetString());
+		}
+
+		if (propertyValues.GetValue(modelBrowserRef).Exists())
+		{
+			Console.WriteLine(propertyValues.GetValue(modelBrowserRef).GetString());
+		}
+
+		Console.WriteLine(((BufferedODDRHTTPEvidence) e).deviceFound.Get("is_wireless_device"));
+
+		Console.ReadKey();
+	}
+}
+</code></pre>