mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-30 01:16:40 +00:00
Removed no longer need HomeService and used Dispatch system for media
loading
This commit is contained in:
@@ -82,15 +82,6 @@
|
||||
<servlet-name>DispatchService</servlet-name>
|
||||
<url-pattern>/service/dispatch</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet>
|
||||
<display-name>Home Service</display-name>
|
||||
<servlet-name>HomeService</servlet-name>
|
||||
<servlet-class>com.sap.sailing.gwt.server.HomeServiceImpl</servlet-class>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>HomeService</servlet-name>
|
||||
<url-pattern>/service/home</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet>
|
||||
<display-name>Media Service</display-name>
|
||||
|
||||
-10
@@ -6,8 +6,6 @@ import com.google.gwt.place.shared.PlaceController;
|
||||
import com.google.gwt.user.client.rpc.ServiceDefTarget;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sap.sailing.gwt.autoplay.client.place.start.StartPlace;
|
||||
import com.sap.sailing.gwt.ui.client.HomeService;
|
||||
import com.sap.sailing.gwt.ui.client.HomeServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.MediaService;
|
||||
import com.sap.sailing.gwt.ui.client.MediaServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.RemoteServiceMappingConstants;
|
||||
@@ -18,7 +16,6 @@ import com.sap.sse.security.ui.client.SecureClientFactoryImpl;
|
||||
|
||||
public abstract class AbstractApplicationClientFactory extends SecureClientFactoryImpl implements AutoPlayAppClientFactory {
|
||||
private final SailingServiceAsync sailingService;
|
||||
private final HomeServiceAsync homeService;
|
||||
private final MediaServiceAsync mediaService;
|
||||
private final PlaceNavigator navigator;
|
||||
|
||||
@@ -26,10 +23,8 @@ public abstract class AbstractApplicationClientFactory extends SecureClientFacto
|
||||
super(root, eventBus, placeController);
|
||||
this.navigator = navigator;
|
||||
sailingService = GWT.create(SailingService.class);
|
||||
homeService = GWT.create(HomeService.class);
|
||||
mediaService = GWT.create(MediaService.class);
|
||||
EntryPointHelper.registerASyncService((ServiceDefTarget) sailingService, RemoteServiceMappingConstants.sailingServiceRemotePath);
|
||||
EntryPointHelper.registerASyncService((ServiceDefTarget) homeService, RemoteServiceMappingConstants.homeServiceRemotePath);
|
||||
EntryPointHelper.registerASyncService((ServiceDefTarget) mediaService, RemoteServiceMappingConstants.mediaServiceRemotePath);
|
||||
}
|
||||
|
||||
@@ -43,11 +38,6 @@ public abstract class AbstractApplicationClientFactory extends SecureClientFacto
|
||||
return sailingService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HomeServiceAsync getHomeService() {
|
||||
return homeService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MediaServiceAsync getMediaService() {
|
||||
return mediaService;
|
||||
|
||||
-10
@@ -6,8 +6,6 @@ import com.google.gwt.place.shared.PlaceController;
|
||||
import com.google.gwt.user.client.rpc.ServiceDefTarget;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sap.sailing.gwt.home.shared.places.start.StartPlace;
|
||||
import com.sap.sailing.gwt.ui.client.HomeService;
|
||||
import com.sap.sailing.gwt.ui.client.HomeServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.MediaService;
|
||||
import com.sap.sailing.gwt.ui.client.MediaServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.RemoteServiceMappingConstants;
|
||||
@@ -19,7 +17,6 @@ import com.sap.sse.security.ui.client.SecureClientFactoryImpl;
|
||||
public abstract class AbstractApplicationClientFactory extends
|
||||
SecureClientFactoryImpl implements DesktopClientFactory {
|
||||
private final SailingServiceAsync sailingService;
|
||||
private final HomeServiceAsync homeService;
|
||||
private final MediaServiceAsync mediaService;
|
||||
private final DesktopPlacesNavigator navigator;
|
||||
|
||||
@@ -28,10 +25,8 @@ public abstract class AbstractApplicationClientFactory extends
|
||||
super(root, eventBus, placeController);
|
||||
this.navigator = navigator;
|
||||
sailingService = GWT.create(SailingService.class);
|
||||
homeService = GWT.create(HomeService.class);
|
||||
mediaService = GWT.create(MediaService.class);
|
||||
EntryPointHelper.registerASyncService((ServiceDefTarget) sailingService, RemoteServiceMappingConstants.sailingServiceRemotePath);
|
||||
EntryPointHelper.registerASyncService((ServiceDefTarget) homeService, RemoteServiceMappingConstants.homeServiceRemotePath);
|
||||
EntryPointHelper.registerASyncService((ServiceDefTarget) mediaService, RemoteServiceMappingConstants.mediaServiceRemotePath);
|
||||
}
|
||||
|
||||
@@ -45,11 +40,6 @@ public abstract class AbstractApplicationClientFactory extends
|
||||
return sailingService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HomeServiceAsync getHomeService() {
|
||||
return homeService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MediaServiceAsync getMediaService() {
|
||||
return mediaService;
|
||||
|
||||
+2
-6
@@ -17,6 +17,7 @@ import com.sap.sailing.gwt.home.communication.event.EventState;
|
||||
import com.sap.sailing.gwt.home.communication.eventview.EventViewDTO;
|
||||
import com.sap.sailing.gwt.home.communication.eventview.EventViewDTO.EventType;
|
||||
import com.sap.sailing.gwt.home.communication.eventview.HasRegattaMetadata;
|
||||
import com.sap.sailing.gwt.home.communication.media.GetMediaForEventAction;
|
||||
import com.sap.sailing.gwt.home.communication.media.MediaDTO;
|
||||
import com.sap.sailing.gwt.home.desktop.app.DesktopPlacesNavigator;
|
||||
import com.sap.sailing.gwt.home.desktop.places.event.regatta.AbstractEventRegattaPlace;
|
||||
@@ -32,7 +33,6 @@ import com.sap.sailing.gwt.home.shared.places.events.EventsPlace;
|
||||
import com.sap.sailing.gwt.home.shared.places.fakeseries.SeriesDefaultPlace;
|
||||
import com.sap.sailing.gwt.home.shared.places.start.StartPlace;
|
||||
import com.sap.sailing.gwt.ui.client.EntryPointLinkFactory;
|
||||
import com.sap.sailing.gwt.ui.client.HomeServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.refresh.ErrorAndBusyClientFactory;
|
||||
import com.sap.sailing.gwt.ui.raceboard.RaceBoardViewConfiguration;
|
||||
@@ -66,10 +66,6 @@ public abstract class AbstractEventActivity<PLACE extends AbstractEventPlace> ex
|
||||
this.clientFactory = clientFactory;
|
||||
}
|
||||
|
||||
public HomeServiceAsync getHomeService() {
|
||||
return clientFactory.getHomeService();
|
||||
}
|
||||
|
||||
public SailingServiceAsync getSailingService() {
|
||||
return clientFactory.getSailingService();
|
||||
}
|
||||
@@ -194,7 +190,7 @@ public abstract class AbstractEventActivity<PLACE extends AbstractEventPlace> ex
|
||||
|
||||
@Override
|
||||
public void ensureMedia(final AsyncCallback<MediaDTO> callback) {
|
||||
getHomeService().getMediaForEvent(eventDTO.getId(), callback);
|
||||
getDispatch().execute(new GetMediaForEventAction(eventDTO.getId()), callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
-2
@@ -21,7 +21,6 @@ import com.sap.sailing.gwt.home.shared.places.event.EventDefaultPlace;
|
||||
import com.sap.sailing.gwt.home.shared.places.events.EventsPlace;
|
||||
import com.sap.sailing.gwt.home.shared.places.fakeseries.SeriesDefaultPlace;
|
||||
import com.sap.sailing.gwt.home.shared.places.start.StartPlace;
|
||||
import com.sap.sailing.gwt.ui.client.HomeServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.refresh.ErrorAndBusyClientFactory;
|
||||
import com.sap.sailing.gwt.ui.shared.StrippedLeaderboardDTO;
|
||||
@@ -40,7 +39,6 @@ public interface EventView<PLACE extends AbstractEventPlace, PRES extends EventV
|
||||
void forPlaceSelection(PlaceCallback callback);
|
||||
Timer getTimerForClientServerOffset();
|
||||
SailingServiceAsync getSailingService();
|
||||
HomeServiceAsync getHomeService();
|
||||
|
||||
AbstractEventRegattaPlace getPlaceForRegatta(String regattaId);
|
||||
AbstractEventRegattaPlace getPlaceForRegattaRaces(String regattaId);
|
||||
|
||||
-13
@@ -1,9 +1,7 @@
|
||||
package com.sap.sailing.gwt.home.mobile.app;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.place.shared.Place;
|
||||
import com.google.gwt.place.shared.PlaceController;
|
||||
import com.google.gwt.user.client.rpc.ServiceDefTarget;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.google.web.bindery.event.shared.SimpleEventBus;
|
||||
import com.sap.sailing.gwt.home.communication.SailingDispatchSystem;
|
||||
@@ -15,12 +13,8 @@ import com.sap.sailing.gwt.home.shared.partials.busy.BusyViewImpl;
|
||||
import com.sap.sailing.gwt.home.shared.places.searchresult.SearchResultClientFactory;
|
||||
import com.sap.sailing.gwt.home.shared.places.searchresult.SearchResultView;
|
||||
import com.sap.sailing.gwt.home.shared.places.start.StartPlace;
|
||||
import com.sap.sailing.gwt.ui.client.HomeService;
|
||||
import com.sap.sailing.gwt.ui.client.HomeServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.RemoteServiceMappingConstants;
|
||||
import com.sap.sailing.gwt.ui.client.refresh.BusyView;
|
||||
import com.sap.sailing.gwt.ui.client.refresh.ErrorAndBusyClientFactory;
|
||||
import com.sap.sse.gwt.client.EntryPointHelper;
|
||||
import com.sap.sse.gwt.client.mvp.ErrorView;
|
||||
import com.sap.sse.security.ui.client.SecureClientFactoryImpl;
|
||||
|
||||
@@ -30,7 +24,6 @@ import com.sap.sse.security.ui.client.SecureClientFactoryImpl;
|
||||
*
|
||||
*/
|
||||
public class MobileApplicationClientFactory extends SecureClientFactoryImpl implements ErrorAndBusyClientFactory, SearchResultClientFactory {
|
||||
private final HomeServiceAsync homeService;
|
||||
private final MobilePlacesNavigator navigator;
|
||||
private final SailingDispatchSystem dispatch = new SailingDispatchSystemImpl();
|
||||
|
||||
@@ -54,18 +47,12 @@ public class MobileApplicationClientFactory extends SecureClientFactoryImpl impl
|
||||
PlaceController placeController, final MobilePlacesNavigator navigator) {
|
||||
super(root, eventBus, placeController);
|
||||
this.navigator = navigator;
|
||||
this.homeService = GWT.create(HomeService.class);
|
||||
EntryPointHelper.registerASyncService((ServiceDefTarget) homeService, RemoteServiceMappingConstants.homeServiceRemotePath);
|
||||
}
|
||||
|
||||
public MobilePlacesNavigator getNavigator() {
|
||||
return navigator;
|
||||
}
|
||||
|
||||
public HomeServiceAsync getHomeService() {
|
||||
return homeService;
|
||||
}
|
||||
|
||||
public SailingDispatchSystem getDispatch() {
|
||||
return dispatch;
|
||||
}
|
||||
|
||||
+12
-1
@@ -16,6 +16,7 @@ import com.sap.sailing.gwt.home.communication.event.news.NewsEntryDTO;
|
||||
import com.sap.sailing.gwt.home.communication.eventview.EventViewDTO;
|
||||
import com.sap.sailing.gwt.home.communication.eventview.EventViewDTO.EventType;
|
||||
import com.sap.sailing.gwt.home.communication.eventview.RegattaMetadataDTO;
|
||||
import com.sap.sailing.gwt.home.communication.media.GetMediaForEventAction;
|
||||
import com.sap.sailing.gwt.home.communication.media.MediaDTO;
|
||||
import com.sap.sailing.gwt.home.desktop.places.event.multiregatta.mediatab.MultiregattaMediaPlace;
|
||||
import com.sap.sailing.gwt.home.desktop.places.event.regatta.leaderboardtab.RegattaLeaderboardPlace;
|
||||
@@ -25,6 +26,7 @@ import com.sap.sailing.gwt.home.desktop.places.event.regatta.racestab.RegattaRac
|
||||
import com.sap.sailing.gwt.home.mobile.app.MobileApplicationClientFactory;
|
||||
import com.sap.sailing.gwt.home.mobile.places.event.EventViewBase.Presenter;
|
||||
import com.sap.sailing.gwt.home.mobile.places.event.minileaderboard.MiniLeaderboardPlace;
|
||||
import com.sap.sailing.gwt.home.mobile.places.event.overview.AbstractEventOverview;
|
||||
import com.sap.sailing.gwt.home.mobile.places.series.minileaderboard.SeriesMiniOverallLeaderboardPlace;
|
||||
import com.sap.sailing.gwt.home.shared.app.ActivityCallback;
|
||||
import com.sap.sailing.gwt.home.shared.app.PlaceNavigation;
|
||||
@@ -97,9 +99,18 @@ public abstract class AbstractEventActivity<PLACE extends AbstractEventPlace> ex
|
||||
return sortedRegattas;
|
||||
}
|
||||
|
||||
protected final void initMedia(final AbstractEventOverview view) {
|
||||
this.initMedia(new MediaCallback() {
|
||||
@Override
|
||||
public void onSuccess(MediaDTO result) {
|
||||
view.setMediaForImpressions(result.getPhotos().size(), result.getVideos().size(), result.getPhotos());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected final void initMedia(final MediaCallback callback) {
|
||||
if (eventDTO.isHasMedia()) {
|
||||
clientFactory.getHomeService().getMediaForEvent(eventDTO.getId(),
|
||||
clientFactory.getDispatch().execute(new GetMediaForEventAction(eventDTO.getId()),
|
||||
new ActivityCallback<MediaDTO>(clientFactory, panel) {
|
||||
@Override
|
||||
public void onSuccess(MediaDTO result) {
|
||||
|
||||
+1
-7
@@ -1,7 +1,6 @@
|
||||
package com.sap.sailing.gwt.home.mobile.places.event.overview.multiregatta;
|
||||
|
||||
import com.sap.sailing.gwt.home.communication.eventview.EventViewDTO;
|
||||
import com.sap.sailing.gwt.home.communication.media.MediaDTO;
|
||||
import com.sap.sailing.gwt.home.mobile.app.MobileApplicationClientFactory;
|
||||
import com.sap.sailing.gwt.home.mobile.places.event.AbstractEventActivity;
|
||||
import com.sap.sailing.gwt.home.mobile.places.event.EventViewBase;
|
||||
@@ -19,12 +18,7 @@ public class MultiRegattaActivity extends AbstractEventActivity<AbstractEventPla
|
||||
final AbstractEventOverview view = new MultiRegattaViewImpl(this);
|
||||
initSailorInfo(view);
|
||||
initQuickfinder(view, true);
|
||||
initMedia(new MediaCallback() {
|
||||
@Override
|
||||
public void onSuccess(MediaDTO result) {
|
||||
view.setMediaForImpressions(result.getPhotos().size(), result.getVideos().size(), result.getPhotos());
|
||||
}
|
||||
});
|
||||
initMedia(view);
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
+1
-7
@@ -1,7 +1,6 @@
|
||||
package com.sap.sailing.gwt.home.mobile.places.event.overview.regatta;
|
||||
|
||||
import com.sap.sailing.gwt.home.communication.eventview.EventViewDTO;
|
||||
import com.sap.sailing.gwt.home.communication.media.MediaDTO;
|
||||
import com.sap.sailing.gwt.home.desktop.places.event.regatta.overviewtab.RegattaOverviewPlace;
|
||||
import com.sap.sailing.gwt.home.mobile.app.MobileApplicationClientFactory;
|
||||
import com.sap.sailing.gwt.home.mobile.places.event.AbstractEventActivity;
|
||||
@@ -20,12 +19,7 @@ public class RegattaActivity extends AbstractEventActivity<RegattaOverviewPlace>
|
||||
initSeriesNavigation(view);
|
||||
initQuickfinder(view, true);
|
||||
if (!isMultiRegattaEvent()) {
|
||||
initMedia(new MediaCallback() {
|
||||
@Override
|
||||
public void onSuccess(MediaDTO result) {
|
||||
view.setMediaForImpressions(result.getPhotos().size(), result.getVideos().size(), result.getPhotos());
|
||||
}
|
||||
});
|
||||
initMedia(view);
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
-68
@@ -1,68 +0,0 @@
|
||||
package com.sap.sailing.gwt.server;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.util.tracker.ServiceTracker;
|
||||
|
||||
import com.sap.sailing.domain.base.Event;
|
||||
import com.sap.sailing.gwt.home.communication.event.EventReferenceDTO;
|
||||
import com.sap.sailing.gwt.home.communication.media.MediaDTO;
|
||||
import com.sap.sailing.gwt.home.communication.media.SailingImageDTO;
|
||||
import com.sap.sailing.gwt.home.communication.media.SailingVideoDTO;
|
||||
import com.sap.sailing.gwt.ui.client.HomeService;
|
||||
import com.sap.sailing.gwt.ui.server.Activator;
|
||||
import com.sap.sailing.gwt.ui.server.ProxiedRemoteServiceServlet;
|
||||
import com.sap.sailing.gwt.ui.shared.media.MediaConstants;
|
||||
import com.sap.sailing.server.RacingEventService;
|
||||
import com.sap.sse.common.media.ImageDescriptor;
|
||||
import com.sap.sse.common.media.MimeType;
|
||||
import com.sap.sse.common.media.VideoDescriptor;
|
||||
import com.sap.sse.util.ServiceTrackerFactory;
|
||||
|
||||
/**
|
||||
* The server side implementation of the RPC service.
|
||||
*/
|
||||
public class HomeServiceImpl extends ProxiedRemoteServiceServlet implements HomeService {
|
||||
private static final long serialVersionUID = 3947782997746039939L;
|
||||
|
||||
private final ServiceTracker<RacingEventService, RacingEventService> racingEventServiceTracker;
|
||||
|
||||
public HomeServiceImpl() {
|
||||
BundleContext context = Activator.getDefault();
|
||||
|
||||
racingEventServiceTracker = ServiceTrackerFactory.createAndOpen(context, RacingEventService.class);
|
||||
}
|
||||
|
||||
protected RacingEventService getService() {
|
||||
return racingEventServiceTracker.getService();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MediaDTO getMediaForEvent(UUID eventId) {
|
||||
Event event = getService().getEvent(eventId);
|
||||
EventReferenceDTO eventRef = new EventReferenceDTO(event);
|
||||
|
||||
String eventName = event.getName();
|
||||
MediaDTO media = new MediaDTO();
|
||||
for(ImageDescriptor image : HomeServiceUtil.getPhotoGalleryImages(event)) {
|
||||
SailingImageDTO imageDTO = new SailingImageDTO(eventRef, image.getURL().toString(), image.getCreatedAtDate().asDate());
|
||||
imageDTO.setSizeInPx(image.getWidthInPx(), image.getHeightInPx());
|
||||
imageDTO.setTitle(image.getTitle() != null ? image.getTitle(): eventName);
|
||||
imageDTO.setSubtitle(image.getSubtitle());
|
||||
imageDTO.setTags(image.getTags());
|
||||
imageDTO.setCopyright(image.getCopyright());
|
||||
imageDTO.setLocale(image.getLocale() != null ? image.getLocale().toString() : null);
|
||||
media.addPhoto(imageDTO);
|
||||
}
|
||||
for(VideoDescriptor video : event.getVideos()) {
|
||||
MimeType type = video.getMimeType();
|
||||
if (MediaConstants.SUPPORTED_VIDEO_TYPES.contains(type)) {
|
||||
SailingVideoDTO videoDTO = HomeServiceUtil.toSailingVideoDTO(eventRef, video);
|
||||
media.addVideo(videoDTO);
|
||||
}
|
||||
}
|
||||
return media;
|
||||
}
|
||||
|
||||
}
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
package com.sap.sailing.gwt.ui.client;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import com.google.gwt.user.client.rpc.RemoteService;
|
||||
import com.sap.sailing.gwt.home.communication.media.MediaDTO;
|
||||
|
||||
public interface HomeService extends RemoteService {
|
||||
MediaDTO getMediaForEvent(UUID eventId);
|
||||
}
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
package com.sap.sailing.gwt.ui.client;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sap.sailing.gwt.home.communication.media.MediaDTO;
|
||||
|
||||
|
||||
/**
|
||||
* The async counterpart of {@link HomeService}
|
||||
*/
|
||||
public interface HomeServiceAsync {
|
||||
void getMediaForEvent(UUID eventId, AsyncCallback<MediaDTO> callback);
|
||||
}
|
||||
-2
@@ -22,8 +22,6 @@ public interface RemoteServiceMappingConstants {
|
||||
|
||||
public static final String serverConfigurationServiceRemotePath = "service/serverconfiguration";
|
||||
|
||||
public static final String homeServiceRemotePath = "service/home";
|
||||
|
||||
public static final String simulatorServiceRemotePath = "service/simulator";
|
||||
|
||||
public static final String dataMiningServiceRemotePath = "service/datamining";
|
||||
|
||||
-2
@@ -14,8 +14,6 @@ import com.sap.sse.security.ui.client.UserService;
|
||||
public interface SailingClientFactory extends ClientFactory {
|
||||
SailingServiceAsync getSailingService();
|
||||
|
||||
HomeServiceAsync getHomeService();
|
||||
|
||||
MediaServiceAsync getMediaService();
|
||||
|
||||
UserManagementServiceAsync getUserManagementService();
|
||||
|
||||
Reference in New Issue
Block a user