RFR: 7247: Alternate for Twitter4J to support twitter plug-in

Suchita Chaturvedi schaturvedi at openjdk.java.net
Sat Oct 16 13:19:06 UTC 2021


This PR addresses the issue of using Twitter4J as third party library for JMC, which is not actively maintained by the owner of Twitter4J. The last release was 3 years back. We have tried contacting the owner for the next release dates but couldn't get a proper response. Hence, we would need to remove the dependency from JMC because we should not use any dependency which is not well maintained. 

JMC Console gives the functionality of setting up triggers for particular conditions which can be set in configuration. Twitter is used as one of the trigger methods to notify users (or tweeters in case of Twitter). I have removed the Twitter4J dependency completely and using all the twitter related APIs directly. There are mainly three parts of this PR (functionality for which Twitter4J was used).

1. Authentication : The authentication of twitter users i.e. tweeters are done as part of preference settings. Twitter follows 3-legged OAuth authentication process for authenticating any user. So there are 3 steps which I have implemented in order to authenticate any user and save his details in preferences. Once the tweeter is verified the JMC application will use his details for verification before any action is triggered for that user. In order to use any user name we need to authorize his/her credentials in JMC preference.
2. Send Direct Message : A verified user (tweeter) can send a direct message to another user (tweeter). The first user should be verified user i.e. it should be one of the users listed in preference. The second user need not be a part of authorized users list but before sending any message we are checking whether the user exists or not.
3. Update Status : A JMC user can update the status of any verified user (tweeter) on Twitter which can be seen on twitter wall of that user.

I have used http classes of JDK 11 for making REST API calls, so this plugin will be dependent on JDK 11.

There is a scope of using a JSON library to make the code better but as of now I haven't used any third party library for this implementation may be we can modify the code in future if we have some JSON library dependency in future.

Please review the same and let me know your valuable comments (if any). Also, feel free to ping me if you want to test it and stuck somewhere. I can help with the steps to test it.

-------------

Commit messages:
 - 7247: Alternate for Twitter4J to support twitter plug-in

Changes: https://git.openjdk.java.net/jmc/pull/323/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jmc&pr=323&range=00
  Issue: https://bugs.openjdk.java.net/browse/JMC-7247
  Stats: 837 lines in 15 files changed: 689 ins; 96 del; 52 mod
  Patch: https://git.openjdk.java.net/jmc/pull/323.diff
  Fetch: git fetch https://git.openjdk.java.net/jmc pull/323/head:pull/323

PR: https://git.openjdk.java.net/jmc/pull/323


More information about the jmc-dev mailing list