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 [3/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/builder/browser/DolfinBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/DolfinBrowserBuilder.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/DolfinBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/DolfinBrowserBuilder.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,92 @@
+/**
+ * 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.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.openddr.simpleapi.oddr.model.UserAgent;
+import org.openddr.simpleapi.oddr.model.browser.Browser;
+
+public class DolfinBrowserBuilder extends LayoutEngineBrowserBuilder {
+
+    private static final String VERSION_REGEXP = ".*?(?:(?:Dolfin/))([0-9\\.]+).*?";
+    private Pattern versionPattern = Pattern.compile(VERSION_REGEXP);
+
+    public boolean canBuild(UserAgent userAgent) {
+        if (userAgent.getCompleteUserAgent().contains("Dolfin")) {
+            return true;
+        }
+        return false;
+    }
+
+    @Override
+    protected Browser buildBrowser(UserAgent userAgent, String layoutEngine, String layoutEngineVersion, int hintedWidth, int hintedHeight) {
+        String version = null;
+
+        Matcher versionMatcher = versionPattern.matcher(userAgent.getCompleteUserAgent());
+        if (!versionMatcher.matches()) {
+            return null;
+
+        } else {
+            if (versionMatcher.group(1) != null) {
+                version = versionMatcher.group(1);
+            }
+        }
+
+        int confidence = 60;
+        Browser identified = new Browser();
+
+        identified.setVendor("Samsung");
+        identified.setModel("Dolfin");
+
+        identified.setVersion(version);
+        String[] versionEl = version.split("\\.");
+
+        if (versionEl.length > 0) {
+            identified.setMajorRevision(versionEl[0]);
+        }
+
+        if (versionEl.length > 1) {
+            identified.setMinorRevision(versionEl[1]);
+            confidence += 10;
+        }
+
+        if (versionEl.length > 2) {
+            identified.setMicroRevision(versionEl[2]);
+        }
+
+        if (versionEl.length > 3) {
+            identified.setNanoRevision(versionEl[3]);
+        }
+
+        identified.setConfidence(confidence);
+
+        if (layoutEngine != null) {
+            identified.setLayoutEngine(layoutEngine);
+            identified.setLayoutEngineVersion(layoutEngineVersion);
+        }
+
+        identified.setDisplayWidth(hintedWidth);
+        identified.setDisplayHeight(hintedHeight);
+
+        return identified;
+    }
+}

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

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

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/FennecBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/FennecBrowserBuilder.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/FennecBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/FennecBrowserBuilder.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,135 @@
+/**
+ * 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.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.openddr.simpleapi.oddr.model.UserAgent;
+import org.openddr.simpleapi.oddr.model.browser.Browser;
+
+public class FennecBrowserBuilder extends LayoutEngineBrowserBuilder {
+
+    private static final String FENNEC_VERSION_REGEXP = ".*Fennec/([0-9a-z\\.\\-]+)";
+    private static final String FIREFOX_VERSION_REGEXP = ".*Firefox.([0-9a-z\\.b]+).*";
+    private Pattern fennecVersionPattern = Pattern.compile(FENNEC_VERSION_REGEXP);
+    private Pattern firefoxVersionPattern = Pattern.compile(FIREFOX_VERSION_REGEXP);
+
+    public boolean canBuild(UserAgent userAgent) {
+        return (userAgent.getCompleteUserAgent().contains("Fennec") || (userAgent.getCompleteUserAgent().contains("Firefox") && userAgent.getCompleteUserAgent().contains("Mobile")));
+    }
+
+    @Override
+    protected Browser buildBrowser(UserAgent userAgent, String layoutEngine, String layoutEngineVersion, int hintedWidth, int hintedHeight) {
+        if (!(userAgent.hasMozillaPattern())) {
+            return null;
+        }
+
+        int confidence = 60;
+        Browser identified = new Browser();
+
+        identified.setVendor("Mozilla");
+        identified.setModel("Firefox Mobile");
+        identified.setVersion("-");
+        identified.setMajorRevision("-");
+
+        Matcher fennecMatcher = fennecVersionPattern.matcher(userAgent.getCompleteUserAgent());
+        Matcher firefoxMatcher = firefoxVersionPattern.matcher(userAgent.getCompleteUserAgent());
+        if (fennecMatcher.matches()) {
+            if (fennecMatcher.group(1) != null) {
+                identified.setVersion(fennecMatcher.group(1));
+                String version[] = fennecMatcher.group(1).split("\\.");
+
+                if (version.length > 0) {
+                    identified.setMajorRevision(version[0]);
+                    if (identified.getMajorRevision().length() == 0) {
+                        identified.setMajorRevision("1");
+                    }
+                }
+
+                if (version.length > 1) {
+                    identified.setMinorRevision(version[1]);
+                    confidence += 10;
+                }
+
+                if (version.length > 2) {
+                    identified.setMicroRevision(version[2]);
+                }
+
+                if (version.length > 3) {
+                    identified.setNanoRevision(version[3]);
+                }
+            }
+
+        } else if (firefoxMatcher.matches()) {
+            if (firefoxMatcher.group(1) != null) {
+                identified.setVersion(firefoxMatcher.group(1));
+                String version[] = firefoxMatcher.group(1).split("\\.");
+
+                if (version.length > 0) {
+                    identified.setMajorRevision(version[0]);
+                    if (identified.getMajorRevision().length() == 0) {
+                        identified.setMajorRevision("1");
+                    }
+                }
+
+                if (version.length > 1) {
+                    identified.setMinorRevision(version[1]);
+                    confidence += 10;
+                }
+
+                if (version.length > 2) {
+                    identified.setMicroRevision(version[2]);
+                }
+
+                if (version.length > 3) {
+                    identified.setNanoRevision(version[3]);
+                }
+            }
+
+        } else {
+            //fallback version
+            identified.setVersion("1.0");
+            identified.setMajorRevision("1");
+        }
+
+        if (layoutEngine != null) {
+            identified.setLayoutEngine(layoutEngine);
+            identified.setLayoutEngineVersion(layoutEngineVersion);
+            if (layoutEngine.equals(LayoutEngineBrowserBuilder.GECKO)) {
+                confidence += 10;
+            }
+        }
+
+        if (firefoxMatcher.matches()) {
+            if (firefoxMatcher.group(1) != null) {
+                identified.setReferenceBrowser("Firefox");
+                identified.setReferenceBrowserVersion(firefoxMatcher.group(1));
+                confidence += 10;
+            }
+        }
+
+        identified.setDisplayWidth(hintedWidth);
+        identified.setDisplayHeight(hintedHeight);
+        identified.setConfidence(confidence);
+
+        return identified;
+    }
+}

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

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

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/FirefoxBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/FirefoxBrowserBuilder.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/FirefoxBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/FirefoxBrowserBuilder.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,98 @@
+/**
+ * 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.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.openddr.simpleapi.oddr.model.UserAgent;
+import org.openddr.simpleapi.oddr.model.browser.Browser;
+
+public class FirefoxBrowserBuilder extends LayoutEngineBrowserBuilder {
+
+    private static final String FIREFOX_VERSION_REGEXP = ".*Firefox.([0-9a-z\\.b]+).*";
+    private Pattern firefoxVersionPattern = Pattern.compile(FIREFOX_VERSION_REGEXP);
+
+    public boolean canBuild(UserAgent userAgent) {
+        return (userAgent.getCompleteUserAgent().contains("Firefox"));
+    }
+
+    @Override
+    protected Browser buildBrowser(UserAgent userAgent, String layoutEngine, String layoutEngineVersion, int hintedWidth, int hintedHeight) {
+        if (!(userAgent.hasMozillaPattern()) || !(userAgent.getCompleteUserAgent().matches(".*Gecko/([0-9]+).*Firefox.*")) || userAgent.getCompleteUserAgent().matches("Fennec")) {
+            return null;
+        }
+
+        int confidence = 60;
+        Browser identified = new Browser();
+
+        identified.setVendor("Mozilla");
+        identified.setModel("Firefox");
+        identified.setVersion("-");
+        identified.setMajorRevision("-");
+
+        Matcher firefoxMatcher = firefoxVersionPattern.matcher(userAgent.getCompleteUserAgent());
+        if (firefoxMatcher.matches()) {
+            if (firefoxMatcher.group(1) != null) {
+                identified.setVersion(firefoxMatcher.group(1));
+                String version[] = firefoxMatcher.group(1).split("\\.");
+
+                if (version.length > 0) {
+                    identified.setMajorRevision(version[0]);
+                    if (identified.getMajorRevision().length() == 0) {
+                        identified.setMajorRevision("1");
+                    }
+                }
+
+                if (version.length > 1) {
+                    identified.setMinorRevision(version[1]);
+                    confidence += 10;
+                }
+
+                if (version.length > 2) {
+                    identified.setMicroRevision(version[2]);
+                }
+
+                if (version.length > 3) {
+                    identified.setNanoRevision(version[3]);
+                }
+            }
+
+        } else {
+            //fallback version
+            identified.setVersion("1.0");
+            identified.setMajorRevision("1");
+        }
+
+        if (layoutEngine != null) {
+            identified.setLayoutEngine(layoutEngine);
+            identified.setLayoutEngineVersion(layoutEngineVersion);
+            if (layoutEngine.equals(LayoutEngineBrowserBuilder.GECKO)) {
+                confidence += 10;
+            }
+        }
+
+        identified.setDisplayWidth(hintedWidth);
+        identified.setDisplayHeight(hintedHeight);
+        identified.setConfidence(confidence);
+
+        return identified;
+    }
+}

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

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

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/HintedResolutionBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/HintedResolutionBrowserBuilder.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/HintedResolutionBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/HintedResolutionBrowserBuilder.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,90 @@
+/**
+ * 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.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.openddr.simpleapi.oddr.builder.Builder;
+import org.openddr.simpleapi.oddr.model.UserAgent;
+import org.openddr.simpleapi.oddr.model.browser.Browser;
+
+public abstract class HintedResolutionBrowserBuilder implements Builder {
+
+    private final String RESOLUTION_HINT_WXH_REGEXP = ".*([0-9][0-9][0-9]+)[*Xx]([0-9][0-9][0-9]+).*";
+    private final String RESOLUTION_HINT_FWVGA_REGEXP = ".*FWVGA.*";
+    private final String RESOLUTION_HINT_WVGA_REGEXP = ".*WVGA.*";
+    private final String RESOLUTION_HINT_WXGA_REGEXP = ".*WXGA.*";
+    private final String RESOLUTION_HINT_WQVGA_REGEXP = ".*WQVGA.*";
+    private Pattern resolutionHintWxHPattern = Pattern.compile(RESOLUTION_HINT_WXH_REGEXP);
+    private Pattern resolutionHintFWVGAPattern = Pattern.compile(RESOLUTION_HINT_FWVGA_REGEXP);
+    private Pattern resolutionHintWVGAPattern = Pattern.compile(RESOLUTION_HINT_WVGA_REGEXP);
+    private Pattern resolutionHintWXGAPattern = Pattern.compile(RESOLUTION_HINT_WXGA_REGEXP);
+    private Pattern resolutionHintWQVGAPattern = Pattern.compile(RESOLUTION_HINT_WQVGA_REGEXP);
+
+    public Browser build(UserAgent userAgent, int confidenceTreshold) {
+        int hintedWidth = -1;
+        int hintedHeight = -1;
+
+        Matcher result = resolutionHintWxHPattern.matcher(userAgent.getCompleteUserAgent());
+
+        if (result.matches()) {
+            try {
+                hintedWidth = Integer.parseInt(result.group(1));
+                hintedHeight = Integer.parseInt(result.group(2));
+
+            } catch (NumberFormatException x) {
+                hintedWidth = -1;
+                hintedHeight = -1;
+            }
+
+        } else if (userAgent.getCompleteUserAgent().contains("VGA") || userAgent.getCompleteUserAgent().contains("WXGA")) {
+            result = resolutionHintFWVGAPattern.matcher(userAgent.getCompleteUserAgent());
+            if (result.matches()) {
+                hintedWidth = 480;
+                hintedHeight = 854;
+
+            } else {
+                result = resolutionHintWVGAPattern.matcher(userAgent.getCompleteUserAgent());
+                if (result.matches()) {
+                    hintedWidth = 480;
+                    hintedHeight = 800;
+
+                } else {
+                    result = resolutionHintWXGAPattern.matcher(userAgent.getCompleteUserAgent());
+                    if (result.matches()) {
+                        hintedWidth = 768;
+                        hintedHeight = 1280;
+
+                    } else {
+                        result = resolutionHintWQVGAPattern.matcher(userAgent.getCompleteUserAgent());
+                        if (result.matches()) {
+                            hintedWidth = 240;
+                            hintedHeight = 400;
+                        }
+                    }
+                }
+            }
+        }
+        return buildBrowser(userAgent, hintedWidth, hintedHeight);
+    }
+
+    protected abstract Browser buildBrowser(UserAgent userAgent, int hintedWidth, int hintedHeight);
+}

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

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

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/IEMobileBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/IEMobileBrowserBuilder.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/IEMobileBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/IEMobileBrowserBuilder.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,126 @@
+/**
+ * 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.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.openddr.simpleapi.oddr.model.UserAgent;
+import org.openddr.simpleapi.oddr.model.browser.Browser;
+
+public class IEMobileBrowserBuilder extends LayoutEngineBrowserBuilder {
+
+    private static final String VERSION_REGEXP = ".*[^MS]IEMobile.([0-9\\.]+).*?";
+    private static final String MSIE_VERSION_REGEXP = ".*MSIE.([0-9\\.]+).*";
+    private static final String MSIEMOBILE_VERSION_REGEXP = ".*MSIEMobile.([0-9\\.]+).*";
+    private Pattern versionPattern = Pattern.compile(VERSION_REGEXP);
+    private Pattern msieVersionPattern = Pattern.compile(MSIE_VERSION_REGEXP);
+    private Pattern msieMobileVersionPattern = Pattern.compile(MSIEMOBILE_VERSION_REGEXP);
+
+    public boolean canBuild(UserAgent userAgent) {
+        return (userAgent.containsWindowsPhone());
+    }
+
+    @Override
+    protected Browser buildBrowser(UserAgent userAgent, String layoutEngine, String layoutEngineVersion, int hintedWidth, int hintedHeight) {
+        if (!userAgent.containsWindowsPhone() || !(userAgent.getCompleteUserAgent().matches(".*Windows.?(?:(?:CE)|(?:Phone)).*"))) {
+            return null;
+        }
+
+        int confidence = 40;
+        Browser identified = new Browser();
+
+        identified.setVendor("Microsoft");
+        identified.setModel("IEMobile");
+
+        if (userAgent.getCompleteUserAgent().contains("MSIEMobile")) {
+            confidence += 10;
+        }
+
+        if (userAgent.hasMozillaPattern()) {
+            confidence += 10;
+        }
+
+        Matcher versionMatcher = versionPattern.matcher(userAgent.getCompleteUserAgent());
+        if (versionMatcher.matches()) {
+            if (versionMatcher.group(1) != null) {
+                identified.setVersion(versionMatcher.group(1));
+                String version[] = versionMatcher.group(1).split("\\.");
+
+                if (version.length > 0) {
+                    identified.setMajorRevision(version[0]);
+                    if (identified.getMajorRevision().length() == 0) {
+                        identified.setMajorRevision("1");
+                    }
+                }
+
+                if (version.length > 1) {
+                    identified.setMinorRevision(version[1]);
+                    confidence += 10;
+                }
+
+                if (version.length > 2) {
+                    identified.setMicroRevision(version[2]);
+                }
+
+                if (version.length > 3) {
+                    identified.setNanoRevision(version[3]);
+                }
+            }
+
+        } else {
+            //fallback version
+            identified.setVersion("1.0");
+            identified.setMajorRevision("1");
+        }
+
+        Matcher msieMatcher = msieVersionPattern.matcher(userAgent.getCompleteUserAgent());
+        if (msieMatcher.matches()) {
+            if (msieMatcher.group(1) != null) {
+                identified.setReferenceBrowser("MSIE");
+                identified.setReferenceBrowserVersion(msieMatcher.group(1));
+                confidence += 10;
+            }
+        }
+
+        Matcher msieMobileMatcher = msieMobileVersionPattern.matcher(userAgent.getCompleteUserAgent());
+        if (msieMobileMatcher.matches()) {
+            if (msieMobileMatcher.group(1) != null) {
+                identified.setLayoutEngine("MSIEMobile");
+                identified.setLayoutEngineVersion(msieMobileMatcher.group(1));
+                confidence += 10;
+            }
+        }
+
+        if (layoutEngine != null) {
+            identified.setLayoutEngine(layoutEngine);
+            identified.setLayoutEngineVersion(layoutEngineVersion);
+            if (layoutEngine.equals(LayoutEngineBrowserBuilder.TRIDENT)) {
+                confidence += 10;
+            }
+        }
+
+        identified.setDisplayWidth(hintedWidth);
+        identified.setDisplayHeight(hintedHeight);
+        identified.setConfidence(confidence);
+
+        return identified;
+    }
+}

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

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

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/InternetExplorerBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/InternetExplorerBrowserBuilder.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/InternetExplorerBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/InternetExplorerBrowserBuilder.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,95 @@
+/**
+ * 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.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.openddr.simpleapi.oddr.model.UserAgent;
+import org.openddr.simpleapi.oddr.model.browser.Browser;
+
+public class InternetExplorerBrowserBuilder extends LayoutEngineBrowserBuilder {
+
+    private static final String MSIE_VERSION_REGEXP = ".*MSIE.([0-9\\.b]+).*";
+    private static final String DOT_NET_CLR_REGEXP = ".*\\.NET.CLR.*";
+    private Pattern msieVersionPattern = Pattern.compile(MSIE_VERSION_REGEXP);
+    private Pattern dotNetClrPattern = Pattern.compile(DOT_NET_CLR_REGEXP);
+
+    public boolean canBuild(UserAgent userAgent) {
+        return (userAgent.containsMSIE());
+    }
+
+    @Override
+    protected Browser buildBrowser(UserAgent userAgent, String layoutEngine, String layoutEngineVersion, int hintedWidth, int hintedHeight) {
+        if (!userAgent.containsMSIE() || !(userAgent.hasMozillaPattern()) || userAgent.getCompleteUserAgent().matches(".*Windows.?(?:(?:CE)|(?:Phone)).*")) {
+            return null;
+        }
+
+        int confidence = 60;
+        Browser identified = new Browser();
+
+        identified.setVendor("Microsoft");
+        identified.setModel("Internet Explorer");
+
+        Matcher msieMatcher = msieVersionPattern.matcher(userAgent.getCompleteUserAgent());
+        if (msieMatcher.matches()) {
+            if (msieMatcher.group(1) != null) {
+                identified.setVersion(msieMatcher.group(1));
+                String version[] = msieMatcher.group(1).split("\\.");
+
+                if (version.length > 0) {
+                    identified.setMajorRevision(version[0]);
+                    if (identified.getMajorRevision().length() == 0) {
+                        identified.setMajorRevision("1");
+                    }
+                }
+
+                if (version.length > 1) {
+                    identified.setMinorRevision(version[1]);
+                    confidence += 10;
+                }
+            }
+            
+        } else {
+            //fallback version
+            identified.setVersion("1.0");
+            identified.setMajorRevision("1");
+        }
+
+        if (layoutEngine != null) {
+            identified.setLayoutEngine(layoutEngine);
+            identified.setLayoutEngineVersion(layoutEngineVersion);
+            if (layoutEngine.equals(LayoutEngineBrowserBuilder.TRIDENT)) {
+                confidence += 10;
+            }
+        }
+
+        Matcher dotNetClrMatcher = dotNetClrPattern.matcher(userAgent.getCompleteUserAgent());
+        if (dotNetClrMatcher.matches()) {
+            confidence += 10;
+        }
+
+        identified.setDisplayWidth(hintedWidth);
+        identified.setDisplayHeight(hintedHeight);
+        identified.setConfidence(confidence);
+
+        return identified;
+    }
+}

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

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

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/JasmineBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/JasmineBrowserBuilder.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/JasmineBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/JasmineBrowserBuilder.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,90 @@
+/**
+ * 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.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.openddr.simpleapi.oddr.model.UserAgent;
+import org.openddr.simpleapi.oddr.model.browser.Browser;
+
+public class JasmineBrowserBuilder extends LayoutEngineBrowserBuilder {
+
+    private static final String VERSION_REGEXP = ".*?(?:(?:Jasmine/))([0-9\\.]+).*?";
+    private Pattern versionPattern = Pattern.compile(VERSION_REGEXP);
+
+    public boolean canBuild(UserAgent userAgent) {
+        if (userAgent.getCompleteUserAgent().contains("Jasmine")) {
+            return true;
+        }
+        return false;
+    }
+
+    @Override
+    protected Browser buildBrowser(UserAgent userAgent, String layoutEngine, String layoutEngineVersion, int hintedWidth, int hintedHeight) {
+        String version = null;
+
+        Matcher versionMatcher = versionPattern.matcher(userAgent.getCompleteUserAgent());
+        if (!versionMatcher.matches()) {
+            return null;
+
+        } else {
+            if (versionMatcher.group(1) != null) {
+                version = versionMatcher.group(1);
+            }
+        }
+
+        int confidence = 60;
+        Browser identified = new Browser();
+
+        identified.setVendor("Samsung");
+        identified.setModel("Jasmine");
+        identified.setVersion(version);
+        String[] versionEl = version.split("\\.");
+
+        if (versionEl.length > 0) {
+            identified.setMajorRevision(versionEl[0]);
+        }
+
+        if (versionEl.length > 1) {
+            identified.setMinorRevision(versionEl[1]);
+            confidence += 10;
+        }
+
+        if (versionEl.length > 2) {
+            identified.setMicroRevision(versionEl[2]);
+        }
+
+        if (versionEl.length > 3) {
+            identified.setNanoRevision(versionEl[3]);
+        }
+
+        if (layoutEngine != null) {
+            identified.setLayoutEngine(layoutEngine);
+            identified.setLayoutEngineVersion(layoutEngineVersion);
+        }
+
+        identified.setDisplayWidth(hintedWidth);
+        identified.setDisplayHeight(hintedHeight);
+        identified.setConfidence(confidence);
+
+        return identified;
+    }
+}

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

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

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/KonquerorBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/KonquerorBrowserBuilder.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/KonquerorBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/KonquerorBrowserBuilder.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,98 @@
+/**
+ * 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.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.openddr.simpleapi.oddr.model.UserAgent;
+import org.openddr.simpleapi.oddr.model.browser.Browser;
+
+public class KonquerorBrowserBuilder extends LayoutEngineBrowserBuilder {
+
+    private static final String KONQUEROR_VERSION_REGEXP = ".*Konqueror/([0-9a-z\\.\\-]+).*";
+    private Pattern konquerorVersionPattern = Pattern.compile(KONQUEROR_VERSION_REGEXP);
+
+    public boolean canBuild(UserAgent userAgent) {
+        return (userAgent.getCompleteUserAgent().contains("Konqueror"));
+    }
+
+    @Override
+    protected Browser buildBrowser(UserAgent userAgent, String layoutEngine, String layoutEngineVersion, int hintedWidth, int hintedHeight) {
+        if (!(userAgent.hasMozillaPattern())) {
+            return null;
+        }
+
+        int confidence = 60;
+        Browser identified = new Browser();
+
+        identified.setVendor("KDE");
+        identified.setModel("Konqueror");
+        identified.setVersion("-");
+        identified.setMajorRevision("-");
+
+        Matcher chromeMatcher = konquerorVersionPattern.matcher(userAgent.getCompleteUserAgent());
+        if (chromeMatcher.matches()) {
+            if (chromeMatcher.group(1) != null) {
+                identified.setVersion(chromeMatcher.group(1));
+                String version[] = chromeMatcher.group(1).split("\\.");
+
+                if (version.length > 0) {
+                    identified.setMajorRevision(version[0]);
+                    if (identified.getMajorRevision().length() == 0) {
+                        identified.setMajorRevision("1");
+                    }
+                }
+
+                if (version.length > 1) {
+                    identified.setMinorRevision(version[1]);
+                    confidence += 10;
+                }
+
+                if (version.length > 2) {
+                    identified.setMicroRevision(version[2]);
+                }
+
+                if (version.length > 3) {
+                    identified.setNanoRevision(version[3]);
+                }
+            }
+
+        } else {
+            //fallback version
+            identified.setVersion("1.0");
+            identified.setMajorRevision("1");
+        }
+
+        if (layoutEngine != null) {
+            identified.setLayoutEngine(layoutEngine);
+            identified.setLayoutEngineVersion(layoutEngineVersion);
+            if (layoutEngine.equals(LayoutEngineBrowserBuilder.KHML)) {
+                confidence += 10;
+            }
+        }
+
+        identified.setDisplayWidth(hintedWidth);
+        identified.setDisplayHeight(hintedHeight);
+        identified.setConfidence(confidence);
+
+        return identified;
+    }
+}

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

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

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/LayoutEngineBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/LayoutEngineBrowserBuilder.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/LayoutEngineBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/LayoutEngineBrowserBuilder.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,88 @@
+/**
+ * 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.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.openddr.simpleapi.oddr.model.UserAgent;
+import org.openddr.simpleapi.oddr.model.browser.Browser;
+
+public abstract class LayoutEngineBrowserBuilder extends HintedResolutionBrowserBuilder {
+
+    static final String APPLEWEBKIT = "AppleWebKit";
+    static final String PRESTO = "Presto";
+    static final String GECKO = "Gecko";
+    static final String TRIDENT = "Trident";
+    static final String KHML = "KHTML";
+    private final String WEBKIT_VERSION_REGEXP = ".*AppleWebKit/([0-9\\.]+).*?";
+    private final String PRESTO_VERSION_REGEXP = ".*Presto/([0-9\\.]+).*?";
+    private final String GECKO_VERSION_REGEXP = ".*Gecko/([0-9\\.]+).*?";
+    private final String TRIDENT_VERSION_REGEXP = ".*Trident/([0-9\\.]+).*?";
+    private final String KHTML_VERSION_REGEXP = ".*KHTML/([0-9\\.]+).*?";
+    private Pattern webkitVersionPattern = Pattern.compile(WEBKIT_VERSION_REGEXP);
+    private Pattern prestoVersionPattern = Pattern.compile(PRESTO_VERSION_REGEXP);
+    private Pattern geckoVersionPattern = Pattern.compile(GECKO_VERSION_REGEXP);
+    private Pattern tridentVersionPattern = Pattern.compile(TRIDENT_VERSION_REGEXP);
+    private Pattern khtmlVersionPattern = Pattern.compile(KHTML_VERSION_REGEXP);
+
+    @Override
+    protected Browser buildBrowser(UserAgent userAgent, int hintedWidth, int hintedHeight) {
+        String layoutEngine = null;
+        String layoutEngineVersion = null;
+        Matcher result = webkitVersionPattern.matcher(userAgent.getCompleteUserAgent());
+
+        if (result.matches()) {
+            layoutEngine = APPLEWEBKIT;
+            layoutEngineVersion = result.group(1);
+
+        } else {
+            result = prestoVersionPattern.matcher(userAgent.getCompleteUserAgent());
+            if (result.matches()) {
+                layoutEngine = "Presto";
+                layoutEngineVersion = result.group(1);
+
+            } else {
+                result = geckoVersionPattern.matcher(userAgent.getCompleteUserAgent());
+                if (result.matches()) {
+                    layoutEngine = "Gecko";
+                    layoutEngineVersion = result.group(1);
+
+                } else {
+                    result = tridentVersionPattern.matcher(userAgent.getCompleteUserAgent());
+                    if (result.matches()) {
+                        layoutEngine = "Trident";
+                        layoutEngineVersion = result.group(1);
+
+                    } else {
+                        result = khtmlVersionPattern.matcher(userAgent.getCompleteUserAgent());
+                        if (result.matches()) {
+                            layoutEngine = "KHTML";
+                            layoutEngineVersion = result.group(1);
+                        }
+                    }
+                }
+            }
+        }
+        return buildBrowser(userAgent, layoutEngine, layoutEngineVersion, hintedWidth, hintedHeight);
+    }
+
+    protected abstract Browser buildBrowser(UserAgent userAgent, String layoutEngine, String layoutEngineVersion, int hintedWidth, int hintedHeight);
+}

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

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

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/NetFrontBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/NetFrontBrowserBuilder.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/NetFrontBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/NetFrontBrowserBuilder.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,90 @@
+/**
+ * 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.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.openddr.simpleapi.oddr.model.UserAgent;
+import org.openddr.simpleapi.oddr.model.browser.Browser;
+
+public class NetFrontBrowserBuilder extends LayoutEngineBrowserBuilder {
+
+    private static final String VERSION_REGEXP = ".*?(?:(?:Net[Ff]ront)|(?:ACS-NF)|(?:NF-Browser))[/ ]?[/ ]?(?:WAP)?([0-9\\.]+).*?";
+    private Pattern versionPattern = Pattern.compile(VERSION_REGEXP);
+
+    public boolean canBuild(UserAgent userAgent) {
+        if (userAgent.getCompleteUserAgent().matches("(?i).*netfront.*") || userAgent.getCompleteUserAgent().contains("ACS-NF") || userAgent.getCompleteUserAgent().contains("NF-Browser")) {
+            return true;
+        }
+        return false;
+    }
+
+    @Override
+    protected Browser buildBrowser(UserAgent userAgent, String layoutEngine, String layoutEngineVersion, int hintedWidth, int hintedHeight) {
+        String version = null;
+
+        Matcher versionMatcher = versionPattern.matcher(userAgent.getCompleteUserAgent());
+        if (!versionMatcher.matches()) {
+            return null;
+
+        } else {
+            if (versionMatcher.group(1) != null) {
+                version = versionMatcher.group(1);
+            }
+        }
+
+        int confidence = 60;
+        Browser identified = new Browser();
+
+        identified.setVendor("Access");
+        identified.setModel("NetFront");
+        identified.setVersion(version);
+        String[] versionEl = version.split("\\.");
+
+        if (versionEl.length > 0) {
+            identified.setMajorRevision(versionEl[0]);
+        }
+
+        if (versionEl.length > 1) {
+            identified.setMinorRevision(versionEl[1]);
+            confidence += 10;
+        }
+
+        if (versionEl.length > 2) {
+            identified.setMicroRevision(versionEl[2]);
+        }
+
+        if (versionEl.length > 3) {
+            identified.setNanoRevision(versionEl[3]);
+        }
+
+        if (layoutEngine != null) {
+            identified.setLayoutEngine(layoutEngine);
+            identified.setLayoutEngineVersion(layoutEngineVersion);
+        }
+
+        identified.setDisplayWidth(hintedWidth);
+        identified.setDisplayHeight(hintedHeight);
+        identified.setConfidence(confidence);
+
+        return identified;
+    }
+}

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

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

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/NokiaBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/NokiaBrowserBuilder.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/NokiaBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/NokiaBrowserBuilder.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,105 @@
+/**
+ * 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.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.openddr.simpleapi.oddr.model.UserAgent;
+import org.openddr.simpleapi.oddr.model.browser.Browser;
+
+public class NokiaBrowserBuilder extends LayoutEngineBrowserBuilder {
+
+    private static final String NOKIA_BROWSER_VERSION_REGEXP = ".*(?:(?:BrowserNG)|(?:NokiaBrowser))/([0-9\\.]+).*";
+    private static final String SAFARI_VERSION_REGEXP = ".*Safari/([0-9\\.]+).*";
+    private Pattern nokiaBrowserVersionPattern = Pattern.compile(NOKIA_BROWSER_VERSION_REGEXP);
+    private Pattern safariVersionPattern = Pattern.compile(SAFARI_VERSION_REGEXP);
+
+    public boolean canBuild(UserAgent userAgent) {
+        return (userAgent.getCompleteUserAgent().contains("Nokia") || userAgent.getCompleteUserAgent().contains("NokiaBrowser") || userAgent.getCompleteUserAgent().contains("BrowserNG") || userAgent.getCompleteUserAgent().contains("Series60"));
+    }
+
+    @Override
+    protected Browser buildBrowser(UserAgent userAgent, String layoutEngine, String layoutEngineVersion, int hintedWidth, int hintedHeight) {
+        if (!(userAgent.hasMozillaPattern() || userAgent.getCompleteUserAgent().contains("SymbianOS") || userAgent.getCompleteUserAgent().contains("Symbian/3") || userAgent.getCompleteUserAgent().contains("Nokia"))) {
+            return null;
+        }
+
+        int confidence = 50;
+        Browser identified = new Browser();
+
+        identified.setVendor("Nokia");
+        identified.setModel("Nokia Browser");
+        identified.setVersion("-");
+        identified.setMajorRevision("-");
+
+        Matcher nokiaBrowserMatcher = nokiaBrowserVersionPattern.matcher(userAgent.getCompleteUserAgent());
+        if (nokiaBrowserMatcher.matches()) {
+            if (nokiaBrowserMatcher.group(1) != null) {
+                identified.setVersion(nokiaBrowserMatcher.group(1));
+                String version[] = nokiaBrowserMatcher.group(1).split("\\.");
+
+                if (version.length > 0) {
+                    identified.setMajorRevision(version[0]);
+                    if (identified.getMajorRevision().length() == 0) {
+                        identified.setMajorRevision("1");
+                    }
+                }
+
+                if (version.length > 1) {
+                    identified.setMinorRevision(version[1]);
+                    confidence += 10;
+                }
+
+                if (version.length > 2) {
+                    identified.setMicroRevision(version[2]);
+                }
+
+                if (version.length > 3) {
+                    identified.setNanoRevision(version[3]);
+                }
+            }
+
+        }
+
+        if (layoutEngine != null) {
+            identified.setLayoutEngine(layoutEngine);
+            identified.setLayoutEngineVersion(layoutEngineVersion);
+            if (layoutEngine.equals(LayoutEngineBrowserBuilder.APPLEWEBKIT)) {
+                confidence += 10;
+            }
+        }
+
+        Matcher safariMatcher = safariVersionPattern.matcher(userAgent.getCompleteUserAgent());
+        if (safariMatcher.matches()) {
+            if (safariMatcher.group(1) != null) {
+                identified.setReferenceBrowser("Safari");
+                identified.setReferenceBrowserVersion(safariMatcher.group(1));
+                confidence += 10;
+            }
+        }
+
+        identified.setDisplayWidth(hintedWidth);
+        identified.setDisplayHeight(hintedHeight);
+        identified.setConfidence(confidence);
+
+        return identified;
+    }
+}

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

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

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/ObigoBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/ObigoBrowserBuilder.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/ObigoBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/ObigoBrowserBuilder.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,133 @@
+/**
+ * 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.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.openddr.simpleapi.oddr.model.UserAgent;
+import org.openddr.simpleapi.oddr.model.browser.Browser;
+
+public class ObigoBrowserBuilder extends LayoutEngineBrowserBuilder {
+
+    private static final String VERSION_REGEXP = ".*?(?:(?:ObigoInternetBrowser/)|(?:Obigo Browser )|(?:[Oo]bigo[- ][Bb]rowser/))([0-9A-Z\\.]+).*?";
+    private static final String VERSION_REGEXP2 = ".*?(?:(?:Browser/Obigo)|(?:OBIGO[/_-])|(?:Obigo[-/ ]))([0-9A-Z\\.]+).*?";
+    private static final String VERSION_REGEXP3 = ".*?(?:(?:Obigo[Il]nternetBrowser/)|(?:Obigo Browser )|(?:[Oo]bigo[- ][Bb]rowser/))([0-9A-Zacqv\\.]+).*?";
+    private static final String VERSION_REGEXP4 = ".*?(?:(?:[Bb]rowser/[Oo]bigo)|(?:OBIGO[/_-])|(?:Obigo[-/ ]))([0-9A-Zacqv\\.]+).*?";
+    private static final String VERSION_REGEXP5 = ".*?(?:(?:[Tt]eleca Q))([0-9A-Zacqv\\.]+).*?";
+    private Pattern versionPattern = Pattern.compile(VERSION_REGEXP);
+    private Pattern versionPattern2 = Pattern.compile(VERSION_REGEXP2);
+    private Pattern versionPattern3 = Pattern.compile(VERSION_REGEXP3);
+    private Pattern versionPattern4 = Pattern.compile(VERSION_REGEXP4);
+    private Pattern versionPattern5 = Pattern.compile(VERSION_REGEXP5);
+
+    public boolean canBuild(UserAgent userAgent) {
+        if (userAgent.getCompleteUserAgent().matches("((?i).*obigo.*)|((?i).*teleca.*)")) {
+            return true;
+        }
+        return false;
+    }
+
+    @Override
+    protected Browser buildBrowser(UserAgent userAgent, String layoutEngine, String layoutEngineVersion, int hintedWidth, int hintedHeight) {
+        String version = null;
+
+        int confidence = 60;
+        Browser identified = new Browser();
+        identified.setVendor("Obigo");
+        identified.setModel("Obigo Browser");
+
+        Matcher versionMatcher = versionPattern.matcher(userAgent.getCompleteUserAgent());
+        if (!versionMatcher.matches()) {
+            version = null;
+
+        } else {
+            if (versionMatcher.group(1) != null) {
+                version = versionMatcher.group(1);
+            }
+        }
+
+        if (version == null) {
+            Matcher versionMatcher2 = versionPattern2.matcher(userAgent.getCompleteUserAgent());
+            if (!versionMatcher2.matches()) {
+                version = null;
+
+            } else {
+                if (versionMatcher2.group(1) != null) {
+                    version = versionMatcher2.group(1);
+                }
+            }
+        }
+
+        if (version == null) {
+            Matcher versionMatcher3 = versionPattern3.matcher(userAgent.getCompleteUserAgent());
+            if (!versionMatcher3.matches()) {
+                version = null;
+
+            } else {
+                if (versionMatcher3.group(1) != null) {
+                    version = versionMatcher3.group(1);
+                }
+            }
+        }
+
+        if (version == null) {
+            Matcher versionMatcher4 = versionPattern4.matcher(userAgent.getCompleteUserAgent());
+            if (!versionMatcher4.matches()) {
+                version = null;
+
+            } else {
+                if (versionMatcher4.group(1) != null) {
+                    version = versionMatcher4.group(1);
+                }
+            }
+        }
+
+        if (version == null) {
+            Matcher versionMatcher5 = versionPattern5.matcher(userAgent.getCompleteUserAgent());
+            if (!versionMatcher5.matches()) {
+                version = null;
+
+            } else {
+                if (versionMatcher5.group(1) != null) {
+                    version = versionMatcher5.group(1);
+                    identified.setModel("Teleca-Obigo");
+                }
+            }
+        }
+
+        if (version == null) {
+            return null;
+        }
+
+        identified.setVersion(version);
+
+        if (layoutEngine != null) {
+            identified.setLayoutEngine(layoutEngine);
+            identified.setLayoutEngineVersion(layoutEngineVersion);
+        }
+
+        identified.setDisplayWidth(hintedWidth);
+        identified.setDisplayHeight(hintedHeight);
+        identified.setConfidence(confidence);
+
+        return identified;
+    }
+}

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

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

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/OpenWaveBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/OpenWaveBrowserBuilder.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/OpenWaveBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/OpenWaveBrowserBuilder.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,90 @@
+/**
+ * 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.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.openddr.simpleapi.oddr.model.UserAgent;
+import org.openddr.simpleapi.oddr.model.browser.Browser;
+
+public class OpenWaveBrowserBuilder extends LayoutEngineBrowserBuilder {
+
+    private static final String VERSION_REGEXP = "(?i).*openwave[/ ]?([0-9\\.]+).*?";
+    private Pattern versionPattern = Pattern.compile(VERSION_REGEXP);
+
+    public boolean canBuild(UserAgent userAgent) {
+        if (userAgent.getCompleteUserAgent().matches("(?i).*openwave.*")) {
+            return true;
+        }
+        return false;
+    }
+
+    @Override
+    protected Browser buildBrowser(UserAgent userAgent, String layoutEngine, String layoutEngineVersion, int hintedWidth, int hintedHeight) {
+        String version = null;
+
+        Matcher versionMatcher = versionPattern.matcher(userAgent.getCompleteUserAgent());
+        if (!versionMatcher.matches()) {
+            return null;
+
+        } else {
+            if (versionMatcher.group(1) != null) {
+                version = versionMatcher.group(1);
+            }
+        }
+
+        int confidence = 60;
+        Browser identified = new Browser();
+
+        identified.setVendor("Openwave");
+        identified.setModel("OpenWave");
+        identified.setVersion(version);
+        String[] versionEl = version.split("\\.");
+
+        if (versionEl.length > 0) {
+            identified.setMajorRevision(versionEl[0]);
+        }
+
+        if (versionEl.length > 1) {
+            identified.setMinorRevision(versionEl[1]);
+            confidence += 10;
+        }
+
+        if (versionEl.length > 2) {
+            identified.setMicroRevision(versionEl[2]);
+        }
+
+        if (versionEl.length > 3) {
+            identified.setNanoRevision(versionEl[3]);
+        }
+
+        if (layoutEngine != null) {
+            identified.setLayoutEngine(layoutEngine);
+            identified.setLayoutEngineVersion(layoutEngineVersion);
+        }
+
+        identified.setDisplayWidth(hintedWidth);
+        identified.setDisplayHeight(hintedHeight);
+        identified.setConfidence(confidence);
+
+        return identified;
+    }
+}

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

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

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/OperaBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/OperaBrowserBuilder.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/OperaBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/OperaBrowserBuilder.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,120 @@
+/**
+ * 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.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.openddr.simpleapi.oddr.model.UserAgent;
+import org.openddr.simpleapi.oddr.model.browser.Browser;
+
+public class OperaBrowserBuilder extends LayoutEngineBrowserBuilder {
+
+    private static final String OPERAMINI_VERSION_REGEXP = "Opera Mobi/(.*)";
+    private static final String OPERA_VERSION_REGEXP = ".* Opera ([0-9\\.]+).*";
+    private Pattern operaMiniVersionPattern = Pattern.compile(OPERAMINI_VERSION_REGEXP);
+    private Pattern operaVersionPattern = Pattern.compile(OPERA_VERSION_REGEXP);
+
+    public boolean canBuild(UserAgent userAgent) {
+        return ((userAgent.hasOperaPattern() || userAgent.getCompleteUserAgent().matches(".*" + " Opera [0-9\\.]+" + ".*")) && (!userAgent.getCompleteUserAgent().contains("Opera Mini")));
+    }
+
+    @Override
+    protected Browser buildBrowser(UserAgent userAgent, String layoutEngine, String layoutEngineVersion, int hintedWidth, int hintedHeight) {
+        if ((!userAgent.hasOperaPattern() || userAgent.getOperaVersion() == null || userAgent.getOperaVersion().length() == 0) && (!userAgent.getCompleteUserAgent().matches(".*" + " Opera [0-9\\.]+" + ".*"))) {
+            return null;
+        }
+
+        int confidence = 60;
+        Browser identified = new Browser();
+
+        identified.setVendor("Opera");
+        if (userAgent.getCompleteUserAgent().contains("Mobi")) {
+            identified.setModel("Opera Mobile");
+            confidence += 10;
+
+        } else if (userAgent.getCompleteUserAgent().contains("Tablet")) {
+            identified.setModel("Opera Tablet");
+
+        } else {
+            identified.setModel("Opera");
+        }
+
+        if (userAgent.getOperaVersion() != null) {
+            identified.setVersion(userAgent.getOperaVersion());
+        } else {
+            Matcher operaMatcher = operaVersionPattern.matcher(userAgent.getCompleteUserAgent());
+            if (operaMatcher.matches()) {
+                if (operaMatcher.group(1) != null) {
+                    identified.setVersion(operaMatcher.group(1));
+                }
+            }
+        }
+
+        String version[] = identified.getVersion().split("\\.");
+
+        if (version.length > 0) {
+            identified.setMajorRevision(version[0]);
+        }
+
+        if (version.length > 1) {
+            identified.setMinorRevision(version[1]);
+            confidence += 10;
+        }
+
+        if (version.length > 2) {
+            identified.setMicroRevision(version[2]);
+        }
+
+        if (version.length > 3) {
+            identified.setNanoRevision(version[3]);
+        }
+
+        if (layoutEngine != null) {
+            identified.setLayoutEngine(layoutEngine);
+            identified.setLayoutEngineVersion(layoutEngineVersion);
+            if (layoutEngine.equals(LayoutEngineBrowserBuilder.PRESTO)) {
+                confidence += 10;
+            }
+        }
+
+        if (userAgent.getPatternElementsInside() != null) {
+            String inside[] = userAgent.getPatternElementsInside().split(";");
+            for (String token : inside) {
+                String element = token.trim();
+                Matcher miniMatcher = operaMiniVersionPattern.matcher(element);
+                if (miniMatcher.matches()) {
+                    if (miniMatcher.group(1) != null) {
+                        identified.setReferenceBrowser("Opera Mobi");
+                        identified.setReferenceBrowserVersion(miniMatcher.group(1));
+                        confidence += 10;
+                        break;
+                    }
+                }
+            }
+        }
+
+        identified.setDisplayWidth(hintedWidth);
+        identified.setDisplayHeight(hintedHeight);
+        identified.setConfidence(confidence);
+
+        return identified;
+    }
+}

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

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

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/OperaMiniBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/OperaMiniBrowserBuilder.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/OperaMiniBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/OperaMiniBrowserBuilder.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,99 @@
+/**
+ * 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.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.openddr.simpleapi.oddr.model.UserAgent;
+import org.openddr.simpleapi.oddr.model.browser.Browser;
+
+public class OperaMiniBrowserBuilder extends LayoutEngineBrowserBuilder {
+
+    private static final String VERSION_REGEXP = ".*?Opera Mini/(?:att/)?v?((\\d+)\\.(\\d+)(?:\\.(\\d+))?(?:\\.(\\d+))?).*?";
+    private static final String BUILD_REGEXP = ".*?Opera Mini/(?:att/)?v?.*?/(.*?);.*";
+    private Pattern versionPattern = Pattern.compile(VERSION_REGEXP);
+    private Pattern buildPattern = Pattern.compile(BUILD_REGEXP);
+
+    public boolean canBuild(UserAgent userAgent) {
+        if (userAgent.getCompleteUserAgent().contains("Opera Mini")) {
+            return true;
+        }
+        return false;
+    }
+
+    @Override
+    protected Browser buildBrowser(UserAgent userAgent, String layoutEngine, String layoutEngineVersion, int hintedWidth, int hintedHeight) {
+        Matcher versionMatcher = versionPattern.matcher(userAgent.getCompleteUserAgent());
+        if (!versionMatcher.matches()) {
+            return null;
+        }
+
+        int confidence = 60;
+        Browser identified = new Browser();
+
+        identified.setVendor("Opera");
+        identified.setModel("Opera Mini");
+
+        if (versionMatcher.group(1) != null) {
+            identified.setVersion(versionMatcher.group(1));
+        }
+        if (versionMatcher.group(2) != null) {
+            identified.setMajorRevision(versionMatcher.group(2));
+        }
+        if (versionMatcher.group(3) != null) {
+            identified.setMinorRevision(versionMatcher.group(3));
+        }
+        if (versionMatcher.group(4) != null) {
+            identified.setMicroRevision(versionMatcher.group(4));
+        }
+        if (versionMatcher.group(5) != null) {
+            identified.setNanoRevision(versionMatcher.group(5));
+        }
+
+        if (userAgent.hasOperaPattern() && userAgent.getOperaVersion() != null) {
+            identified.setReferenceBrowser("Opera");
+            identified.setReferenceBrowserVersion(userAgent.getOperaVersion());
+            confidence += 20;
+        }
+
+        Matcher buildMatcher = buildPattern.matcher(userAgent.getCompleteUserAgent());
+        if (buildMatcher.matches()) {
+            if (buildMatcher.group(1) != null) {
+                identified.setBuild(buildMatcher.group(1));
+                confidence += 10;
+            }
+        }
+
+        if (layoutEngine != null) {
+            identified.setLayoutEngine(layoutEngine);
+            identified.setLayoutEngineVersion(layoutEngineVersion);
+            if (layoutEngine.equals(LayoutEngineBrowserBuilder.PRESTO)) {
+                confidence += 10;
+            }
+        }
+
+        identified.setDisplayWidth(hintedWidth);
+        identified.setDisplayHeight(hintedHeight);
+        identified.setConfidence(confidence);
+
+        return identified;
+    }
+}

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

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

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/PolarisBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/PolarisBrowserBuilder.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/PolarisBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/PolarisBrowserBuilder.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,90 @@
+/**
+ * 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.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.openddr.simpleapi.oddr.model.UserAgent;
+import org.openddr.simpleapi.oddr.model.browser.Browser;
+
+public class PolarisBrowserBuilder extends LayoutEngineBrowserBuilder {
+
+    private static final String VERSION_REGEXP = ".*?(?:(?:Polaris)|(?:POLARIS))[/ ](?:v)?([0-9\\.]+).*?";
+    private Pattern versionPattern = Pattern.compile(VERSION_REGEXP);
+
+    public boolean canBuild(UserAgent userAgent) {
+        if (userAgent.getCompleteUserAgent().contains("Polaris")) {
+            return true;
+        }
+        return false;
+    }
+
+    @Override
+    protected Browser buildBrowser(UserAgent userAgent, String layoutEngine, String layoutEngineVersion, int hintedWidth, int hintedHeight) {
+        String version = null;
+
+        Matcher versionMatcher = versionPattern.matcher(userAgent.getCompleteUserAgent());
+        if (!versionMatcher.matches()) {
+            return null;
+
+        } else {
+            if (versionMatcher.group(1) != null) {
+                version = versionMatcher.group(1);
+            }
+        }
+
+        int confidence = 60;
+        Browser identified = new Browser();
+
+        identified.setVendor("Infraware");
+        identified.setModel("Polaris");
+        identified.setVersion(version);
+        String[] versionEl = version.split("\\.");
+
+        if (versionEl.length > 0) {
+            identified.setMajorRevision(versionEl[0]);
+        }
+
+        if (versionEl.length > 1) {
+            identified.setMinorRevision(versionEl[1]);
+            confidence += 10;
+        }
+
+        if (versionEl.length > 2) {
+            identified.setMicroRevision(versionEl[2]);
+        }
+
+        if (versionEl.length > 3) {
+            identified.setNanoRevision(versionEl[3]);
+        }
+
+        if (layoutEngine != null) {
+            identified.setLayoutEngine(layoutEngine);
+            identified.setLayoutEngineVersion(layoutEngineVersion);
+        }
+
+        identified.setDisplayWidth(hintedWidth);
+        identified.setDisplayHeight(hintedHeight);
+        identified.setConfidence(confidence);
+
+        return identified;
+    }
+}

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

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

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/SEMCBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/SEMCBrowserBuilder.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/SEMCBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/SEMCBrowserBuilder.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,91 @@
+/**
+ * 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.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.openddr.simpleapi.oddr.model.UserAgent;
+import org.openddr.simpleapi.oddr.model.browser.Browser;
+
+public class SEMCBrowserBuilder extends LayoutEngineBrowserBuilder {
+
+    private static final String VERSION_REGEXP = ".*SEMC?(?:(?:-Browser/)|(?:-BROWSER/)|(?:/NewsReader/)|(?:-Java/))(?:Symbian/)?([0-9\\.RA]+).*?";
+    private Pattern versionPattern = Pattern.compile(VERSION_REGEXP);
+
+    public boolean canBuild(UserAgent userAgent) {
+        if (userAgent.getCompleteUserAgent().contains("SEMC")) {
+            return true;
+        }
+
+        return false;
+    }
+
+    @Override
+    protected Browser buildBrowser(UserAgent userAgent, String layoutEngine, String layoutEngineVersion, int hintedWidth, int hintedHeight) {
+        String version = null;
+
+        Matcher versionMatcher = versionPattern.matcher(userAgent.getCompleteUserAgent());
+        if (!versionMatcher.matches()) {
+            return null;
+
+        } else {
+            if (versionMatcher.group(1) != null) {
+                version = versionMatcher.group(1);
+            }
+        }
+
+        int confidence = 60;
+        Browser identified = new Browser();
+
+        identified.setVendor("SonyEricsson");
+        identified.setModel("Mobile Browser");
+        identified.setVersion(version);
+        String[] versionEl = version.split("\\.");
+
+        if (versionEl.length > 0) {
+            identified.setMajorRevision(versionEl[0]);
+        }
+
+        if (versionEl.length > 1) {
+            identified.setMinorRevision(versionEl[1]);
+            confidence += 10;
+        }
+
+        if (versionEl.length > 2) {
+            identified.setMicroRevision(versionEl[2]);
+        }
+
+        if (versionEl.length > 3) {
+            identified.setNanoRevision(versionEl[3]);
+        }
+
+        if (layoutEngine != null) {
+            identified.setLayoutEngine(layoutEngine);
+            identified.setLayoutEngineVersion(layoutEngineVersion);
+        }
+
+        identified.setDisplayWidth(hintedWidth);
+        identified.setDisplayHeight(hintedHeight);
+        identified.setConfidence(confidence);
+
+        return identified;
+    }
+}

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

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

Added: incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/SafariBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/SafariBrowserBuilder.java?rev=1392911&view=auto
==============================================================================
--- incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/SafariBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/openddr/java/src/org/openddr/simpleapi/oddr/builder/browser/SafariBrowserBuilder.java Tue Oct  2 13:32:28 2012
@@ -0,0 +1,94 @@
+/**
+ * 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.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.openddr.simpleapi.oddr.model.UserAgent;
+import org.openddr.simpleapi.oddr.model.browser.Browser;
+
+public class SafariBrowserBuilder extends LayoutEngineBrowserBuilder {
+
+    private static final String SAFARI_VERSION_REGEXP = ".*Version/([0-9\\.]+).*";
+    private Pattern safariVersionPattern = Pattern.compile(SAFARI_VERSION_REGEXP);
+
+    public boolean canBuild(UserAgent userAgent) {
+        return (userAgent.getCompleteUserAgent().contains("Safari") && !userAgent.getCompleteUserAgent().contains("Mobile"));
+    }
+
+    @Override
+    protected Browser buildBrowser(UserAgent userAgent, String layoutEngine, String layoutEngineVersion, int hintedWidth, int hintedHeight) {
+        if (!(userAgent.hasMozillaPattern())) {
+            return null;
+        }
+
+        int confidence = 60;
+        Browser identified = new Browser();
+
+        identified.setVendor("Apple");
+        identified.setModel("Safari");
+        identified.setVersion("-");
+        identified.setMajorRevision("-");
+
+        Matcher safariMatcher = safariVersionPattern.matcher(userAgent.getCompleteUserAgent());
+        if (safariMatcher.matches()) {
+            if (safariMatcher.group(1) != null) {
+                identified.setVersion(safariMatcher.group(1));
+                String version[] = safariMatcher.group(1).split("\\.");
+
+                if (version.length > 0) {
+                    identified.setMajorRevision(version[0]);
+                    if (identified.getMajorRevision().length() == 0) {
+                        identified.setMajorRevision("1");
+                    }
+                }
+
+                if (version.length > 1) {
+                    identified.setMinorRevision(version[1]);
+                    confidence += 10;
+                }
+
+                if (version.length > 2) {
+                    identified.setMicroRevision(version[2]);
+                }
+
+                if (version.length > 3) {
+                    identified.setNanoRevision(version[3]);
+                }
+            }
+
+        }
+
+        if (layoutEngine != null) {
+            identified.setLayoutEngine(layoutEngine);
+            identified.setLayoutEngineVersion(layoutEngineVersion);
+            if (layoutEngine.equals(LayoutEngineBrowserBuilder.GECKO)) {
+                confidence += 10;
+            }
+        }
+
+        identified.setDisplayWidth(hintedWidth);
+        identified.setDisplayHeight(hintedHeight);
+        identified.setConfidence(confidence);
+
+        return identified;
+    }
+}