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

Feature/nta restapi #68

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open

Conversation

Amila17
Copy link

@Amila17 Amila17 commented May 28, 2014

Created new REST API module and updated the POM.xml and nta-dist.pom.xml
Added new API classes(Root, Tracer and Transaction)
Added new service classes (Transaction and TraceLogging)
Added new Exception Handlers that implements ExceptionMappers
Added a LinkBuilder class to provide the correct url for collections within entities.
Added hibernate validation on the requests for the api.
Added Response Classes to create well formed responses from the REST API.

This feature is still a work in progress. However, I would like the current work to be reviewed before moving on to the Participant and Event API classes. In addition, each of the API and Service classes will require unit tests.

Update:

New API classes have been added for ResourceManager and ParticipantRecord entities.
New service classes have been added which corresponds to the above two new API's.
Updated the LinkBuilder to build url encoded api uri's for ResourceManager entities.
Added new queries to Resource Manager entity class and DataAccessObject class.

Amila17 added 11 commits May 10, 2014 02:13
Modified nta-dis pom.xml to remove the webapp module
Modified restapi pom.xml to downgrade the rest api version to fix the issue with CDI injection
Removed IHelperService and implementation.
Added new Transaction Service interface
Updated the main pom file and the nta-dist pom file.
Added a URI Constant class to hold the uri constants for API's.
Added a transaction info model object to map the transaction model object from core. TransactionInfo object returns collection of links for collections instead of actual objects.
Added TransactionService interface and implementation.
Added a LinkBuilder helper to help build REST links for collections.
Merged master into current branch.
Added a new Tracer API
Added a new TraceLogging interface and implementation to enable and disable tracing.
Changed the location of URI Constants
Updated TracerAPI with the methods to call the TracerService.
Removed unused method from TracerService interface and implementation
Used media type for Produces annotation instead of string.
Added Manifest file for Client Controller
Added validation check for Transaction to check if parent transaction is null.
Added new Exception Handlers that implements ExceptionMappers
Modified the LinkBuilder class to provide the correct url for participant record
Added new method to get transaction by id for the API and service classes
Added hibernate validation on the requests for the api.
Removed wrong exclamation mark.
Added new response entities.
Removed NTA_URI and updated the LinkBuilder.
Updated the nta-dist/pom.xml
@jbosstm-bot
Copy link

Started testing this pull request: http://172.17.131.2/job/pulls-transaction-analyser/32/

@jbosstm-bot
Copy link

@@ -91,6 +96,11 @@
<webModule>
<groupId>io.narayana.nta</groupId>
<artifactId>webapp</artifactId>
<contextRoot>/ntaweb</contextRoot>
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we leave the web-console on /nta? Maybe change the rest api to be on /nta/rest or something? Is there a defacto standard for that url?

Copy link
Author

Choose a reason for hiding this comment

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

Will revert the url change made on web-console and update the rest url to nta/rest. There is no defacto standard but the preferred standard is "host/project/rest/api/version/endpoint". This can be seen in the following line: https://github.com/Amila17/transaction-analyser/blob/Feature/NTA_Restapi/restapi/src/main/java/io/narayana/nta/restapi/models/URIConstants.java#L12

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, so switching the context root to "nta/rest" should fix the problem without breaking your URL? Assuming it works of course. Overlapping context roots might not be allowed.

Copy link
Author

Choose a reason for hiding this comment

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

The over lapping context root url might be a problem, I will need to test it to confirm on that.

@paulrobinson
Copy link
Contributor

Can you explain what the uriBuilder is in the response from http://localhost:8080/nta/rest/api/v1/transaction? It appears in the events and participantRecords.

uriBuilder: {
    host: null,
    scheme: null,
    port: -1,
    userInfo: null,
    path: "rest/api/v1/participantRecord/3",
    query: null,
    fragment: null,
    pathParamNamesInDeclarationOrder: [ ]
},

@@ -0,0 +1,8 @@
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this file needed?

@paulrobinson
Copy link
Contributor

I get an error when visiting: http://localhost:8080/nta/rest/api/v1/participantRecord

status: "INTERNAL_SERVER_ERROR",
message: "Could not find resource for full path: http://localhost:8080/nta/rest/api/v1/participantRecord",

@paulrobinson
Copy link
Contributor

Is the API at http://docs.ntarestapi.apiary.io/ still current? I don't see /resourcemanager implemented here? Maybe you haven't got that far yet?

@Amila17
Copy link
Author

Amila17 commented May 30, 2014

As mentioned in the PR, only the trace and transaction api is complete. I will also need to update the apiary docs to reflect this.

@paulrobinson
Copy link
Contributor

Ah yes, sorry. I read the intro a while ago and forgot about it ;-)

Do you intend to implement everything in the Apiary.io documented API now, or later? If it's going to be in another release of NTA, maybe you could create a v0.1 API in Apiary.io for this release, and keep the current one for documenting what it will look in the future?

@Amila17
Copy link
Author

Amila17 commented May 30, 2014

No worries.
I am planning to implement all the API's mentioned in Apiary documentation. But this depends on when the next release for NTA is? Depending on the time, I can give a more accurate answer.

