Giter VIP home page Giter VIP logo

openespi-common-java's Introduction

CircleCI Quality Gate Status

OpenESPI-Common -- Archived January 29, 2024

NOTE: This repository is no longer maintained. The OpenESPI project has been archived and is no longer being maintained.

This is the Common module of the OpenESPI Green Button Data Custodian and Third Party implementation. It is a Spring application written in java and built on top of jpa for database access.

This Common run-time and test code is shared between stand-alone Data Custodian and Third Party applications. OpenESPI-DataCustodian and OpenESPI-ThirdParty.

An operational sandbox with these services operating may be found at: sandbox.greenbuttonalliance.org:8443

Setup

First clone the project from github:

git clone https://github.com/greenbuttonalliance/OpenESPI-Common-java.git
cd OpenESPI-Common

Then install the OpenESPI-Common JAR in your local repository:

# The JUnit test have not been maintained since the original creation of the repository. 
# Any errors encountered here are due to not including the "-Dmaven.test.skip=true" portion of the command.
mvn -Dmaven.test.skip=true clean install

# or for a specific profile
mvn -P <profile name> -Dmaven.test.skip=true clean install

IDE Setup

Eclipse Setup

Open Eclipse and import a Maven project (File > Import... > Maven > Existing Maven Projects).

Spring Tool Suite Setup

Open Spring Tool Suite and import a Maven project (File > Import... > Maven > Existing Maven Projects).

IntelliJ Setup

Open IntelliJ and open the project (File > Open...).

Testing

All testing of OpenESPI is performed using the Test Harness project. See the README file for instructions.

openespi-common-java's People

Contributors

antityping avatar dfcoffin avatar jateeter avatar martyburns avatar mooreb avatar nist-sgcps avatar ronpasquarelli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openespi-common-java's Issues

API path paremeter

I see couple of case where path parameter starts with uppercase letter. I think convention is lowercase letter.

public static final String DATA_CUSTODIAN_AUTHORIZATION = "/espi/1_1/resource/Authorization/{AuthorizationID}";
public static final String DATA_CUSTODIAN_REST_USAGE_POINT_COLLECTION = "/espi/1_1/resource/RetailCustomer/{retailCustomerId}/UsagePoint";
public static final String DATA_CUSTODIAN_REST_USAGE_POINT_CREATE = "/espi/1_1/resource/RetailCustomer/{retailCustomerId}/UsagePoint";
public static final String DATA_CUSTODIAN_REST_USAGE_POINT_GET = "/espi/1_1/resource/RetailCustomer/{RetailCustomerID}/UsagePoint/{UsagePointID}";

@Autowire without setter

There are couple of classes where there are no setter for some attributes. Though jetty and tomcat can workwit it but google appengine needs setter for autowire attributes.

datacustodian base URl in tokenenhancer

datacustodian base URl in token enhancer is injected though properties. Hence it needs to be provided in application during build time. Can this be used from application information corresponds to data-custodian.

IntervalBlock JPA annotation in MeterReading Class

Is it possible to manage relationship with IntervalBlock and MeterReading problematically not thorugh JPA. Having JPA relationship, lots of data is being loaded for Interval Block which is not always necessary.

Complete DB Seed files

It is now necessary to have all db rows completely loaded during the seed of the databases. This is especially needed for the dynamic registration issues in the DataCustodian and ThirdParty projects, but also needed in the SFTP and Bulk implementations. Following completion, any residual NULL entries should have documentation as to why they are still NULL for clarity.

Errors in links for download my data

The download my data function puts double // in some of the hrefs for the atom links. Also, there is a / in front of the stylesheet declaration which prevents browser from finding stylesheet in the same directory as the file download.

IntervalBlock:Merge

Current implementation of merge in IntervalBlock class, replace interval reading with new Interval reading data. Merge needs be based on the changes in new block.

The ThirdParty.authorizations table needs a new row

