-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Exec agent Che IDE client #3032
Conversation
Signed-off-by: Dmitry Kuleshov <dkuleshov@codenvy.com>
…, test fixes Signed-off-by: Dmitry Kuleshov <dkuleshov@codenvy.com>
Signed-off-by: Dmitry Kuleshov <dkuleshov@codenvy.com>
Build success. https://ci.codenvycorp.com/job/che-pullrequests-build/967/ |
Build success. https://ci.codenvycorp.com/job/che-pullrequests-build/969/ |
* Dispatches json rpc notification received from endpoint identified by a | ||
* high level identifier and represented as a json object. | ||
* | ||
* @param endpointId high level endpoint identifier |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
javadoc isn't formatted with che code style.
Please, review all classes in org.eclipse.che.api.core.jsonrpc.impl package because another ones have the same problem.
import javax.inject.Singleton; | ||
|
||
/** | ||
* Dispatches messages received from web socket endpoint throughout json rcp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
json rcp -> json rpc
import javax.inject.Singleton; | ||
|
||
/** | ||
* Dispatches messages received from web socket endpoint throughout json rcp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
json rcp -> json rpc
|
||
/** | ||
* Register an operation which will be performed when a process generates | ||
* process standard error event. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doc says standard error event but method name is thenIfProcessStdOutEvent.
I think that doc should say standard output event.
No?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're absolutely right
|
||
/** | ||
* Register an operation which will be performed when a process generates | ||
* process standard output event. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doc says standard output event but method name is thenIfProcessStdErrEvent.
I think that doc should say standard error event.
No?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct
* Copyright (c) 2012-2016 Codenvy, S.A. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that one of these license headers is unnecessary )
And please review all new DTOs in this PR. Because really a lot of them have duplicated license headers.
* @author Dmitry Kuleshov | ||
*/ | ||
@DTO | ||
public interface ProcessStartResponseDto extends DtoWithPidDto{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line isn't formatted. There is no space before {
*/ | ||
void transmit(JsonRpcRequest request); | ||
@DTO | ||
public interface ProcessKillResponseDto extends DtoWithPidDto{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line isn't formatted. There is no space before {
* Dispatches json rpc notification received from endpoint identified by a | ||
* high level identifier and represented as a json object. | ||
* | ||
* @param endpointId high level endpoint identifier |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
javadoc isn't formatted with che code style.
Please, review all classes in org.eclipse.che.ide.jsonrpc.impl package because several of them have the same problem.
…for endusers Signed-off-by: Dmitry Kuleshov <dkuleshov@codenvy.com>
Signed-off-by: Dmitry Kuleshov <dkuleshov@codenvy.com>
Build # 1050 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/1050/ to view the results. |
Signed-off-by: Dmitry Kuleshov <dkuleshov@codenvy.com>
Build # 1071 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/1071/ to view the results. |
19a4927
to
a34f616
Compare
Build # 1193 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/1193/ to view the results. |
Build # 1232 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/1232/ to view the results. |
a79f9ba
to
6fba10b
Compare
Build # 1262 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/1262/ to view the results. |
@dkuleshov - now that we have tagged 5.0.0 - can you resolve these conflicts and be ready to merge this? I think it's good for us to clean up our backlog of PRs, before moving onto bigger projects. |
This is merged to master under another pull request |
What does this PR do?
ExecAgentCommandManager
- new exec agent Che IDE clientJsonRPC
protocolwebsocket
protocolWhat issues does this PR fix or reference?
This is an adaptation of a new exec agent implementation located in exec-agent branch, the work is done under #1947 issue.
Changes to existing protocols
Websocket protocol
org.eclipse.che.ide.websocket.ng.impl.WebSocketInitializer#initialize(String endpointId, String url)
where
endpointId
is a high level websocket connection identifier (e.g. "exec-agent", "ws-agent", etc.)url
is a URL of websocket endpoint the connection is established to.After a connection is initialized and established an endpoint identifier can be used to choose where to send a message via a transmitter, an instance of
org.eclipse.che.ide.websocket.ng.WebSocketMessageTransmitter#transmit(String endpointId, String message)
JsonRPC protocol
where
exec-agent
is an endpoint identifierconnected
is a method name in terms of JsonRpc 2.0 protocol.At the same time for server-side registration procedure nothing is changed.
org.eclipse.che.ide.jsonrpc.RequestHandler
class for client-side andorg.eclipse.che.api.core.jsonrpc.RequestHandler
for server-side. The request handlers are now responsible for handling all kind of incoming request and notification. Handling is done by overriding of a corresponding method. Classes have two generic type parameters<P, R>
that corresponds for request/notification parameters and response result class types. Note that for handling requests the implementor isn't responsible now for response transmission because it is done automatically by taking the return value of a corresponding method.org.eclipse.che.api.core.jsonrpc.RequestTransmitter
andorg.eclipse.che.ide.jsonrpc.RequestTransmitter
for server side and client side correspondingly. Now request transmission methods return javascript promise wrappers for client-side and completable futures for server-side. That allows to dynamically handle response while previously was done by static binding of a corresponding response receiver in a dependency injection container.New exec agent client capabilities and use-cases
This is the core feature of this pull request, main task is to add a handy client to address process related calls to an exec agent through json rpc protocol.
Original json rpc exec agent API:
The client is added as an implementation of
org.eclipse.che.ide.api.machine.ExecAgentCommandManager
and provide next methodsAs you can see this API requires support of optional parameters and it will be added soon but now it is quite enough for all actual workflows and probably the most simple and basic one should be the following:
org.eclipse.che.ide.api.machine.ExecAgentEventManager
injecting it ororg.eclipse.che.ide.api.machine.execagent.ExecAgentPromise
that is retuned by corresponding methods (startProcess
,subscribe
).A good example of how to run a command using the new client is a piece of
org.eclipse.che.ide.extension.machine.client.actions.RunExecAgentCommandsAction
source code:where
"Test command"
is the name of the commandvalue
is the command line"Custom"
is the type of the commandProcess*EventOperation
operation that will be performed on project (started, died, stdout, stderr ) event