You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devicemap.apache.org by wk...@apache.org on 2014/03/24 01:52:49 UTC

svn commit: r1580679 [2/6] - in /incubator/devicemap/trunk/devicemap/java: ./ classifier/ simpleddr/ simpleddr/src/ simpleddr/src/main/ simpleddr/src/main/java/ simpleddr/src/main/java/org/ simpleddr/src/main/java/org/apache/ simpleddr/src/main/java/or...

Added: incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/Builder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/Builder.java?rev=1580679&view=auto
==============================================================================
--- incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/Builder.java (added)
+++ incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/Builder.java Mon Mar 24 00:52:47 2014
@@ -0,0 +1,31 @@
+/**
+ * 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.apache.devicemap.simpleddr.builder;
+
+import org.apache.devicemap.simpleddr.model.BuiltObject;
+import org.apache.devicemap.simpleddr.model.UserAgent;
+
+public interface Builder {
+
+    public boolean canBuild(UserAgent userAgent);
+
+    public BuiltObject build(UserAgent userAgent, int confidenceTreshold);
+}

Added: incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/AndroidMobileBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/AndroidMobileBrowserBuilder.java?rev=1580679&view=auto
==============================================================================
--- incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/AndroidMobileBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/AndroidMobileBrowserBuilder.java Mon Mar 24 00:52:47 2014
@@ -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.apache.devicemap.simpleddr.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.apache.devicemap.simpleddr.model.UserAgent;
+import org.apache.devicemap.simpleddr.model.browser.Browser;
+
+public class AndroidMobileBrowserBuilder extends LayoutEngineBrowserBuilder {
+
+    private static final String VERSION_REGEXP = ".*Version/([0-9\\.]+).*?";
+    private static final String SAFARI_REGEXP = ".*Safari/([0-9\\.]+).*?";
+    private Pattern versionPattern = Pattern.compile(VERSION_REGEXP);
+    private Pattern safariPattern = Pattern.compile(SAFARI_REGEXP);
+
+    public boolean canBuild(UserAgent userAgent) {
+        return (userAgent.containsAndroid());
+    }
+
+    @Override
+    protected Browser buildBrowser(UserAgent userAgent, String layoutEngine, String layoutEngineVersion, int hintedWidth, int hintedHeight) {
+        if (!userAgent.containsAndroid() || !userAgent.hasMozillaPattern() || userAgent.getCompleteUserAgent().contains("Fennec")) {
+            return null;
+        }
+
+        int confidence = 70;
+        Browser identified = new Browser();
+
+        identified.setVendor("Google");
+        identified.setModel("Android Browser");
+
+        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 (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.APPLEWEBKIT)) {
+                confidence += 10;
+            }
+        }
+
+        Matcher safariMatcher = safariPattern.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;
+    }
+}

Added: incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/BlackBerryBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/BlackBerryBrowserBuilder.java?rev=1580679&view=auto
==============================================================================
--- incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/BlackBerryBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/BlackBerryBrowserBuilder.java Mon Mar 24 00:52:47 2014
@@ -0,0 +1,110 @@
+/**
+ * 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.apache.devicemap.simpleddr.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.apache.devicemap.simpleddr.model.UserAgent;
+import org.apache.devicemap.simpleddr.model.browser.Browser;
+
+public class BlackBerryBrowserBuilder extends LayoutEngineBrowserBuilder {
+
+    private static final String BLACKBERRY_VERSION_REGEXP = ".*(?:(?:Version)|(?:[Bb]lack.?[Bb]erry.?(?:[0-9a-z]+)))/([0-9\\.]+).*";//"(?:.*?Version.?([0-9\\.]+).*)|(?:.*?[Bb]lack.?[Bb]erry(?:\\d+)/([0-9\\.]+).*)";
+    private static final String SAFARI_VERSION_REGEXP = ".*Safari/([0-9\\.]+).*";
+    private Pattern blackberryVersionPattern = Pattern.compile(BLACKBERRY_VERSION_REGEXP);
+    private Pattern safariVersionPattern = Pattern.compile(SAFARI_VERSION_REGEXP);
+
+    public boolean canBuild(UserAgent userAgent) {
+        return userAgent.getCompleteUserAgent().contains("BlackBerry");
+    }
+
+    @Override
+    protected Browser buildBrowser(UserAgent userAgent, String layoutEngine, String layoutEngineVersion, int hintedWidth, int hintedHeight) {
+
+        int confidence = 50;
+        Browser identified = new Browser();
+
+        identified.setVendor("RIM");
+        identified.setModel("BlackBerry");
+        identified.setVersion("-");
+        identified.setMajorRevision("-");
+
+        Matcher blackberryBrowserMatcher = blackberryVersionPattern.matcher(userAgent.getCompleteUserAgent());
+        if (blackberryBrowserMatcher.matches()) {
+            if (blackberryBrowserMatcher.group(1) != null) {
+                String totalVersion = "";
+                if (blackberryBrowserMatcher.group(1) != null) {
+                    totalVersion = blackberryBrowserMatcher.group(1);
+                } else if (blackberryBrowserMatcher.group(2) != null) {
+                    totalVersion = blackberryBrowserMatcher.group(2);
+                }
+                if (totalVersion.length() > 0) {
+                    identified.setVersion(totalVersion);
+                    String version[] = totalVersion.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;
+    }
+}

Added: incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/ChromeBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/ChromeBrowserBuilder.java?rev=1580679&view=auto
==============================================================================
--- incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/ChromeBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/ChromeBrowserBuilder.java Mon Mar 24 00:52:47 2014
@@ -0,0 +1,109 @@
+/**
+ * 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.apache.devicemap.simpleddr.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.apache.devicemap.simpleddr.model.UserAgent;
+import org.apache.devicemap.simpleddr.model.browser.Browser;
+
+public class ChromeBrowserBuilder extends LayoutEngineBrowserBuilder {
+
+    private static final String CHROME_VERSION_REGEXP = ".*Chrome.([0-9a-z\\.b]+).*";
+    private static final String SAFARI_REGEXP = ".*Safari/([0-9\\.]+).*?";
+    private Pattern chromeVersionPattern = Pattern.compile(CHROME_VERSION_REGEXP);
+    private Pattern safariPattern = Pattern.compile(SAFARI_REGEXP);
+
+    public boolean canBuild(UserAgent userAgent) {
+        return (userAgent.getCompleteUserAgent().contains("Chrome"));
+    }
+
+    @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("Google");
+        identified.setModel("Chrome");
+        identified.setVersion("-");
+        identified.setMajorRevision("-");
+
+        Matcher chromeMatcher = chromeVersionPattern.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;
+            }
+        }
+
+        Matcher safariMatcher = safariPattern.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;
+    }
+}

Added: incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/ChromeMobileBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/ChromeMobileBrowserBuilder.java?rev=1580679&view=auto
==============================================================================
--- incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/ChromeMobileBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/ChromeMobileBrowserBuilder.java Mon Mar 24 00:52:47 2014
@@ -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.apache.devicemap.simpleddr.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.apache.devicemap.simpleddr.model.UserAgent;
+import org.apache.devicemap.simpleddr.model.browser.Browser;
+
+public class ChromeMobileBrowserBuilder extends LayoutEngineBrowserBuilder {
+
+    private static final String VERSION_REGEXP = "(?:.*Chrome/([0-9\\.]+).*?)|(?:.*CriOS/([0-9\\.]+).*?)";
+    private static final String SAFARI_REGEXP = ".*Safari/([0-9\\.]+).*?";
+    private Pattern versionPattern = Pattern.compile(VERSION_REGEXP);
+    private Pattern safariPattern = Pattern.compile(SAFARI_REGEXP);
+
+    public boolean canBuild(UserAgent userAgent) {
+        return ((userAgent.containsAndroid() || userAgent.containsIOSDevices()) && (userAgent.getCompleteUserAgent().contains("Chrome") || userAgent.getCompleteUserAgent().contains("CriOS")));
+    }
+
+    @Override
+    protected Browser buildBrowser(UserAgent userAgent, String layoutEngine, String layoutEngineVersion, int hintedWidth, int hintedHeight) {
+        if (!userAgent.hasMozillaPattern() || !userAgent.getCompleteUserAgent().contains("Mobile")) {
+            return null;
+        }
+
+        int confidence = 70;
+        Browser identified = new Browser();
+
+        identified.setVendor("Google");
+        identified.setModel("Chrome");
+
+        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 (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 (versionMatcher.group(2) != null) {
+                identified.setVersion(versionMatcher.group(2));
+                String version[] = versionMatcher.group(2).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]);
+                }
+            }
+
+        } else {
+            //fallback version
+            identified.setVersion("18.0");
+            identified.setMajorRevision("18");
+        }
+
+        if (layoutEngine != null) {
+            identified.setLayoutEngine(layoutEngine);
+            identified.setLayoutEngineVersion(layoutEngineVersion);
+
+            if (layoutEngine.equals(LayoutEngineBrowserBuilder.APPLEWEBKIT)) {
+                confidence += 10;
+            }
+        }
+
+        Matcher safariMatcher = safariPattern.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;
+    }
+}

Added: incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/DefaultBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/DefaultBrowserBuilder.java?rev=1580679&view=auto
==============================================================================
--- incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/DefaultBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/DefaultBrowserBuilder.java Mon Mar 24 00:52:47 2014
@@ -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.apache.devicemap.simpleddr.builder.browser;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import org.apache.devicemap.simpleddr.builder.Builder;
+import org.apache.devicemap.simpleddr.model.UserAgent;
+import org.apache.devicemap.simpleddr.model.browser.Browser;
+
+public class DefaultBrowserBuilder implements Builder {
+
+    private Builder[] builders;
+    private static DefaultBrowserBuilder instance;
+
+    public static synchronized DefaultBrowserBuilder getInstance() {
+        if (instance == null) {
+            instance = new DefaultBrowserBuilder();
+        }
+        return instance;
+    }
+
+    private DefaultBrowserBuilder() {
+
+        builders = new Builder[]{
+                    new OperaMiniBrowserBuilder(),
+                    new ChromeMobileBrowserBuilder(),
+                    new FennecBrowserBuilder(),
+                    new SafariMobileBrowserBuilder(), 
+                    new SilkBrowserBuilder(),
+                    new AndroidMobileBrowserBuilder(),
+                    new NetFrontBrowserBuilder(),
+                    new UPBrowserBuilder(),
+                    new OpenWaveBrowserBuilder(),
+                    new SEMCBrowserBuilder(),
+                    new DolfinBrowserBuilder(),
+                    new JasmineBrowserBuilder(),
+                    new PolarisBrowserBuilder(),
+                    new ObigoBrowserBuilder(),
+                    new OperaBrowserBuilder(),
+                    new IEMobileBrowserBuilder(),
+                    new NokiaBrowserBuilder(),
+                    new BlackBerryBrowserBuilder(),
+                    new WebOsBrowserBuilder(),
+                    new InternetExplorerBrowserBuilder(),
+                    new ChromeBrowserBuilder(),
+                    new FirefoxBrowserBuilder(),
+                    new SafariBrowserBuilder(),
+                    new KonquerorBrowserBuilder()};
+    }
+
+    public boolean canBuild(UserAgent userAgent) {
+        for (Builder browserBuilder : builders) {
+            if (browserBuilder.canBuild(userAgent)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public Browser build(UserAgent userAgent, int confidenceTreshold) {
+        List<Browser> founds = new ArrayList<Browser>();
+        Browser found = null;
+        for (Builder builder : builders) {
+            if (builder.canBuild(userAgent)) {
+                Browser builded = (Browser) builder.build(userAgent, confidenceTreshold);
+                if (builded != null) {
+                    founds.add(builded);
+                    if (builded.getConfidence() >= confidenceTreshold) {
+                        found = builded;
+                        break;
+                    }
+                }
+            }
+        }
+
+        if (found != null) {
+            return found;
+
+        } else {
+            if (founds.isEmpty()) {
+                return null;
+            }
+
+            Collections.sort(founds, Collections.reverseOrder());
+            return founds.get(0);
+        }
+    }
+}

Added: incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/DolfinBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/DolfinBrowserBuilder.java?rev=1580679&view=auto
==============================================================================
--- incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/DolfinBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/DolfinBrowserBuilder.java Mon Mar 24 00:52:47 2014
@@ -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.apache.devicemap.simpleddr.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.apache.devicemap.simpleddr.model.UserAgent;
+import org.apache.devicemap.simpleddr.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;
+    }
+}

Added: incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/FennecBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/FennecBrowserBuilder.java?rev=1580679&view=auto
==============================================================================
--- incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/FennecBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/FennecBrowserBuilder.java Mon Mar 24 00:52:47 2014
@@ -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.apache.devicemap.simpleddr.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.apache.devicemap.simpleddr.model.UserAgent;
+import org.apache.devicemap.simpleddr.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;
+    }
+}

Added: incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/FirefoxBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/FirefoxBrowserBuilder.java?rev=1580679&view=auto
==============================================================================
--- incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/FirefoxBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/FirefoxBrowserBuilder.java Mon Mar 24 00:52:47 2014
@@ -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.apache.devicemap.simpleddr.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.apache.devicemap.simpleddr.model.UserAgent;
+import org.apache.devicemap.simpleddr.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;
+    }
+}

Added: incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/HintedResolutionBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/HintedResolutionBrowserBuilder.java?rev=1580679&view=auto
==============================================================================
--- incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/HintedResolutionBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/HintedResolutionBrowserBuilder.java Mon Mar 24 00:52:47 2014
@@ -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.apache.devicemap.simpleddr.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.apache.devicemap.simpleddr.builder.Builder;
+import org.apache.devicemap.simpleddr.model.UserAgent;
+import org.apache.devicemap.simpleddr.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);
+}

Added: incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/IEMobileBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/IEMobileBrowserBuilder.java?rev=1580679&view=auto
==============================================================================
--- incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/IEMobileBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/IEMobileBrowserBuilder.java Mon Mar 24 00:52:47 2014
@@ -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.apache.devicemap.simpleddr.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.apache.devicemap.simpleddr.model.UserAgent;
+import org.apache.devicemap.simpleddr.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;
+    }
+}

Added: incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/InternetExplorerBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/InternetExplorerBrowserBuilder.java?rev=1580679&view=auto
==============================================================================
--- incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/InternetExplorerBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/InternetExplorerBrowserBuilder.java Mon Mar 24 00:52:47 2014
@@ -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.apache.devicemap.simpleddr.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.apache.devicemap.simpleddr.model.UserAgent;
+import org.apache.devicemap.simpleddr.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;
+    }
+}

Added: incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/JasmineBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/JasmineBrowserBuilder.java?rev=1580679&view=auto
==============================================================================
--- incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/JasmineBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/JasmineBrowserBuilder.java Mon Mar 24 00:52:47 2014
@@ -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.apache.devicemap.simpleddr.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.apache.devicemap.simpleddr.model.UserAgent;
+import org.apache.devicemap.simpleddr.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;
+    }
+}

Added: incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/KonquerorBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/KonquerorBrowserBuilder.java?rev=1580679&view=auto
==============================================================================
--- incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/KonquerorBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/KonquerorBrowserBuilder.java Mon Mar 24 00:52:47 2014
@@ -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.apache.devicemap.simpleddr.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.apache.devicemap.simpleddr.model.UserAgent;
+import org.apache.devicemap.simpleddr.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;
+    }
+}

Added: incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/LayoutEngineBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/LayoutEngineBrowserBuilder.java?rev=1580679&view=auto
==============================================================================
--- incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/LayoutEngineBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/LayoutEngineBrowserBuilder.java Mon Mar 24 00:52:47 2014
@@ -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.apache.devicemap.simpleddr.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.apache.devicemap.simpleddr.model.UserAgent;
+import org.apache.devicemap.simpleddr.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);
+}

Added: incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/NetFrontBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/NetFrontBrowserBuilder.java?rev=1580679&view=auto
==============================================================================
--- incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/NetFrontBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/NetFrontBrowserBuilder.java Mon Mar 24 00:52:47 2014
@@ -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.apache.devicemap.simpleddr.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.apache.devicemap.simpleddr.model.UserAgent;
+import org.apache.devicemap.simpleddr.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;
+    }
+}

Added: incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/NokiaBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/NokiaBrowserBuilder.java?rev=1580679&view=auto
==============================================================================
--- incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/NokiaBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/NokiaBrowserBuilder.java Mon Mar 24 00:52:47 2014
@@ -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.apache.devicemap.simpleddr.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.apache.devicemap.simpleddr.model.UserAgent;
+import org.apache.devicemap.simpleddr.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;
+    }
+}

Added: incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/ObigoBrowserBuilder.java
URL: http://svn.apache.org/viewvc/incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/ObigoBrowserBuilder.java?rev=1580679&view=auto
==============================================================================
--- incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/ObigoBrowserBuilder.java (added)
+++ incubator/devicemap/trunk/devicemap/java/simpleddr/src/main/java/org/apache/devicemap/simpleddr/builder/browser/ObigoBrowserBuilder.java Mon Mar 24 00:52:47 2014
@@ -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.apache.devicemap.simpleddr.builder.browser;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.apache.devicemap.simpleddr.model.UserAgent;
+import org.apache.devicemap.simpleddr.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;
+    }
+}