The ThirdParty.authorizations table, as created during the .sql seed process, needs to have a new row to represent that third-party-admin clientId and the client-access-token (along with all additional relevant seed information so that the ThirdParty.NotificationController may successfully issue a GET on Batch/Bulk/{bulkId} and /Authorization/{authorizationId}

Support Bulk retrieval

Support the Pattern:

GET /espi/1_1/resource/Batch/Bulk/{bulkId}

Will effect supporting the Services Interface:
List resourceService.findByBulkId{Long bulkId};

Remove version reference for Postgres Database

The OpenESPI-Common-java repository POM.xml file contains a version reference for the Postgres Database, however, there are no references to the version nor is the Postgres Database currently supported

Entity id in self/related link of XML

While exporting data from Datacustodian, self or related link is formed using entity id in generate XML irrespective of what value is used in import XML. So link value differ in import xml and export xml.

ResourceValidationFilter String out of Bounds Error

The following (baddly formed) curl commands results in a string out of bound error:

curl -H "Authorization: Bearer 688b026c-665f-4994-9139-6b21b13fbeee" http://localhost:8080/DataCustodian/foo bar

===== error =====

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1871)
at org.energyos.espi.datacustodian.web.filter.ResourceValidationFilter.doFilter(ResourceValidationFilter.java:145)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)

Remove deprecated Profiles

The POM file contains profiles that are no longer available. These should be removed to simplify the POM file.

subscription reference in Usage Points

An usage point can be linked to multiple subscription which is managed by subscriptions relationship. A review is required whether OneToOne reference to subscription is required or not.

Merge functionality of batchlist and resource table into a single table -- batchlist

Currently, the system keeps the subscription uri value in the "resource" table and assigns "batchlist" as a foreign key. The only element of the "batchlist" table is the key field. The ESPI standard defines the contents of the current "resource" table as being the contents of the "batchlist" entity. Making this merge brings the current implementation into alignment with the ESPI standard.

Since this change impacts the database files, it should be coordinated with the update for bulk processing.

Third Party Scope Selection Screen Displays An Invalid Scope Selection

The current Third Party Scope Selection screen displays "Third Party Admin Access" as a selectable SCOPE value to non-Administrative users.

Currently the Third Party application SCOPE selection entries are dynamically defined and presented based on the ApplicationInformation ID contained within the ApplicationInformationScope table entry. The current ThirdParty ApplicationInformationScope table contains an entry indicating "ThirdParty_Admin_Access" is a valid SCOPE selection for any Retail Customer authorizing the ThirdParty application access to their data. However, since the DataCustodian OAuth2 implementation contains a different client ID value for the Third Party Admin function, as it should, the OAuth Access Token is rejected.

The proper correction is to assign the "ThirdParty_Admin_Access" SCOPE to a new ApplicationInformation structure, similar to the manner in which the "Upload_Admin_Access" Scope is currently assigned.

authorizationUri not populated correctly when new authorization is made

Current code produces new authorizations using the OAuth flow. However, the authorization records do not populate the authorizationUri with the value for the autorization. Instead, it places the authorizationUri template:
'http://localhost:8080/DataCustodian/espi/1_1/resource/Authorization/{authorizationId}'
instead of:
'http://localhost:8080/DataCustodian/espi/1_1/resource/Authorization/5' (assuming this is 5th authorization added to the DC.

To create:

  1. Run SOAPUI script resetDb
  2. Use mysql to view authorizations table records in database -- 1..4
  3. Run SOAPUI script UploadTestFileAndAuthorize which will add a new UsagePoint and Subscription for the ThirdParty.
  4. Use mysql to view authorizations table records in database -- 1..5

the 5th record is new and has the authorizationUri of 'http://localhost:8080/DataCustodian/espi/1_1/resource/Authorization/{authorizationId}' instead of 'http://localhost:8080/DataCustodian/espi/1_1/resource/Authorization/5' as expected.

Entity needs to be serialized

Generally, application server/web server maintain session object in memory. Google app-engine maintains session objects in datastore. This means that objects those are stored in session needs to be serialized e.g. IdentifiableObjects, LinkType

Marshaling of TimeConfiguration

dstEndRule/dstStartRule marshal/unmarshal using HexBinaryAdapter. Hence hex representation is in output XML. Here output value needs to be in string representation. Due to incorrected start.end rule XML validation failed at www.greenbuttondata.org/greentest.aspx. I have changed as below
-- in TimeConfiguration .java
@XmlJavaTypeAdapter(StringBinaryAdapter.class)
protected byte [] dstEndRule;

public final class StringBinaryAdapter extends XmlAdapter<String,byte[]> {
public byte[] unmarshal(String s) {
if(s==null) return null;
return s.getBytes();
}

public String marshal(byte[] bytes) {
    if(bytes==null)     return null;
    return new String(bytes);
}

}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.