devicemap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From re...@apache.org
Subject svn commit: r1649992 - in /devicemap/trunk/devicemap/java/classifier_w3c_simple/src: main/java/org/apache/devicemap/w3csimple/ main/java/org/apache/devicemap/w3csimple/model/ test/java/org/apache/devicemap/w3csimple/
Date Wed, 07 Jan 2015 04:20:39 GMT
Author: rezan
Date: Wed Jan  7 04:20:39 2015
New Revision: 1649992

URL: http://svn.apache.org/r1649992
Log:
variable cleanup

Modified:
    devicemap/trunk/devicemap/java/classifier_w3c_simple/src/main/java/org/apache/devicemap/w3csimple/DeviceMapW3CSimple.java
    devicemap/trunk/devicemap/java/classifier_w3c_simple/src/main/java/org/apache/devicemap/w3csimple/model/DeviceMapEvidence.java
    devicemap/trunk/devicemap/java/classifier_w3c_simple/src/main/java/org/apache/devicemap/w3csimple/model/DeviceMapPropertyName.java
    devicemap/trunk/devicemap/java/classifier_w3c_simple/src/main/java/org/apache/devicemap/w3csimple/model/DeviceMapPropertyRef.java
    devicemap/trunk/devicemap/java/classifier_w3c_simple/src/main/java/org/apache/devicemap/w3csimple/model/DeviceMapPropertyValue.java
    devicemap/trunk/devicemap/java/classifier_w3c_simple/src/main/java/org/apache/devicemap/w3csimple/model/DeviceMapPropertyValues.java
    devicemap/trunk/devicemap/java/classifier_w3c_simple/src/test/java/org/apache/devicemap/w3csimple/DeviceMapW3CSimpleTest.java

Modified: devicemap/trunk/devicemap/java/classifier_w3c_simple/src/main/java/org/apache/devicemap/w3csimple/DeviceMapW3CSimple.java
URL: http://svn.apache.org/viewvc/devicemap/trunk/devicemap/java/classifier_w3c_simple/src/main/java/org/apache/devicemap/w3csimple/DeviceMapW3CSimple.java?rev=1649992&r1=1649991&r2=1649992&view=diff
==============================================================================
--- devicemap/trunk/devicemap/java/classifier_w3c_simple/src/main/java/org/apache/devicemap/w3csimple/DeviceMapW3CSimple.java
(original)
+++ devicemap/trunk/devicemap/java/classifier_w3c_simple/src/main/java/org/apache/devicemap/w3csimple/DeviceMapW3CSimple.java
Wed Jan  7 04:20:39 2015
@@ -40,7 +40,7 @@ public class DeviceMapW3CSimple implemen
   public final static String VERSION = "1.0.0";
   public final static String NAMESPACE = "org.apache.devicemap";
   public final static String VOCABULARY = "org.apache.devicemap";
-  public final static String EVIDENCE = "User-Agent";
+  public final static String USER_AGENT = "User-Agent";
   public final static String LOADER_OPTION = "loaderOption";
   public final static String LOADER_OPTION_PATH = "loaderOptionPath";
   public final static String CLASSNAME = DeviceMapW3CSimple.class.getName();
@@ -104,42 +104,42 @@ public class DeviceMapW3CSimple implemen
 
   @Override
   public PropertyValue getPropertyValue(Evidence evidence, PropertyRef propertyRef) throws
NameException {
-    return new DeviceMapPropertyValues(client.classifyDevice(evidence.get(EVIDENCE))).getValue(propertyRef);
+    return new DeviceMapPropertyValues(client.classify(evidence.get(USER_AGENT))).getValue(propertyRef);
   }
 
   @Override
   public PropertyValue getPropertyValue(Evidence evidence, PropertyName propertyName) throws
NameException {
-    return new DeviceMapPropertyValues(client.classifyDevice(evidence.get(EVIDENCE))).getValue(propertyName);
+    return new DeviceMapPropertyValues(client.classify(evidence.get(USER_AGENT))).getValue(propertyName);
   }
 
   @Override
   public PropertyValue getPropertyValue(Evidence evidence, String localPropertyName) throws
NameException {
-    return new DeviceMapPropertyValues(client.classifyDevice(evidence.get(EVIDENCE))).getValue(localPropertyName);
+    return new DeviceMapPropertyValues(client.classify(evidence.get(USER_AGENT))).getValue(localPropertyName);
   }
 
   @Override
   public PropertyValue getPropertyValue(Evidence evidence, String localPropertyName, String
localAspectName, String vocabularyIRI) throws NameException {
-    return new DeviceMapPropertyValues(client.classifyDevice(evidence.get(EVIDENCE))).getValue(localPropertyName);
+    return new DeviceMapPropertyValues(client.classify(evidence.get(USER_AGENT))).getValue(localPropertyName);
   }
 
   @Override
   public PropertyValues getPropertyValues(Evidence evidence) throws NameException {
-    return new DeviceMapPropertyValues(client.classifyDevice(evidence.get(EVIDENCE)));
+    return new DeviceMapPropertyValues(client.classify(evidence.get(USER_AGENT)));
   }
 
   @Override
   public PropertyValues getPropertyValues(Evidence evidence, PropertyRef[] propertyRefs)
throws NameException {
-    return new DeviceMapPropertyValues(client.classifyDevice(evidence.get(EVIDENCE)));
+    return new DeviceMapPropertyValues(client.classify(evidence.get(USER_AGENT)));
   }
 
   @Override
   public PropertyValues getPropertyValues(Evidence evidence, String localAspectName) throws
NameException {
-    return new DeviceMapPropertyValues(client.classifyDevice(evidence.get(EVIDENCE)));
+    return new DeviceMapPropertyValues(client.classify(evidence.get(USER_AGENT)));
   }
 
   @Override
   public PropertyValues getPropertyValues(Evidence evidence, String localAspectName, String
vocabularyIRI) throws NameException {
-    return new DeviceMapPropertyValues(client.classifyDevice(evidence.get(EVIDENCE)));
+    return new DeviceMapPropertyValues(client.classify(evidence.get(USER_AGENT)));
   }
 
   @Override

Modified: devicemap/trunk/devicemap/java/classifier_w3c_simple/src/main/java/org/apache/devicemap/w3csimple/model/DeviceMapEvidence.java
URL: http://svn.apache.org/viewvc/devicemap/trunk/devicemap/java/classifier_w3c_simple/src/main/java/org/apache/devicemap/w3csimple/model/DeviceMapEvidence.java?rev=1649992&r1=1649991&r2=1649992&view=diff
==============================================================================
--- devicemap/trunk/devicemap/java/classifier_w3c_simple/src/main/java/org/apache/devicemap/w3csimple/model/DeviceMapEvidence.java
(original)
+++ devicemap/trunk/devicemap/java/classifier_w3c_simple/src/main/java/org/apache/devicemap/w3csimple/model/DeviceMapEvidence.java
Wed Jan  7 04:20:39 2015
@@ -18,15 +18,11 @@ package org.apache.devicemap.w3csimple.m
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.devicemap.data.Device;
-
 import org.w3c.ddr.simple.Evidence;
 
 public class DeviceMapEvidence implements Evidence {
 
-  Map<String, String> headers;
-
-  private Device device;
+  private final Map<String, String> headers;
 
   public DeviceMapEvidence() {
     headers = new HashMap<String, String>();
@@ -60,12 +56,4 @@ public class DeviceMapEvidence implement
     headers.put(key.toLowerCase(), value);
   }
 
-  public Device getDevice() {
-    return device;
-  }
-
-  public void setDevice(Device device) {
-    this.device = device;
-  }
-
 }

