diff --git a/java/com.sap.sailing.dashboards.gwt/META-INF/MANIFEST.MF b/java/com.sap.sailing.dashboards.gwt/META-INF/MANIFEST.MF index 15b3a813597..3f43c949b17 100644 --- a/java/com.sap.sailing.dashboards.gwt/META-INF/MANIFEST.MF +++ b/java/com.sap.sailing.dashboards.gwt/META-INF/MANIFEST.MF @@ -25,7 +25,9 @@ Require-Bundle: com.sap.sailing.domain, com.sap.sse.gwt.adminconsole, org.apache.commons.math;bundle-version="2.1.0" Bundle-ActivationPolicy: lazy -Import-Package: org.osgi.framework;version="1.5.0", +Import-Package: com.sap.sailing.news, + com.sap.sse.util, + org.osgi.framework;version="1.5.0", org.osgi.util.tracker Web-ContextPath: /dashboards Bundle-ClassPath: WEB-INF/classes/, diff --git a/java/com.sap.sailing.dashboards.gwt/SailingDashboardsGWT sdm.launch b/java/com.sap.sailing.dashboards.gwt/SailingDashboardsGWT sdm.launch index 3df14c0b671..aefd1e3ffb6 100755 --- a/java/com.sap.sailing.dashboards.gwt/SailingDashboardsGWT sdm.launch +++ b/java/com.sap.sailing.dashboards.gwt/SailingDashboardsGWT sdm.launch @@ -43,5 +43,5 @@ - + diff --git a/java/com.sap.sailing.dashboards.gwt/SailingDashboardsGWT.launch b/java/com.sap.sailing.dashboards.gwt/SailingDashboardsGWT.launch index 4d2ae11f9e2..463a6cf721f 100755 --- a/java/com.sap.sailing.dashboards.gwt/SailingDashboardsGWT.launch +++ b/java/com.sap.sailing.dashboards.gwt/SailingDashboardsGWT.launch @@ -43,5 +43,5 @@ - + diff --git a/java/com.sap.sailing.dashboards.gwt/WEB-INF/web.xml b/java/com.sap.sailing.dashboards.gwt/WEB-INF/web.xml index 46e9142f142..2181d54550d 100644 --- a/java/com.sap.sailing.dashboards.gwt/WEB-INF/web.xml +++ b/java/com.sap.sailing.dashboards.gwt/WEB-INF/web.xml @@ -39,6 +39,16 @@ SailingService /service/sailing + + + Dispatch Service + DispatchService + com.sap.sailing.dashboards.gwt.server.DashboardDispatchRPCServletImpl + + + DispatchService + /service/dispatch + diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/DashboardClientFactory.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/DashboardClientFactory.java new file mode 100644 index 00000000000..f516121acc0 --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/DashboardClientFactory.java @@ -0,0 +1,11 @@ +package com.sap.sailing.dashboards.gwt.client; + +import com.sap.sailing.dashboards.gwt.shared.dispatch.DashboardDispatchSystem; + +/** + * @author Alexander Ries (D062114) + * + */ +public interface DashboardClientFactory{ + DashboardDispatchSystem getDispatch(); +} diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/DashboardClientFactoryImpl.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/DashboardClientFactoryImpl.java new file mode 100644 index 00000000000..b704185a2fb --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/DashboardClientFactoryImpl.java @@ -0,0 +1,19 @@ +package com.sap.sailing.dashboards.gwt.client; + +import com.sap.sailing.dashboards.gwt.shared.dispatch.DashboardDispatchSystem; +import com.sap.sailing.dashboards.gwt.shared.dispatch.impl.DashboardDispatchSystemImpl; + +/** + * @author Alexander Ries (D062114) + * + */ +public class DashboardClientFactoryImpl implements DashboardClientFactory{ + + private final DashboardDispatchSystem dispatch = new DashboardDispatchSystemImpl(); + + @Override + public DashboardDispatchSystem getDispatch() { + return dispatch; + } + +} diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/RemoteServiceMappingConstants.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/RemoteServiceMappingConstants.java index 3e3f281bbc6..f008fede3b2 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/RemoteServiceMappingConstants.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/RemoteServiceMappingConstants.java @@ -18,4 +18,5 @@ public interface RemoteServiceMappingConstants { public static final String sailingServiceRemotePath = "service/sailing"; public static final String ribdashboardServiceRemotePath = "service/ribdashboard"; + public static final String ribdashboardDispatchServiceRemotePath = "service/dispatch"; } diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/RibDashboardEntryPoint.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/RibDashboardEntryPoint.java index 8b143644190..4cb66669148 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/RibDashboardEntryPoint.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/RibDashboardEntryPoint.java @@ -39,14 +39,15 @@ public class RibDashboardEntryPoint extends AbstractEntryPoint { RibDashboardDataRetriever dataRetriever = new RibDashboardDataRetriever(ribdashboardService); applyMGWTSettings(); - RibDashboardPanel ribDashboardPanel = new RibDashboardPanel(ribdashboardService, sailingService, dataRetriever); + DashboardClientFactory dashboardClientFactory = new DashboardClientFactoryImpl(); + RibDashboardPanel ribDashboardPanel = new RibDashboardPanel(dashboardClientFactory); RootLayoutPanel.get().add(ribDashboardPanel); - WindBotDataRetriever windBotDataRetriever = new WindBotDataRetriever(ribdashboardService, sailingService); + /*WindBotDataRetriever windBotDataRetriever = new WindBotDataRetriever(ribdashboardService, sailingService); windBotDataRetriever.addNumberOfWindBotsChangeListeners(ribDashboardPanel); Timer dashboardTimer = new Timer(PlayModes.Live); dashboardTimer.setRefreshInterval(DASHBOARD_RERFRESH_INTERVAL); dashboardTimer.addTimeListener(windBotDataRetriever); - dashboardTimer.addTimeListener(dataRetriever); + dashboardTimer.addTimeListener(dataRetriever);*/ } private void applyMGWTSettings() { diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/RibDashboardPanel.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/RibDashboardPanel.java index aefb8c550eb..89eb096aa77 100644 --- a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/RibDashboardPanel.java +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/RibDashboardPanel.java @@ -18,6 +18,7 @@ import com.google.gwt.user.client.ui.Image; import com.google.gwt.user.client.ui.LayoutPanel; import com.google.gwt.user.client.ui.Widget; import com.googlecode.mgwt.ui.client.widget.carousel.Carousel; +import com.sap.sailing.dashboards.gwt.client.actions.GetIDFromRaceThatIsLiveAction; import com.sap.sailing.dashboards.gwt.client.dataretriever.NumberOfWindBotsChangeListener; import com.sap.sailing.dashboards.gwt.client.dataretriever.RibDashboardDataRetriever; import com.sap.sailing.dashboards.gwt.client.dataretriever.WindBotDataRetrieverProvider; @@ -28,6 +29,7 @@ import com.sap.sailing.dashboards.gwt.client.startlineadvantage.StartLineAdvanta import com.sap.sailing.dashboards.gwt.client.startlineadvantage.StartlineAdvantagesByWindComponent; import com.sap.sailing.dashboards.gwt.client.windchart.WindBotComponent; import com.sap.sailing.dashboards.gwt.shared.DashboardURLParameters; +import com.sap.sailing.dashboards.gwt.shared.RaceIdDTO; import com.sap.sailing.domain.common.RegattaAndRaceIdentifier; import com.sap.sailing.gwt.ui.client.SailingServiceAsync; import com.sap.sailing.gwt.ui.client.StringMessages; @@ -91,22 +93,24 @@ public class RibDashboardPanel extends Composite implements NumberOfWindBotsChan private List windBotComponents; private StringMessages stringConstants; private RibDashboardServiceAsync ribDashboardService; + DashboardClientFactory dashboardClientFactory; private static final Logger logger = Logger.getLogger(RibDashboardPanel.class.getName()); - public RibDashboardPanel(RibDashboardServiceAsync ribDashboardService, SailingServiceAsync sailingServiceAsync, RibDashboardDataRetriever ribDashboardDataRetriever) { - this.ribDashboardService = ribDashboardService; - windBotComponents = new ArrayList(); - startanalysisComponent = new StartlineAnalysisComponent(ribDashboardService, sailingServiceAsync); - startlineAdvantagesByWindComponent = new StartlineAdvantagesByWindComponent(ribDashboardService); - startlineAdvantageByGeometryComponent = new StartLineAdvantageByGeometryComponent(ribDashboardDataRetriever); + public RibDashboardPanel(DashboardClientFactory dashboardClientFactory) { + this.dashboardClientFactory = dashboardClientFactory; +// this.ribDashboardService = ribDashboardService; +// windBotComponents = new ArrayList(); +// startanalysisComponent = new StartlineAnalysisComponent(ribDashboardService, sailingServiceAsync); +// startlineAdvantagesByWindComponent = new StartlineAdvantagesByWindComponent(ribDashboardService); +// startlineAdvantageByGeometryComponent = new StartLineAdvantageByGeometryComponent(ribDashboardDataRetriever); stringConstants = StringMessages.INSTANCE; initWidget(uiBinder.createAndBindUi(this)); - initLogos(); - windcharthint.getElement().setInnerText(stringConstants.dashboardWindChartHint()); - windloadinghintleft.setInnerHTML(stringConstants.dashboardWindBotLoadingText()+"
"+stringConstants.dashboardWindBotLoadingMessage()); - windloadinghintright.setInnerHTML(stringConstants.dashboardWindBotLoadingText()+"
"+stringConstants.dashboardWindBotLoadingMessage()); +// initLogos(); +// windcharthint.getElement().setInnerText(stringConstants.dashboardWindChartHint()); +// windloadinghintleft.setInnerHTML(stringConstants.dashboardWindBotLoadingText()+"
"+stringConstants.dashboardWindBotLoadingMessage()); +// windloadinghintright.setInnerHTML(stringConstants.dashboardWindBotLoadingText()+"
"+stringConstants.dashboardWindBotLoadingMessage()); startUpdatingRaceLabelIn20SecondInterval(); - loadAndAddEventLogo(sailingServiceAsync); +// loadAndAddEventLogo(sailingServiceAsync); initAndAddWrongOrientationNotification(); } @@ -176,26 +180,29 @@ public class RibDashboardPanel extends Composite implements NumberOfWindBotsChan private void startUpdatingRaceLabelIn20SecondInterval() { Timer timer = new Timer(PlayModes.Live); - timer.setRefreshInterval(20000); - timer.addTimeListener( new TimeListener() { - + timer.setRefreshInterval(5000); + timer.addTimeListener(new TimeListener() { + @Override public void timeChanged(Date newTime, Date oldTime) { String leaderboardNameParameterValue = DashboardURLParameters.LEADERBOARD_NAME.getValue(); if (leaderboardNameParameterValue != null) { - ribDashboardService.getIDFromRaceThatIsLive(leaderboardNameParameterValue, - new AsyncCallback() { - @Override - public void onSuccess(RegattaAndRaceIdentifier result) { - if (result != null) { - logger.log(Level.INFO, "Updating UI with RibDashboardRaceInfoDTO race name"); - setHeaderText(result.getRaceName()); - } - } + dashboardClientFactory.getDispatch().execute( + new GetIDFromRaceThatIsLiveAction(leaderboardNameParameterValue), + new AsyncCallback() { @Override public void onFailure(Throwable caught) { - logger.log(Level.INFO, "Failed to received RegattaAndRaceIdentifier from race that is live, " + caught.getMessage()); + logger.log(Level.INFO, + "Failed to received RegattaAndRaceIdentifier from race that is live, "+caught.getMessage()); + } + + @Override + public void onSuccess(RaceIdDTO result) { + if (result != null) { + logger.log(Level.INFO, "Updating UI with RibDashboardRaceInfoDTO race name"); + setHeaderText(result.getRaceId().getRaceName()); + } } }); } diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/actions/GetIDFromRaceThatIsLiveAction.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/actions/GetIDFromRaceThatIsLiveAction.java new file mode 100644 index 00000000000..cd5a3952d54 --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/client/actions/GetIDFromRaceThatIsLiveAction.java @@ -0,0 +1,50 @@ +package com.sap.sailing.dashboards.gwt.client.actions; + +import com.google.gwt.core.shared.GwtIncompatible; +import com.sap.sailing.dashboards.gwt.shared.RaceIdDTO; +import com.sap.sailing.dashboards.gwt.shared.dispatch.DashboardAction; +import com.sap.sailing.dashboards.gwt.shared.dispatch.DashboardDispatchContext; +import com.sap.sailing.domain.base.Fleet; +import com.sap.sailing.domain.base.RaceColumn; +import com.sap.sailing.domain.leaderboard.Leaderboard; +import com.sap.sailing.domain.tracking.TrackedRace; +import com.sap.sailing.gwt.dispatch.client.exceptions.DispatchException; +import com.sap.sse.common.impl.MillisecondsTimePoint; + +/** + * @author Alexander Ries (D062114) + * + */ +public class GetIDFromRaceThatIsLiveAction implements DashboardAction { + + private String leaderboarName; + + @SuppressWarnings("unused") + private GetIDFromRaceThatIsLiveAction() { + } + + public GetIDFromRaceThatIsLiveAction(String leaderboardName) { + this.leaderboarName = leaderboardName; + } + + @Override + @GwtIncompatible + public RaceIdDTO execute(DashboardDispatchContext ctx) throws DispatchException { + RaceIdDTO result = new RaceIdDTO(); + TrackedRace liveRace = null; + Leaderboard leaderboard = ctx.getRacingEventService().getLeaderboardByName(this.leaderboarName); + if (leaderboard != null) { + for (RaceColumn column : leaderboard.getRaceColumns()) { + for (Fleet fleet : column.getFleets()) { + TrackedRace race = column.getTrackedRace(fleet); + if (race != null && race.isLive(MillisecondsTimePoint.now())) { + liveRace = race; + } + } + } + } + if (liveRace != null) + result.setRaceId(liveRace.getRaceIdentifier()); + return result; + } +} diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/server/DashboardDispatchRPCServletImpl.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/server/DashboardDispatchRPCServletImpl.java new file mode 100644 index 00000000000..8e9ea5781e5 --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/server/DashboardDispatchRPCServletImpl.java @@ -0,0 +1,73 @@ +package com.sap.sailing.dashboards.gwt.server; + +import java.util.UUID; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.osgi.framework.BundleContext; +import org.osgi.util.tracker.ServiceTracker; + +import com.sap.sailing.dashboards.gwt.shared.dispatch.DashboardDispatchContext; +import com.sap.sailing.dashboards.gwt.shared.dispatch.impl.DashboardDispatchContextImpl; +import com.sap.sailing.gwt.dispatch.client.Action; +import com.sap.sailing.gwt.dispatch.client.Result; +import com.sap.sailing.gwt.dispatch.client.ResultWrapper; +import com.sap.sailing.gwt.dispatch.client.exceptions.DispatchException; +import com.sap.sailing.gwt.dispatch.client.exceptions.ServerDispatchException; +import com.sap.sailing.gwt.dispatch.client.rpcimpl.DispatchRPC; +import com.sap.sailing.gwt.dispatch.client.rpcimpl.RequestWrapper; +import com.sap.sailing.gwt.ui.server.Activator; +import com.sap.sailing.gwt.ui.server.ProxiedRemoteServiceServlet; +import com.sap.sailing.server.RacingEventService; +import com.sap.sse.util.ServiceTrackerFactory; + +public class DashboardDispatchRPCServletImpl extends ProxiedRemoteServiceServlet implements DispatchRPC { + private static final long serialVersionUID = -245230476512348999L; + private static final Logger logger = Logger.getLogger(DashboardDispatchRPCServletImpl.class.getName()); + + private final ServiceTracker racingEventServiceTracker; + + public DashboardDispatchRPCServletImpl() { + final BundleContext context = Activator.getDefault(); + + racingEventServiceTracker = ServiceTrackerFactory.createAndOpen(context, RacingEventService.class); + } + + @Override + public > ResultWrapper execute( + RequestWrapper request) throws DispatchException { + A action = request.getAction(); + long start = System.currentTimeMillis(); + try { + R executionResult = action.execute( + new DashboardDispatchContextImpl(request.getCurrentClientTime(), + racingEventServiceTracker.getService(), request + .getClientLocaleName(), getThreadLocalRequest())); + return new ResultWrapper(executionResult); + } catch (DispatchException d) { + logger.log(Level.WARNING, "Server exception", d); + throw d; + } catch (Throwable t) { + String serverExceptionUUID = UUID.randomUUID().toString(); + logger.log(Level.SEVERE, "Uncaught server exception id: " + serverExceptionUUID, t); + throw new ServerDispatchException(serverExceptionUUID, t); + } finally { + long duration = System.currentTimeMillis() - start; + final Level logLevel; + if (duration < 100) { + logLevel = Level.FINEST; + } else if (duration < 500) { + logLevel = Level.INFO; + } else { + logLevel = Level.WARNING; + } + logger.log(logLevel, "Dispatch took " + duration + "ms for " + action.getClass().getSimpleName()); + } + } + + @Override + protected void doUnexpectedFailure(Throwable e) { + logger.log(Level.WARNING, "GWT RPC Exception: " + e.getMessage(), e); + super.doUnexpectedFailure(e); + } +} diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/shared/RaceIdDTO.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/shared/RaceIdDTO.java new file mode 100644 index 00000000000..5d473cb8948 --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/shared/RaceIdDTO.java @@ -0,0 +1,24 @@ +package com.sap.sailing.dashboards.gwt.shared; + +import com.sap.sailing.domain.common.RegattaAndRaceIdentifier; +import com.sap.sailing.gwt.dispatch.client.Result; + +/** + * @author Alexander Ries (D062114) + * + */ +public class RaceIdDTO implements Result { + + private RegattaAndRaceIdentifier raceId; + + public RaceIdDTO() { + } + + public RegattaAndRaceIdentifier getRaceId() { + return raceId; + } + + public void setRaceId(RegattaAndRaceIdentifier raceId) { + this.raceId = raceId; + } +} diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/shared/dispatch/DashboardAction.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/shared/dispatch/DashboardAction.java new file mode 100644 index 00000000000..abf992cab72 --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/shared/dispatch/DashboardAction.java @@ -0,0 +1,17 @@ +package com.sap.sailing.dashboards.gwt.shared.dispatch; + +import com.google.gwt.core.shared.GwtIncompatible; +import com.sap.sailing.gwt.dispatch.client.Action; +import com.sap.sailing.gwt.dispatch.client.Result; +import com.sap.sailing.gwt.dispatch.client.exceptions.DispatchException; + +/** + * @author Alexander Ries (D062114) + * + */ +public interface DashboardAction extends Action { + + @GwtIncompatible + R execute(DashboardDispatchContext ctx) throws DispatchException; + +} \ No newline at end of file diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/shared/dispatch/DashboardDispatchContext.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/shared/dispatch/DashboardDispatchContext.java new file mode 100644 index 00000000000..c54e21f3957 --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/shared/dispatch/DashboardDispatchContext.java @@ -0,0 +1,27 @@ +package com.sap.sailing.dashboards.gwt.shared.dispatch; + +import java.util.Date; +import java.util.Locale; + +import com.google.gwt.core.shared.GwtIncompatible; +import com.sap.sailing.gwt.dispatch.client.DispatchContext; +import com.sap.sailing.server.RacingEventService; + +/** + * @author Alexander Ries (D062114) + * + */ +public interface DashboardDispatchContext extends DispatchContext { + + @GwtIncompatible + RacingEventService getRacingEventService(); + + @GwtIncompatible + String getClientLocaleName(); + + @GwtIncompatible + Locale getClientLocale(); + + @GwtIncompatible + Date getCurrentClientTime(); +} diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/shared/dispatch/DashboardDispatchSystem.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/shared/dispatch/DashboardDispatchSystem.java new file mode 100644 index 00000000000..4902a45e242 --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/shared/dispatch/DashboardDispatchSystem.java @@ -0,0 +1,11 @@ +package com.sap.sailing.dashboards.gwt.shared.dispatch; + +import com.sap.sailing.gwt.dispatch.client.impl.DispatchSystem; + +/** + * @author Alexander Ries (D062114) + * + */ +public interface DashboardDispatchSystem extends DispatchSystem{ + +} diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/shared/dispatch/impl/DashboardDispatchContextImpl.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/shared/dispatch/impl/DashboardDispatchContextImpl.java new file mode 100644 index 00000000000..b625294cecb --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/shared/dispatch/impl/DashboardDispatchContextImpl.java @@ -0,0 +1,62 @@ +package com.sap.sailing.dashboards.gwt.shared.dispatch.impl; + +import java.net.URL; +import java.util.Date; +import java.util.Locale; + +import javax.servlet.http.HttpServletRequest; + +import com.sap.sailing.dashboards.gwt.shared.dispatch.DashboardDispatchContext; +import com.sap.sailing.gwt.dispatch.client.exceptions.DispatchException; +import com.sap.sailing.gwt.server.HomeServiceUtil; +import com.sap.sailing.server.RacingEventService; + +/** + * @author Alexander Ries (D062114) + * + */ +public class DashboardDispatchContextImpl implements DashboardDispatchContext{ + private final RacingEventService racingEventService; + private final Date currentClientTime; +// private final Date currentServerTime = new Date(); + private String clientLocaleName; + private final HttpServletRequest request; + + public DashboardDispatchContextImpl(Date currentClientTime, RacingEventService racingEventService, String clientLocaleName, HttpServletRequest request) { + this.currentClientTime = currentClientTime; + this.racingEventService = racingEventService; + this.clientLocaleName = clientLocaleName; + this.request = request; + } + + @Override + public RacingEventService getRacingEventService() { + return racingEventService; + } + + @Override + public Date getCurrentClientTime() { + return currentClientTime; + } + + @Override + public String getClientLocaleName() { + return clientLocaleName; + } + + @Override + public Locale getClientLocale() { + return Locale.forLanguageTag(clientLocaleName); + } + + @Override + public HttpServletRequest getRequest() { + return request; + } + + @Override + public URL getRequestBaseURL() throws DispatchException { + return HomeServiceUtil.getRequestBaseURL(request); + } + +} diff --git a/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/shared/dispatch/impl/DashboardDispatchSystemImpl.java b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/shared/dispatch/impl/DashboardDispatchSystemImpl.java new file mode 100644 index 00000000000..0e9a9986656 --- /dev/null +++ b/java/com.sap.sailing.dashboards.gwt/src/main/java/com/sap/sailing/dashboards/gwt/shared/dispatch/impl/DashboardDispatchSystemImpl.java @@ -0,0 +1,13 @@ +package com.sap.sailing.dashboards.gwt.shared.dispatch.impl; + +import com.sap.sailing.dashboards.gwt.client.RemoteServiceMappingConstants; +import com.sap.sailing.dashboards.gwt.shared.dispatch.DashboardDispatchContext; +import com.sap.sailing.dashboards.gwt.shared.dispatch.DashboardDispatchSystem; +import com.sap.sailing.gwt.dispatch.client.impl.DispatchSystemImpl; + +public class DashboardDispatchSystemImpl extends DispatchSystemImpl implements DashboardDispatchSystem { + + public DashboardDispatchSystemImpl() { + super(RemoteServiceMappingConstants.ribdashboardDispatchServiceRemotePath); + } +} diff --git a/java/com.sap.sailing.gwt.ui/META-INF/MANIFEST.MF b/java/com.sap.sailing.gwt.ui/META-INF/MANIFEST.MF index 91e8a38b32f..43aac8438a7 100644 --- a/java/com.sap.sailing.gwt.ui/META-INF/MANIFEST.MF +++ b/java/com.sap.sailing.gwt.ui/META-INF/MANIFEST.MF @@ -71,6 +71,15 @@ TrackLifecycle: true Export-Package: com.google.gwt.user.client.rpc.core.com.sap.sailing.domain.common.confidence.impl, com.google.gwt.user.client.rpc.core.com.sap.sailing.domain.common.impl, com.google.gwt.user.client.rpc.core.com.sap.sailing.domain.common.tracking.impl, + com.sap.sailing.gwt.dispatch.client, + com.sap.sailing.gwt.dispatch.client.batching, + com.sap.sailing.gwt.dispatch.client.caching, + com.sap.sailing.gwt.dispatch.client.exceptions, + com.sap.sailing.gwt.dispatch.client.impl, + com.sap.sailing.gwt.dispatch.client.rpcimpl, + com.sap.sailing.gwt.home.communication, + com.sap.sailing.gwt.home.server, + com.sap.sailing.gwt.server, com.sap.sailing.gwt.ui.actions, com.sap.sailing.gwt.ui.client, com.sap.sailing.gwt.ui.client.shared.charts, diff --git a/java/com.sap.sailing.gwt.ui/SailingGWT Remote Profiling (Run-Mode only).launch b/java/com.sap.sailing.gwt.ui/SailingGWT Remote Profiling (Run-Mode only).launch index 3ffcab00446..4e32ff66b23 100755 --- a/java/com.sap.sailing.gwt.ui/SailingGWT Remote Profiling (Run-Mode only).launch +++ b/java/com.sap.sailing.gwt.ui/SailingGWT Remote Profiling (Run-Mode only).launch @@ -1,60 +1,60 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/com.sap.sailing.gwt.ui/SailingGWT sdm.launch b/java/com.sap.sailing.gwt.ui/SailingGWT sdm.launch index 762b510c1e3..2b63f334eb7 100644 --- a/java/com.sap.sailing.gwt.ui/SailingGWT sdm.launch +++ b/java/com.sap.sailing.gwt.ui/SailingGWT sdm.launch @@ -75,5 +75,5 @@ - + diff --git a/java/com.sap.sailing.gwt.ui/SailingGWT.launch b/java/com.sap.sailing.gwt.ui/SailingGWT.launch index 4f94e217a34..74a6774a504 100755 --- a/java/com.sap.sailing.gwt.ui/SailingGWT.launch +++ b/java/com.sap.sailing.gwt.ui/SailingGWT.launch @@ -1,76 +1,76 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/dispatch/client/impl/DispatchSystemImpl.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/dispatch/client/impl/DispatchSystemImpl.java index 5bb331f988f..a34252f80fc 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/dispatch/client/impl/DispatchSystemImpl.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/dispatch/client/impl/DispatchSystemImpl.java @@ -15,10 +15,15 @@ import com.sap.sailing.gwt.dispatch.client.rpcimpl.SimpleDispatch; public class DispatchSystemImpl implements DispatchSystem { - private final SimpleDispatch simpleDispatch = new SimpleDispatch(null); - private final DispatchAsync dispatch = new CachingDispatch(new AutomaticBatchingDispatch( - simpleDispatch)); + private final SimpleDispatch simpleDispatch; + private final DispatchAsync dispatch; + public DispatchSystemImpl(String dispatchRPCPath) { + simpleDispatch = new SimpleDispatch(dispatchRPCPath); + dispatch = new CachingDispatch(new AutomaticBatchingDispatch( + simpleDispatch)); + } + @Override public > void execute(final A action, final AsyncCallback callback) { // TODO: client side execution time logging diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/dispatch/client/rpcimpl/SimpleDispatch.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/dispatch/client/rpcimpl/SimpleDispatch.java index 63b564c4e04..49ab4df3730 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/dispatch/client/rpcimpl/SimpleDispatch.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/dispatch/client/rpcimpl/SimpleDispatch.java @@ -9,8 +9,6 @@ import com.sap.sailing.gwt.dispatch.client.DispatchAsync; import com.sap.sailing.gwt.dispatch.client.DispatchContext; import com.sap.sailing.gwt.dispatch.client.Result; import com.sap.sailing.gwt.dispatch.client.ResultWrapper; -import com.sap.sailing.gwt.ui.client.RemoteServiceMappingConstants; -import com.sap.sailing.gwt.ui.client.SailingClientFactory; public class SimpleDispatch implements DispatchAsync { @@ -18,8 +16,8 @@ public class SimpleDispatch implements DispatchAsyn private long clientServerOffset = 0; - public SimpleDispatch(SailingClientFactory clientFactory) { - ((ServiceDefTarget) dispatchRPC).setServiceEntryPoint(RemoteServiceMappingConstants.dispatchServiceRemotePath); + public SimpleDispatch(String dispatchRPCPath) { + ((ServiceDefTarget) dispatchRPC).setServiceEntryPoint(dispatchRPCPath); } @Override diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/communication/SailingDispatchSystemImpl.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/communication/SailingDispatchSystemImpl.java index f6a83a87e13..db62ef9885d 100644 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/communication/SailingDispatchSystemImpl.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/communication/SailingDispatchSystemImpl.java @@ -1,7 +1,12 @@ package com.sap.sailing.gwt.home.communication; import com.sap.sailing.gwt.dispatch.client.impl.DispatchSystemImpl; +import com.sap.sailing.gwt.ui.client.RemoteServiceMappingConstants; public class SailingDispatchSystemImpl extends DispatchSystemImpl implements SailingDispatchSystem { + + public SailingDispatchSystemImpl() { + super(RemoteServiceMappingConstants.dispatchServiceRemotePath); + } } diff --git a/java/com.sap.sailing.server/SailingServer (No Proxy).launch b/java/com.sap.sailing.server/SailingServer (No Proxy).launch index 1778a15302f..ad2ef4043be 100644 --- a/java/com.sap.sailing.server/SailingServer (No Proxy).launch +++ b/java/com.sap.sailing.server/SailingServer (No Proxy).launch @@ -1,38 +1,38 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/com.sap.sse.gwt.theme/SSETheme_GWT sdm.launch b/java/com.sap.sse.gwt.theme/SSETheme_GWT sdm.launch index e61889df28b..2523720b3c5 100644 --- a/java/com.sap.sse.gwt.theme/SSETheme_GWT sdm.launch +++ b/java/com.sap.sse.gwt.theme/SSETheme_GWT sdm.launch @@ -23,5 +23,5 @@ - + diff --git a/java/com.sap.sse.gwt.theme/SSETheme_GWT.launch b/java/com.sap.sse.gwt.theme/SSETheme_GWT.launch index 497ba323966..b592dd92581 100644 --- a/java/com.sap.sse.gwt.theme/SSETheme_GWT.launch +++ b/java/com.sap.sse.gwt.theme/SSETheme_GWT.launch @@ -22,5 +22,5 @@ - + diff --git a/java/com.sap.sse.security.ui/Security UI sdm.launch b/java/com.sap.sse.security.ui/Security UI sdm.launch index 7ff5e9979c7..e15e8f7ab9e 100755 --- a/java/com.sap.sse.security.ui/Security UI sdm.launch +++ b/java/com.sap.sse.security.ui/Security UI sdm.launch @@ -44,5 +44,5 @@ - +