Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

package fiftyone.devicedetection.examples.console;

import fiftyone.devicedetection.examples.shared.FindOutMore;
import fiftyone.devicedetection.DeviceDetectionPipelineBuilder;
import fiftyone.devicedetection.examples.shared.KeyHelper;
import fiftyone.devicedetection.examples.shared.EvidenceHelper;
Expand Down Expand Up @@ -53,6 +54,12 @@
*/
@SuppressWarnings("DuplicatedCode")
public class GettingStartedCloud {
/**
* This example's tag in the links of its "Find out more" section.
*/
private static final String EXAMPLE_TAG =
"console-src-main-java-fiftyone-devicedetection-examples-console-gettingstartedcloud.java";

private static final Logger logger = LoggerFactory.getLogger(GettingStartedCloud.class);

/**
Expand All @@ -66,6 +73,8 @@ public static void main(String[] args) throws Exception {
// prepare 'evidence' for use in pipeline (see below)
List<Map<String, String>> evidence = EvidenceHelper.setUpEvidence();
run(resourceKey, evidence, System.out);
FindOutMore.write(System.out, EXAMPLE_TAG,
FindOutMore.CLOUD_REPOSITORIES);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

package fiftyone.devicedetection.examples.console;

import fiftyone.devicedetection.examples.shared.FindOutMore;
import fiftyone.devicedetection.examples.shared.DataFileHelper;
import fiftyone.devicedetection.examples.shared.EvidenceHelper;
import fiftyone.devicedetection.hash.engine.onpremise.flowelements.DeviceDetectionHashEngine;
Expand Down Expand Up @@ -58,6 +59,12 @@
* The concepts of "pipeline", "flow data", "evidence" and "results" are illustrated.
*/
public class GettingStartedOnPrem {
/**
* This example's tag in the links of its "Find out more" section.
*/
private static final String EXAMPLE_TAG =
"console-src-main-java-fiftyone-devicedetection-examples-console-gettingstartedonprem.java";

private static final Logger logger = LoggerFactory.getLogger(GettingStartedOnPrem.class);

/* In this example, by default, the 51degrees "Lite" file is used from the data repository in
Expand All @@ -84,6 +91,8 @@ public static void main(String[] args) throws Exception {
// prepare 'evidence' for use in pipeline (see below)
List<Map<String, String>> evidence = EvidenceHelper.setUpEvidence();
run(dataFile, evidence, System.out);
FindOutMore.write(System.out, EXAMPLE_TAG,
FindOutMore.ON_PREMISE_REPOSITORIES);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

package fiftyone.devicedetection.examples.console;

import fiftyone.devicedetection.examples.shared.FindOutMore;
import fiftyone.devicedetection.DeviceDetectionPipelineBuilder;
import fiftyone.devicedetection.examples.shared.DataFileHelper;
import fiftyone.devicedetection.examples.shared.EvidenceHelper;
Expand Down Expand Up @@ -61,6 +62,12 @@
* page.
*/
public class MatchMetrics {
/**
* This example's tag in the links of its "Find out more" section.
*/
private static final String EXAMPLE_TAG =
"console-src-main-java-fiftyone-devicedetection-examples-console-matchmetrics.java";

private static final Logger logger = LoggerFactory.getLogger(MatchMetrics.class);

/**
Expand All @@ -76,6 +83,8 @@ public static void main(String[] args) throws Exception {
String dataFilename = DataFileHelper.getDataFileLocation(
args.length > 0 ? args[0] : LITE_HASH_DATA_FILE_PATH);
run(dataFilename, EvidenceHelper.setUpEvidence(), false, System.out);
FindOutMore.write(System.out, EXAMPLE_TAG,
FindOutMore.ON_PREMISE_REPOSITORIES);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* ********************************************************************* */
package fiftyone.devicedetection.examples.console;

import fiftyone.devicedetection.examples.shared.FindOutMore;
import fiftyone.devicedetection.DeviceDetectionPipelineBuilder;
import fiftyone.devicedetection.cloud.flowelements.DeviceDetectionCloudEngine;
import fiftyone.devicedetection.examples.shared.KeyHelper;
Expand All @@ -42,12 +43,20 @@


public class MetadataCloud {
/**
* This example's tag in the links of its "Find out more" section.
*/
private static final String EXAMPLE_TAG =
"console-src-main-java-fiftyone-devicedetection-examples-console-metadatacloud.java";

private static final Logger logger = LoggerFactory.getLogger(GettingStartedOnPrem.class);

public static void main(String[] args) throws Exception {
configureLogback(getFilePath("logback.xml"));
String resourceKey = args.length > 0 ? args[0]: null;
run(resourceKey, System.out);
FindOutMore.write(System.out, EXAMPLE_TAG,
FindOutMore.CLOUD_REPOSITORIES);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* ********************************************************************* */
package fiftyone.devicedetection.examples.console;

import fiftyone.devicedetection.examples.shared.FindOutMore;
import fiftyone.pipeline.engines.fiftyone.data.FiftyOneAspectPropertyMetaData;
import fiftyone.devicedetection.examples.shared.DataFileHelper;
import fiftyone.devicedetection.hash.engine.onpremise.flowelements.DeviceDetectionHashEngine;
Expand All @@ -45,6 +46,12 @@


public class MetadataOnPrem {
/**
* This example's tag in the links of its "Find out more" section.
*/
private static final String EXAMPLE_TAG =
"console-src-main-java-fiftyone-devicedetection-examples-console-metadataonprem.java";

private static final Logger logger = LoggerFactory.getLogger(GettingStartedOnPrem.class);

/* In this example, by default, the 51degrees "Lite" file is used from the data repository in
Expand All @@ -65,6 +72,8 @@ public static void main(String[] args) throws Exception {
configureLogback(getFilePath("logback.xml"));
String dataFile = args.length > 0 ? args[0] : LITE_V_4_1_HASH;
run(dataFile, System.out);
FindOutMore.write(System.out, EXAMPLE_TAG,
FindOutMore.ON_PREMISE_REPOSITORIES);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

package fiftyone.devicedetection.examples.console;

import fiftyone.devicedetection.examples.shared.FindOutMore;
import fiftyone.devicedetection.DeviceDetectionPipelineBuilder;
import fiftyone.devicedetection.shared.DeviceData;
import fiftyone.pipeline.core.data.FlowData;
Expand All @@ -44,9 +45,17 @@
*/
public class MinimalExample {

/**
* This example's tag in the links of its "Find out more" section.
*/
private static final String EXAMPLE_TAG =
"console-src-main-java-fiftyone-devicedetection-examples-console-minimalexample.java";

public static void main(String[] args) throws Exception {
String resource = args.length > 0 ? args[0] : null;
run(resource);
FindOutMore.write(System.out, EXAMPLE_TAG,
FindOutMore.CLOUD_REPOSITORIES);
}

public static void run(String resource) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

package fiftyone.devicedetection.examples.console;

import fiftyone.devicedetection.examples.shared.FindOutMore;
import fiftyone.devicedetection.cloud.data.MultiDeviceDataCloud;
import fiftyone.devicedetection.cloud.flowelements.HardwareProfileCloudEngineBuilder;
import fiftyone.devicedetection.shared.Constants;
Expand All @@ -41,6 +42,12 @@
import static fiftyone.pipeline.util.FileFinder.getFilePath;

public class NativeModelCloud {
/**
* This example's tag in the links of its "Find out more" section.
*/
private static final String EXAMPLE_TAG =
"console-src-main-java-fiftyone-devicedetection-examples-console-nativemodelcloud.java";

// Example values to use when looking up device details from native model names.
private static final String NATIVE_MODEL_1 = "SC-03L";
private static final String NATIVE_MODEL_2 = "iPhone11,8";
Expand Down Expand Up @@ -90,6 +97,10 @@ public static void run(String resourceKey, OutputStream os) throws Exception {
// Repeat for an alternative native model name.
analyseNativeModel(NATIVE_MODEL_2, pipeline, output);
}
// The writer closes the stream it was given, so the section is
// written before it.
FindOutMore.write(output, EXAMPLE_TAG,
FindOutMore.CLOUD_REPOSITORIES);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

package fiftyone.devicedetection.examples.console;

import fiftyone.devicedetection.examples.shared.FindOutMore;
import fiftyone.devicedetection.DeviceDetectionPipelineBuilder;
import fiftyone.devicedetection.examples.shared.DataFileHelper;
import fiftyone.devicedetection.hash.engine.onpremise.flowelements.DeviceDetectionHashEngine;
Expand Down Expand Up @@ -67,6 +68,12 @@
* predictive power using Performance Profile, Graph and Difference and Drift settings.
*/
public class OfflineProcessing {
/**
* This example's tag in the links of its "Find out more" section.
*/
private static final String EXAMPLE_TAG =
"console-src-main-java-fiftyone-devicedetection-examples-console-offlineprocessing.java";

static final Logger logger = LoggerFactory.getLogger(OfflineProcessing.class);
// This 51degrees "Lite" file is used from the data repository in
// cxx/data, and is downloaded if it is missing
Expand Down Expand Up @@ -238,6 +245,10 @@ public static void run(String dataFile, InputStream is, OutputStream os) throws
}
// finish the last YAML document
writer.write("...\n");
// The section is written as comments, so the output stays a
// valid YAML stream.
FindOutMore.writeCommented(new PrintWriter(writer), "# ",
EXAMPLE_TAG, FindOutMore.ON_PREMISE_REPOSITORIES);
writer.flush();
logger.info("Finished processing {} records", count);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

package fiftyone.devicedetection.examples.console;

import fiftyone.devicedetection.examples.shared.FindOutMore;
import fiftyone.common.testhelpers.LogbackHelper;
import fiftyone.devicedetection.DeviceDetectionOnPremisePipelineBuilder;
import fiftyone.devicedetection.DeviceDetectionPipelineBuilder;
Expand Down Expand Up @@ -58,6 +59,12 @@
* for more information about adjusting performance.
*/
public class PerformanceBenchmark {
/**
* This example's tag in the links of its "Find out more" section.
*/
private static final String EXAMPLE_TAG =
"console-src-main-java-fiftyone-devicedetection-examples-console-performancebenchmark.java";

// the default number of threads if one is not provided.
public static final int DEFAULT_NUMBER_OF_THREADS = 4;
// the number of tests to execute.
Expand Down Expand Up @@ -106,6 +113,8 @@ public static void main(String[] args) throws Exception {
evidenceFilename,
numberOfThreads,
new PrintWriter(System.out,true));
FindOutMore.write(System.out, EXAMPLE_TAG,
FindOutMore.ON_PREMISE_REPOSITORIES);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

package fiftyone.devicedetection.examples.console;

import fiftyone.devicedetection.examples.shared.FindOutMore;
import fiftyone.devicedetection.examples.shared.DataFileHelper;
import fiftyone.pipeline.core.data.FlowData;
import fiftyone.pipeline.core.flowelements.Pipeline;
Expand Down Expand Up @@ -74,6 +75,12 @@
* identifier before running this example.</p>
*/
public class ShareUsageExample {
/**
* This example's tag in the links of its "Find out more" section.
*/
private static final String EXAMPLE_TAG =
"console-src-main-java-fiftyone-devicedetection-examples-console-shareusageexample.java";

static final Logger logger = LoggerFactory.getLogger(ShareUsageExample.class);

// Evidence file with 20,000 examples, from the data repository in
Expand Down Expand Up @@ -104,6 +111,8 @@ public static void main(String[] args) throws Exception {

File evidenceFile = DataFileHelper.findDataFile(HEADER_EVIDENCE_YML);
run(Files.newInputStream(evidenceFile.toPath()));
FindOutMore.write(System.out, EXAMPLE_TAG,
FindOutMore.CLOUD_REPOSITORIES);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

package fiftyone.devicedetection.examples.console;

import fiftyone.devicedetection.examples.shared.FindOutMore;
import fiftyone.devicedetection.cloud.data.MultiDeviceDataCloud;
import fiftyone.devicedetection.shared.Constants;
import fiftyone.devicedetection.shared.DeviceData;
Expand Down Expand Up @@ -56,6 +57,12 @@
* file tacCloud.xml.
*/
public class TacCloud {
/**
* This example's tag in the links of its "Find out more" section.
*/
private static final String EXAMPLE_TAG =
"console-src-main-java-fiftyone-devicedetection-examples-console-taccloud.java";

// Example values to use when looking up device details from TACs.
static final String TAC_1 = "35925406";
static final String TAC_2 = "86386802";
Expand Down Expand Up @@ -100,6 +107,10 @@ public static void run(String resourceKey, OutputStream os) throws Exception {
analyseTac(TAC_1, pipeline, writer);
analyseTac(TAC_2, pipeline, writer);
}
// The writer closes the stream it was given, so the section is
// written before it.
FindOutMore.write(writer, EXAMPLE_TAG,
FindOutMore.CLOUD_REPOSITORIES);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

package fiftyone.devicedetection.examples.console;

import fiftyone.devicedetection.examples.shared.FindOutMore;
import fiftyone.devicedetection.DeviceDetectionPipelineBuilder;
import fiftyone.devicedetection.examples.shared.DataFileHelper;
import fiftyone.devicedetection.shared.testhelpers.KeyUtils;
Expand Down Expand Up @@ -189,6 +190,12 @@
*/
public class UpdateDataFile {

/**
* This example's tag in the links of its "Find out more" section.
*/
private static final String EXAMPLE_TAG =
"console-src-main-java-fiftyone-devicedetection-examples-console-updatedatafile.java";

public static final String UPDATE_EXAMPLE_LICENSE_KEY_NAME = "LicenseKey";
public static final String DEFAULT_DATA_FILENAME =
System.getProperty("user.dir") + File.separator + ENTERPRISE_HASH_DATA_FILE_NAME;
Expand All @@ -209,6 +216,8 @@ public static void main(String[] args) throws Exception {
String licenseKey = args.length > 0 ? args[0] : null;
String dataFilename = args.length > 1 ? args[1] : null;
run(dataFilename, licenseKey, true);
FindOutMore.write(System.out, EXAMPLE_TAG,
FindOutMore.ON_PREMISE_REPOSITORIES);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

package fiftyone.devicedetection.examples.console.comparison;

import fiftyone.devicedetection.examples.shared.FindOutMore;
import fiftyone.common.testhelpers.LogbackHelper;
import fiftyone.devicedetection.examples.console.comparison.Detection.BenchmarkResult;
import fiftyone.devicedetection.examples.console.comparison.Detection.Request;
Expand Down Expand Up @@ -50,6 +51,12 @@
* code has not been tested and it is left to those interested to uncomment and get working.
*/
public class Comparer {
/**
* This example's tag in the links of its "Find out more" section.
*/
private static final String EXAMPLE_TAG =
"console-src-main-java-fiftyone-devicedetection-examples-console-comparison-comparer.java";

public static final int DEFAULT_NUMBER_OF_THREADS = 4;
public static final int DEFAULT_NUMBER_OF_RESULTS = 2500;
@SuppressWarnings("resource")
Expand All @@ -69,6 +76,8 @@ public static void main(String[] args) throws Exception {
DEFAULT_NUMBER_OF_RESULTS,
new Reporting.Minimal(),
new PrintWriter(System.out, true));
FindOutMore.write(System.out, EXAMPLE_TAG,
FindOutMore.ON_PREMISE_REPOSITORIES);
}

/**
Expand Down
Loading
Loading