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:32:32 UTC

svn commit: r1392911 [6/7] - in /incubator/devicemap/trunk/openddr: ./ java/ java/src/ java/src/org/ java/src/org/openddr/ java/src/org/openddr/simpleapi/ java/src/org/openddr/simpleapi/oddr/ java/src/org/openddr/simpleapi/oddr/builder/ java/src/org/op...

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/documenthandler/VocabularyHandler.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/documenthandler/VocabularyHandler.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/documenthandler/VocabularyHandler.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/documenthandler/VocabularyHandler.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,199 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.openddr.simpleapi.oddr.documenthandler;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.openddr.simpleapi.oddr.model.vocabulary.Vocabulary;
+import org.openddr.simpleapi.oddr.model.vocabulary.VocabularyProperty;
+import org.openddr.simpleapi.oddr.model.vocabulary.VocabularyVariable;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+public class VocabularyHandler extends DefaultHandler {
+
+    private static final String ELEMENT_VOCABULARY_DESCRIPTION = "VocabularyDescription";
+    private static final String ELEMENT_ASPECTS = "Aspects";
+    private static final String ELEMENT_ASPECT = "Aspect";
+    private static final String ELEMENT_VARIABLES = "Variables";
+    private static final String ELEMENT_VARIABLE = "Variable";
+    private static final String ELEMENT_PROPERTIES = "Properties";
+    private static final String ELEMENT_PROPERTY = "Property";
+    private static final String ATTRIBUTE_PROPERTY_TARGET = "target";
+    private static final String ATTRIBUTE_PROPERTY_ASPECT_NAME = "name";
+    private static final String ATTRIBUTE_PROPERTY_ASPECT = "aspect";
+    private static final String ATTRIBUTE_PROPERTY_NAME = "name";
+    private static final String ATTRIBUTE_PROPERTY_VOCABULARY = "vocabulary";
+    private static final String ATTRIBUTE_PROPERTY_ID = "id";
+    private static final String ATTRIBUTE_PROPERTY_DATA_TYPE = "datatype";
+    private static final String ATTRIBUTE_PROPERTY_EXPR = "expr";
+    private static final String ATTRIBUTE_PROPERTY_ASPECTS = "aspects";
+    private static final String ATTRIBUTE_PROPERTY_DEFAULT_ASPECT = "defaultAspect";
+    private Vocabulary vocabulary = null;
+    private String aspect = null;
+    private List<String> aspects = null;
+    private VocabularyProperty vocabularyProperty = null;
+    private Map<String, VocabularyProperty> vocabularyProperties = null;
+    private Map<String, VocabularyVariable> vocabularyVariables = null;
+    private VocabularyVariable vocabularyVariable = null;
+
+    @Override
+    public void startDocument() throws SAXException {
+        super.startDocument();
+    }
+
+    @Override
+    public void startElement(String uri, String localName, String name, Attributes attributes) throws SAXException {
+        if (ELEMENT_VOCABULARY_DESCRIPTION.equals(name)) {
+            startVocabularyDescription(attributes);
+
+        } else if (ELEMENT_ASPECTS.equals(name)) {
+            startAspects(attributes);
+
+        } else if (ELEMENT_ASPECT.equals(name)) {
+            startAspect(attributes);
+
+        } else if (ELEMENT_VARIABLES.equals(name)) {
+            startVariables(attributes);
+
+        } else if (ELEMENT_VARIABLE.equals(name)) {
+            startVariable(attributes);
+
+        } else if (ELEMENT_PROPERTIES.equals(name)) {
+            startProperties(attributes);
+
+        } else if (ELEMENT_PROPERTY.equals(name)) {
+            startProperty(attributes);
+        }
+    }
+
+    @Override
+    public void endElement(String uri, String localName, String name) throws SAXException {
+        if (ELEMENT_ASPECT.equals(name)) {
+            endAspectElement();
+
+        } else if (ELEMENT_ASPECTS.equals(name)) {
+            endAspectsElement();
+
+        } else if (ELEMENT_VARIABLES.equals(name)) {
+            endVariablesElement();
+
+        } else if (ELEMENT_VARIABLE.equals(name)) {
+            endVariableElement();
+            
+        } else if (ELEMENT_PROPERTIES.equals(name)) {
+            endProperties();
+
+        } else if (ELEMENT_PROPERTY.equals(name)) {
+            endProperty();
+        }
+    }
+
+    private void startVocabularyDescription(Attributes attributes) {
+        vocabulary = new Vocabulary();
+        vocabulary.setVocabularyIRI(attributes.getValue(ATTRIBUTE_PROPERTY_TARGET));
+    }
+
+    private void startAspects(Attributes attributes) {
+        aspects = new ArrayList<String>();
+    }
+
+    private void startAspect(Attributes attributes) {
+        aspect = attributes.getValue(ATTRIBUTE_PROPERTY_ASPECT_NAME);
+        if (!aspects.contains(aspect)) {
+            aspects.add(aspect);
+        }
+    }
+
+    private void startVariables(Attributes attributes) {
+        vocabularyVariables = new HashMap<String, VocabularyVariable>();
+    }
+
+    private void startVariable(Attributes attributes) {
+        vocabularyVariable = new VocabularyVariable();
+        vocabularyVariable.setAspect(attributes.getValue(ATTRIBUTE_PROPERTY_ASPECT));
+        vocabularyVariable.setId(attributes.getValue(ATTRIBUTE_PROPERTY_ID));
+        vocabularyVariable.setName(attributes.getValue(ATTRIBUTE_PROPERTY_NAME));
+        vocabularyVariable.setVocabulary(attributes.getValue(ATTRIBUTE_PROPERTY_VOCABULARY));
+        if (!vocabularyVariables.containsKey(vocabularyVariable.getId())) {
+            vocabularyVariables.put(vocabularyVariable.getId(), vocabularyVariable);
+        }
+    }
+
+    private void endAspectElement() {
+        aspect = null;
+    }
+
+    private void endAspectsElement() {
+        String[] aspectsArray = new String[aspects.size()];
+        vocabulary.setAspects(aspects.toArray(aspectsArray));
+        aspects = null;
+    }
+
+    private void endVariableElement() {
+        vocabularyVariable = null;
+    }
+
+    private void endVariablesElement() {
+        vocabulary.setVocabularyVariables(vocabularyVariables);
+        vocabularyVariables = null;
+    }
+
+    private void startProperties(Attributes attributes) {
+        vocabularyProperties = new HashMap<String, VocabularyProperty>();
+    }
+
+    private void startProperty(Attributes attributes) {
+        vocabularyProperty = new VocabularyProperty();
+        String[] aspectsArray = attributes.getValue(ATTRIBUTE_PROPERTY_ASPECTS).split(",");
+
+        for (int i = 0; i < aspectsArray.length; i++) {
+            aspectsArray[i] = aspectsArray[i].trim();
+        }
+
+        vocabularyProperty.setAspects(aspectsArray);
+        vocabularyProperty.setDefaultAspect(attributes.getValue(ATTRIBUTE_PROPERTY_DEFAULT_ASPECT));
+        vocabularyProperty.setExpr(attributes.getValue(ATTRIBUTE_PROPERTY_EXPR));
+        vocabularyProperty.setName(attributes.getValue(ATTRIBUTE_PROPERTY_NAME));
+        vocabularyProperty.setType(attributes.getValue(ATTRIBUTE_PROPERTY_DATA_TYPE));
+    }
+
+    private void endProperty() {
+        vocabularyProperties.put(vocabularyProperty.getName(), vocabularyProperty);
+        vocabularyProperty = null;
+    }
+
+    private void endProperties() {
+        vocabulary.setProperties(vocabularyProperties);
+    }
+
+    @Override
+    public void endDocument() throws SAXException {
+        vocabularyProperties = null;
+    }
+
+    public Vocabulary getVocabulary() {
+        return vocabulary;
+    }
+}

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/documenthandler/VocabularyHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/documenthandler/VocabularyHandler.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/identificator/BrowserIdentificator.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/identificator/BrowserIdentificator.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/identificator/BrowserIdentificator.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/identificator/BrowserIdentificator.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,125 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.openddr.simpleapi.oddr.identificator;
+
+import java.util.Map;
+import org.openddr.simpleapi.oddr.builder.Builder;
+import org.openddr.simpleapi.oddr.model.UserAgent;
+import org.openddr.simpleapi.oddr.model.UserAgentFactory;
+import org.openddr.simpleapi.oddr.model.browser.Browser;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.ddr.simple.Evidence;
+
+public class BrowserIdentificator implements Identificator {
+
+    private Builder[] builders;
+    private Map<String, Browser> browserCapabilities;
+    protected final Logger logger = LoggerFactory.getLogger(getClass());
+
+    public BrowserIdentificator(Builder[] builders, Map<String, Browser> browserCapabilities) {
+        this.builders = builders;
+        this.browserCapabilities = browserCapabilities;
+    }
+
+    public Browser get(String userAgent, int confidenceTreshold) {
+        return get(UserAgentFactory.newUserAgent(userAgent), confidenceTreshold);
+    }
+
+    //XXX to be refined, this should NOT be the main entry point, we should use a set of evidence derivation
+    public Browser get(Evidence evdnc, int threshold) {
+        UserAgent ua = UserAgentFactory.newBrowserUserAgent(evdnc);
+
+        if (ua != null) {
+            return get(ua, threshold);
+        }
+
+        return null;
+    }
+
+    public Browser get(UserAgent userAgent, int confidenceTreshold) {
+        for (Builder builder : builders) {
+            if (builder.canBuild(userAgent)) {
+                Browser browser = (Browser) builder.build(userAgent, confidenceTreshold);
+                if (browser != null) {
+                    if (browserCapabilities != null) {
+                        String bestID = getClosestKnownBrowserID(browser.getId());
+                        if (bestID != null) {
+                            browser.putPropertiesMap(browserCapabilities.get(bestID).getPropertiesMap());
+                            if (!bestID.equals(browser.getId())) {
+                                browser.setConfidence(browser.getConfidence() - 15);
+                            }
+                        }
+                    }
+                    return browser;
+                }
+            }
+        }
+
+        return null;
+    }
+
+    private String getClosestKnownBrowserID(String actualBrowserID) {
+        if (actualBrowserID == null) {
+            return null;
+        }
+
+        int idx = actualBrowserID.indexOf(".");
+
+        if (idx < 0) {
+            logger.error("SHOULD NOT BE HERE, PLEASE CHECK BROWSER DOCUMENT(1)");
+            logger.debug(actualBrowserID);
+            return null;
+
+        } else {
+            idx++;
+        }
+        idx = actualBrowserID.indexOf(".", idx);
+
+        if (idx < 0) {
+            logger.error("SHOULD NOT BE HERE, PLEASE CHECK BROWSER DOCUMENT(2)" + idx);
+            logger.debug(actualBrowserID);
+            return null;
+
+        } else {
+            idx++;
+        }
+
+        String bestID = null;
+        for (String listBrowserID : browserCapabilities.keySet()) {
+            if (listBrowserID.equals(actualBrowserID)) {
+                return actualBrowserID;
+            }
+
+            if (listBrowserID.length() > idx && listBrowserID.substring(0, idx).equals(actualBrowserID.substring(0, idx))) {
+                if (listBrowserID.compareTo(actualBrowserID) <= 0) {
+                    bestID = listBrowserID;
+                }
+            }
+        }
+
+        return bestID;
+    }
+
+    public void completeInit() {
+        //does nothing
+    }
+}

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/identificator/BrowserIdentificator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/identificator/BrowserIdentificator.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/identificator/DeviceIdentificator.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/identificator/DeviceIdentificator.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/identificator/DeviceIdentificator.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/identificator/DeviceIdentificator.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,108 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.openddr.simpleapi.oddr.identificator;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.openddr.simpleapi.oddr.builder.device.DeviceBuilder;
+import org.openddr.simpleapi.oddr.model.device.Device;
+import org.openddr.simpleapi.oddr.model.UserAgent;
+import org.openddr.simpleapi.oddr.model.UserAgentFactory;
+import org.w3c.ddr.simple.Evidence;
+
+public class DeviceIdentificator implements Identificator {
+
+    private DeviceBuilder[] builders;
+    private Map<String, Device> devices;
+
+    public DeviceIdentificator(DeviceBuilder[] builders, Map<String, Device> devices) {
+        this.builders = builders;
+        this.devices = devices;
+    }
+
+    public Device get(String userAgent, int confidenceTreshold) {
+        return get(UserAgentFactory.newUserAgent(userAgent), confidenceTreshold);
+    }
+
+    //XXX to be refined, this should NOT be the main entry point, we should use a set of evidence derivation
+    public Device get(Evidence evdnc, int threshold) {
+        UserAgent ua = UserAgentFactory.newDeviceUserAgent(evdnc);
+        if (ua != null) {
+            return get(ua, threshold);
+        }
+        return null;
+    }
+
+    public Device get(UserAgent userAgent, int confidenceTreshold) {
+        List<Device> foundDevices = new ArrayList<Device>();
+        Device foundDevice = null;
+        for (DeviceBuilder deviceBuilder : builders) {
+            if (deviceBuilder.canBuild(userAgent)) {
+                Device device = (Device) deviceBuilder.build(userAgent, confidenceTreshold);
+                if (device != null) {
+                    String parentId = device.getParentId();
+                    Device parentDevice = null;
+                    Set propertiesSet = null;
+                    Iterator it = null;
+                    while (!"root".equals(parentId)) {
+                        parentDevice = (Device) devices.get(parentId);
+                        propertiesSet = parentDevice.getPropertiesMap().entrySet();
+                        it = propertiesSet.iterator();
+                        while (it.hasNext()) {
+                            Map.Entry entry = (Map.Entry) it.next();
+                            if (!device.containsProperty((String) entry.getKey())) {
+                                device.putProperty((String) entry.getKey(), (String) entry.getValue());
+                            }
+                        }
+                        parentId = parentDevice.getParentId();
+                    }
+                    foundDevices.add(device);
+                    if (device.getConfidence() >= confidenceTreshold) {
+                        foundDevice = device;
+                        break;
+                    }
+                }
+            }
+        }
+
+        if (foundDevice != null) {
+            return foundDevice;
+
+        } else {
+            if (foundDevices.isEmpty()) {
+                return null;
+            }
+
+            Collections.sort(foundDevices, Collections.reverseOrder());
+            return foundDevices.get(0);
+        }
+    }
+
+    public void completeInit() {
+        for (DeviceBuilder deviceBuilder : builders) {
+            deviceBuilder.completeInit(devices);
+        }
+    }
+}

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/identificator/DeviceIdentificator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/identificator/DeviceIdentificator.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/identificator/Identificator.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/identificator/Identificator.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/identificator/Identificator.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/identificator/Identificator.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,36 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.openddr.simpleapi.oddr.identificator;
+
+import org.openddr.simpleapi.oddr.model.BuiltObject;
+import org.openddr.simpleapi.oddr.model.UserAgent;
+import org.w3c.ddr.simple.Evidence;
+
+public interface Identificator {
+
+    public BuiltObject get(String userAgent, int confidenceTreshold);
+
+    public BuiltObject get(Evidence evdnc, int threshold);
+
+    public BuiltObject get(UserAgent userAgent, int confidenceTreshold);
+
+    public void completeInit();
+}

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/identificator/Identificator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/identificator/Identificator.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/identificator/OSIdentificator.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/identificator/OSIdentificator.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/identificator/OSIdentificator.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/identificator/OSIdentificator.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,122 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.openddr.simpleapi.oddr.identificator;
+
+import java.util.Map;
+import org.openddr.simpleapi.oddr.builder.Builder;
+import org.openddr.simpleapi.oddr.model.UserAgent;
+import org.openddr.simpleapi.oddr.model.UserAgentFactory;
+import org.openddr.simpleapi.oddr.model.os.OperatingSystem;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.ddr.simple.Evidence;
+
+public class OSIdentificator implements Identificator {
+
+    private Builder[] builders;
+    private Map<String, OperatingSystem> operatingSystemCapabilities;
+    protected final Logger logger = LoggerFactory.getLogger(getClass());
+
+    public OSIdentificator(Builder[] builders, Map<String, OperatingSystem> operatingSystemCapabilities) {
+        this.builders = builders;
+        this.operatingSystemCapabilities = operatingSystemCapabilities;
+    }
+
+    public OperatingSystem get(String userAgent, int confidenceTreshold) {
+        return get(UserAgentFactory.newUserAgent(userAgent), confidenceTreshold);
+    }
+
+    //XXX to be refined, this should NOT be the main entry point, we should use a set of evidence derivation
+    public OperatingSystem get(Evidence evdnc, int threshold) {
+        UserAgent ua = UserAgentFactory.newDeviceUserAgent(evdnc);
+        if (ua != null) {
+            return get(ua, threshold);
+        }
+        return null;
+    }
+
+    public OperatingSystem get(UserAgent userAgent, int confidenceTreshold) {
+        for (Builder builder : builders) {
+            if (builder.canBuild(userAgent)) {
+                OperatingSystem os = (OperatingSystem) builder.build(userAgent, confidenceTreshold);
+                if (os != null) {
+                    if (operatingSystemCapabilities != null) {
+                        String bestID = getClosestKnownBrowserID(os.getId());
+                        if (bestID != null) {
+                            os.putPropertiesMap(operatingSystemCapabilities.get(bestID).getPropertiesMap());
+                            if (!bestID.equals(os.getId())) {
+                                os.setConfidence(os.getConfidence() - 15);
+                            }
+                        }
+                    }
+                    return os;
+                }
+            }
+        }
+        return null;
+    }
+
+    private String getClosestKnownBrowserID(String actualOperatingSystemID) {
+        if (actualOperatingSystemID == null) {
+            return null;
+        }
+
+        int idx = actualOperatingSystemID.indexOf(".");
+
+        if (idx < 0) {
+            logger.error("SHOULD NOT BE HERE, PLEASE CHECK BROWSER DOCUMENT(1)");
+            logger.debug(actualOperatingSystemID);
+            return null;
+
+        } else {
+            idx++;
+        }
+        idx = actualOperatingSystemID.indexOf(".", idx);
+
+        if (idx < 0) {
+            logger.error("SHOULD NOT BE HERE, PLEASE CHECK BROWSER DOCUMENT(2)" + idx);
+            logger.debug(actualOperatingSystemID);
+            return null;
+
+        } else {
+            idx++;
+        }
+
+        String bestID = null;
+        for (String listOperatingSystemID : operatingSystemCapabilities.keySet()) {
+            if (listOperatingSystemID.equals(actualOperatingSystemID)) {
+                return actualOperatingSystemID;
+            }
+
+            if (listOperatingSystemID.length() > idx && listOperatingSystemID.substring(0, idx).equals(actualOperatingSystemID.substring(0, idx))) {
+                if (listOperatingSystemID.compareTo(actualOperatingSystemID) <= 0) {
+                    bestID = listOperatingSystemID;
+                }
+            }
+        }
+
+        return bestID;
+    }
+
+    public void completeInit() {
+        //does nothing
+    }
+}

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/identificator/OSIdentificator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/identificator/OSIdentificator.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/BufferedODDRHTTPEvidence.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/BufferedODDRHTTPEvidence.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/BufferedODDRHTTPEvidence.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/BufferedODDRHTTPEvidence.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,64 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.openddr.simpleapi.oddr.model;
+
+import org.openddr.simpleapi.oddr.model.browser.Browser;
+import org.openddr.simpleapi.oddr.model.device.Device;
+import org.openddr.simpleapi.oddr.model.os.OperatingSystem;
+
+public class BufferedODDRHTTPEvidence extends ODDRHTTPEvidence {
+
+    private Browser browserFound = null;
+    private Device deviceFound = null;
+    private OperatingSystem osFound = null;
+
+    public synchronized Browser getBrowserFound() {
+        return browserFound;
+    }
+
+    public synchronized void setBrowserFound(Browser browserFound) {
+        this.browserFound = browserFound;
+    }
+
+    public synchronized Device getDeviceFound() {
+        return deviceFound;
+    }
+
+    public synchronized void setDeviceFound(Device deviceFound) {
+        this.deviceFound = deviceFound;
+    }
+
+    public synchronized OperatingSystem getOsFound() {
+        return osFound;
+    }
+
+    public synchronized void setOsFound(OperatingSystem osFound) {
+        this.osFound = osFound;
+    }
+
+    @Override
+    public synchronized void put(String key, String value) {
+        setOsFound(null);
+        setBrowserFound(null);
+        setDeviceFound(null);
+        super.put(key, value);
+    }
+}

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/BufferedODDRHTTPEvidence.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/BufferedODDRHTTPEvidence.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/BuiltObject.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/BuiltObject.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/BuiltObject.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/BuiltObject.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,72 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.openddr.simpleapi.oddr.model;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class BuiltObject {
+
+    protected int confidence;
+    protected final Map<String, String> properties;
+
+    public BuiltObject() {
+        this.properties = new HashMap<String, String>();
+        this.confidence = 0;
+    }
+
+    public BuiltObject(int confidence, Map<String, String> properties) {
+        this.confidence = confidence;
+        this.properties = properties;
+    }
+
+    public BuiltObject(Map<String, String> properties) {
+        this.confidence = 0;
+        this.properties = properties;
+    }
+
+    public int getConfidence() {
+        return confidence;
+    }
+
+    public void setConfidence(int confidence) {
+        this.confidence = confidence;
+    }
+
+    public String get(String property) {
+        if (properties.containsKey(property)) {
+            return properties.get(property);
+        }
+        return null;
+    }
+
+    public void putProperty(String name, String value) {
+        this.properties.put(name, value);
+    }
+
+    public void putPropertiesMap(Map<String, String> properties) {
+        this.properties.putAll(properties);
+    }
+
+    public Map<String, String> getPropertiesMap() {
+        return properties;
+    }
+}

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/BuiltObject.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/BuiltObject.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/ODDRHTTPEvidence.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/ODDRHTTPEvidence.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/ODDRHTTPEvidence.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/ODDRHTTPEvidence.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,59 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.openddr.simpleapi.oddr.model;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.w3c.ddr.simple.Evidence;
+
+public class ODDRHTTPEvidence implements Evidence {
+
+    Map<String, String> headers;
+
+    public ODDRHTTPEvidence() {
+        headers = new HashMap<String, String>();
+    }
+
+    public ODDRHTTPEvidence(Map<String, String> map) {
+        headers = new HashMap<String, String>();
+        headers.putAll(map);
+    }
+
+    public boolean exists(String string) {
+        if (string == null) {
+            return false;
+        }
+        return headers.containsKey(string.toLowerCase());
+    }
+
+    public String get(String key) {
+        return headers.get(key.toLowerCase());
+    }
+
+    /**
+     *
+     * @param key case insensitive
+     * @param value case sensitive
+     */
+    public void put(String key, String value) {
+        headers.put(key.toLowerCase(), value);
+    }
+}

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/ODDRHTTPEvidence.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/ODDRHTTPEvidence.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/ODDRPropertyName.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/ODDRPropertyName.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/ODDRPropertyName.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/ODDRPropertyName.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,42 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.openddr.simpleapi.oddr.model;
+
+import org.w3c.ddr.simple.PropertyName;
+
+public class ODDRPropertyName implements PropertyName {
+
+    private String localPropertyName;
+    private String namespace;
+
+    public ODDRPropertyName(String localPropertyName, String namespace) {
+        this.localPropertyName = localPropertyName;
+        this.namespace = namespace;
+    }
+
+    public String getLocalPropertyName() {
+        return this.localPropertyName;
+    }
+
+    public String getNamespace() {
+        return this.namespace;
+    }
+}

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/ODDRPropertyName.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/ODDRPropertyName.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/ODDRPropertyRef.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/ODDRPropertyRef.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/ODDRPropertyRef.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/ODDRPropertyRef.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,67 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.openddr.simpleapi.oddr.model;
+
+import org.w3c.ddr.simple.PropertyName;
+import org.w3c.ddr.simple.PropertyRef;
+
+public class ODDRPropertyRef implements PropertyRef {
+
+    private final PropertyName pn;
+    private final String aspectName;
+
+    public ODDRPropertyRef(PropertyName pn, String string) {
+        this.pn = pn;
+        this.aspectName = string;
+    }
+
+    public String getLocalPropertyName() {
+        return pn.getLocalPropertyName();
+    }
+
+    public String getAspectName() {
+        return aspectName;
+    }
+
+    public String getNamespace() {
+        return pn.getNamespace();
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (o == null || !(o instanceof ODDRPropertyRef)) {
+            return false;
+        }
+        ODDRPropertyRef oddr = (ODDRPropertyRef) o;
+	return
+	    aspectName != null && aspectName.equals(oddr.aspectName) &&
+	    getLocalPropertyName() != null && getLocalPropertyName().equals(oddr.getLocalPropertyName()) &&
+	    getNamespace() != null && getNamespace().equals(oddr.getNamespace());
+    }
+
+    @Override
+    public int hashCode() {
+        int hash = 3;
+        hash = 73 * hash + (this.pn != null ? this.pn.hashCode() : 0);
+        hash = 73 * hash + (this.aspectName != null ? this.aspectName.hashCode() : 0);
+        return hash;
+    }
+}

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/ODDRPropertyRef.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/ODDRPropertyRef.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/ODDRPropertyValue.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/ODDRPropertyValue.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/ODDRPropertyValue.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/ODDRPropertyValue.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,175 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.openddr.simpleapi.oddr.model;
+
+import org.w3c.ddr.simple.PropertyRef;
+import org.w3c.ddr.simple.PropertyValue;
+import org.w3c.ddr.simple.exception.ValueException;
+
+public class ODDRPropertyValue implements PropertyValue {
+
+    private static final String TYPE_BOOLEAN = "xs:boolean";
+    private static final String TYPE_DOUBLE = "xs:double";
+    private static final String TYPE_ENUMERATION = "xs:enumeration";
+    private static final String TYPE_FLOAT = "xs:float";
+    private static final String TYPE_INT = "xs:integer";
+    private static final String TYPE_NON_NEGATIVE_INTEGER = "xs:nonNegativeInteger";
+    private static final String TYPE_LONG = "xs:long";
+    private final String value;
+    private final String type;
+    private final PropertyRef propertyRef;
+
+    public ODDRPropertyValue(String value, String type, PropertyRef propertyRef) {
+        this.value = (value == null ? value : value.trim());
+        this.type = type;
+        this.propertyRef = propertyRef;
+    }
+
+    public double getDouble() throws ValueException {
+        if (!exists()) {
+            throw new ValueException(ValueException.NOT_KNOWN, type);
+        }
+
+        if (type.equals(TYPE_DOUBLE) || type.equals(TYPE_FLOAT)) {
+            try {
+                return Double.parseDouble(value);
+
+            } catch (NumberFormatException ex) {
+                throw new ValueException(ValueException.INCOMPATIBLE_TYPES, ex);
+            }
+        }
+        throw new ValueException(ValueException.INCOMPATIBLE_TYPES, "Not " + TYPE_DOUBLE + " value");
+    }
+
+    public long getLong() throws ValueException {
+        if (!exists()) {
+            throw new ValueException(ValueException.NOT_KNOWN, type);
+        }
+        if (type.equals(TYPE_LONG) || type.equals(TYPE_INT) || type.equals(TYPE_NON_NEGATIVE_INTEGER)) {
+            try {
+                return Long.parseLong(value);
+
+            } catch (NumberFormatException ex) {
+                throw new ValueException(ValueException.INCOMPATIBLE_TYPES, ex);
+            }
+        }
+        throw new ValueException(ValueException.INCOMPATIBLE_TYPES, "Not " + TYPE_LONG + " value");
+    }
+
+    public boolean getBoolean() throws ValueException {
+        if (!exists()) {
+            throw new ValueException(ValueException.NOT_KNOWN, type);
+        }
+        if (type.equals(TYPE_BOOLEAN)) {
+            try {
+                return Boolean.parseBoolean(value);
+
+            } catch (NumberFormatException ex) {
+                throw new ValueException(ValueException.INCOMPATIBLE_TYPES, ex);
+            }
+        }
+        throw new ValueException(ValueException.INCOMPATIBLE_TYPES, "Not " + TYPE_BOOLEAN + " value");
+    }
+
+    public int getInteger() throws ValueException {
+        if (!exists()) {
+            throw new ValueException(ValueException.NOT_KNOWN, type);
+        }
+
+        if (type.equals(TYPE_INT)) {
+            try {
+                return Integer.parseInt(value);
+
+            } catch (NumberFormatException ex) {
+                throw new ValueException(ValueException.INCOMPATIBLE_TYPES, ex);
+            }
+        }
+
+        if (type.equals(TYPE_NON_NEGATIVE_INTEGER)) {
+            try {
+                Integer integer = Integer.parseInt(value);
+
+                if (integer >= 0) {
+                    return Integer.parseInt(value);
+                }
+
+            } catch (NumberFormatException ex) {
+                throw new ValueException(ValueException.INCOMPATIBLE_TYPES, ex);
+            }
+        }
+        throw new ValueException(ValueException.INCOMPATIBLE_TYPES, "Not " + TYPE_INT + " value");
+    }
+
+    public String[] getEnumeration() throws ValueException {
+        if (!exists()) {
+            throw new ValueException(ValueException.NOT_KNOWN, type);
+        }
+
+        if (type.equals(TYPE_ENUMERATION)) {
+            try {
+                String[] splitted = value.split(",");
+                for (int i = 0; i < splitted.length; i++) {
+                    splitted[i] = splitted[i].trim();
+                }
+
+                return splitted;
+
+            } catch (NumberFormatException ex) {
+                throw new ValueException(ValueException.INCOMPATIBLE_TYPES, ex);
+            }
+        }
+        throw new ValueException(ValueException.INCOMPATIBLE_TYPES, "Not " + TYPE_ENUMERATION + " value");
+    }
+
+    public float getFloat() throws ValueException {
+        if (!exists()) {
+            throw new ValueException(ValueException.NOT_KNOWN, type);
+        }
+
+        if (type.equals(TYPE_FLOAT)) {
+            try {
+                return Float.parseFloat(value);
+
+            } catch (NumberFormatException ex) {
+                throw new ValueException(ValueException.INCOMPATIBLE_TYPES, ex);
+            }
+        }
+        throw new ValueException(ValueException.INCOMPATIBLE_TYPES, "Not " + TYPE_FLOAT + " value");
+    }
+
+    public PropertyRef getPropertyRef() {
+        return propertyRef;
+    }
+
+    public String getString() throws ValueException {
+        if (!exists()) {
+            throw new ValueException(ValueException.NOT_KNOWN, type);
+        }
+        return value;
+    }
+
+    public boolean exists() {
+        if (value != null && value.length() > 0 && !"-".equals(value)) {
+            return true;
+        }
+        return false;
+    }
+}

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/ODDRPropertyValue.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/ODDRPropertyValue.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/ODDRPropertyValues.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/ODDRPropertyValues.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/ODDRPropertyValues.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/ODDRPropertyValues.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,58 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.openddr.simpleapi.oddr.model;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.w3c.ddr.simple.PropertyRef;
+import org.w3c.ddr.simple.PropertyValue;
+import org.w3c.ddr.simple.PropertyValues;
+import org.w3c.ddr.simple.exception.NameException;
+
+public class ODDRPropertyValues implements PropertyValues {
+
+    List<PropertyValue> properties;
+
+    public ODDRPropertyValues() {
+        this.properties = new ArrayList<PropertyValue>();
+    }
+
+    public void addProperty(PropertyValue v) {
+        properties.add(v);
+    }
+
+    public PropertyValue[] getAll() {
+	if (properties != null)
+            return properties.toArray(new PropertyValue[properties.size()]);
+	else
+            return new PropertyValue[0];
+    }
+
+    public PropertyValue getValue(PropertyRef pr) throws NameException {
+        for (PropertyValue propertyValue : properties) {
+            if (propertyValue.getPropertyRef().equals(pr)) {
+                return propertyValue;
+            }
+        }
+        return null;
+        //throw new NameException(NameException.PROPERTY_NOT_RECOGNIZED, new IllegalArgumentException());
+    }
+}

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/ODDRPropertyValues.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/ODDRPropertyValues.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/UserAgent.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/UserAgent.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/UserAgent.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/UserAgent.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,189 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.openddr.simpleapi.oddr.model;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class UserAgent {
+
+    public static final String MOZILLA_AND_OPERA_PATTERN = "(.*?)((?:Mozilla)|(?:Opera))[/ ](\\d+\\.\\d+).*?\\(((?:.*?)(?:.*?\\(.*?\\))*(?:.*?))\\)(.*)";
+    public static final int INDEX_MOZILLA_PATTERN_GROUP_PRE = 1;
+    public static final int INDEX_MOZILLA_PATTERN_GROUP_INSIDE = 4;
+    public static final int INDEX_MOZILLA_PATTERN_GROUP_POST = 5;
+    public static final int INDEX_MOZILLA_PATTERN_GROUP_MOZ_VER = 3;
+    public static final int INDEX_OPERA_OR_MOZILLA = 2;
+    private static Pattern mozillaPatternCompiled =
+	Pattern.compile(MOZILLA_AND_OPERA_PATTERN);
+    private static Pattern versionPatternCompiled =
+	Pattern.compile(".*Version/(\\d+.\\d+).*");
+    private String completeUserAgent;
+    private boolean mozillaPattern;
+    private boolean operaPattern;
+    private String mozillaVersion;
+    private String operaVersion;
+    private boolean containsAndroid;
+    private boolean containsBlackBerryOrRim;
+    private boolean containsIOSDevices;
+    private boolean containsMSIE;
+    private boolean containsSymbian;
+    private boolean containsWindowsPhone;
+    private String[] patternElements;
+
+    UserAgent(String userAgent) {
+        if (userAgent == null) {
+            throw new IllegalArgumentException("userAgent can not be null");
+        }
+        completeUserAgent = userAgent;
+
+        Matcher result = mozillaPatternCompiled.matcher(userAgent);
+
+        if (result.matches()) {
+            patternElements = new String[]{
+                        result.group(INDEX_MOZILLA_PATTERN_GROUP_PRE),
+                        result.group(INDEX_MOZILLA_PATTERN_GROUP_INSIDE),
+                        result.group(INDEX_MOZILLA_PATTERN_GROUP_POST)
+                    };
+            String version = result.group(INDEX_MOZILLA_PATTERN_GROUP_MOZ_VER);
+            if (result.group(INDEX_OPERA_OR_MOZILLA).contains("Opera")) {
+                mozillaPattern = false;
+                operaPattern = true;
+                operaVersion = version;
+
+                if (operaVersion.equals("9.80") && patternElements[2] != null) {
+                    Matcher result2 = versionPatternCompiled.matcher(patternElements[2]);
+
+                    if (result2.matches()) {
+                        operaVersion = result2.group(1);
+                    }
+                }
+
+            } else {
+                mozillaPattern = true;
+                mozillaVersion = version;
+            }
+
+        } else {
+            mozillaPattern = false;
+            operaPattern = false;
+            patternElements = new String[]{
+                        null,
+                        null,
+                        null};
+            mozillaVersion = null;
+            operaVersion = null;
+        }
+
+        if (userAgent.contains("Android")) {
+            containsAndroid = true;
+
+        } else {
+            containsAndroid = false;
+            if (userAgent.matches(".*(?!like).iPad.*") || userAgent.matches(".*(?!like).iPod.*") || userAgent.matches(".*(?!like).iPhone.*")) {
+                containsIOSDevices = true;
+
+            } else {
+                containsIOSDevices = false;
+                if (userAgent.matches(".*[Bb]lack.?[Bb]erry.*|.*RIM.?Tablet.?OS.*")) {
+                    containsBlackBerryOrRim = true;
+
+                } else {
+                    containsBlackBerryOrRim = false;
+                    if (userAgent.matches(".*Symbian.*|.*SymbOS.*|.*Series.?60.*")) {
+                        containsSymbian = true;
+
+                    } else {
+                        containsSymbian = false;
+                        if (userAgent.matches(".*Windows.?(?:(?:CE)|(?:Phone)|(?:NT)|(?:Mobile)).*")) {
+                            containsWindowsPhone = true;
+
+                        } else {
+                            containsWindowsPhone = false;
+                        }
+
+                        if (userAgent.matches(".*MSIE.([0-9\\.b]+).*")) {
+                            containsMSIE = true;
+
+                        } else {
+                            containsMSIE = false;
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    public String getCompleteUserAgent() {
+        return completeUserAgent;
+    }
+
+    public boolean containsAndroid() {
+        return containsAndroid;
+    }
+
+    public boolean containsBlackBerryOrRim() {
+        return containsBlackBerryOrRim;
+    }
+
+    public boolean containsIOSDevices() {
+        return containsIOSDevices;
+    }
+
+    public boolean containsMSIE() {
+        return containsMSIE;
+    }
+
+    public boolean containsSymbian() {
+        return containsSymbian;
+    }
+
+    public boolean containsWindowsPhone() {
+        return containsWindowsPhone;
+    }
+
+    public boolean hasMozillaPattern() {
+        return mozillaPattern;
+    }
+
+    public boolean hasOperaPattern() {
+        return operaPattern;
+    }
+
+    public String getPatternElementsPre() {
+        return patternElements[0];
+    }
+
+    public String getPatternElementsInside() {
+        return patternElements[1];
+    }
+
+    public String getPatternElementsPost() {
+        return patternElements[2];
+    }
+
+    public String getMozillaVersion() {
+        return mozillaVersion;
+    }
+
+    public String getOperaVersion() {
+        return operaVersion;
+    }
+}

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/UserAgent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/UserAgent.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/UserAgentFactory.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/UserAgentFactory.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/UserAgentFactory.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/UserAgentFactory.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,51 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.openddr.simpleapi.oddr.model;
+
+import java.util.Map;
+import org.w3c.ddr.simple.Evidence;
+
+public class UserAgentFactory {
+
+    public static UserAgent newBrowserUserAgent(Evidence evidence) {
+        return newUserAgent(evidence.get("user-agent"));
+    }
+
+    public static UserAgent newBrowserUserAgent(Map<String, String> headers) {
+        return newBrowserUserAgent(new ODDRHTTPEvidence(headers));
+    }
+
+    public static UserAgent newDeviceUserAgent(Evidence evidence) {
+        String ua = evidence.get("x-device-user-agent");
+        if (ua == null || ua.trim().length() < 2) {
+            ua = evidence.get("user-agent");
+        }
+        return newUserAgent(ua);
+    }
+
+    public static UserAgent newDeviceUserAgent(Map<String, String> headers) {
+        return newDeviceUserAgent(new ODDRHTTPEvidence(headers));
+    }
+
+    public static UserAgent newUserAgent(String realUserAgent) {
+        return new UserAgent(realUserAgent);
+    }
+}

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/UserAgentFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/UserAgentFactory.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/browser/Browser.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/browser/Browser.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/browser/Browser.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/browser/Browser.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,286 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.openddr.simpleapi.oddr.model.browser;
+
+import java.util.Map;
+import org.openddr.simpleapi.oddr.model.BuiltObject;
+
+public class Browser extends BuiltObject implements Comparable {
+
+    private String majorRevision = "0";
+    private String minorRevision = "0";
+    private String microRevision = "0";
+    private String nanoRevision = "0";
+
+    public Browser() {
+        super();
+    }
+
+    public Browser(Map<String, String> properties) {
+        super(properties);
+    }
+
+    public String getMajorRevision() {
+        return majorRevision;
+    }
+
+    public void setMajorRevision(String majorRevision) {
+        this.majorRevision = majorRevision;
+    }
+
+    public String getMicroRevision() {
+        return microRevision;
+    }
+
+    public void setMicroRevision(String microRevision) {
+        this.microRevision = microRevision;
+    }
+
+    public String getMinorRevision() {
+        return minorRevision;
+    }
+
+    public void setMinorRevision(String minorRevision) {
+        this.minorRevision = minorRevision;
+    }
+
+    public String getNanoRevision() {
+        return nanoRevision;
+    }
+
+    public void setNanoRevision(String nanoRevision) {
+        this.nanoRevision = nanoRevision;
+    }
+
+    public String getId() {
+        if (getModel() == null || getVendor() == null) {
+            return null;
+        }
+        String id = getVendor() + "." + getModel() + "." + getMajorRevision() + "." + getMinorRevision() + "." + getMicroRevision() + "." + getNanoRevision();
+        return id;
+    }
+
+    //GETTERS
+    //utility getter for core ddr properties
+    public String getCookieSupport() {
+        return get("cookieSupport");
+    }
+
+    public int getDisplayHeight() {
+        try {
+            return Integer.parseInt(get("displayHeight"));
+
+        } catch (Exception x) {
+            return -1;
+        }
+    }
+
+    public int getDisplayWidth() {
+        try {
+            return Integer.parseInt(get("displayWidth"));
+
+        } catch (Exception x) {
+            return -1;
+        }
+    }
+
+    public String getImageFormatSupport() {
+        return get("imageFormatSupport");
+    }
+
+    public String getInputModeSupport() {
+        return get("inputModeSupport");
+    }
+
+    public String getMarkupSupport() {
+        return get("markupSupport");
+    }
+
+    public String getModel() {
+        return get("model");
+    }
+
+    public String getScriptSupport() {
+        return get("scriptSupport");
+    }
+
+    public String getStylesheetSupport() {
+        return get("stylesheetSupport");
+    }
+
+    public String getVendor() {
+        return get("vendor");
+    }
+
+    public String getVersion() {
+        return get("version");
+    }
+
+    //utility getter for significant oddr browser properties
+    public String getRenderer() {
+        return get("layoutEngine");
+    }
+
+    public String getRendererVersion() {
+        return get("layoutEngineVersion");
+    }
+
+    public String getClaimedReference() {
+        return get("referencedBrowser");
+    }
+
+    public String getClaimedReferenceVersion() {
+        return get("referencedBrowserVersion");
+    }
+
+    public String getBuild() {
+        return get("build");
+    }
+
+    //SETTERS
+    //utility setter for core ddr properties
+    public void setCookieSupport(String cookieSupport) {
+        putProperty("cookieSupport", cookieSupport);
+    }
+
+    public void setDisplayHeight(int displayHeight) {
+        putProperty("displayHeight", Integer.toString(displayHeight));
+    }
+
+    public void setDisplayWidth(int displayWidth) {
+        putProperty("displayWidth", Integer.toString(displayWidth));
+    }
+
+    public void setImageFormatSupport(String imageFormatSupport) {
+        putProperty("imageFormatSupport", imageFormatSupport);
+    }
+
+    public void setInputModeSupport(String inputModeSupport) {
+        putProperty("inputModeSupport", inputModeSupport);
+    }
+
+    public void setMarkupSupport(String markupSupport) {
+        putProperty("markupSupport", markupSupport);
+    }
+
+    public void setModel(String model) {
+        putProperty("model", model);
+    }
+
+    public void setScriptSupport(String scriptSupport) {
+        putProperty("scriptSupport", scriptSupport);
+    }
+
+    public void setStylesheetSupport(String stylesheetSupport) {
+        putProperty("stylesheetSupport", stylesheetSupport);
+    }
+
+    public void setVendor(String vendor) {
+        putProperty("vendor", vendor);
+    }
+
+    public void setVersion(String version) {
+        putProperty("version", version);
+    }
+
+    //utility setter for significant oddr browser properties
+    public void setLayoutEngine(String layoutEngine) {
+        putProperty("layoutEngine", layoutEngine);
+    }
+
+    public void setLayoutEngineVersion(String layoutEngineVersion) {
+        putProperty("layoutEngineVersion", layoutEngineVersion);
+    }
+
+    public void setReferenceBrowser(String referenceBrowser) {
+        putProperty("referenceBrowser", referenceBrowser);
+    }
+
+    public void setReferenceBrowserVersion(String referenceBrowserVersion) {
+        putProperty("referenceBrowserVersion", referenceBrowserVersion);
+    }
+
+    public void setBuild(String build) {
+        putProperty("build", build);
+    }
+
+    //Comparable
+    public int compareTo(Object o) {
+        if (o == null || !(o instanceof Browser)) {
+            return Integer.MAX_VALUE;
+        }
+
+        Browser bd = (Browser) o;
+        return this.getConfidence() - bd.getConfidence();
+    }
+
+    // Cloneable
+    public Object clone() {
+        Browser b = new Browser();
+        b.setMajorRevision(getMajorRevision());
+        b.setMinorRevision(getMinorRevision());
+        b.setMicroRevision(getMicroRevision());
+        b.setNanoRevision(getNanoRevision());
+        b.setConfidence(getConfidence());
+        b.putPropertiesMap(getPropertiesMap());
+        return b;
+    }
+
+    //Utility
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getVendor());
+        sb.append(" ");
+        sb.append(getModel());
+
+        sb.append("(");
+        if (getRenderer() != null && getRenderer().length() > 0) {
+            sb.append(" ");
+            sb.append(getRenderer());
+            sb.append(" ");
+            sb.append(getRendererVersion());
+            sb.append(" ");
+        }
+        if (getClaimedReference() != null && getClaimedReference().length() > 0) {
+            sb.append(" ");
+            sb.append(getClaimedReference());
+            sb.append(" ");
+            sb.append(getClaimedReferenceVersion());
+            sb.append(" ");
+        }
+        sb.append(getVersion()).append(")");
+
+        sb.append(" [").append(getMajorRevision()).append(".").append(getMinorRevision()).append(".").append(getMicroRevision()).append(".").append(getNanoRevision()).append("]");
+        if (getBuild() != null) {
+            sb.append(" - ").append(getBuild());
+        }
+        if (getDisplayWidth() > 0 && getDisplayHeight() > 0) {
+            sb.append("<");
+            sb.append(getDisplayWidth());
+            sb.append("x");
+            sb.append(getDisplayHeight());
+            sb.append(">");
+        }
+        sb.append(" ").append(getConfidence()).append("%");
+        return new String(sb);
+    }
+}

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/browser/Browser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/browser/Browser.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/device/Device.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/device/Device.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/device/Device.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/device/Device.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,69 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.openddr.simpleapi.oddr.model.device;
+
+import org.openddr.simpleapi.oddr.model.BuiltObject;
+
+public class Device extends BuiltObject implements Comparable, Cloneable {
+
+    private String id;
+    private String parentId = "root";
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getParentId() {
+        return parentId;
+    }
+
+    public void setParentId(String parentId) {
+        this.parentId = parentId;
+    }
+
+    public int compareTo(Object o) {
+        if (o == null || !(o instanceof Device)) {
+            return Integer.MAX_VALUE;
+        }
+
+        Device bd = (Device) o;
+        return this.getConfidence() - bd.getConfidence();
+    }
+
+    public Object clone() {
+        Device d = new Device();
+        d.setId(id);
+        d.setParentId(parentId);
+        d.setConfidence(getConfidence());
+        d.putPropertiesMap(getPropertiesMap());
+        return d;
+    }
+
+    public boolean containsProperty(String propertyName) {
+	return
+	    properties != null &&
+	    properties.containsKey(propertyName);
+    }
+}

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/device/Device.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/device/Device.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/os/OperatingSystem.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/os/OperatingSystem.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/os/OperatingSystem.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/os/OperatingSystem.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,169 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.openddr.simpleapi.oddr.model.os;
+
+import java.util.Map;
+import org.openddr.simpleapi.oddr.model.BuiltObject;
+
+public class OperatingSystem extends BuiltObject implements Comparable {
+
+    private String majorRevision = "0";
+    private String minorRevision = "0";
+    private String microRevision = "0";
+    private String nanoRevision = "0";
+
+    public OperatingSystem() {
+        super();
+    }
+
+    public OperatingSystem(Map<String, String> properties) {
+        super(properties);
+    }
+
+    //version id getter and setters
+    public String getMajorRevision() {
+        return majorRevision;
+    }
+
+    public void setMajorRevision(String majorRevision) {
+        this.majorRevision = majorRevision;
+    }
+
+    public String getMicroRevision() {
+        return microRevision;
+    }
+
+    public void setMicroRevision(String microRevision) {
+        this.microRevision = microRevision;
+    }
+
+    public String getMinorRevision() {
+        return minorRevision;
+    }
+
+    public void setMinorRevision(String minorRevision) {
+        this.minorRevision = minorRevision;
+    }
+
+    public String getNanoRevision() {
+        return nanoRevision;
+    }
+
+    public void setNanoRevision(String nanoRevision) {
+        this.nanoRevision = nanoRevision;
+    }
+
+    public String getId() {
+        if (getModel() == null || getVendor() == null) {
+            return null;
+        }
+        String id = getVendor() + "." + getModel() + "." + getMajorRevision() + "." + getMinorRevision() + "." + getMicroRevision() + "." + getNanoRevision();
+        return id;
+    }
+
+    //GETTERS
+    //utility getter for significant oddr OS properties
+    public String getModel() {
+        return get("model");
+    }
+
+    public String getVendor() {
+        return get("vendor");
+    }
+
+    public String getVersion() {
+        return get("version");
+    }
+
+    public String getBuild() {
+        return get("build");
+    }
+
+    public String getDescription() {
+        return get("description");
+    }
+
+    //SETTERS
+    //utility setter for significant oddr OS properties
+    public void setModel(String model) {
+        putProperty("model", model);
+    }
+
+    public void setVendor(String vendor) {
+        putProperty("vendor", vendor);
+    }
+
+    public void setVersion(String version) {
+        putProperty("version", version);
+    }
+
+    public void setBuild(String build) {
+        putProperty("build", build);
+    }
+
+    public void setDescription(String description) {
+        putProperty("description", description);
+    }
+
+    //Comparable
+    public int compareTo(Object o) {
+        if (o == null || !(o instanceof OperatingSystem)) {
+            return Integer.MAX_VALUE;
+        }
+
+        OperatingSystem bd = (OperatingSystem) o;
+        return this.getConfidence() - bd.getConfidence();
+    }
+
+    // Cloneable
+    @Override
+    public Object clone() {
+        OperatingSystem os = new OperatingSystem();
+        os.setMajorRevision(getMajorRevision());
+        os.setMinorRevision(getMinorRevision());
+        os.setMicroRevision(getMicroRevision());
+        os.setNanoRevision(getNanoRevision());
+        os.setConfidence(getConfidence());
+        os.putPropertiesMap(getPropertiesMap());
+        return os;
+    }
+
+    //Utility
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getVendor());
+        sb.append(" ");
+        sb.append(getModel());
+
+        if (getDescription() != null && getDescription().length() > 0) {
+            sb.append("(");
+            sb.append(getDescription());
+            sb.append(getVersion()).append(")");
+        }
+
+        sb.append(" [").append(getMajorRevision()).append(".").append(getMinorRevision()).append(".").append(getMicroRevision()).append(".").append(getNanoRevision()).append("]");
+        if (getBuild() != null) {
+            sb.append(" - ").append(getBuild());
+        }
+        sb.append(" ").append(getConfidence()).append("%");
+        return new String(sb);
+    }
+}

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/os/OperatingSystem.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/os/OperatingSystem.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/vocabulary/Vocabulary.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/vocabulary/Vocabulary.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/vocabulary/Vocabulary.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/vocabulary/Vocabulary.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,63 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.openddr.simpleapi.oddr.model.vocabulary;
+
+import java.util.Map;
+
+public class Vocabulary {
+
+    private String[] aspects = null;
+    private Map<String, VocabularyProperty> properties = null;
+    private Map<String, VocabularyVariable> vocabularyVariables = null;
+    private String vocabularyIRI = null;
+
+    public String[] getAspects() {
+        return aspects;
+    }
+
+    public void setAspects(String[] aspects) {
+        this.aspects = aspects;
+    }
+
+    public Map<String, VocabularyProperty> getProperties() {
+        return properties;
+    }
+
+    public void setProperties(Map<String, VocabularyProperty> properties) {
+        this.properties = properties;
+    }
+
+    public Map<String, VocabularyVariable> getVocabularyVariables() {
+        return vocabularyVariables;
+    }
+
+    public void setVocabularyVariables(Map<String, VocabularyVariable> vocabularyVariables) {
+        this.vocabularyVariables = vocabularyVariables;
+    }
+
+    public String getVocabularyIRI() {
+        return vocabularyIRI;
+    }
+
+    public void setVocabularyIRI(String vocabularyIRI) {
+        this.vocabularyIRI = vocabularyIRI;
+    }
+}

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/vocabulary/Vocabulary.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/vocabulary/Vocabulary.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/vocabulary/VocabularyProperty.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/vocabulary/VocabularyProperty.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/vocabulary/VocabularyProperty.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/vocabulary/VocabularyProperty.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,70 @@
+/**
+ * Copyright 2011 OpenDDR LLC
+ * This software is distributed under the terms of the GNU Lesser General Public License.
+ *
+ *
+ * This file is part of OpenDDR Simple APIs.
+ * OpenDDR Simple APIs is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * OpenDDR Simple APIs is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Simple APIs.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.openddr.simpleapi.oddr.model.vocabulary;
+
+public class VocabularyProperty {
+
+    private String[] aspects = null;
+    private String defaultAspect = null;
+    private String expr = null;
+    private String name = null;
+    private String type = null;
+
+    public String[] getAspects() {
+        return aspects;
+    }
+
+    public void setAspects(String[] aspects) {
+        this.aspects = aspects;
+    }
+
+    public String getDefaultAspect() {
+        return defaultAspect;
+    }
+
+    public void setDefaultAspect(String defaultAspect) {
+        this.defaultAspect = defaultAspect;
+    }
+
+    public String getExpr() {
+        return expr;
+    }
+
+    public void setExpr(String expr) {
+        this.expr = expr;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+}

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/vocabulary/VocabularyProperty.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/model/vocabulary/VocabularyProperty.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL