Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config slurper master #191

Closed
Closed
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
51d993a
Redesign generic loader and start creating tests
kevinhinterlong Mar 3, 2017
eb50f85
Fix unit tests for metrics/dimensions
kevinhinterlong Mar 3, 2017
64503c2
Expand test, set up for loading metrics
kevinhinterlong Mar 3, 2017
93af80d
Add interfaces. Need to guess time grain
kevinhinterlong Mar 3, 2017
daabf0e
Merge remote-tracking branch 'refs/remotes/yahoo/master' into configS…
kevinhinterlong Mar 5, 2017
52303e0
Merge remote-tracking branch 'refs/remotes/yahoo/master'
kevinhinterlong Mar 5, 2017
1766d91
Only use references to interfaces
kevinhinterlong Mar 7, 2017
3f2517d
Got most tests working. Still need to refactor and run maven tests fo…
kevinhinterlong Mar 8, 2017
9abe713
Merge remote-tracking branch 'refs/remotes/yahoo/master'
kevinhinterlong Mar 8, 2017
83a6fb8
Merge remote-tracking branch 'refs/remotes/origin/master' into config…
kevinhinterlong Mar 8, 2017
f030d84
Remove unnecessary code and fix tests
kevinhinterlong Mar 8, 2017
a690dc0
create base url for coordinator in druidNavigator
kevinhinterlong Mar 8, 2017
a7f3ef5
Rename files to Generic* instead of Wiki*
kevinhinterlong Mar 8, 2017
2d3bb87
Fix url typo in DruidNavigator and refactor
kevinhinterlong Mar 8, 2017
d5be970
reordering
kevinhinterlong Mar 8, 2017
bb96450
Refactor to remove test code, Small rearrangements, remove some unuse…
kevinhinterlong Mar 8, 2017
b4b76e4
Remove GenericBinder singleton
kevinhinterlong Mar 11, 2017
af23ce1
Finish refactoring, remove unnecesary Singleton class
kevinhinterlong Mar 14, 2017
f1bbbb7
Merge remote-tracking branch 'refs/remotes/yahoo/master'
kevinhinterlong Mar 14, 2017
7aff9bb
Merge remote-tracking branch 'refs/remotes/origin/master' into config…
kevinhinterlong Mar 14, 2017
0894bec
Merge remote-tracking branch 'refs/remotes/origin/configSlurperMaster…
kevinhinterlong Mar 14, 2017
02789c4
Fix most code suggestions from review
kevinhinterlong Mar 14, 2017
98d3637
Remove unnecesary code/comments
kevinhinterlong Mar 16, 2017
7665012
Merge remote-tracking branch 'refs/remotes/yahoo/master'
kevinhinterlong Mar 16, 2017
4eb5d55
Merge remote-tracking branch 'refs/remotes/origin/master' into config…
kevinhinterlong Mar 16, 2017
18a3ef8
Merge remote-tracking branch 'refs/remotes/origin/configSlurperMaster…
kevinhinterlong Mar 16, 2017
99845c3
Reformatting, remove unused imports/code
kevinhinterlong Mar 16, 2017
da7773a
Merge changes from code review kevinhinterlong/configSlurperDevelopment
kevinhinterlong Mar 16, 2017
9071bce
Minor fixes to clean up from codacy review
kevinhinterlong Mar 16, 2017
78da58d
Merge pull request #9 from kevinhinterlong/configSlurperDevelopment
kevinhinterlong Mar 16, 2017
bda3a6c
Remove uses of ConfigLoader, Fix some checkstyle errors
kevinhinterlong Mar 16, 2017
0dad160
Comment Most classes and remove unneeded code.
kevinhinterlong Mar 16, 2017
aae028c
Merge remote-tracking branch 'refs/remotes/origin/configSlurperMaster…
kevinhinterlong Mar 16, 2017
4f9e824
Clean up unneeded code and add comments
kevinhinterlong Mar 16, 2017
802e60f
Finish commenting and removing unneeded code.
kevinhinterlong Mar 16, 2017
62eedae
Fix existing test cases.
kevinhinterlong Mar 16, 2017
70c87fb
Add better timegrain checking and tests for it
kevinhinterlong Mar 17, 2017
8552f8e
Remove use of camelcase, change foreach to stream
kevinhinterlong Mar 17, 2017
412be7b
Remove unused import
kevinhinterlong Mar 17, 2017
d013895
Merge remote-tracking branch 'refs/remotes/yahoo/master'
kevinhinterlong Mar 17, 2017
e8bbb61
Merge remote-tracking branch 'refs/remotes/origin/master' into config…
kevinhinterlong Mar 17, 2017
9ff07bf
Merge remote-tracking branch 'refs/remotes/origin/configSlurperMaster…
kevinhinterlong Mar 17, 2017
e04d369
Remove accidental code duplication, more streams, some usage document…
kevinhinterlong Mar 17, 2017
c982d43
Remove unused variables from GenericMetricLoader
kevinhinterlong Mar 17, 2017
caf0052
Merge pull request #10 from kevinhinterlong/configSlurperDevelopment
kevinhinterlong Mar 17, 2017
3f8bd0b
Remove import, add final
kevinhinterlong Mar 23, 2017
fe09ada
Merge remote-tracking branch 'refs/remotes/yahoo/master'
kevinhinterlong Mar 23, 2017
4cf8108
Merge remote-tracking branch 'refs/remotes/origin/configSlurperMaster…
kevinhinterlong Mar 23, 2017
56b8d3b
Refactor timegrain detection
kevinhinterlong Mar 27, 2017
6e5ca46
Merge remote-tracking branch 'refs/remotes/origin/master' into config…
kevinhinterlong Mar 27, 2017
b8df865
Merge remote-tracking branch 'refs/remotes/origin/configSlurperMaster…
kevinhinterlong Mar 27, 2017
9822d42
Merge pull request #11 from kevinhinterlong/configSlurperDevelopment
kevinhinterlong Mar 27, 2017
4504cd6
Rearranged import
kevinhinterlong Mar 29, 2017
a9c9094
Merge remote-tracking branch 'refs/remotes/yahoo/master'
kevinhinterlong Mar 29, 2017
2c233f5
Merge remote-tracking branch 'refs/remotes/origin/master' into config…
kevinhinterlong Mar 29, 2017
7010ea3
Merge remote-tracking branch 'refs/remotes/origin/configSlurperMaster…
kevinhinterlong Mar 29, 2017
f8b44bc
Fix test cases and config file
kevinhinterlong Mar 29, 2017
925599b
Merge remote-tracking branch 'refs/remotes/yahoo/master'
kevinhinterlong Mar 29, 2017
36ef864
Merge remote-tracking branch 'refs/remotes/origin/master' into config…
kevinhinterlong Mar 29, 2017
e0b673e
Merge remote-tracking branch 'refs/remotes/origin/configSlurperMaster…
kevinhinterlong Mar 29, 2017
f4b6488
Fix from upstream changes
kevinhinterlong Mar 29, 2017
fc69d89
Keep reference to datasourcemetadataservice
kevinhinterlong Mar 29, 2017
33ba9dd
Override DruidDimensionsLoader constructor and build it manually
kevinhinterlong Mar 30, 2017
f18830a
fix coordinator url in DruidNavigator
kevinhinterlong Mar 30, 2017
42fb25a
Fix getting DataSourceMetadataService
kevinhinterlong Mar 30, 2017
402ac33
Fix test cases, Manually build druid webservice, refactor DruidDimens…
kevinhinterlong Mar 30, 2017
5326ec0
Merge remote-tracking branch 'refs/remotes/yahoo/master'
kevinhinterlong Mar 30, 2017
c97f728
Merge remote-tracking branch 'refs/remotes/origin/master' into config…
kevinhinterlong Mar 30, 2017
5406749
Merge remote-tracking branch 'refs/remotes/origin/configSlurperMaster…
kevinhinterlong Mar 30, 2017
cf47962
Fix readme, mark dimension cache healthy, and build druid webservice …
kevinhinterlong Mar 31, 2017
60b3c15
Merge remote-tracking branch 'refs/remotes/yahoo/master'
kevinhinterlong Mar 31, 2017
4352c0c
Merge remote-tracking branch 'refs/remotes/yahoo/master'
kevinhinterlong Mar 31, 2017
e1f131b
Style/comment cleanup
kevinhinterlong Mar 31, 2017
27e5f24
Merge remote-tracking branch 'refs/remotes/origin/master' into config…
kevinhinterlong Mar 31, 2017
b51f921
Merge remote-tracking branch 'refs/remotes/origin/master' into config…
kevinhinterlong Mar 31, 2017
1e1f759
Merge remote-tracking branch 'refs/remotes/origin/configSlurperMaster…
kevinhinterlong Mar 31, 2017
43f398f
Update readme
kevinhinterlong Apr 2, 2017
a66db2b
Merge pull request #12 from kevinhinterlong/configSlurperDevelopment
kevinhinterlong Apr 2, 2017
0bb826a
Fix formatting, remove unused imports, add more logging
kevinhinterlong Apr 2, 2017
932144a
Merge pull request #13 from kevinhinterlong/configSlurperDevelopment
kevinhinterlong Apr 2, 2017
19c546a
Fix javadoc
kevinhinterlong Apr 2, 2017
a1f63fc
Merge pull request #14 from kevinhinterlong/configSlurperDevelopment
kevinhinterlong Apr 2, 2017
750ebc2
Small refactoring
kevinhinterlong Apr 5, 2017
82a8847
Merge remote-tracking branch 'refs/remotes/yahoo/master'
kevinhinterlong Apr 5, 2017
3944ed1
Merge remote-tracking branch 'refs/remotes/origin/master' into config…
kevinhinterlong Apr 5, 2017
10bbc70
Merge remote-tracking branch 'refs/remotes/origin/configSlurperMaster…
kevinhinterlong Apr 5, 2017
2ab0669
Merge pull request #15 from kevinhinterlong/configSlurperDevelopment
kevinhinterlong Apr 5, 2017
d6c1b2a
Refactor java to be more clear, fix some logging levels
kevinhinterlong Apr 7, 2017
a9b9809
Address most comments from review
kevinhinterlong Apr 8, 2017
32f0a9e
Add fili's port as a system property
kevinhinterlong Apr 10, 2017
6ce0de3
Clean up Druid dimension loader and finish addressing comments
kevinhinterlong Apr 11, 2017
7b0799e
Merge remote-tracking branch 'refs/remotes/yahoo/master'
kevinhinterlong Apr 11, 2017
c73b626
Merge remote-tracking branch 'refs/remotes/origin/master' into config…
kevinhinterlong Apr 11, 2017
bbc5720
Merge branch 'configSlurperMaster' of https://github.com/kevinhinterl…
kevinhinterlong Apr 11, 2017
8886b8c
Merge remote-tracking branch 'refs/remotes/origin/configSlurperMaster…
kevinhinterlong Apr 11, 2017
e0480a8
Merge pull request #17 from kevinhinterlong/configSlurperDevelopment
kevinhinterlong Apr 11, 2017
ccb1b57
Merge remote-tracking branch 'refs/remotes/yahoo/master'
kevinhinterlong Apr 15, 2017
c32785f
Add expected druid responses to druid navigator
kevinhinterlong Apr 15, 2017
7c97a3c
Merge pull request #18 from kevinhinterlong/configSlurperDevelopment
kevinhinterlong Apr 15, 2017
b1c57cc
Merge remote-tracking branch 'refs/remotes/origin/master' into config…
kevinhinterlong Apr 15, 2017
a3cad5c
Merge remote-tracking branch 'origin/configSlurperMaster' into config…
kevinhinterlong Apr 15, 2017
3939765
Merge remote-tracking branch 'refs/remotes/origin/master' into config…
kevinhinterlong Apr 15, 2017
2edfedd
Fix missing import lines
kevinhinterlong Apr 16, 2017
0ee5996
Cleanup and more comments
kevinhinterlong Apr 18, 2017
d8b674c
Merge remote-tracking branch 'refs/remotes/origin/configSlurperMaster…
kevinhinterlong Apr 18, 2017
8adb318
Merge remote-tracking branch 'refs/remotes/yahoo/master'
kevinhinterlong Apr 20, 2017
ebd786a
Merge remote-tracking branch 'refs/remotes/origin/master' into config…
kevinhinterlong Apr 20, 2017
f598cbc
Merge remote-tracking branch 'refs/remotes/origin/configSlurperMaster…
kevinhinterlong Apr 20, 2017
c04817d
Merge pull request #19 from kevinhinterlong/configSlurperDevelopment
kevinhinterlong Apr 20, 2017
34c5c19
Update for upstream changes
kevinhinterlong Apr 20, 2017
6739979
Merge pull request #20 from kevinhinterlong/configSlurperDevelopment
kevinhinterlong Apr 20, 2017
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
72 changes: 72 additions & 0 deletions fili-generic-example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
Fili Wikipedia Example Application
==================================

This example is an entirely self contained example that provides a Fili application for the
[Druid Wikipedia example](http://druid.io/docs/latest/tutorials/quickstart.html).

## Setup and Launching
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably mention the default druid endpoint we are expecting somewhere.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


1. Follow the [Druid instructions](http://druid.io/docs/latest/tutorials/quickstart.html) to bring up a local Druid
cluster on your Unix based machine.

2. Clone this repository to your computer.
```bash
git clone git@github.com:yahoo/fili.git
```
3. Use Maven to install and launch the Fili Wikipedia example:

```bash
cd fili
mvn install
mvn -pl fili-wikipedia-example exec:java
```
From another window, run a test query against the default druid data:

```bash
curl "http://localhost:9998/v1/data/wikipedia/hour/?metrics=deleted&dateTime=2015-09-12/PT2H" -H "Content-Type: application/json" | python -m json.tool
```
If everything is working you should see something like:
```
{
"rows": [
{
"dateTime": "2015-09-12 00:00:00.000",
"deleted": 1761.0
},
{
"dateTime": "2015-09-12 01:00:00.000",
"deleted": 16208.0
}
]
}
```

## Example Queries

Here are some sample queries that you can run to verify your server:

- List tables:

GET http://localhost:9998/v1/tables

- List dimensions:

GET http://localhost:9998/v1/dimensions

- List metrics:

GET http://localhost:9998/v1/metrics/

- Count of edits by hour for the last 72 hours:

GET http://localhost:9998/v1/data/wikipedia/hour/?metrics=count&dateTime=PT72H/current

- Show debug info, including the query sent to Druid:

GET http://localhost:9998/v1/data/wikipedia/hour/?format=debug&metrics=count&dateTime=PT72H/current

## Importing and Running in IntelliJ

1. In IntelliJ, go to `File -> Open`
2. Select the `pom.xml` file at the root of the project
3. Run `WikiMain` which can be found in `fili-wikipedia-example` (e.g. right click and choose run)
140 changes: 140 additions & 0 deletions fili-generic-example/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<prerequisites>
<maven>3.0</maven>
</prerequisites>

<parent>
<groupId>com.yahoo.fili</groupId>
<artifactId>fili-parent-pom</artifactId>
<version>0.8-SNAPSHOT</version>
</parent>

<artifactId>fili-generic-example</artifactId>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I change the the name fili-generic-example?

<packaging>war</packaging>
<name>Fili: Generic Example</name>
<description>Fili Wikipedia Example serves as a standalone sample implementation using core Fili services to stand
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might need to update the description to be non-wiki, would be nice if we change all the wiki names in the code also.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was there anywhere specific in the code you remember this? I know the package still says wiki

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package is the most likely culprit. But you could do a grep through the directory holding the fili-generic-example and find all instances of [Ww]iki pretty easily.

in front of the Druid wiki tutorial and automatically configure
</description>

<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>

<properties>
<maven.deploy.skip>true</maven.deploy.skip>

<checkstyle.config.location>../checkstyle-style.xml</checkstyle.config.location>
<checkstyle.suppressions.location>../checkstyle-suppressions.xml</checkstyle.suppressions.location>
</properties>

<dependencies>
<dependency>
<groupId>com.yahoo.fili</groupId>
<artifactId>fili</artifactId>
</dependency>

<dependency>
<groupId>com.yahoo.fili</groupId>
<artifactId>fili-core</artifactId>
</dependency>

<dependency>
<groupId>com.yahoo.fili</groupId>
<artifactId>fili-core</artifactId>
<type>test-jar</type>
</dependency>

<!-- Servlet API -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>

<!-- Jersey -->
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-common</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>

<!-- Test -->
<dependency>
<groupId>org.glassfish.jersey.test-framework</groupId>
<artifactId>jersey-test-framework-core</artifactId>
</dependency>

<!-- Jersey Test 'grizzly' container -->
<dependency>
<groupId>org.glassfish.jersey.test-framework.providers</groupId>
<artifactId>jersey-test-framework-provider-grizzly2</artifactId>
</dependency>

<!-- Jetty Servlet Support -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>1</id>
<phase>prepare-package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<exec executable="/bin/sh">
<env key="BUILD_NUMBER" value="${project.build}" />
<arg value="-c" />
<arg
value="echo ${project.version}.${BUILD_NUMBER:=0} | sed -e s/-SNAPSHOT//g &gt; target/buildVersion" />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try move the ending /> to the next line so that it makes a nice block.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

</exec>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution><goals><goal>java</goal></goals></execution>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indent each of the level would be nice.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

</executions>
<configuration>
<mainClass>com.yahoo.wiki.webservice.application.WikiMain</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Copyright 2016 Yahoo Inc.
// Licensed under the terms of the Apache license. Please see LICENSE.md file distributed with this work for terms.
package com.yahoo.wiki.webservice.application;

import com.yahoo.bard.webservice.data.config.dimension.DimensionConfig;
import com.yahoo.bard.webservice.data.config.metric.MetricLoader;
import com.yahoo.bard.webservice.data.config.table.TableLoader;
import com.yahoo.bard.webservice.druid.client.DruidWebService;
import com.yahoo.wiki.webservice.data.config.auto.ConfigLoader;
import com.yahoo.wiki.webservice.data.config.auto.StaticWikiConfigLoader;
import com.yahoo.wiki.webservice.data.config.dimension.GenericDimensions;
import com.yahoo.wiki.webservice.data.config.metric.GenericMetricLoader;
import com.yahoo.wiki.webservice.data.config.table.GenericTableLoader;

import java.util.LinkedHashSet;

/**
* Created by kevin on 3/7/2017.
*/
public class GenericBinder {
private static GenericBinder genericBinder;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this should be called Binder in that it does not implement org.glassfish.hk2.utilities.Binder which is the sense of Binder used in the AbstractBinderFactory.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, class javadoc.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I just remove GenericBinder? It seemed appropriate at the time but looking back it doesn't seem very necessary

private DruidWebService druidWebService;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class has no longer has unused private fields

private ConfigLoader configLoader;

private GenericBinder() {
configLoader = new StaticWikiConfigLoader();
//druidWebService = null; //TODO how to initialize with actual DruidWebService
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may be missing some context here. Why is this using the hard-coding StaticWikiConfigLoader?

Copy link
Member Author

@kevinhinterlong kevinhinterlong Mar 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was before I found out how to get a reference to a DruidWebService from GenericBinderFactory (it's been removed now)

//configLoader = new DruidNavigator(druidWebService);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make it a constructor parameter. Inject that when you construct the binder below in the binder factory.


public static GenericBinder getInstance() {
if (genericBinder == null) {
genericBinder = new GenericBinder();
}
return genericBinder;
}

public TableLoader buildTableLoader() {
return new GenericTableLoader(configLoader);
}

public LinkedHashSet<DimensionConfig> buildDimensionConfigurations() {
return new LinkedHashSet<>(new GenericDimensions(configLoader).getAllDimensionConfigurations());
}

public MetricLoader buildMetricLoader() {
return new GenericMetricLoader(configLoader);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2016 Yahoo Inc.
// Licensed under the terms of the Apache license. Please see LICENSE.md file distributed with this work for terms.
package com.yahoo.wiki.webservice.application;

import com.yahoo.bard.webservice.application.AbstractBinderFactory;
import com.yahoo.bard.webservice.data.config.dimension.DimensionConfig;
import com.yahoo.bard.webservice.data.config.metric.MetricLoader;
import com.yahoo.bard.webservice.data.config.table.TableLoader;

import java.util.LinkedHashSet;

/**
* Wiki specialization of the Abstract Binder factory, applying Wiki configuration objects.
*/
public class WikiBinderFactory extends AbstractBinderFactory {

@Override
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than have the static instance held in GenericBinder, you could hold the static instance here and have GenericBinder be more static.

e.g.

GenericBinder genericBinder;

getGenericBinder() {
if (genericBinder == null) {
genericBinderFactory = new GenericBinderFactory(buildDruidWebService(getMappers().getMapper()))
}
return genericBinder
}

protected MetricLoader getMetricLoader() {
return getGenericBinder().buildMetricLoader();
}
...

protected MetricLoader getMetricLoader() {
return GenericBinder.getInstance().buildMetricLoader();
}

@Override
protected LinkedHashSet<DimensionConfig> getDimensionConfigurations() {
return GenericBinder.getInstance().buildDimensionConfigurations();
}

@Override
protected TableLoader getTableLoader() {
return GenericBinder.getInstance().buildTableLoader();
}
}
Loading