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

CHE-5350: rework Maven plugin to avoid using Everrest Websocket #5527

Merged
merged 2 commits into from
Jul 5, 2017

Conversation

svor
Copy link
Contributor

@svor svor commented Jul 3, 2017

What does this PR do?

Replaces using Everrest Websocket with JSON-RPC for Maven plugin

What issues does this PR fix or reference?

#5350

Changelog

Use JSON-RPC for broadcasting maven output events

@svor svor added kind/enhancement A feature request - must adhere to the feature request template. team/ide labels Jul 3, 2017
@svor svor self-assigned this Jul 3, 2017
@svor svor requested review from dkuleshov and vparfonov July 3, 2017 16:36
@codenvy-ci
Copy link

}

@Inject
private void configureSubscribeHandler(RequestHandlerConfigurator configurator) {

Choose a reason for hiding this comment

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

It would be nice if we could have also a method to cancel subscription here, what do you think?


@Override
public void onEvent(ArchetypeOutput event) {
sendArchetypeNotification(event);

Choose a reason for hiding this comment

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

I would say that we don't need to have one more method here, we probably can just move

         ArchetypeOutput archetypeOutput = DtoFactory.newDto(ArchetypeOutput.class);
         archetypeOutput.setOutput(event.getOutput());
         archetypeOutput.setState(event.getState());
 
         endpointIds.forEach(it -> transmitter.newRequest()
                                              .endpointId(it)
                                              .methodName(MAVEN_ARCHETYPE_CHANEL_OUTPUT)
                                              .paramsAsDto(archetypeOutput)
                                              .sendAndSkipResult());

here or did I miss the reason that stands by this decision?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree. I've removed the excessive method.

@@ -110,9 +110,16 @@ public void projectUpdated(Map<MavenProject, MavenProjectModifications> updated,
List<MavenProject> needResolve = manager.findDependentProjects(allChangedProjects);
needResolve.addAll(updated.keySet());

List<String> updatedPaths = updated.keySet().stream()

Choose a reason for hiding this comment

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

To be compliant to streaming ideology I think it would be nice if we could have here something like this:

updated.keySet().stream()
                             .map(project -> project.getProject())
                             .map(project -> project.getFullPath())
                             .map(fullPath -> fullPath.toOSString())
                             .collect(Collectors.toList());

Don't you agree?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, but since when did "streaming ideology" become an argument for code quality? The version you propose has the advantage that it is easier to debug (because I can use line breakpoints), on the other hand, it will perform worse and is longer.
Btw: if we want to be more catholic than the pope, it would have to be .map(project::getProject), etc.

Copy link

@dkuleshov dkuleshov Jul 4, 2017

Choose a reason for hiding this comment

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

Java Streams ideology becomes an argument since @svor uses Java Streams API.

Choose a reason for hiding this comment

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

And btw talking about your btw: if we want to be more catholic than the pope, it would be .map(MavenProject::getProject) :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think popes are good people :)

String MAVEN_ARCHETYPE_CHANEL_NAME = "maven:archetype:output";


String MAVEN_CHANEL_SUBSCRIBE = "maven/subscribe";

Choose a reason for hiding this comment

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

Shouldn't it be mavenOutput/subscribe ?

private final MavenOutputEvent mavenOutputEvent;
private final String notificationType;

public MavenMessage(MavenOutputEvent mavenOutputEvent, String notificationType) {

Choose a reason for hiding this comment

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

Could you please explain why do we use String for notification type because I'm not sure that I understood the idea?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's unnecessary class which I've forgotten to delete. Thank you!

}

private void handleOperations(final WsAgentStateController wsAgentStateController) {
private void handleOperations() {
eventBus.addHandler(WsAgentStateEvent.TYPE, new WsAgentStateHandler() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can remove this handler
eventBus.addHandler(WorkspaceStoppedEvent.TYPE, event -> dependencyResolver.hide());
will be enough

@@ -91,32 +75,10 @@ public void removeResolvingProjectStateListener(ResolvingProjectStateListener li

@Override
public void onWsAgentStarted(WsAgentStateEvent event) {
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 remove it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes! Done, thank you!

@codenvy-ci
Copy link

@svor svor merged commit ef74274 into master Jul 5, 2017
@svor svor deleted the CHE-5350 branch July 5, 2017 13:22
@slemeur slemeur removed the team/ide label Jul 6, 2017
@slemeur slemeur added this to the 5.15.0 milestone Jul 6, 2017
@slemeur
Copy link
Contributor

slemeur commented Jul 6, 2017

@svor : Please assign milestone when merging.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement A feature request - must adhere to the feature request template.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants