You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by andreaturli <gi...@git.apache.org> on 2016/01/06 16:16:23 UTC
[GitHub] incubator-brooklyn pull request: improvements to rest-api module
GitHub user andreaturli opened a pull request:
https://github.com/apache/incubator-brooklyn/pull/1127
improvements to rest-api module
Initial work to simplify the rest server:
- remove `JsonNode` from API interfaces
- refactor consistently `toString`and `hashCode` and `equals` for the domain objects
- remove deprecated code, although `LocationSpec` needs still some work
- simplified pom dependencies
Interestingly, with these changes, the `swagger.json`, obtained from the Swagger Annotation, can be used to generate automatically a java client using something like [that](https://github.com/swagger-api/swagger-codegen#to-generate-a-sample-client-library)
@sjcorbett could you have a look?
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/andreaturli/incubator-brooklyn improvements/rest-api
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-brooklyn/pull/1127.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1127
----
commit 114e5e443dfc7f32316f56c20cb89eb6e717fa8e
Author: Andrea Turli <an...@gmail.com>
Date: 2016-01-06T15:04:25Z
improvements to rest-api module
- remove JsonNode from API interfaces
- remove deprecated code
- simplified pom dependencies
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-brooklyn pull request: improvements to rest-api module
Posted by andreaturli <gi...@git.apache.org>.
GitHub user andreaturli reopened a pull request:
https://github.com/apache/incubator-brooklyn/pull/1127
improvements to rest-api module
Initial work to simplify the rest server:
- remove `JsonNode` from API interfaces
- refactor consistently `toString`and `hashCode` and `equals` for the domain objects
- remove deprecated code, although `LocationSpec` needs still some work
- simplified pom dependencies
Interestingly, with these changes, the `swagger.json`, obtained from the Swagger Annotation, can be used to generate automatically a java client using something like [that](https://github.com/swagger-api/swagger-codegen#to-generate-a-sample-client-library)
@sjcorbett could you have a look?
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/andreaturli/incubator-brooklyn improvements/rest-api
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-brooklyn/pull/1127.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1127
----
commit b4d42917572bdf17f5da188dc1b8961f61486666
Author: Andrea Turli <an...@gmail.com>
Date: 2016-01-06T15:04:25Z
improvements to rest-api module
- remove JsonNode from API interfaces
- remove deprecated code
- simplified pom dependencies
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-brooklyn pull request: improvements to rest-api module
Posted by andreaturli <gi...@git.apache.org>.
Github user andreaturli closed the pull request at:
https://github.com/apache/incubator-brooklyn/pull/1127
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-brooklyn pull request: improvements to rest-api module
Posted by ahgittin <gi...@git.apache.org>.
Github user ahgittin commented on the pull request:
https://github.com/apache/incubator-brooklyn/pull/1127#issuecomment-169661022
using https://github.com/apache/incubator-brooklyn/pull/1127/files?w=1 you can at least see the changes in github. (@andreaturli worth checking what your IDE does to cause so many whitespace changes!)
you can't comment on that page though so i'll also make comments here
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-brooklyn pull request: improvements to rest-api module
Posted by andreaturli <gi...@git.apache.org>.
Github user andreaturli commented on the pull request:
https://github.com/apache/incubator-brooklyn/pull/1127#issuecomment-173949034
I'll close this PR and open a simplified version of it where I will
- remove JsonNode from API interfaces
- refactor consistently `toString`, `hashCode` and `equals` for the domain objects in rest-api
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-brooklyn pull request: improvements to rest-api module
Posted by sjcorbett <gi...@git.apache.org>.
Github user sjcorbett commented on the pull request:
https://github.com/apache/incubator-brooklyn/pull/1127#issuecomment-169654793
brooklyn-server/rest/rest-api/generated/swagger-api-spec/retrofit2.json:
What is this file for? Why does it refer to "petstore"?
```
{
"library": "retrofit2",
"artifactId": "swagger-petstore-retrofit2"
}
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-brooklyn pull request: improvements to rest-api module
Posted by CMoH <gi...@git.apache.org>.
Github user CMoH commented on the pull request:
https://github.com/apache/incubator-brooklyn/pull/1127#issuecomment-171006809
See #1139 for a solution for dependencies.xml
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-brooklyn pull request: improvements to rest-api module
Posted by CMoH <gi...@git.apache.org>.
Github user CMoH commented on the pull request:
https://github.com/apache/incubator-brooklyn/pull/1127#issuecomment-170968512
@sjcorbett @ahgittin Yes, the ```dependencies''' file is generated for dependency control across versions. I think for now is not useful and I'll remove it in a separate PR.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-brooklyn pull request: improvements to rest-api module
Posted by andreaturli <gi...@git.apache.org>.
Github user andreaturli commented on the pull request:
https://github.com/apache/incubator-brooklyn/pull/1127#issuecomment-169612534
thanks @sjcorbett I think I fixed it now, sorry.
Looks like jenkins has not restarted ...
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-brooklyn pull request: improvements to rest-api module
Posted by ahgittin <gi...@git.apache.org>.
Github user ahgittin commented on the pull request:
https://github.com/apache/incubator-brooklyn/pull/1127#issuecomment-169661215
are you sure the `LocationApi` methods aren't used in the current UI ?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-brooklyn pull request: improvements to rest-api module
Posted by ahgittin <gi...@git.apache.org>.
Github user ahgittin commented on the pull request:
https://github.com/apache/incubator-brooklyn/pull/1127#issuecomment-169661760
i prefer `Objects.hashCode` over autogenerated and use of `Objects.equal(.., ..)` over three-part check but no strong feeling. i have no preference on the `toString` impls.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-brooklyn pull request: improvements to rest-api module
Posted by ahgittin <gi...@git.apache.org>.
Github user ahgittin commented on the pull request:
https://github.com/apache/incubator-brooklyn/pull/1127#issuecomment-169660397
> brooklyn-server/karaf/features/src/main/history/dependencies.xml:
> Do you really want to remove BROOKLYN_VERSION from all of the entries?
i've noticed the build sometimes replaces this. @CMoH @hzbarcea is that file auto-generated? if so should it be removed from version control?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-brooklyn pull request: improvements to rest-api module
Posted by ahgittin <gi...@git.apache.org>.
Github user ahgittin commented on the pull request:
https://github.com/apache/incubator-brooklyn/pull/1127#issuecomment-169662359
`public` methods (e.g. `displayNameComparator()`) shouldn't be removed without a deprecation cycle unless there is a good reason
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-brooklyn pull request: improvements to rest-api module
Posted by ahgittin <gi...@git.apache.org>.
Github user ahgittin commented on the pull request:
https://github.com/apache/incubator-brooklyn/pull/1127#issuecomment-172872188
> @JsonSerialize introduces another deps on jackson (databind) which I think it doesn't need to be there as it really depends on the ObjectMapper settings how to ser/deser the domain objects. In fact, ObjectMapper can deal with NON_NULL or NON_EMPTY using something like 1
your link "1" is huge when i click it (maybe due to the latest push); can you be more specific? i have a slight pref for the current behaviour (where nulls/empties are often dropped giving more readable JSON) and don't mind the dep on jackson, but happy to defer to you.
> re HighAvailabilityMode and ManagementNodeState I thought that having a dependency on brooklyn-api just for those enums was a bit too much, that's why I moved to brooklyn-utils-common.
-1 to moving these to `brooklyn-utils-common`; that's an abuse of project structure for visibility. either keep the dependency on `brooklyn-api`, which seems reasonable (as it is relatively dependency-free isn't it?) or make copies of the enums here along with tests that assert they are real copies (with `brooklyn-api` added in test scope).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-brooklyn pull request: improvements to rest-api module
Posted by sjcorbett <gi...@git.apache.org>.
Github user sjcorbett commented on the pull request:
https://github.com/apache/incubator-brooklyn/pull/1127#issuecomment-169657068
`toString` methods would be cleaner using `ToStringHelper` rather than IntelliJ's automated mess.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-brooklyn pull request: improvements to rest-api module
Posted by ahgittin <gi...@git.apache.org>.
Github user ahgittin commented on the pull request:
https://github.com/apache/incubator-brooklyn/pull/1127#issuecomment-169663939
why move `HighAvailabilityMode` and `ManagementNodeState` to different packages? that will break backwards compatibility (and so should be in README if we do it). in this case i don't think it gives us anything.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-brooklyn pull request: improvements to rest-api module
Posted by sjcorbett <gi...@git.apache.org>.
Github user sjcorbett commented on the pull request:
https://github.com/apache/incubator-brooklyn/pull/1127#issuecomment-169656161
brooklyn-server/rest/rest-api/src/main/java/org/apache/brooklyn/rest/domain/AccessSummary.java
I think it would be better to continue using `Objects.hashCode`. It does the same thing.
```java
@Override
public int hashCode() {
- return Objects.hashCode(locationProvisioningAllowed);
+ int result = (locationProvisioningAllowed ? 1 : 0);
+ result = 31 * result + (links != null ? links.hashCode() : 0);
+ return result;
}
```
Just write `Objects.hashCode(locationProvisioningAllowed, links)`.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-brooklyn pull request: improvements to rest-api module
Posted by sjcorbett <gi...@git.apache.org>.
Github user sjcorbett commented on the pull request:
https://github.com/apache/incubator-brooklyn/pull/1127#issuecomment-169654547
brooklyn-server/karaf/features/src/main/history/dependencies.xml:
Do you really want to remove `BROOKLYN_VERSION` from
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-brooklyn pull request: improvements to rest-api module
Posted by sjcorbett <gi...@git.apache.org>.
Github user sjcorbett commented on the pull request:
https://github.com/apache/incubator-brooklyn/pull/1127#issuecomment-169362282
In org.apache.brooklyn.rest.domain.LocationSummaryTest.testSerializeToJSON.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-brooklyn pull request: improvements to rest-api module
Posted by ahgittin <gi...@git.apache.org>.
Github user ahgittin commented on the pull request:
https://github.com/apache/incubator-brooklyn/pull/1127#issuecomment-169661824
why remove `@JsonSerialize(include=Inclusion.NON_EMPTY)` in places?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-brooklyn pull request: improvements to rest-api module
Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on the pull request:
https://github.com/apache/incubator-brooklyn/pull/1127#issuecomment-172898775
@andreaturli The plan for #1140 (at least currently) is to try to move the changes in the existing modules instead of forking them. It will also ease merging. Feel free to update this PR and merge it.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-brooklyn pull request: improvements to rest-api module
Posted by andreaturli <gi...@git.apache.org>.
Github user andreaturli closed the pull request at:
https://github.com/apache/incubator-brooklyn/pull/1127
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-brooklyn pull request: improvements to rest-api module
Posted by andreaturli <gi...@git.apache.org>.
Github user andreaturli commented on the pull request:
https://github.com/apache/incubator-brooklyn/pull/1127#issuecomment-169665520
thanks @ahgittin for comments
- `Object.hashCode` or `Objects.equals` from Guava are nicer but I wanted to avoid to have a direct dependency on Guava just for that. I know Guava is pulled in anyway, but we may in time be Guava-free at least for domain objects.
- @JsonSerialize introduces another deps on jackson (databind) which I think it doesn't need to be there as it really depends on the ObjectMapper settings how to ser/deser the domain objects. In fact, `ObjectMapper` can deal with `NON_NULL` or `NON_EMPTY` using something like [1](https://github.com/apache/incubator-brooklyn/pull/1127/files#diff-0686331603044ae35702b44e20abdbb6R42)
- re `LocationApi` I removed the deprecated methods and tests are passing, but I will have another look at the UI.
- re `HighAvailabilityMode` and `ManagementNodeState` I thought that having a dependency on `brooklyn-api` just for those enums was a bit too much, that's why I moved to `brooklyn-utils-common`.
- `displayNameComparator` was not used by any project and looked like an util method, but I agree, I should have deprecated first.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-brooklyn pull request: improvements to rest-api module
Posted by sjcorbett <gi...@git.apache.org>.
Github user sjcorbett commented on the pull request:
https://github.com/apache/incubator-brooklyn/pull/1127#issuecomment-169362167
@andreaturli I'll take a look. The Jenkins failure is valid:
```
java.lang.AssertionError: expected / found:
[{"id":"123","name":"localhost","spec":"localhost","links":{"self":"/v1/locations/123"}}]
[{"id":"123","name":"localhost","spec":"localhost","config":{},"links":{"self":"/v1/locations/123"}}]
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-brooklyn pull request: improvements to rest-api module
Posted by sjcorbett <gi...@git.apache.org>.
Github user sjcorbett commented on the pull request:
https://github.com/apache/incubator-brooklyn/pull/1127#issuecomment-169656652
Likewise with AccessSummary.equals could do the type checks and then `Objects.equals(this.locationProvisioningAllowed, that.locationProvisioningAllowed) && Objects.equal(this.links, that.links)`
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-brooklyn pull request: improvements to rest-api module
Posted by sjcorbett <gi...@git.apache.org>.
Github user sjcorbett commented on the pull request:
https://github.com/apache/incubator-brooklyn/pull/1127#issuecomment-172512885
@andreaturli Could you resolve the merge conflicts?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-brooklyn pull request: improvements to rest-api module
Posted by sjcorbett <gi...@git.apache.org>.
Github user sjcorbett commented on the pull request:
https://github.com/apache/incubator-brooklyn/pull/1127#issuecomment-169654474
The diff is too large to review on GitHub. I'll leave comments here instead.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-brooklyn pull request: improvements to rest-api module
Posted by andreaturli <gi...@git.apache.org>.
Github user andreaturli commented on the pull request:
https://github.com/apache/incubator-brooklyn/pull/1127#issuecomment-172874651
@ahgittin thanks for your review, I think this PR clashes with https://github.com/apache/incubator-brooklyn/pull/1140
Happy to close this and work on #1140
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---