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

Java ize2 #39

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open

Java ize2 #39

wants to merge 17 commits into from

Conversation

polx
Copy link

@polx polx commented Dec 18, 2019

This branch is the second proposal to port the groovy code to java.
Earlier PR and comments.

* @version $Id$
* @since 3.0
*/
class GoogleAppsEventListener implements EventListener
Copy link

Choose a reason for hiding this comment

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

Where / how is this event listener used?

Copy link
Author

Choose a reason for hiding this comment

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

Ouch. That's a good. That got moved away for readability and to prevent double-instantiation but was not constructed when the manager starts. Now fixed in 70368b2 .

Copy link

Choose a reason for hiding this comment

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

Still, why isn't this a component?

Copy link
Author

Choose a reason for hiding this comment

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

I've spent quite some time trying to make the various objects a component and, at the end, considered it a failure. Here is the reason:

  • There is no practice (apparently) to make package-internal components. This is a requirement for almost all classes here: They make no sense if not configured with the rest and many methods need to be public even though their function is only internal (this follows from attempts but also from a discussion with Vincent Massol).
  • When building, e.g. GoogleAppsXWikiObjects, you need to refer to GoogleAppsManager and conversely. Same for just about any component. That means you need providers... not very elegant and bringing a big uncertainty as to whether your object is actually built.
  • Normal practice for components is to apply "the interface dance": Each component's function is described in an interface and a component is an implementation of this interface. This works but doubles the code which is really not useful for functions that internal.

I agree that having injection for some of the objects (in particular loggers) would be a lot better but requiring this for all seems to be too much and expose too much of the API.

Copy link

Choose a reason for hiding this comment

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

There is no practice (apparently) to make package-internal components.

There is a practice and I believe I mentioned it to you.. We do have internal components that don't implement any interface, where you can have package protected methods or public internal methods as you like. See https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-handlers/xwiki-platform-extension-handler-xar/src/main/java/org/xwiki/extension/xar/internal/doc/InstalledExtensionDocumentTree.java for instance.

That means you need providers...

I don't see the problem with that.

Normal practice for components is to apply "the interface dance"

Again. You can have internal components that don't have an interface. The best practice requires an interface only for public components.

Copy link

Choose a reason for hiding this comment

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

Yes, a component class needs to be public and its default constructor needs to be public as well, but that doesn't make it public API.

So that makes the class part of the public API even if without public methods.

No, what makes it a public API is the package. Anything inside the *.internal.* package is internal API. Anything not inside the *.internal.* package is public API. Of course, you can use any public class, but using internal API means your code can break at any upgrade (we can add, remove, modify internal APIs as we wish without caring how they are used outside, because they are internal API). For public APIs we need to maintain backwards compatibility. So is that your only concern regarding using components: the fact that they "become public API"? Because they don't.

Copy link
Author

Choose a reason for hiding this comment

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

So I can remove any annotation of Unstable in there too?

This issue is what I remember now to have been the only problem I met.
I'll try it again (it might be that I was dissisatisfied by using provider everywhere too but I can accept that).
I'll report when done.

Copy link

Choose a reason for hiding this comment

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

@Unstable annotation doesn't make sense inside the internal package, for internal APIs.

Copy link
Author

Choose a reason for hiding this comment

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

I have now pushed a version with just components and no complex constructors anymore.
It would be cool to have the ability to have package-internal classes... but that's just a wish for the future.
Thanks for insisting. It does make the code more focussed (e.g. the manager does not need to grab everything).
paul

Copy link
Author

Choose a reason for hiding this comment

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

Hello @mflorea,
I believe that a review for the latest "componentization" (commit d810949 ) has it complete now.
I would love a review.
paul

polx and others added 7 commits February 5, 2020 21:56
Variable-names reformulation suggestions.
paul
…make the way for upgrades.

Simplifying the API to call the Google drive APIs, from view to java, so as to delete apparent duplicates.
paul
Now using a UIExtension so as to become prohibit-guest-access-compatible.
paul
@polx
Copy link
Author

polx commented Jun 12, 2020

Hello @mflorea and @acotiuga ,
I've now pushed a series of commit with the last one respecting formatting and checkstyle.
Except for more testing and a decision on whether to change the OAuth return URL, this should be good for review.
paul

api/pom.xml Outdated Show resolved Hide resolved
api/pom.xml Outdated Show resolved Hide resolved
* @version $Id$
* @since 3.0
*/
class GoogleAppsEventListener implements EventListener
Copy link

Choose a reason for hiding this comment

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

Still, why isn't this a component?

ui/src/main/resources/GoogleApps/GoogleAppsConfigSheet.vm Outdated Show resolved Hide resolved
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.

2 participants