Skip to content

Commit

Permalink
#65 add checkstyle to java apis (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
SirOibaf authored Jul 29, 2020
1 parent b28524f commit 65a9baf
Show file tree
Hide file tree
Showing 46 changed files with 654 additions and 236 deletions.
25 changes: 25 additions & 0 deletions java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,31 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<configuration>
<configLocation>src/main/resources/checkstyle.xml</configLocation>
<suppressionsLocation>src/main/resources/suppressions.xml</suppressionsLocation>
<failOnViolation>true</failOnViolation>
<failsOnError>true</failsOnError>
<consoleOutput>true</consoleOutput>
<logViolationsToConsole>true</logViolationsToConsole>
<sourceDirectories>
<sourceDirectory>src/main/java</sourceDirectory>
</sourceDirectories>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
1 change: 1 addition & 0 deletions java/src/main/java/com/logicalclocks/hsfs/DataFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*
* See the License for the specific language governing permissions and limitations under the License.
*/

package com.logicalclocks.hsfs;

import com.fasterxml.jackson.annotation.JsonProperty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*
* See the License for the specific language governing permissions and limitations under the License.
*/

package com.logicalclocks.hsfs;

public enum EntityEndpointType {
Expand Down
1 change: 1 addition & 0 deletions java/src/main/java/com/logicalclocks/hsfs/Feature.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*
* See the License for the specific language governing permissions and limitations under the License.
*/

package com.logicalclocks.hsfs;

import lombok.AllArgsConstructor;
Expand Down
21 changes: 11 additions & 10 deletions java/src/main/java/com/logicalclocks/hsfs/FeatureGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*
* See the License for the specific language governing permissions and limitations under the License.
*/

package com.logicalclocks.hsfs;

import com.fasterxml.jackson.annotation.JsonIgnore;
Expand Down Expand Up @@ -176,9 +177,9 @@ public void delete() throws FeatureStoreException, IOException {
}

/**
* Add a tag without value to the feature group
* Add a tag without value to the feature group.
*
* @param name: name of the tag
* @param name name of the tag
* @throws FeatureStoreException
* @throws IOException
*/
Expand All @@ -187,10 +188,10 @@ public void addTag(String name) throws FeatureStoreException, IOException {
}

/**
* Add name/value tag to the feature group
* Add name/value tag to the feature group.
*
* @param name: name of the tag
* @param value: value of the tag
* @param name name of the tag
* @param value value of the tag
* @throws FeatureStoreException
* @throws IOException
*/
Expand All @@ -199,7 +200,7 @@ public void addTag(String name, String value) throws FeatureStoreException, IOEx
}

/**
* Get all tags of the feature group
* Get all tags of the feature group.
*
* @return map of all tags from name to value
* @throws FeatureStoreException
Expand All @@ -211,9 +212,9 @@ public Map<String, String> getTag() throws FeatureStoreException, IOException {
}

/**
* Get a single tag value of the feature group
* Get a single tag value of the feature group.
*
* @param name: name of tha tag
* @param name name of tha tag
* @return string value of the tag
* @throws FeatureStoreException
* @throws IOException
Expand All @@ -224,9 +225,9 @@ public Map<String, String> getTag(String name) throws FeatureStoreException, IOE
}

/**
* Delete a tag of the feature group
* Delete a tag of the feature group.
*
* @param name: name of the tag to be deleted
* @param name name of the tag to be deleted
* @throws FeatureStoreException
* @throws IOException
*/
Expand Down
61 changes: 33 additions & 28 deletions java/src/main/java/com/logicalclocks/hsfs/FeatureStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@
*
* See the License for the specific language governing permissions and limitations under the License.
*/

package com.logicalclocks.hsfs;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Strings;
import com.logicalclocks.hsfs.engine.FeatureGroupEngine;
import com.logicalclocks.hsfs.engine.SparkEngine;
import com.logicalclocks.hsfs.metadata.FeatureGroupApi;
import com.logicalclocks.hsfs.metadata.StorageConnectorApi;
Expand Down Expand Up @@ -51,7 +50,7 @@ public class FeatureStore {

private static final Logger LOGGER = LoggerFactory.getLogger(FeatureStore.class);

final Integer DEFAULT_VERSION = 1;
private static final Integer DEFAULT_VERSION = 1;

public FeatureStore() throws FeatureStoreException {
featureGroupApi = new FeatureGroupApi();
Expand All @@ -60,26 +59,30 @@ public FeatureStore() throws FeatureStoreException {
}

/**
* Get a feature group object from the feature store
* @param name: the name of the feature group
* @param version: the version of the feature group
* @return
* Get a feature group object from the feature store.
*
* @param name the name of the feature group
* @param version the version of the feature group
* @return FeatureGroup
* @throws FeatureStoreException
* @throws IOException
*/
public FeatureGroup getFeatureGroup(@NonNull String name, @NonNull Integer version)
throws FeatureStoreException, IOException {
return featureGroupApi.get(this, name, version);
}

/**
* Get a feature group object with default version `1` from the feature store
* @param name: the name of the feature group
* @return
* Get a feature group object with default version `1` from the feature store.
*
* @param name the name of the feature group
* @return FeatureGroup
* @throws FeatureStoreException
* @throws IOException
*/
public FeatureGroup getFeatureGroup(String name) throws FeatureStoreException, IOException {
LOGGER.info("VersionWarning: No version provided for getting feature group `" + name + "`, defaulting to `" +
DEFAULT_VERSION + "`.");
LOGGER.info("VersionWarning: No version provided for getting feature group `" + name + "`, defaulting to `"
+ DEFAULT_VERSION + "`.");
return getFeatureGroup(name, DEFAULT_VERSION);
}

Expand All @@ -88,7 +91,7 @@ public Dataset<Row> sql(String query) {
}

public StorageConnector getStorageConnector(String name, StorageConnectorType type)
throws FeatureStoreException, IOException {
throws FeatureStoreException, IOException {
return storageConnectorApi.getByNameAndType(this, name, type);
}

Expand All @@ -103,10 +106,11 @@ public TrainingDataset.TrainingDatasetBuilder createTrainingDataset() {
}

/**
* Get a training dataset object from the selected feature store
* @param name: name of the training dataset
* @param version: version to get
* @return
* Get a training dataset object from the selected feature store.
*
* @param name name of the training dataset
* @param version version to get
* @return TrainingDataset
* @throws FeatureStoreException
* @throws IOException
*/
Expand All @@ -116,25 +120,26 @@ public TrainingDataset getTrainingDataset(@NonNull String name, @NonNull Integer
}

/**
* Get a training dataset object with the default version `1` from the selected feature store
* @param name: name of the training dataset
* @return
* Get a training dataset object with the default version `1` from the selected feature store.
*
* @param name name of the training dataset
* @return TrainingDataset
* @throws FeatureStoreException
* @throws IOException
*/
public TrainingDataset getTrainingDataset(String name) throws FeatureStoreException, IOException {
LOGGER.info("VersionWarning: No version provided for getting training dataset `" + name + "`, defaulting to `" +
DEFAULT_VERSION + "`.");
LOGGER.info("VersionWarning: No version provided for getting training dataset `" + name + "`, defaulting to `"
+ DEFAULT_VERSION + "`.");
return getTrainingDataset(name, DEFAULT_VERSION);
}

@Override
public String toString() {
return "FeatureStore{" +
"id=" + id +
", name='" + name + '\'' +
", projectId=" + projectId +
", featureGroupApi=" + featureGroupApi +
'}';
return "FeatureStore{"
+ "id=" + id
+ ", name='" + name + '\''
+ ", projectId=" + projectId
+ ", featureGroupApi=" + featureGroupApi
+ '}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*
* See the License for the specific language governing permissions and limitations under the License.
*/

package com.logicalclocks.hsfs;

public class FeatureStoreException extends Exception {
Expand Down
1 change: 1 addition & 0 deletions java/src/main/java/com/logicalclocks/hsfs/FsQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*
* See the License for the specific language governing permissions and limitations under the License.
*/

package com.logicalclocks.hsfs;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
Expand Down
21 changes: 12 additions & 9 deletions java/src/main/java/com/logicalclocks/hsfs/HopsworksConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*
* See the License for the specific language governing permissions and limitations under the License.
*/

package com.logicalclocks.hsfs;

import com.google.common.base.Strings;
Expand Down Expand Up @@ -58,7 +59,7 @@ public class HopsworksConnection implements Closeable {
private String certPath;

@Getter
private String APIKeyFilePath;
private String apiKeyFilePath;


private FeatureStoreApi featureStoreApi = new FeatureStoreApi();
Expand All @@ -69,7 +70,7 @@ public class HopsworksConnection implements Closeable {
@Builder
public HopsworksConnection(String host, int port, String project, Region region, SecretStore secretStore,
boolean hostnameVerification, String trustStorePath,
String certPath, String APIKeyFilePath) throws IOException, FeatureStoreException {
String certPath, String apiKeyFilePath) throws IOException, FeatureStoreException {
this.host = host;
this.port = port;
this.project = project;
Expand All @@ -78,29 +79,31 @@ public HopsworksConnection(String host, int port, String project, Region region,
this.hostnameVerification = hostnameVerification;
this.trustStorePath = trustStorePath;
this.certPath = certPath;
this.APIKeyFilePath = APIKeyFilePath;
this.apiKeyFilePath = apiKeyFilePath;

HopsworksClient hopsworksClient = HopsworksClient.setupHopsworksClient(host, port, region, secretStore,
hostnameVerification, trustStorePath, APIKeyFilePath);
hostnameVerification, trustStorePath, this.apiKeyFilePath);
projectObj = getProject();
hopsworksClient.downloadCredentials(projectObj, certPath);
}

/**
* Retrieve the project feature store
* @return
* Retrieve the project feature store.
*
* @return FeatureStore
* @throws IOException
* @throws FeatureStoreException
*/
public FeatureStore getFeatureStore() throws IOException, FeatureStoreException{
public FeatureStore getFeatureStore() throws IOException, FeatureStoreException {
return getFeatureStore(project + Constants.FEATURESTORE_SUFFIX);
}

/**
* Retrieve a feature store based on name. The feature store needs to be shared with
* the connection's project.
* @param name
* @return
*
* @param name the name of the feature store to get the handle for
* @return FeatureStore
* @throws IOException
* @throws FeatureStoreException
*/
Expand Down
1 change: 1 addition & 0 deletions java/src/main/java/com/logicalclocks/hsfs/JoinType.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*
* See the License for the specific language governing permissions and limitations under the License.
*/

package com.logicalclocks.hsfs;

public enum JoinType {
Expand Down
3 changes: 2 additions & 1 deletion java/src/main/java/com/logicalclocks/hsfs/MainClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*
* See the License for the specific language governing permissions and limitations under the License.
*/

package com.logicalclocks.hsfs;

import com.logicalclocks.hsfs.engine.SparkEngine;
Expand All @@ -26,7 +27,7 @@

public class MainClass {

private final static Logger LOGGER = LoggerFactory.getLogger(MainClass.class);
private static final Logger LOGGER = LoggerFactory.getLogger(MainClass.class);

public static void main(String[] args) throws Exception {

Expand Down
1 change: 1 addition & 0 deletions java/src/main/java/com/logicalclocks/hsfs/Project.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*
* See the License for the specific language governing permissions and limitations under the License.
*/

package com.logicalclocks.hsfs;

import lombok.Getter;
Expand Down
1 change: 1 addition & 0 deletions java/src/main/java/com/logicalclocks/hsfs/SecretStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*
* See the License for the specific language governing permissions and limitations under the License.
*/

package com.logicalclocks.hsfs;

public enum SecretStore {
Expand Down
1 change: 1 addition & 0 deletions java/src/main/java/com/logicalclocks/hsfs/Split.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*
* See the License for the specific language governing permissions and limitations under the License.
*/

package com.logicalclocks.hsfs;

import lombok.AllArgsConstructor;
Expand Down
Loading

0 comments on commit 65a9baf

Please sign in to comment.