mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-04 10:09:42 +00:00
Initial implementation of dispatch server side
This commit is contained in:
1 parent
65a4a33e14
commit
be3368d7fa
7 files changed
+114
No files matched your search
@@ -63,6 +63,16 @@
|
|||||||
<url-pattern>/service/sailing</url-pattern>
|
<url-pattern>/service/sailing</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
|
|
||||||
|
<servlet>
|
||||||
|
<display-name>Dispatch Service</display-name>
|
||||||
|
<servlet-name>DispatchService</servlet-name>
|
||||||
|
<servlet-class>com.sap.sailing.gwt.ui.server.dispatch.DispatchRPCImpl</servlet-class>
|
||||||
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>DispatchService</servlet-name>
|
||||||
|
<url-pattern>/service/dispatch</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
<servlet>
|
<servlet>
|
||||||
<display-name>Media Service</display-name>
|
<display-name>Media Service</display-name>
|
||||||
<servlet-name>MediaService</servlet-name>
|
<servlet-name>MediaService</servlet-name>
|
||||||
|
|||||||
+51
@@ -0,0 +1,51 @@
|
|||||||
|
package com.sap.sailing.gwt.ui.server.dispatch;
|
||||||
|
|
||||||
|
import org.osgi.framework.BundleContext;
|
||||||
|
import org.osgi.util.tracker.ServiceTracker;
|
||||||
|
|
||||||
|
import com.sap.sailing.domain.base.Event;
|
||||||
|
import com.sap.sailing.domain.leaderboard.Leaderboard;
|
||||||
|
import com.sap.sailing.domain.leaderboard.LeaderboardGroup;
|
||||||
|
import com.sap.sailing.domain.tracking.TrackedRace;
|
||||||
|
import com.sap.sailing.gwt.ui.server.Activator;
|
||||||
|
import com.sap.sailing.gwt.ui.server.ProxiedRemoteServiceServlet;
|
||||||
|
import com.sap.sailing.gwt.ui.shared.dispatch.Action;
|
||||||
|
import com.sap.sailing.gwt.ui.shared.dispatch.DispatchException;
|
||||||
|
import com.sap.sailing.gwt.ui.shared.dispatch.Result;
|
||||||
|
import com.sap.sailing.gwt.ui.shared.dispatch.ResultWithTTL;
|
||||||
|
import com.sap.sailing.gwt.ui.shared.dispatch.event.GetLiveRacesAction;
|
||||||
|
import com.sap.sailing.gwt.ui.shared.dispatch.event.LiveRaceDTO;
|
||||||
|
import com.sap.sailing.gwt.ui.shared.dispatch.event.LiveRacesDTO;
|
||||||
|
import com.sap.sailing.gwt.ui.shared.dispatch.event.OtherAction;
|
||||||
|
import com.sap.sailing.gwt.ui.shared.dispatch.event.OtherDTO;
|
||||||
|
import com.sap.sailing.gwt.ui.shared.dispatch.rpc.DispatchRPC;
|
||||||
|
import com.sap.sailing.server.RacingEventService;
|
||||||
|
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||||
|
import com.sap.sse.util.ServiceTrackerFactory;
|
||||||
|
|
||||||
|
public class DispatchRPCImpl extends ProxiedRemoteServiceServlet implements DispatchRPC {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -245230476512348999L;
|
||||||
|
private final ServiceTracker<RacingEventService, RacingEventService> racingEventServiceTracker;
|
||||||
|
|
||||||
|
public DispatchRPCImpl() {
|
||||||
|
BundleContext context = Activator.getDefault();
|
||||||
|
Activator activator = Activator.getInstance();
|
||||||
|
if (context != null) {
|
||||||
|
// TODO
|
||||||
|
// activator.setSailingService(this); // register so this service is informed when the bundle shuts down
|
||||||
|
}
|
||||||
|
racingEventServiceTracker = ServiceTrackerFactory.createAndOpen(context, RacingEventService.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected RacingEventService getService() {
|
||||||
|
return racingEventServiceTracker.getService(); // grab the service
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <R extends Result, A extends Action<R>> R execute(A action) throws DispatchException {
|
||||||
|
// TODO implement
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package com.sap.sailing.gwt.ui.shared.dispatch;
|
||||||
|
|
||||||
|
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||||
|
|
||||||
|
public interface Action<R extends Result> extends IsSerializable {
|
||||||
|
|
||||||
|
}
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
package com.sap.sailing.gwt.ui.shared.dispatch;
|
||||||
|
|
||||||
|
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||||
|
|
||||||
|
public class DispatchException extends RuntimeException implements IsSerializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 8192187255698006941L;
|
||||||
|
|
||||||
|
private DispatchException() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public DispatchException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package com.sap.sailing.gwt.ui.shared.dispatch;
|
||||||
|
|
||||||
|
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||||
|
|
||||||
|
public interface Result extends IsSerializable {
|
||||||
|
|
||||||
|
}
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
package com.sap.sailing.gwt.ui.shared.dispatch.rpc;
|
||||||
|
|
||||||
|
import com.google.gwt.user.client.rpc.RemoteService;
|
||||||
|
import com.sap.sailing.gwt.ui.shared.dispatch.Action;
|
||||||
|
import com.sap.sailing.gwt.ui.shared.dispatch.DispatchException;
|
||||||
|
import com.sap.sailing.gwt.ui.shared.dispatch.Result;
|
||||||
|
|
||||||
|
public interface DispatchRPC extends RemoteService {
|
||||||
|
|
||||||
|
<R extends Result, A extends Action<R>> R execute(A action) throws DispatchException;
|
||||||
|
|
||||||
|
}
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
package com.sap.sailing.gwt.ui.shared.dispatch.rpc;
|
||||||
|
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.sap.sailing.gwt.ui.shared.dispatch.Action;
|
||||||
|
import com.sap.sailing.gwt.ui.shared.dispatch.Result;
|
||||||
|
|
||||||
|
public interface DispatchRPCAsync {
|
||||||
|
|
||||||
|
<R extends Result, A extends Action<R>> void execute(Action<R> action, AsyncCallback<R> callback);
|
||||||
|
|
||||||
|
}
|
||||||
Reference in new issue
Block a user