@Amila17
Copy link
Author

Amila17 commented May 30, 2014

For the comment on the uriBuilder response. This was intended to return a REST url for nested objects to the client instead of the actual object. For example the participant records within a transaction will be returned as REST urls instead of the actual content. I used the LinkBuilder class to achieve this but the output does not look very neat.

May be its better to create a custom model for this purpose and return that model?

@paulrobinson
Copy link
Contributor

I think what I really mean is, will the full API be in the first release of this work? We agreed that the first release would just replicate what we have today, but using REST and Angular.

As for time frames, don't worry about it. We'll put this work in when it's ready (i.e. replicates what we have today).

@paulrobinson
Copy link
Contributor

WRT the link. I was just expecting a single string value. E.g:

"recourceManager": "http://localhost:8080/nta/rest/api/v1/resourcemanager/{branchId}"

Would that make sense, do you think? But I'm not that experienced in REST APIs, so I don't know what is common practice here.

@Amila17
Copy link
Author

Amila17 commented May 30, 2014

The API for the first release will be the same functionality exposed by the web module and the Angular stuff on the frontend.

Regarding the link, I think the example you just showed is the best approach. Its much cleaner and clearer. I will do this change and update the PR asap.

@Amila17
Copy link
Author

Amila17 commented May 30, 2014

The REST link returned for an entity will be in the following format: api/v1/resourcemanager/{branchId}. The client will have to append the host url and context url.

Added JBoss Copyright message to all files.
Updated the file header template.

Changed the context of webapp and restapi modules.
Discarded use of LinkBuilder class and implemented custom REST link generators.
Updated the TransactionInfo Model to adhere to the change of REST links for an entity.
Updated the TransactionService to return better response objects to API level.
Updated API to return 204 status if no content is found.
@Amila17
Copy link
Author

Amila17 commented Jun 4, 2014

@paulrobinson I am using IntelliJ. I believe I have setup my IDE to use a custom formatting setting. I will change this to default settings and re-format the code accordingly.

Re-formatted code layout to match the format followed by the NTA project.
@jbosstm-bot
Copy link

Started testing this pull request: http://172.17.131.2/job/pulls-transaction-analyser/35/

@jbosstm-bot
Copy link

Changed folder naming convention.
Added API class for ParticipantRecord entity.
Added Serivce class interface and implementation to process the ParticipantRecord REST requests.
Updated the Link Generator class to generate links for Participant Records.
@jbosstm-bot
Copy link

Started testing this pull request: http://172.17.131.2/job/pulls-transaction-analyser/36/

@jbosstm-bot
Copy link

@paulrobinson
Copy link
Contributor

@Amila17 it looks like you are on the right track. Let us know if you need us to review anything.

Added named query to Event model.
Added two new methods to DataAccessObject to get events and get event by id.
Added EventAPI class.
Added EventInfo model
Added EventService interface and implementation
@jbosstm-bot
Copy link

Started testing this pull request: http://172.17.131.2/job/pulls-transaction-analyser/37/

@jbosstm-bot
Copy link

@jbosstm-bot
Copy link

Started testing this pull request: http://172.17.131.2/job/pulls-transaction-analyser/38/

@jbosstm-bot
Copy link

Moved Get and GetById methods to a generic Common Service interface.
Added two specific interfaces for Transaction and ResourceManager which extends Common Service interface.
Updated the implementation of the service classes to implement Common Service interface.
Updated the REST API to return bad request for a entity that does not exists in the system.
Removed @nAmed parameter from TraceLoggingServiceImpl class.
@jbosstm-bot
Copy link

Started testing this pull request: http://172.17.131.2/job/pulls-transaction-analyser/42/

@jbosstm-bot
Copy link

Added the EventAPI class to query event information.
@jbosstm-bot
Copy link

Started testing this pull request: http://172.17.131.2/job/pulls-transaction-analyser/43/

@jbosstm-bot
Copy link

Added a TransactionAPI interface and implementation. Interface was added to enable testing so the ProxyFactory can proxy the interface.
@jbosstm-bot
Copy link

Started testing this pull request: http://172.17.131.2/job/pulls-transaction-analyser/44/

@jbosstm-bot
Copy link

@zhfeng
Copy link
Contributor

zhfeng commented Dec 17, 2014

@Amila17 can you squash all the commits into one ? I'm preparing to merge this PR. Thanks a lot !

@jbosstm-bot
Copy link

@mmusgrov
Copy link
Member

mmusgrov commented Jan 3, 2023

@Amila17 FYI I am closing this PR since the Blacktie project is now archived (https://groups.google.com/g/narayana-users/c/k0EgFlS6VJc/m/6DcliSBfEAAJ). But thanks very much for your PR. What are you using for a transaction manager now?

@mmusgrov mmusgrov closed this Jan 3, 2023
@mmusgrov mmusgrov reopened this Jan 3, 2023
@mmusgrov
Copy link
Member

mmusgrov commented Jan 3, 2023

Sorry @Amila17 I got the analyser confused with the archived BlackTie project - I have re-opened your PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants