Skip to content

Commit 8f3f3d1

Browse files
ndoschekeneufeld
andauthored
#15 Update to latest GLSP Server version (#16)
#15 Update to latest GLSP Server version - Update to latest GLSP Server version and consume DI rework - Update targetplatform - Fix M2 build - Add secondary license to LICENSE files Co-authored-by: Eugen Neufeld <eneufeld@eclipsesource.com>
1 parent 136a0d7 commit 8f3f3d1

22 files changed

Lines changed: 144 additions & 75 deletions

File tree

.mvn/custom-settings.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 http://maven.apache.org/xsd/settings-1.2.0.xsd">
2+
<mirrors>
3+
<mirror>
4+
<id>wso2-mirror</id>
5+
<mirrorOf>wso2</mirrorOf>
6+
<name>WSO2 mirror to unblock.</name>
7+
<url>http://dist.wso2.org/maven2/</url>
8+
<blocked>false</blocked>
9+
</mirror>
10+
</mirrors>
11+
</settings>

.mvn/maven.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--settings ./.mvn/custom-settings.xml

LICENSE

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
Eclipse Public License - v 2.0
1+
This program and the accompanying materials are made available under the
2+
terms of the Eclipse Public License v. 2.0 which is available at
3+
https://www.eclipse.org/legal/epl-2.0, or the MIT License which is
4+
available at https://opensource.org/licenses/MIT.
5+
6+
# Eclipse Public License - v 2.0
27

38
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
49
PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION
@@ -54,8 +59,7 @@ in any manner that enables the transfer of a copy.
5459
modifications, including but not limited to software source code,
5560
documentation source, and configuration files.
5661

57-
"Secondary License" means either the GNU General Public License,
58-
Version 2.0, or any later versions of that license, including any
62+
"Secondary License" means either the MIT License or any
5963
exceptions or additional permissions as identified by the initial
6064
Contributor.
6165

@@ -275,3 +279,27 @@ version(s), and exceptions or additional permissions here}."
275279
look for such a notice.
276280

277281
You may add additional accurate notices of copyright ownership.
282+
283+
---
284+
## The MIT License
285+
286+
Copyright 2021 EclipseSource & others
287+
288+
Permission is hereby granted, free of charge, to any person obtaining a copy
289+
of this software and associated documentation files (the "Software"), to deal
290+
in the Software without restriction, including without limitation the rights
291+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
292+
copies of the Software, and to permit persons to whom the Software is
293+
furnished to do so, subject to the following conditions:
294+
295+
The above copyright notice and this permission notice shall be included in
296+
all copies or substantial portions of the Software.
297+
298+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
299+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
300+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
301+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
302+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
303+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
304+
THE SOFTWARE.
305+

plugins/org.eclipse.emfcloud.modelserver.glsp.integration/META-INF/MANIFEST.MF

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ Export-Package: org.eclipse.emfcloud.modelserver.glsp,
2828
org.eclipse.emfcloud.modelserver.glsp.model,
2929
org.eclipse.emfcloud.modelserver.glsp.notation.integration,
3030
org.eclipse.emfcloud.modelserver.glsp.operations.handlers
31+
Import-Package: org.apache.log4j;version="1.2.15"

plugins/org.eclipse.emfcloud.modelserver.glsp.integration/src/org/eclipse/emfcloud/modelserver/glsp/EMSGLSPModule.java

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,16 @@
1414
import org.eclipse.emfcloud.modelserver.glsp.actions.handlers.EMSRedoActionHandler;
1515
import org.eclipse.emfcloud.modelserver.glsp.actions.handlers.EMSSaveModelActionHandler;
1616
import org.eclipse.emfcloud.modelserver.glsp.actions.handlers.EMSUndoActionHandler;
17-
import org.eclipse.emfcloud.modelserver.glsp.client.ModelServerClientProvider;
1817
import org.eclipse.emfcloud.modelserver.glsp.layout.EMSLayoutEngine;
1918
import org.eclipse.glsp.server.actions.ActionHandler;
2019
import org.eclipse.glsp.server.actions.SaveModelActionHandler;
21-
import org.eclipse.glsp.server.di.DefaultGLSPModule;
20+
import org.eclipse.glsp.server.di.GModelJsonDiagramModule;
21+
import org.eclipse.glsp.server.di.MultiBinding;
2222
import org.eclipse.glsp.server.features.undoredo.UndoRedoActionHandler;
23-
import org.eclipse.glsp.server.layout.ILayoutEngine;
23+
import org.eclipse.glsp.server.layout.LayoutEngine;
2424
import org.eclipse.glsp.server.operations.OperationActionHandler;
25-
import org.eclipse.glsp.server.protocol.GLSPServer;
26-
import org.eclipse.glsp.server.utils.MultiBinding;
2725

28-
public abstract class EMSGLSPModule extends DefaultGLSPModule {
26+
public abstract class EMSGLSPModule extends GModelJsonDiagramModule {
2927

3028
@Override
3129
protected void configureActionHandlers(final MultiBinding<ActionHandler> bindings) {
@@ -38,22 +36,12 @@ protected void configureActionHandlers(final MultiBinding<ActionHandler> binding
3836
}
3937

4038
@Override
41-
public void configure() {
42-
super.configure();
43-
bind(bindModelServerClientProvider()).asEagerSingleton();
39+
protected void configureAdditionals() {
40+
super.configureAdditionals();
4441
}
4542

4643
@Override
47-
protected Class<? extends GLSPServer> bindGLSPServer() {
48-
return EMSGLSPServer.class;
49-
}
50-
51-
protected Class<? extends ModelServerClientProvider> bindModelServerClientProvider() {
52-
return ModelServerClientProvider.class;
53-
}
54-
55-
@Override
56-
protected Class<? extends ILayoutEngine> bindLayoutEngine() {
44+
protected Class<? extends LayoutEngine> bindLayoutEngine() {
5745
return EMSLayoutEngine.class;
5846
}
5947

plugins/org.eclipse.emfcloud.modelserver.glsp.integration/src/org/eclipse/emfcloud/modelserver/glsp/EMSGLSPServer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
********************************************************************************/
1111
package org.eclipse.emfcloud.modelserver.glsp;
1212

13-
import static org.eclipse.glsp.server.protocol.GLSPServerException.getOrThrow;
13+
import static org.eclipse.glsp.server.types.GLSPServerException.getOrThrow;
1414

1515
import java.net.MalformedURLException;
1616
import java.util.Map;
@@ -22,7 +22,7 @@
2222
import org.eclipse.emfcloud.modelserver.client.ModelServerClient;
2323
import org.eclipse.emfcloud.modelserver.client.Response;
2424
import org.eclipse.emfcloud.modelserver.glsp.client.ModelServerClientProvider;
25-
import org.eclipse.glsp.server.jsonrpc.DefaultGLSPServer;
25+
import org.eclipse.glsp.server.protocol.DefaultGLSPServer;
2626
import org.eclipse.glsp.server.protocol.DisposeClientSessionParameters;
2727
import org.eclipse.glsp.server.protocol.InitializeResult;
2828
import org.eclipse.glsp.server.utils.MapUtil;

plugins/org.eclipse.emfcloud.modelserver.glsp.integration/src/org/eclipse/emfcloud/modelserver/glsp/EMSModelServerAccess.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import org.eclipse.emfcloud.modelserver.client.NotificationSubscriptionListener;
2222
import org.eclipse.emfcloud.modelserver.client.Response;
2323
import org.eclipse.emfcloud.modelserver.command.CCommand;
24-
import org.eclipse.glsp.server.protocol.GLSPServerException;
24+
import org.eclipse.glsp.server.types.GLSPServerException;
2525

2626
import com.google.common.base.Preconditions;
2727

plugins/org.eclipse.emfcloud.modelserver.glsp.integration/src/org/eclipse/emfcloud/modelserver/glsp/actions/handlers/EMSBasicActionHandler.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,23 @@
1414

1515
import org.eclipse.emfcloud.modelserver.glsp.EMSModelServerAccess;
1616
import org.eclipse.emfcloud.modelserver.glsp.model.EMSModelState;
17+
import org.eclipse.glsp.server.actions.AbstractActionHandler;
1718
import org.eclipse.glsp.server.actions.Action;
18-
import org.eclipse.glsp.server.actions.BasicActionHandler;
1919
import org.eclipse.glsp.server.internal.util.GenericsUtil;
2020
import org.eclipse.glsp.server.model.GModelState;
2121

22+
import com.google.inject.Inject;
23+
2224
@SuppressWarnings("restriction")
2325
public abstract class EMSBasicActionHandler<T extends Action, U extends EMSModelState, V extends EMSModelServerAccess>
24-
extends BasicActionHandler<T> implements EMSActionHandler<T, U, V> {
26+
extends AbstractActionHandler<T> implements EMSActionHandler<T, U, V> {
2527

2628
protected final Class<U> modelStateType;
2729
protected final Class<V> modelServerAccessType;
2830

31+
@Inject
32+
protected GModelState gModelState;
33+
2934
public EMSBasicActionHandler() {
3035
super();
3136
this.modelStateType = deriveModelStateType();
@@ -52,11 +57,10 @@ protected Class<V> deriveModelServerAccessType() {
5257
}
5358

5459
@Override
55-
public List<Action> executeAction(final T actualAction, final GModelState gModelState) {
60+
public List<Action> executeAction(final T actualAction) {
5661
if (handles(actualAction)) {
57-
EMSModelState modelState = EMSModelState.getModelState(gModelState);
58-
EMSModelServerAccess modelServerAccess = EMSModelState.getModelServerAccess(modelState);
59-
return executeAction(actionType.cast(actualAction), modelStateType.cast(modelState),
62+
EMSModelServerAccess modelServerAccess = EMSModelState.getModelServerAccess(gModelState);
63+
return executeAction(actionType.cast(actualAction), modelStateType.cast(gModelState),
6064
modelServerAccessType.cast(modelServerAccess));
6165
}
6266
return none();

plugins/org.eclipse.emfcloud.modelserver.glsp.integration/src/org/eclipse/emfcloud/modelserver/glsp/actions/handlers/EMSOperationActionHandler.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,27 @@
1515

1616
import org.eclipse.emfcloud.modelserver.glsp.operations.handlers.EMSOperationHandler;
1717
import org.eclipse.glsp.server.actions.Action;
18-
import org.eclipse.glsp.server.model.GModelState;
1918
import org.eclipse.glsp.server.operations.Operation;
2019
import org.eclipse.glsp.server.operations.OperationActionHandler;
2120
import org.eclipse.glsp.server.operations.OperationHandler;
2221

2322
public class EMSOperationActionHandler extends OperationActionHandler {
2423

2524
@Override
26-
public List<Action> executeAction(final Operation operation, final GModelState modelState) {
25+
public List<Action> executeAction(final Operation operation) {
2726
// Disable the special handling for CreateOperation, as we don't register
2827
// one handler per element type to create.
2928
Optional<? extends OperationHandler> operationHandler = operationHandlerRegistry.get(operation);
3029
if (operationHandler.isPresent()) {
31-
return executeHandler(operation, operationHandler.get(), modelState);
30+
return executeHandler(operation, operationHandler.get());
3231
}
3332
return none();
3433
}
3534

3635
@Override
37-
protected List<Action> executeHandler(final Operation operation, final OperationHandler handler,
38-
final GModelState gModelState) {
36+
protected List<Action> executeHandler(final Operation operation, final OperationHandler handler) {
3937
if (handler instanceof EMSOperationHandler) {
40-
handler.execute(operation, gModelState);
38+
handler.execute(operation);
4139
}
4240
return none();
4341
}

plugins/org.eclipse.emfcloud.modelserver.glsp.integration/src/org/eclipse/emfcloud/modelserver/glsp/actions/handlers/EMSSaveModelActionHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import org.eclipse.emfcloud.modelserver.glsp.model.EMSModelState;
1717
import org.eclipse.glsp.server.actions.Action;
1818
import org.eclipse.glsp.server.actions.SaveModelAction;
19-
import org.eclipse.glsp.server.protocol.GLSPServerException;
19+
import org.eclipse.glsp.server.types.GLSPServerException;
2020

2121
public class EMSSaveModelActionHandler
2222
extends EMSBasicActionHandler<SaveModelAction, EMSModelState, EMSModelServerAccess> {

0 commit comments

Comments
 (0)