Modified: devicemap/trunk/devicemap/java/classifier_w3c_simple/src/main/java/org/apache/devicemap/w3csimple/model/DeviceMapPropertyName.java
URL: http://svn.apache.org/viewvc/devicemap/trunk/devicemap/java/classifier_w3c_simple/src/main/java/org/apache/devicemap/w3csimple/model/DeviceMapPropertyName.java?rev=1649992&r1=1649991&r2=1649992&view=diff
==============================================================================
--- devicemap/trunk/devicemap/java/classifier_w3c_simple/src/main/java/org/apache/devicemap/w3csimple/model/DeviceMapPropertyName.java
(original)
+++ devicemap/trunk/devicemap/java/classifier_w3c_simple/src/main/java/org/apache/devicemap/w3csimple/model/DeviceMapPropertyName.java
Wed Jan  7 04:20:39 2015
@@ -15,12 +15,13 @@
  */
 package org.apache.devicemap.w3csimple.model;
 
-import org.w3c.ddr.simple.PropertyName;
 import org.apache.devicemap.w3csimple.DeviceMapW3CSimple;
 
+import org.w3c.ddr.simple.PropertyName;
+
 public class DeviceMapPropertyName implements PropertyName {
 
-  private String name;
+  private final String name;
 
   public DeviceMapPropertyName(String name) {
     this.name = name;

Modified: devicemap/trunk/devicemap/java/classifier_w3c_simple/src/main/java/org/apache/devicemap/w3csimple/model/DeviceMapPropertyRef.java
URL: http://svn.apache.org/viewvc/devicemap/trunk/devicemap/java/classifier_w3c_simple/src/main/java/org/apache/devicemap/w3csimple/model/DeviceMapPropertyRef.java?rev=1649992&r1=1649991&r2=1649992&view=diff
==============================================================================
--- devicemap/trunk/devicemap/java/classifier_w3c_simple/src/main/java/org/apache/devicemap/w3csimple/model/DeviceMapPropertyRef.java
(original)
+++ devicemap/trunk/devicemap/java/classifier_w3c_simple/src/main/java/org/apache/devicemap/w3csimple/model/DeviceMapPropertyRef.java
Wed Jan  7 04:20:39 2015
@@ -15,12 +15,13 @@
  */
 package org.apache.devicemap.w3csimple.model;
 
-import org.w3c.ddr.simple.PropertyRef;
 import org.apache.devicemap.w3csimple.DeviceMapW3CSimple;
 
+import org.w3c.ddr.simple.PropertyRef;
+
 public class DeviceMapPropertyRef implements PropertyRef {
 
-  private String name;
+  private final String name;
 
   public DeviceMapPropertyRef(String name) {
     this.name = name;

Modified: devicemap/trunk/devicemap/java/classifier_w3c_simple/src/main/java/org/apache/devicemap/w3csimple/model/DeviceMapPropertyValue.java
URL: http://svn.apache.org/viewvc/devicemap/trunk/devicemap/java/classifier_w3c_simple/src/main/java/org/apache/devicemap/w3csimple/model/DeviceMapPropertyValue.java?rev=1649992&r1=1649991&r2=1649992&view=diff
==============================================================================
--- devicemap/trunk/devicemap/java/classifier_w3c_simple/src/main/java/org/apache/devicemap/w3csimple/model/DeviceMapPropertyValue.java
(original)
+++ devicemap/trunk/devicemap/java/classifier_w3c_simple/src/main/java/org/apache/devicemap/w3csimple/model/DeviceMapPropertyValue.java
Wed Jan  7 04:20:39 2015
@@ -69,6 +69,7 @@ public class DeviceMapPropertyValue impl
     return value;
   }
 
+  //TODO implement this correctly
   @Override
   public boolean exists() {
     return true;

Modified: devicemap/trunk/devicemap/java/classifier_w3c_simple/src/main/java/org/apache/devicemap/w3csimple/model/DeviceMapPropertyValues.java
URL: http://svn.apache.org/viewvc/devicemap/trunk/devicemap/java/classifier_w3c_simple/src/main/java/org/apache/devicemap/w3csimple/model/DeviceMapPropertyValues.java?rev=1649992&r1=1649991&r2=1649992&view=diff
==============================================================================
--- devicemap/trunk/devicemap/java/classifier_w3c_simple/src/main/java/org/apache/devicemap/w3csimple/model/DeviceMapPropertyValues.java
(original)
+++ devicemap/trunk/devicemap/java/classifier_w3c_simple/src/main/java/org/apache/devicemap/w3csimple/model/DeviceMapPropertyValues.java
Wed Jan  7 04:20:39 2015
@@ -17,7 +17,8 @@ package org.apache.devicemap.w3csimple.m
 
 import java.util.ArrayList;
 import java.util.List;
-import org.apache.devicemap.data.Device;
+import java.util.Map;
+
 import org.w3c.ddr.simple.PropertyName;
 import org.w3c.ddr.simple.PropertyRef;
 import org.w3c.ddr.simple.PropertyValue;
@@ -28,13 +29,11 @@ public class DeviceMapPropertyValues imp
 
   List<PropertyValue> values;
 
-  public DeviceMapPropertyValues(Device device) {
+  public DeviceMapPropertyValues(Map<String, String> attributes) {
     values = new ArrayList<PropertyValue>();
 
-    values.add(new DeviceMapPropertyValue("id", device.getId()));
-
-    for(String attribute : device.getAttributes().keySet()) {
-      String value = device.getAttribute(attribute);
+    for(String attribute : attributes.keySet()) {
+      String value = attributes.get(attribute);
       values.add(new DeviceMapPropertyValue(attribute, value));
     }
   }

Modified: devicemap/trunk/devicemap/java/classifier_w3c_simple/src/test/java/org/apache/devicemap/w3csimple/DeviceMapW3CSimpleTest.java
URL: http://svn.apache.org/viewvc/devicemap/trunk/devicemap/java/classifier_w3c_simple/src/test/java/org/apache/devicemap/w3csimple/DeviceMapW3CSimpleTest.java?rev=1649992&r1=1649991&r2=1649992&view=diff
==============================================================================
--- devicemap/trunk/devicemap/java/classifier_w3c_simple/src/test/java/org/apache/devicemap/w3csimple/DeviceMapW3CSimpleTest.java
(original)
+++ devicemap/trunk/devicemap/java/classifier_w3c_simple/src/test/java/org/apache/devicemap/w3csimple/DeviceMapW3CSimpleTest.java
Wed Jan  7 04:20:39 2015
@@ -16,7 +16,9 @@
 package org.apache.devicemap.w3csimple;
 
 import java.util.Properties;
+
 import org.apache.devicemap.loader.LoaderOption;
+
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -37,7 +39,7 @@ public class DeviceMapW3CSimpleTest {
     //System.out.println("Testing: " + userAgent);
 
     Evidence e = simple.newHTTPEvidence();
-    e.put(DeviceMapW3CSimple.EVIDENCE, userAgent);
+    e.put(DeviceMapW3CSimple.USER_AGENT, userAgent);
 
     /*
     PropertyValues values = simple.getPropertyValues(e);
@@ -63,7 +65,7 @@ public class DeviceMapW3CSimpleTest {
     String userAgent = "Mozilla/5.0 (Linux; U; Android 2.2; en; HTC Aria A6380 Build/ERE27)
AppleWebKit/540.13+ (KHTML, like Gecko) Version/3.1 Mobile Safari/524.15.0";
 
     Evidence e = simple.newHTTPEvidence();
-    e.put(DeviceMapW3CSimple.EVIDENCE, userAgent);
+    e.put(DeviceMapW3CSimple.USER_AGENT, userAgent);
 
     Assert.assertEquals("test ua not htc aria", "HTC Aria", simple.getPropertyValue(e, "id").getString());
   }



Mime
View raw message