Workspace Handlers
Hi,
I would like to use these two handlers:
WorkspaceRunningEvent.Handler, WorkspaceStoppedEvent.Handler
`import com.google.web.bindery.event.shared.EventBus; import org.eclipse.che.api.fs.server.FsManager; import org.eclipse.che.ide.api.notification.NotificationManager; import org.eclipse.che.ide.api.workspace.event.WorkspaceRunningEvent; import org.eclipse.che.ide.api.workspace.event.WorkspaceStoppedEvent;
import javax.inject.Inject;
public class Communications implements WorkspaceRunningEvent.Handler, WorkspaceStoppedEvent.Handler {
private FsManager fsManager;
private NotificationManager notificationManager;
@Inject
public Communications(NotificationManager notificationManager, FsManager fsManager, EventBus eventBus) {
this.fsManager = fsManager;
this.notificationManager = notificationManager;
eventBus.addHandler(WorkspaceRunningEvent.TYPE, this);
eventBus.addHandler(WorkspaceStoppedEvent.TYPE, this);
}
@Override
public void onWorkspaceRunning(WorkspaceRunningEvent event) {
notificationManager.notify("RUNNING");
}
@Override
public void onWorkspaceStopped(WorkspaceStoppedEvent event) {
notificationManager.notify("STOPPED");
}
}`
Am I missing something in a pom or in a AbstractModule ?
Thanks,
Hello, @mstavares . Can you describe what do you want to do? and what exact issue do you have?
Hi @skabashnyuk,
I would like to be noticed when a concrete workspace is running or stops. I would like to open a server socket while it's running and shut it down when the workspace stops.
That's why I would like to be notified using these two methods.
Thanks,
@skabashnyuk any news?
Do you want to adjust some reaction in GWT IDE? Or what?
I would like to be noticed when a concrete workspace is running or stops
Where IDE, dashboard, etc?
I would like to open a server socket while it's running and shut it down when the workspace stops.
Socket where, ws-master, agent?
that's why I would like to be notified using these two methods.
Can you formulate some concrete question? Do you have some issues with the code? Is working, not working, not compiling? Error, traces? It would be nice if you can follow github issue template more precise.
Hi, @mstavares, looks like we already have it https://github.com/eclipse/che/blob/master/wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/event/WorkspaceJsonRpcMessenger.java#L25
Hi @skabashnyuk,
Ok sorry about that, I will try to be more precise. What I want to do is to find a way to receive files externally and store them in a project which is attached to a workspace. My first clue was to do it through a web service. I have open this issue but I still don't know if I'm able to do it with a web service or not https://github.com/eclipse/che/issues/11269.
Then I have tried to find a workaround for this. My workaround is use a server socket, but seems obvious for me that I can't keep a while true running all the time. Then I have found those two interfaces, my ideia was start the server socket when the workspace starts and then stop it when the workspace also stops.
@vparfonov thanks a lot, I will test it.
Hi @skabashnyuk and @vparfonov,
Unfortunately I faced the same issue that I have already reported on #11269. I would like to provide a web service in order to receive and store files inside of concrete project.
In order to provide this web service I would like to have FsManager class available or AppContext in my webservice.
I don't know why but in both cases I always have the same behavior.
ERROR: (che start): Timeout waiting for server. Run "docker logs che" to inspect
@mstavares can you share your code so we can take a look?
Closing due to inactivity, please reopen if needed.