Skip to content

Commit

Permalink
13: Make complex types available in client(s)
Browse files Browse the repository at this point in the history
Task-Url: #13
  • Loading branch information
keilw committed Mar 25, 2019
1 parent b223017 commit b797250
Show file tree
Hide file tree
Showing 116 changed files with 139 additions and 139 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -106,8 +106,8 @@ public Map<String, String> classify(String text) {
return null;
}

Set<String> hitPatterns = new HashSet<String>();
Set<DeviceType> hitDevices = new HashSet<DeviceType>();
Set<String> hitPatterns = new HashSet<>();
Set<DeviceType> hitDevices = new HashSet<>();
DeviceType winner = null;
Pattern winnerPattern = null;
LOG.log(Level.FINE, "classify: ''{0}''", text);
Expand Down Expand Up @@ -163,7 +163,7 @@ public Map<String, String> classify(String text) {
if (winner != null) {
LOG.log(Level.FINE, "Result: {0}", winner);

UserAgent userAgent = UserAgent.of(text);
final UserAgent userAgent = UserAgent.of(text);
LOG.log(Level.FINE, "User Agent: {0}", userAgent);
return adjustFromUserAgent(winner, userAgent).getAttributes();
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,7 +27,7 @@

/**
* @author Werner Keil
* @version 1.1
* @version 1.2
*/
abstract class DeviceAdjuster {
private static final Logger LOG = Logger.getLogger(DeviceAdjuster.class.getName());
Expand All @@ -50,7 +50,7 @@ static final DeviceType adjustFromUserAgent(final DeviceType device, final UserA
Map<String, String> attributes;
if (device.isLocked()) {
// clone map
attributes = new HashMap<String, String>();
attributes = new HashMap<>();

attributes.putAll(device.getAttributes());
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,7 +21,7 @@

/**
* @author Werner Keil
* @version 1.1
* @version 1.2
*/
public class Device {
public static final String UNKNOWN_ID = "unknown";
Expand All @@ -30,32 +30,32 @@ public class Device {
private final Map<String, String> attributes;

public Device(String id, Map<String, String> attributes) {
this.id = id;
this.attributes = attributes;
this.id = id;
this.attributes = attributes;
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();

sb.append('{');
sb.append(JsonParser.outputKeyValue("id", id)).append(',');
sb.append(JsonParser.outputString("attributes")).append(':')
.append(JsonParser.outputMap(attributes));
sb.append('}');

return sb.toString();
final StringBuilder sb = new StringBuilder();
sb.append('{');
sb.append(JsonParser.outputKeyValue("id", id)).append(',');
sb.append(JsonParser.outputString("attributes")).append(':')
.append(JsonParser.outputMap(attributes));
sb.append('}');
return sb.toString();
}

public String getId() {
return id;
return id;
}

public String getAttribute(String key) {
return attributes.get(key);
return attributes.get(key);
}

public Map<String, String> getAttributes() {
return attributes;
return attributes;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -42,7 +42,7 @@
/**
* @author Werner Keil
* @author Reza Naghibi
* @version 1.3
* @version 1.4
*/
public class ClassifierConsole {
private static final String APP_NAME = "OpenDDR Classifier Console";
Expand Down Expand Up @@ -230,10 +230,10 @@ public static void main(String[] args) throws Exception {
}

private static void map(Classifier client, String text) {
StopWatch stopWatch = new StopWatch();
final StopWatch stopWatch = new StopWatch();
stopWatch.start();

Device device = client.classifyDevice(text);
final Device device = client.classifyDevice(text);
stopWatch.stop();
String deviceId = "unknown";
if (device != null) {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
<header>src/license/header.txt</header>
<properties>
<owner>OpenDDR LLC and others</owner>
<currentYear>2017</currentYear>
<currentYear>2019</currentYear>
</properties>
<excludes>
<exclude>**/*.adoc</exclude>
Expand Down
2 changes: 1 addition & 1 deletion simple/src/main/java/mobi/openddr/simple/DDRService.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017 OpenDDR LLC and others. All rights reserved.
* Copyright (c) 2011-2019 OpenDDR LLC and others. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Loading

0 comments on commit b797250

Please sign in to comment.