mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-25 06:58:39 +00:00
deleted filestorage.ui bundle, and added filestorage UI in c.s.s.gwt.ui
This commit is contained in:
@@ -58,7 +58,6 @@
|
||||
<plugin id="com.sap.sailing.xmlexport" autoStart="true" startLevel="4" />
|
||||
<plugin id="com.sap.sailing.xrr.resultimport" autoStart="true" startLevel="3" />
|
||||
<plugin id="com.sap.sse.filestorage" autoStart="true" startLevel="4" />
|
||||
<plugin id="com.sap.sse.filestorage.ui" autoStart="true" startLevel="6" />
|
||||
<plugin id="com.sap.sse.replication" autoStart="true" startLevel="4" />
|
||||
<plugin id="com.sap.sse.security.ui" autoStart="true" startLevel="5" />
|
||||
<plugin id="com.sap.sse.security.userstore.mongodb" autoStart="true" startLevel="3" />
|
||||
|
||||
@@ -402,10 +402,4 @@ Computes leaderboard information for sailing races and offers RESTful APIs to al
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="com.sap.sse.filestorage.ui"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"/>
|
||||
|
||||
</feature>
|
||||
|
||||
@@ -44,7 +44,8 @@ Require-Bundle: com.sap.sailing.domain,
|
||||
com.sap.sse.gwt.adminconsole,
|
||||
com.sap.sse.operationaltransformation,
|
||||
com.sap.sse,
|
||||
com.sap.sse.security.common
|
||||
com.sap.sse.security.common,
|
||||
com.sap.sse.filestorage;bundle-version="1.0.0"
|
||||
Bundle-Activator: com.sap.sailing.gwt.ui.server.Activator
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Import-Package: com.sap.sailing.polars,
|
||||
|
||||
+27
@@ -88,6 +88,8 @@ import com.sap.sse.common.NoCorrespondingServiceRegisteredException;
|
||||
import com.sap.sse.common.Util;
|
||||
import com.sap.sse.common.Util.Pair;
|
||||
import com.sap.sse.common.search.KeywordQuery;
|
||||
import com.sap.sse.filestorage.dto.FileStorageServiceDTO;
|
||||
import com.sap.sse.filestorage.dto.PropertyErrors;
|
||||
|
||||
/**
|
||||
* The client side stub for the RPC service. Usually, when a <code>null</code> date is passed to
|
||||
@@ -574,4 +576,29 @@ public interface SailingService extends RemoteService {
|
||||
|
||||
List<DeviceMappingDTO> getDeviceMappingsFromLogHierarchy(String leaderboardName, String raceColumnName,
|
||||
String fleetName) throws TransformationException;
|
||||
|
||||
FileStorageServiceDTO[] getAvailableFileStorageServices();
|
||||
|
||||
/**
|
||||
* @throws NoCorrespondingServiceRegisteredException service may have disappeared from registry in the meantime
|
||||
* @return only a service with valid properties can be selected for usage
|
||||
*/
|
||||
PropertyErrors testFileStorageServiceProperties(String serviceName) throws NoCorrespondingServiceRegisteredException;
|
||||
|
||||
/**
|
||||
* @throws NoCorrespondingServiceRegisteredException service may have disappeared from registry in the meantime
|
||||
* @return only a service with valid properties can be selected for usage
|
||||
*/
|
||||
PropertyErrors setActiveFileStorageService(String serviceName) throws NoCorrespondingServiceRegisteredException;
|
||||
|
||||
/**
|
||||
* @return may be {@code null}
|
||||
*/
|
||||
String getActiveFileStorageServiceName();
|
||||
|
||||
/**
|
||||
* @throws NoCorrespondingServiceRegisteredException service may have disappeared from registry in the meantime
|
||||
* @throws IllegalArgumentException if the property with name {@code propertyName} doesn't exist for the service
|
||||
*/
|
||||
void setFileStorageServiceProperties(String serviceName, Map<String, String> properties);
|
||||
}
|
||||
|
||||
+14
-1
@@ -76,6 +76,8 @@ import com.sap.sailing.gwt.ui.shared.WindDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.WindInfoForRaceDTO;
|
||||
import com.sap.sse.common.Util;
|
||||
import com.sap.sse.common.search.KeywordQuery;
|
||||
import com.sap.sse.filestorage.dto.FileStorageServiceDTO;
|
||||
import com.sap.sse.filestorage.dto.PropertyErrors;
|
||||
import com.sap.sse.gwt.client.BuildVersionRetriever;
|
||||
|
||||
/**
|
||||
@@ -683,6 +685,17 @@ public interface SailingServiceAsync extends BuildVersionRetriever {
|
||||
void getRegattas(String manage2SailJsonUrl, AsyncCallback<Iterable<RegattaDTO>> asyncCallback);
|
||||
|
||||
void createRegattaStructure(Iterable<RegattaDTO> regattaNames,
|
||||
EventDTO newEvent, AsyncCallback<Void> asyncCallback);
|
||||
EventDTO newEvent, AsyncCallback<Void> asyncCallback);
|
||||
|
||||
void setFileStorageServiceProperties(String serviceName, Map<String, String> properties,
|
||||
AsyncCallback<Void> callback);
|
||||
|
||||
void getAvailableFileStorageServices(AsyncCallback<FileStorageServiceDTO[]> callback);
|
||||
|
||||
void testFileStorageServiceProperties(String serviceName, AsyncCallback<PropertyErrors> callback);
|
||||
|
||||
void setActiveFileStorageService(String serviceName, AsyncCallback<PropertyErrors> callback);
|
||||
|
||||
void getActiveFileStorageServiceName(AsyncCallback<String> callback);
|
||||
|
||||
}
|
||||
|
||||
+2
@@ -1134,4 +1134,6 @@ public interface StringMessages extends com.sap.sse.gwt.client.StringMessages {
|
||||
String active();
|
||||
String errorTryingToRegisterRacesForTracking(String raceNames, String message);
|
||||
String errorDeterminingPolarAvailability(String raceName, String message);
|
||||
String error();
|
||||
String setAsActive();
|
||||
}
|
||||
|
||||
+3
-1
@@ -1116,4 +1116,6 @@ noFleetsDefined=No fleets defined.
|
||||
successfullyCreatedRegattas=Successfully created regattas
|
||||
active=Active
|
||||
errorTryingToRegisterRacesForTracking=Error trying to register races {0} for tracking: {1}. Check live/stored URI syntax.
|
||||
errorDeterminingPolarAvailability=Error determining availability of polar / VPP data for race {0}: {1}
|
||||
errorDeterminingPolarAvailability=Error determining availability of polar / VPP data for race {0}: {1}
|
||||
error=Error
|
||||
setAsActive=Set as active
|
||||
+3
-1
@@ -1105,4 +1105,6 @@ noFleetsDefined=Keine Gruppen definiert.
|
||||
successfullyCreatedRegattas=Regatten erfolgreich angelegt
|
||||
active=Aktiv
|
||||
errorTryingToRegisterRacesForTracking=Fehler beim Versuch, die Wettfahrten {0} zum Tracking zu registrieren: {1}. Live/stored URI syntax prüfen.
|
||||
errorDeterminingPolarAvailability=Fehler bei der Verfügbarkeitsprüfung für Polardaten für Wettfahrt {0}: {1}
|
||||
errorDeterminingPolarAvailability=Fehler bei der Verfügbarkeitsprüfung für Polardaten für Wettfahrt {0}: {1}
|
||||
error=Fehler
|
||||
setAsActive=Aktiv setzen
|
||||
+261
@@ -0,0 +1,261 @@
|
||||
package com.sap.sailing.gwt.ui.client.filestorage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.gwt.cell.client.FieldUpdater;
|
||||
import com.google.gwt.cell.client.TextInputCell;
|
||||
import com.google.gwt.core.client.Callback;
|
||||
import com.google.gwt.event.dom.client.ChangeEvent;
|
||||
import com.google.gwt.event.dom.client.ChangeHandler;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.user.cellview.client.CellTable;
|
||||
import com.google.gwt.user.cellview.client.Column;
|
||||
import com.google.gwt.user.cellview.client.TextColumn;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.CaptionPanel;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.ListBox;
|
||||
import com.google.gwt.view.client.ListDataProvider;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sse.filestorage.dto.FileStorageServiceDTO;
|
||||
import com.sap.sse.filestorage.dto.PropertyDTO;
|
||||
import com.sap.sse.filestorage.dto.PropertyErrors;
|
||||
import com.sap.sse.gwt.client.ErrorReporter;
|
||||
|
||||
public class FileStoragePanel extends FlowPanel {
|
||||
private final SailingServiceAsync sailingService;
|
||||
private final ErrorReporter errorReporter;
|
||||
|
||||
private final Label activeServiceLabel;
|
||||
private final ListBox servicesListBox;
|
||||
private CellTable<PropertyDTO> propertiesTable;
|
||||
private final Label serviceDescriptionLabel;
|
||||
|
||||
private final List<PropertyDTO> properties = new ArrayList<>();
|
||||
private final Map<String, FileStorageServiceDTO> availableServices = new HashMap<>();
|
||||
private final Map<PropertyDTO, String> perPropertyErros = new HashMap<>();
|
||||
|
||||
public FileStoragePanel(SailingServiceAsync sailingService, ErrorReporter errorReporter,
|
||||
StringMessages stringMessages) {
|
||||
this.sailingService = sailingService;
|
||||
this.errorReporter = errorReporter;
|
||||
|
||||
Button refreshButton = new Button(stringMessages.refresh());
|
||||
refreshButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
refresh();
|
||||
}
|
||||
});
|
||||
add(refreshButton);
|
||||
|
||||
CaptionPanel activeServicePanel = new CaptionPanel(stringMessages.active());
|
||||
activeServiceLabel = new Label();
|
||||
activeServicePanel.add(activeServiceLabel);
|
||||
add(activeServicePanel);
|
||||
|
||||
CaptionPanel editServicePanel = new CaptionPanel(stringMessages.edit());
|
||||
servicesListBox = new ListBox();
|
||||
servicesListBox.addChangeHandler(new ChangeHandler() {
|
||||
@Override
|
||||
public void onChange(ChangeEvent event) {
|
||||
onServiceSelectionChanged();
|
||||
}
|
||||
});
|
||||
editServicePanel.add(servicesListBox);
|
||||
|
||||
serviceDescriptionLabel = new Label();
|
||||
editServicePanel.add(serviceDescriptionLabel);
|
||||
|
||||
propertiesTable = new CellTable<>();
|
||||
ListDataProvider<PropertyDTO> propertiesListDataProvider = new ListDataProvider<>(properties);
|
||||
propertiesListDataProvider.addDataDisplay(propertiesTable);
|
||||
|
||||
TextColumn<PropertyDTO> nameColumn = new TextColumn<PropertyDTO>() {
|
||||
@Override
|
||||
public String getValue(PropertyDTO p) {
|
||||
return p.name;
|
||||
}
|
||||
};
|
||||
propertiesTable.addColumn(nameColumn, stringMessages.name());
|
||||
|
||||
Column<PropertyDTO, String> inputColumn = new Column<PropertyDTO, String>(new TextInputCell()) {
|
||||
@Override
|
||||
public String getValue(PropertyDTO object) {
|
||||
return object.value;
|
||||
}
|
||||
};
|
||||
inputColumn.setFieldUpdater(new FieldUpdater<PropertyDTO, String>() {
|
||||
@Override
|
||||
public void update(int index, PropertyDTO object, String value) {
|
||||
object.value = value;
|
||||
}
|
||||
});
|
||||
propertiesTable.addColumn(inputColumn, stringMessages.value());
|
||||
|
||||
TextColumn<PropertyDTO> descriptionColumn = new TextColumn<PropertyDTO>() {
|
||||
@Override
|
||||
public String getValue(PropertyDTO p) {
|
||||
return p.description;
|
||||
}
|
||||
};
|
||||
propertiesTable.addColumn(descriptionColumn, stringMessages.description());
|
||||
|
||||
TextColumn<PropertyDTO> errorColumn = new TextColumn<PropertyDTO>() {
|
||||
@Override
|
||||
public String getValue(PropertyDTO p) {
|
||||
String error = perPropertyErros.get(p);
|
||||
return error == null ? "" : error;
|
||||
}
|
||||
};
|
||||
propertiesTable.addColumn(errorColumn, stringMessages.error());
|
||||
|
||||
editServicePanel.add(propertiesTable);
|
||||
|
||||
HorizontalPanel buttonsPanel = new HorizontalPanel();
|
||||
|
||||
Button saveAndTestPropertiesButton = new Button(stringMessages.save());
|
||||
saveAndTestPropertiesButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
saveAndTestProperties(null);
|
||||
}
|
||||
});
|
||||
buttonsPanel.add(saveAndTestPropertiesButton);
|
||||
|
||||
Button setAsActiveServiceButton = new Button(stringMessages.setAsActive());
|
||||
saveAndTestPropertiesButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
setAsActiveService();
|
||||
}
|
||||
});
|
||||
buttonsPanel.add(setAsActiveServiceButton);
|
||||
|
||||
editServicePanel.add(buttonsPanel);
|
||||
|
||||
add(editServicePanel);
|
||||
}
|
||||
|
||||
private String getSelectedServiceName() {
|
||||
return servicesListBox.getItemText(servicesListBox.getSelectedIndex());
|
||||
}
|
||||
|
||||
private void saveAndTestProperties(final Callback<Void, Void> callback) {
|
||||
Map<String, String> values = new HashMap<String, String>();
|
||||
for (PropertyDTO p : properties) {
|
||||
values.put(p.name, p.value);
|
||||
}
|
||||
perPropertyErros.clear();
|
||||
sailingService.setFileStorageServiceProperties(getSelectedServiceName(), values, new AsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
sailingService.testFileStorageServiceProperties(getSelectedServiceName(),
|
||||
new AsyncCallback<PropertyErrors>() {
|
||||
@Override
|
||||
public void onSuccess(PropertyErrors result) {
|
||||
if (result != null) {
|
||||
perPropertyErros.putAll(result.perPropertyMessages);
|
||||
}
|
||||
propertiesTable.redraw();
|
||||
if (callback != null) {
|
||||
callback.onSuccess(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError("Could not test properties: " + caught.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError("Could not set service properties: " + caught.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setAsActiveService() {
|
||||
saveAndTestProperties(new Callback<Void, Void>() {
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
sailingService.setActiveFileStorageService(getSelectedServiceName(), new AsyncCallback<PropertyErrors>() {
|
||||
@Override
|
||||
public void onSuccess(PropertyErrors result) {
|
||||
refresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError("Could not set new active service: " + caught.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Void reason) {
|
||||
Window.alert("Cannot activate service with errors");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void onServiceSelectionChanged() {
|
||||
properties.clear();
|
||||
perPropertyErros.clear();
|
||||
serviceDescriptionLabel.setText("");
|
||||
FileStorageServiceDTO selected = availableServices.get(getSelectedServiceName());
|
||||
if (selected == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
serviceDescriptionLabel.setText(selected.description);
|
||||
properties.addAll(Arrays.asList(selected.properties));
|
||||
}
|
||||
|
||||
private void refresh() {
|
||||
servicesListBox.clear();
|
||||
servicesListBox.addItem("");
|
||||
availableServices.clear();
|
||||
onServiceSelectionChanged();
|
||||
|
||||
sailingService.getActiveFileStorageServiceName(new AsyncCallback<String>() {
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
activeServiceLabel.setText(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError("Could not load active file storage service: " + caught.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
sailingService.getAvailableFileStorageServices(new AsyncCallback<FileStorageServiceDTO[]>() {
|
||||
@Override
|
||||
public void onSuccess(FileStorageServiceDTO[] result) {
|
||||
for (FileStorageServiceDTO service : result) {
|
||||
availableServices.put(service.name, service);
|
||||
servicesListBox.addItem(service.name);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError("Could not load available file storage services: " + caught.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
+50
@@ -419,6 +419,10 @@ import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
import com.sap.sse.common.impl.TimeRangeImpl;
|
||||
import com.sap.sse.common.search.KeywordQuery;
|
||||
import com.sap.sse.common.search.Result;
|
||||
import com.sap.sse.filestorage.FileStorageService;
|
||||
import com.sap.sse.filestorage.InvalidPropertiesException;
|
||||
import com.sap.sse.filestorage.dto.FileStorageServiceDTO;
|
||||
import com.sap.sse.filestorage.dto.PropertyErrors;
|
||||
import com.sap.sse.replication.OperationWithResult;
|
||||
import com.sap.sse.replication.ReplicationFactory;
|
||||
import com.sap.sse.replication.ReplicationMasterDescriptor;
|
||||
@@ -5420,4 +5424,50 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private FileStorageService getFileStorageService(String name) {
|
||||
return getService().getFileStorageManagementService().getFileStorageService(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileStorageServiceDTO[] getAvailableFileStorageServices() {
|
||||
List<FileStorageServiceDTO> serviceDtos = new ArrayList<>();
|
||||
for (FileStorageService s : getService().getFileStorageManagementService().getAvailableFileStorageServices()) {
|
||||
serviceDtos.add(FileStorageServiceDTO.convert(s));
|
||||
}
|
||||
return serviceDtos.toArray(new FileStorageServiceDTO[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFileStorageServiceProperties(String serviceName, Map<String, String> properties) {
|
||||
for (Entry<String, String> p : properties.entrySet()) {
|
||||
getService().getFileStorageManagementService()
|
||||
.setFileStorageServiceProperty(serviceName, p.getKey(), p.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PropertyErrors testFileStorageServiceProperties(String serviceName) {
|
||||
try {
|
||||
getFileStorageService(serviceName).testProperties();
|
||||
} catch (InvalidPropertiesException e) {
|
||||
return new PropertyErrors(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PropertyErrors setActiveFileStorageService(String serviceName) {
|
||||
try {
|
||||
getService().getFileStorageManagementService().setActiveFileStorageService(getFileStorageService(serviceName));
|
||||
} catch (InvalidPropertiesException e) {
|
||||
return new PropertyErrors(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getActiveFileStorageServiceName() {
|
||||
return getService().getFileStorageManagementService().getActiveFileStorageService().getName();
|
||||
}
|
||||
}
|
||||
|
||||
+4
-2
@@ -32,8 +32,10 @@
|
||||
<inherits name="com.sap.sailing.domain.SailingDomain" />
|
||||
<inherits name="com.sap.sse.gwt.AdminConsole" />
|
||||
<inherits name="com.sap.sse.security.ui.LoginPanel" />
|
||||
<inherits name="com.sap.sse.Security" />
|
||||
|
||||
<inherits name="com.sap.sse.Security" />
|
||||
|
||||
<inherits name="com.sap.sse.filestorage.FileStorage" />
|
||||
|
||||
<!-- Fancy DateTimePicker (without the rest of Bootstrap!) -->
|
||||
<!-- GWT-Bootstrap License: Apache License, Version 2.0 -->
|
||||
<inherits name="com.github.gwtbootstrap.BootstrapNoResources" />
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ public class TeamImageTest extends AbstractJaxRsApiTest {
|
||||
super.setUp();
|
||||
racingEventService = spy(racingEventService);
|
||||
storageService = AmazonS3TestSupport.createService();
|
||||
doReturn(storageService).when(racingEventService).getFileStorageService();
|
||||
doReturn(storageService).when(racingEventService).getActiveFileStorageService();
|
||||
DynamicTeam team = new TeamImpl(null, Collections.singleton(new PersonImpl(null, new NationalityImpl(
|
||||
nationality), null, null)), null);
|
||||
DynamicBoat boat = new BoatImpl(null, new BoatClassImpl(boatClassName, false), sailID);
|
||||
|
||||
+1
-1
@@ -124,7 +124,7 @@ public class CompetitorsResource extends AbstractSailingServerResource {
|
||||
.entity("Image is larger than " + MAX_SIZE_IN_MB + "MB").build());
|
||||
}
|
||||
|
||||
imageUri = getService().getFileStorageService().storeFile(uploadedInputStream, fileName, sizeInBytes);
|
||||
imageUri = getService().getActiveFileStorageService().storeFile(uploadedInputStream, fileName, sizeInBytes);
|
||||
} catch (IOException | OperationFailedException | InvalidPropertiesException e) {
|
||||
logger.log(Level.WARNING, "Could not store competitor image", e);
|
||||
throw new WebApplicationException(Response.status(Status.INTERNAL_SERVER_ERROR)
|
||||
|
||||
@@ -64,6 +64,7 @@ import com.sap.sailing.domain.tracking.TrackerManager;
|
||||
import com.sap.sailing.domain.tracking.WindStore;
|
||||
import com.sap.sailing.polars.PolarDataService;
|
||||
import com.sap.sailing.server.masterdata.DataImportLockWithProgress;
|
||||
import com.sap.sse.common.NoCorrespondingServiceRegisteredException;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.TypeBasedServiceFinderFactory;
|
||||
import com.sap.sse.common.Util;
|
||||
@@ -71,6 +72,7 @@ import com.sap.sse.common.Util.Triple;
|
||||
import com.sap.sse.common.search.KeywordQuery;
|
||||
import com.sap.sse.common.search.Result;
|
||||
import com.sap.sse.common.search.Searchable;
|
||||
import com.sap.sse.filestorage.FileStorageManagementService;
|
||||
import com.sap.sse.filestorage.FileStorageService;
|
||||
import com.sap.sse.replication.impl.ReplicableWithObjectInputStream;
|
||||
|
||||
@@ -577,7 +579,9 @@ public interface RacingEventService extends TrackedRegattaRegistry, RegattaFetch
|
||||
|
||||
/**
|
||||
* Get the currently configured {@link FileStorageService}.
|
||||
* @return may be {@code null} if no service is correctly configured.
|
||||
* @throws NoCorrespondingServiceRegisteredException if no service has been activated
|
||||
*/
|
||||
FileStorageService getFileStorageService();
|
||||
FileStorageService getActiveFileStorageService() throws NoCorrespondingServiceRegisteredException;
|
||||
|
||||
FileStorageManagementService getFileStorageManagementService();
|
||||
}
|
||||
|
||||
+48
-37
@@ -201,6 +201,7 @@ import com.sap.sse.common.search.Result;
|
||||
import com.sap.sse.common.search.ResultImpl;
|
||||
import com.sap.sse.concurrent.LockUtil;
|
||||
import com.sap.sse.concurrent.NamedReentrantReadWriteLock;
|
||||
import com.sap.sse.filestorage.FileStorageManagementService;
|
||||
import com.sap.sse.filestorage.FileStorageService;
|
||||
import com.sap.sse.replication.OperationExecutionListener;
|
||||
import com.sap.sse.replication.OperationWithResult;
|
||||
@@ -359,14 +360,15 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
|
||||
private TypeBasedServiceFinderFactory serviceFinderFactory;
|
||||
|
||||
/**
|
||||
* The master from which this replicable is currently replicating, or <code>null</code> if this replicable is not currently
|
||||
* replicated from any master.
|
||||
* The master from which this replicable is currently replicating, or <code>null</code> if this replicable is not
|
||||
* currently replicated from any master.
|
||||
*/
|
||||
private ReplicationMasterDescriptor replicatingFromMaster;
|
||||
|
||||
|
||||
private Set<OperationWithResultWithIdWrapper<?, ?>> operationsSentToMasterForReplication;
|
||||
|
||||
private ThreadLocal<Boolean> currentlyFillingFromInitialLoadOrApplyingOperationReceivedFromMaster = ThreadLocal.withInitial(() -> false);
|
||||
|
||||
private ThreadLocal<Boolean> currentlyFillingFromInitialLoadOrApplyingOperationReceivedFromMaster = ThreadLocal
|
||||
.withInitial(() -> false);
|
||||
|
||||
/**
|
||||
* Constructs a {@link DomainFactory base domain factory} that uses this object's {@link #competitorStore competitor
|
||||
@@ -532,8 +534,10 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCurrentlyFillingFromInitialLoadOrApplyingOperationReceivedFromMaster(boolean currentlyFillingFromInitialLoadOrApplyingOperationReceivedFromMaster) {
|
||||
this.currentlyFillingFromInitialLoadOrApplyingOperationReceivedFromMaster.set(currentlyFillingFromInitialLoadOrApplyingOperationReceivedFromMaster);
|
||||
public void setCurrentlyFillingFromInitialLoadOrApplyingOperationReceivedFromMaster(
|
||||
boolean currentlyFillingFromInitialLoadOrApplyingOperationReceivedFromMaster) {
|
||||
this.currentlyFillingFromInitialLoadOrApplyingOperationReceivedFromMaster
|
||||
.set(currentlyFillingFromInitialLoadOrApplyingOperationReceivedFromMaster);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -680,8 +684,9 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
|
||||
int[] discardThresholds, ScoringScheme scoringScheme, Serializable courseAreaId) {
|
||||
logger.info("adding flexible leaderboard " + leaderboardName);
|
||||
CourseArea courseArea = getCourseArea(courseAreaId);
|
||||
FlexibleLeaderboard result = new FlexibleLeaderboardImpl(getRaceLogStore(), getRegattaLogStore(), leaderboardName,
|
||||
new ThresholdBasedResultDiscardingRuleImpl(discardThresholds), scoringScheme, courseArea);
|
||||
FlexibleLeaderboard result = new FlexibleLeaderboardImpl(getRaceLogStore(), getRegattaLogStore(),
|
||||
leaderboardName, new ThresholdBasedResultDiscardingRuleImpl(discardThresholds), scoringScheme,
|
||||
courseArea);
|
||||
result.setDisplayName(leaderboardDisplayName);
|
||||
if (getLeaderboardByName(leaderboardName) != null) {
|
||||
throw new IllegalArgumentException("Leaderboard with name " + leaderboardName + " already exists");
|
||||
@@ -1043,32 +1048,32 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
|
||||
public Regatta getOrCreateDefaultRegatta(String name, String boatClassName, Serializable id) {
|
||||
Regatta result = regattasByName.get(name);
|
||||
if (result == null) {
|
||||
result = new RegattaImpl(getRaceLogStore(), getRegattaLogStore(), name, getBaseDomainFactory().getOrCreateBoatClass(
|
||||
boatClassName), /*startDate*/ null, /*endDate*/ null, this, getBaseDomainFactory().createScoringScheme(ScoringSchemeType.LOW_POINT), id,
|
||||
null);
|
||||
result = new RegattaImpl(getRaceLogStore(), getRegattaLogStore(), name, getBaseDomainFactory()
|
||||
.getOrCreateBoatClass(boatClassName), /* startDate */null, /* endDate */null, this,
|
||||
getBaseDomainFactory().createScoringScheme(ScoringSchemeType.LOW_POINT), id, null);
|
||||
logger.info("Created default regatta " + result.getName() + " (" + hashCode() + ") on " + this);
|
||||
onRegattaLikeAdded(result);
|
||||
cacheAndReplicateDefaultRegatta(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private void onRegattaLikeAdded(IsRegattaLike isRegattaLike) {
|
||||
isRegattaLike.addListener(regattaLogReplicator);
|
||||
}
|
||||
|
||||
|
||||
private void onRegattaLikeRemoved(IsRegattaLike isRegattaLike) {
|
||||
isRegattaLike.removeListener(regattaLogReplicator);
|
||||
getRegattaLogStore().removeRegattaLog(isRegattaLike.getRegattaLikeIdentifier());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Regatta createRegatta(String fullRegattaName, String boatClassName, TimePoint startDate, TimePoint endDate, Serializable id,
|
||||
Iterable<? extends Series> series, boolean persistent, ScoringScheme scoringScheme,
|
||||
public Regatta createRegatta(String fullRegattaName, String boatClassName, TimePoint startDate, TimePoint endDate,
|
||||
Serializable id, Iterable<? extends Series> series, boolean persistent, ScoringScheme scoringScheme,
|
||||
Serializable defaultCourseAreaId, boolean useStartTimeInference) {
|
||||
com.sap.sse.common.Util.Pair<Regatta, Boolean> regattaWithCreatedFlag = getOrCreateRegattaWithoutReplication(
|
||||
fullRegattaName, boatClassName, startDate, endDate, id, series, persistent, scoringScheme, defaultCourseAreaId,
|
||||
useStartTimeInference);
|
||||
fullRegattaName, boatClassName, startDate, endDate, id, series, persistent, scoringScheme,
|
||||
defaultCourseAreaId, useStartTimeInference);
|
||||
Regatta regatta = regattaWithCreatedFlag.getA();
|
||||
if (regattaWithCreatedFlag.getB()) {
|
||||
onRegattaLikeAdded(regatta);
|
||||
@@ -1088,7 +1093,7 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
|
||||
logger.info("Regatta with name " + regatta.getName() + " already existed, so it hasn't been added.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private RaceLogStore getRaceLogStore() {
|
||||
return MongoRaceLogStoreFactory.INSTANCE.getMongoRaceLogStore(mongoObjectFactory, domainObjectFactory);
|
||||
}
|
||||
@@ -1099,11 +1104,13 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
|
||||
|
||||
@Override
|
||||
public com.sap.sse.common.Util.Pair<Regatta, Boolean> getOrCreateRegattaWithoutReplication(String fullRegattaName,
|
||||
String boatClassName, TimePoint startDate, TimePoint endDate, Serializable id, Iterable<? extends Series> series, boolean persistent,
|
||||
ScoringScheme scoringScheme, Serializable defaultCourseAreaId, boolean useStartTimeInference) {
|
||||
String boatClassName, TimePoint startDate, TimePoint endDate, Serializable id,
|
||||
Iterable<? extends Series> series, boolean persistent, ScoringScheme scoringScheme,
|
||||
Serializable defaultCourseAreaId, boolean useStartTimeInference) {
|
||||
CourseArea courseArea = getCourseArea(defaultCourseAreaId);
|
||||
Regatta regatta = new RegattaImpl(getRaceLogStore(), getRegattaLogStore(), fullRegattaName, getBaseDomainFactory().getOrCreateBoatClass(
|
||||
boatClassName), startDate, endDate, series, persistent, scoringScheme, id, courseArea, useStartTimeInference);
|
||||
Regatta regatta = new RegattaImpl(getRaceLogStore(), getRegattaLogStore(), fullRegattaName,
|
||||
getBaseDomainFactory().getOrCreateBoatClass(boatClassName), startDate, endDate, series, persistent,
|
||||
scoringScheme, id, courseArea, useStartTimeInference);
|
||||
boolean wasCreated = addAndConnectRegatta(persistent, defaultCourseAreaId, regatta);
|
||||
if (wasCreated) {
|
||||
logger.info("Created regatta " + regatta.getName() + " (" + hashCode() + ") on " + this);
|
||||
@@ -1585,7 +1592,7 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
|
||||
stopTrackingWind(regatta, race);
|
||||
}
|
||||
}
|
||||
raceTracker.stop(/* preemptive */ false);
|
||||
raceTracker.stop(/* preemptive */false);
|
||||
final Object trackerId = raceTracker.getID();
|
||||
final NamedReentrantReadWriteLock lock = lockRaceTrackersById(trackerId);
|
||||
try {
|
||||
@@ -1659,7 +1666,7 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
|
||||
if (trackersForRegatta != null) {
|
||||
trackersForRegatta.remove(tracker);
|
||||
}
|
||||
tracker.stop(/* preemptive */ true);
|
||||
tracker.stop(/* preemptive */true);
|
||||
final Object trackerId = tracker.getID();
|
||||
final NamedReentrantReadWriteLock lock = lockRaceTrackersById(trackerId);
|
||||
try {
|
||||
@@ -1691,7 +1698,7 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
|
||||
RaceTracker raceTracker = trackerIter.next();
|
||||
if (raceTracker.getRaces() != null && raceTracker.getRaces().contains(race)) {
|
||||
logger.info("Found tracker to stop for races " + raceTracker.getRaces());
|
||||
raceTracker.stop(/* preemptive */ false);
|
||||
raceTracker.stop(/* preemptive */false);
|
||||
trackerIter.remove();
|
||||
final Object trackerId = raceTracker.getID();
|
||||
final NamedReentrantReadWriteLock lock = lockRaceTrackersById(trackerId);
|
||||
@@ -1756,9 +1763,9 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
|
||||
}
|
||||
|
||||
@Override
|
||||
public Regatta updateRegatta(RegattaIdentifier regattaIdentifier, TimePoint startDate, TimePoint endDate, Serializable newDefaultCourseAreaId,
|
||||
RegattaConfiguration newRegattaConfiguration, Iterable<? extends Series> series,
|
||||
boolean useStartTimeInference) {
|
||||
public Regatta updateRegatta(RegattaIdentifier regattaIdentifier, TimePoint startDate, TimePoint endDate,
|
||||
Serializable newDefaultCourseAreaId, RegattaConfiguration newRegattaConfiguration,
|
||||
Iterable<? extends Series> series, boolean useStartTimeInference) {
|
||||
// We're not doing any renaming of the regatta itself, therefore we don't have to sync on the maps.
|
||||
Regatta regatta = getRegatta(regattaIdentifier);
|
||||
CourseArea newCourseArea = getCourseArea(newDefaultCourseAreaId);
|
||||
@@ -1871,7 +1878,7 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
|
||||
}
|
||||
if (!foundReachableRace) {
|
||||
// firstly stop the tracker
|
||||
raceTracker.stop(/* preemptive */ true);
|
||||
raceTracker.stop(/* preemptive */true);
|
||||
// remove it from the raceTrackers by Regatta
|
||||
trackerIter.remove();
|
||||
final Object trackerId = raceTracker.getID();
|
||||
@@ -2391,7 +2398,7 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
|
||||
final Set<RaceTracker> trackers = raceTrackersByRegatta.get(regatta.getRegatta());
|
||||
if (trackers != null) {
|
||||
for (RaceTracker tracker : trackers) {
|
||||
tracker.stop(/* preemptive */ true);
|
||||
tracker.stop(/* preemptive */true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2984,12 +2991,16 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
|
||||
public boolean hasSentOperationToMaster(OperationWithResult<RacingEventService, ?> operation) {
|
||||
return this.operationsSentToMasterForReplication.remove(operation);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public FileStorageService getFileStorageService() {
|
||||
//TODO make this configurable in the AdminConsole
|
||||
//when stopping context, also unget existing service references
|
||||
ServiceReference<FileStorageService> ref = bundleContext.getServiceReference(FileStorageService.class);
|
||||
public FileStorageService getActiveFileStorageService() {
|
||||
return getFileStorageManagementService().getActiveFileStorageService();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileStorageManagementService getFileStorageManagementService() {
|
||||
ServiceReference<FileStorageManagementService> ref = bundleContext
|
||||
.getServiceReference(FileStorageManagementService.class);
|
||||
return bundleContext.getService(ref);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ public class NoCorrespondingServiceRegisteredException extends RuntimeException
|
||||
public String serviceInterface;
|
||||
private static final long serialVersionUID = -358955216089477585L;
|
||||
|
||||
protected NoCorrespondingServiceRegisteredException() {}
|
||||
public NoCorrespondingServiceRegisteredException() {}
|
||||
|
||||
public NoCorrespondingServiceRegisteredException(String message, String type, String serviceInterface) {
|
||||
super(message);
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
|
||||
<classpathentry exported="true" kind="lib" path="WEB-INF/classes"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
@@ -1,5 +0,0 @@
|
||||
/bin
|
||||
/.gwt
|
||||
/.generated
|
||||
/gwt-unitCache
|
||||
/extras
|
||||
@@ -1,39 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.sap.sse.filestorage.ui</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>com.google.gwt.eclipse.core.gwtNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -1,5 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
jarsExcludedFromWebInfLib=
|
||||
launchConfigExternalUrlPrefix=
|
||||
warSrcDir=
|
||||
warSrcDirIsOutput=true
|
||||
@@ -1,3 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
entryPointModules=
|
||||
gwtCompileSettings=PGd3dC1jb21waWxlLXNldHRpbmdzPjxsb2ctbGV2ZWw+SU5GTzwvbG9nLWxldmVsPjxvdXRwdXQtc3R5bGU+T0JGVVNDQVRFRDwvb3V0cHV0LXN0eWxlPjxleHRyYS1hcmdzPjwhW0NEQVRBWy13YXIgLiAtbG9jYWxXb3JrZXJzIDMgLXN0cmljdCAtbG9nTGV2ZWwgVFJBQ0VdXT48L2V4dHJhLWFyZ3M+PHZtLWFyZ3M+PCFbQ0RBVEFbLVhteDIwMjRtIC1EZ3d0LnVzZWFyY2hpdmVzPWZhbHNlXV0+PC92bS1hcmdzPjxlbnRyeS1wb2ludC1tb2R1bGU+Y29tLnNhcC5zc2Uuc2VjdXJpdHkudWkuRWRpdFByb2ZpbGU8L2VudHJ5LXBvaW50LW1vZHVsZT48ZW50cnktcG9pbnQtbW9kdWxlPmNvbS5zYXAuc3NlLnNlY3VyaXR5LnVpLkVtYWlsVmFsaWRhdGlvbjwvZW50cnktcG9pbnQtbW9kdWxlPjxlbnRyeS1wb2ludC1tb2R1bGU+Y29tLnNhcC5zc2Uuc2VjdXJpdHkudWkuTG9naW48L2VudHJ5LXBvaW50LW1vZHVsZT48ZW50cnktcG9pbnQtbW9kdWxlPmNvbS5zYXAuc3NlLnNlY3VyaXR5LnVpLk9BdXRoTG9naW48L2VudHJ5LXBvaW50LW1vZHVsZT48ZW50cnktcG9pbnQtbW9kdWxlPmNvbS5zYXAuc3NlLnNlY3VyaXR5LnVpLlJlZ2lzdGVyPC9lbnRyeS1wb2ludC1tb2R1bGU+PGVudHJ5LXBvaW50LW1vZHVsZT5jb20uc2FwLnNzZS5zZWN1cml0eS51aS5Vc2VyTWFuYWdlbWVudDwvZW50cnktcG9pbnQtbW9kdWxlPjwvZ3d0LWNvbXBpbGUtc2V0dGluZ3M+
|
||||
@@ -1,2 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding//src/main/java/com/sap/sse/filestorage/ui/client/i18n/StringMessages_de.properties=UTF-8
|
||||
@@ -1,7 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
||||
@@ -1,3 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
pluginProject.extensions=false
|
||||
resolve.requirebundle=false
|
||||
@@ -1,19 +0,0 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Security
|
||||
Bundle-SymbolicName: com.sap.sse.filestorage.ui
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Vendor: SAP
|
||||
Bundle-Activator: com.sap.sse.filestorage.ui.server.Activator
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||
Import-Package: org.osgi.framework;version="1.3.0",
|
||||
org.osgi.util.tracker;version="1.5.1"
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-ClassPath: WEB-INF/classes/
|
||||
Require-Bundle: javax.servlet;bundle-version="2.5.0",
|
||||
com.sap.sse.gwt,
|
||||
com.google.gwt.osgi;bundle-version="2.6.1",
|
||||
com.sap.sse.filestorage,
|
||||
com.sap.sse.common;bundle-version="1.0.0",
|
||||
com.sap.sse.osgi;bundle-version="1.0.0"
|
||||
Web-ContextPath: /filestorage/ui
|
||||
@@ -1,2 +0,0 @@
|
||||
deploy
|
||||
classes
|
||||
@@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
||||
version="2.5">
|
||||
|
||||
<!-- Disable directory listing: -->
|
||||
<servlet>
|
||||
<servlet-name>default</servlet-name>
|
||||
<servlet-class>org.eclipse.jetty.servlet.DefaultServlet
|
||||
</servlet-class>
|
||||
<init-param>
|
||||
<param-name>dirAllowed</param-name>
|
||||
<param-value>false</param-value>
|
||||
</init-param>
|
||||
</servlet>
|
||||
|
||||
<servlet>
|
||||
<display-name>File Storage Management Service</display-name>
|
||||
<servlet-name>FileStorageManagementService</servlet-name>
|
||||
<servlet-class>com.sap.sse.filestorage.ui.server.FileStorageManagementServiceImpl</servlet-class>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>FileStorageManagementService</servlet-name>
|
||||
<url-pattern>/service/filestoragemanagement</url-pattern>
|
||||
</servlet-mapping>
|
||||
</web-app>
|
||||
@@ -1,6 +0,0 @@
|
||||
source.WEB-INF/classes/ = src/main/java,
|
||||
output.WEB-INF/classes/ = bin
|
||||
bin.includes = META-INF/,\
|
||||
WEB-INF/classes/,\
|
||||
WEB-INF/web.xml,
|
||||
output.. = WEB-INF/classes/
|
||||
@@ -1,96 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>root</artifactId>
|
||||
<groupId>com.sap.sailing</groupId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>com.sap.sse.filestorage.ui</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<properties>
|
||||
<gwt.version>2.6.1</gwt.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.sap.sailing</groupId>
|
||||
<artifactId>com.sap.sse.gwt</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<classifier>sources</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sap.sailing</groupId>
|
||||
<artifactId>com.sap.sse.filestorage</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<classifier>sources</classifier>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.eclipse.tycho</groupId>
|
||||
<artifactId>tycho-source-plugin</artifactId>
|
||||
<version>${tycho-version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>plugin-source</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>plugin-source</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>gwt-maven-plugin</artifactId>
|
||||
<version>2.6.1</version>
|
||||
<executions>
|
||||
<!-- GWT version detected from dependencyManagement -->
|
||||
<execution>
|
||||
<configuration>
|
||||
<extraJvmArgs>-Dgwt.persistentunitcache=false</extraJvmArgs>
|
||||
<!-- <userAgents>chrome</userAgents> -->
|
||||
<gen>${basedir}/.generated</gen>
|
||||
<localWorkers>7</localWorkers>
|
||||
<webappDirectory>${basedir}</webappDirectory>
|
||||
<warSourceDirectory>${basedir}/src/main/resources
|
||||
</warSourceDirectory>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>debug.no-gwt-compile</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>gwt-maven-plugin</artifactId>
|
||||
<version>${gwt.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<configuration combine.self="override">
|
||||
<modules>
|
||||
</modules>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>help</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
package com.sap.sse.filestorage.ui.client;
|
||||
|
||||
import com.google.gwt.user.client.rpc.RemoteService;
|
||||
import com.sap.sse.common.NoCorrespondingServiceRegisteredException;
|
||||
import com.sap.sse.filestorage.InvalidPropertiesException;
|
||||
import com.sap.sse.filestorage.ui.shared.FileStorageServiceDTO;
|
||||
|
||||
/**
|
||||
* For use with GWT for managing the file storage service to use.
|
||||
*
|
||||
* @author Fredrik Teschke
|
||||
*
|
||||
*/
|
||||
public interface FileStorageRpcManagementService extends RemoteService {
|
||||
FileStorageServiceDTO[] getAvailableFileStorageServices();
|
||||
|
||||
/**
|
||||
* @throws NoCorrespondingServiceRegisteredException service may have disappeared from registry in the meantime
|
||||
* @throws IllegalArgumentException if the property with name {@code propertyName} doesn't exist for the service
|
||||
*/
|
||||
void setFileStorageServiceProperty(String serviceName, String propertyName, String propertyValue)
|
||||
throws NoCorrespondingServiceRegisteredException, IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* @throws NoCorrespondingServiceRegisteredException service may have disappeared from registry in the meantime
|
||||
* @throws InvalidPropertiesException is thrown if properties are not valid
|
||||
*/
|
||||
void testFileStorageServiceProperties(String serviceName) throws NoCorrespondingServiceRegisteredException,
|
||||
InvalidPropertiesException;
|
||||
|
||||
/**
|
||||
* @throws NoCorrespondingServiceRegisteredException service may have disappeared from registry in the meantime
|
||||
* @throws InvalidPropertiesException only a service with valid properties can be selected for usage
|
||||
*/
|
||||
void setActiveFileStorageService(String serviceName) throws NoCorrespondingServiceRegisteredException,
|
||||
InvalidPropertiesException;
|
||||
|
||||
/**
|
||||
* @return may be {@code null}
|
||||
*/
|
||||
String getActiveFileStorageServiceName();
|
||||
}
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
package com.sap.sse.filestorage.ui.client;
|
||||
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sap.sse.filestorage.ui.shared.FileStorageServiceDTO;
|
||||
|
||||
public interface FileStorageRpcManagementServiceAsync {
|
||||
|
||||
void getAvailableFileStorageServices(AsyncCallback<FileStorageServiceDTO[]> callback);
|
||||
|
||||
void setFileStorageServiceProperty(String serviceName, String propertyName, String propertyValue,
|
||||
AsyncCallback<Void> callback);
|
||||
|
||||
void setActiveFileStorageService(String serviceName, AsyncCallback<Void> callback);
|
||||
|
||||
void testFileStorageServiceProperties(String serviceName, AsyncCallback<Void> callback);
|
||||
|
||||
void getActiveFileStorageServiceName(AsyncCallback<String> callback);
|
||||
|
||||
}
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
package com.sap.sse.filestorage.ui.client.i18n;
|
||||
|
||||
|
||||
public interface StringMessages extends com.sap.sse.gwt.client.StringMessages {
|
||||
String sample();
|
||||
}
|
||||
-1
@@ -1 +0,0 @@
|
||||
sample=Sample
|
||||
-1
@@ -1 +0,0 @@
|
||||
sample=Beispiel
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
package com.sap.sse.filestorage.ui.server;
|
||||
|
||||
import org.osgi.framework.BundleActivator;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
public class Activator implements BundleActivator {
|
||||
|
||||
private static BundleContext context;
|
||||
|
||||
public static BundleContext getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
public void start(BundleContext bundleContext) throws Exception {
|
||||
Activator.context = bundleContext;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
public void stop(BundleContext bundleContext) throws Exception {
|
||||
Activator.context = null;
|
||||
}
|
||||
|
||||
}
|
||||
-56
@@ -1,56 +0,0 @@
|
||||
package com.sap.sse.filestorage.ui.server;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.util.tracker.ServiceTracker;
|
||||
|
||||
import com.sap.sse.filestorage.FileStorageManagementService;
|
||||
import com.sap.sse.filestorage.FileStorageService;
|
||||
import com.sap.sse.filestorage.InvalidPropertiesException;
|
||||
import com.sap.sse.filestorage.ui.client.FileStorageRpcManagementService;
|
||||
import com.sap.sse.filestorage.ui.shared.FileStorageServiceDTO;
|
||||
|
||||
public class FileStorageRpcManagementServiceImpl implements FileStorageRpcManagementService {
|
||||
private final ServiceTracker<FileStorageManagementService, FileStorageManagementService> managementServiceTracker;
|
||||
|
||||
public FileStorageRpcManagementServiceImpl() {
|
||||
BundleContext context = Activator.getContext();
|
||||
managementServiceTracker = new ServiceTracker<>(context, FileStorageManagementService.class.getName(), null);
|
||||
managementServiceTracker.open();
|
||||
}
|
||||
|
||||
private FileStorageManagementService getManagementService() {
|
||||
return managementServiceTracker.getService();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileStorageServiceDTO[] getAvailableFileStorageServices() {
|
||||
List<FileStorageServiceDTO> serviceDtos = new ArrayList<>();
|
||||
for (FileStorageService s : getManagementService().getAvailableFileStorageServices()) {
|
||||
serviceDtos.add(FileStorageServiceDTO.convert(s));
|
||||
}
|
||||
return serviceDtos.toArray(new FileStorageServiceDTO[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFileStorageServiceProperty(String serviceName, String propertyName, String propertyValue) {
|
||||
getManagementService().setFileStorageServiceProperty(serviceName, propertyName, propertyValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testFileStorageServiceProperties(String serviceName) throws InvalidPropertiesException {
|
||||
getManagementService().getFileStorageService(serviceName).testProperties();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setActiveFileStorageService(String serviceName) throws InvalidPropertiesException {
|
||||
getManagementService().setActiveFileStorageService(getManagementService().getFileStorageService(serviceName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getActiveFileStorageServiceName() {
|
||||
return getManagementService().getActiveFileStorageService().getName();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="resources"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
||||
|
||||
@@ -4,8 +4,9 @@ Bundle-Name: Sse File storage
|
||||
Bundle-SymbolicName: com.sap.sse.filestorage
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Vendor: SAP
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||
Export-Package: com.sap.sse.filestorage,
|
||||
com.sap.sse.filestorage.dto,
|
||||
com.sap.sse.filestorage.impl,
|
||||
com.sap.sse.filestorage.testsupport
|
||||
Import-Package: com.sap.sse.osgi,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
source.. = src/
|
||||
source.. = src/,\
|
||||
resources/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.4.0/distro-source/core/src/gwt-module.dtd">
|
||||
<module>
|
||||
<source path='dto'/>
|
||||
</module>
|
||||
+12
-8
@@ -10,22 +10,26 @@ import com.sap.sse.common.NoCorrespondingServiceRegisteredException;
|
||||
*/
|
||||
public interface FileStorageManagementService {
|
||||
FileStorageService[] getAvailableFileStorageServices();
|
||||
|
||||
|
||||
FileStorageService getFileStorageService(String name);
|
||||
|
||||
/**
|
||||
* Sets the property of the service, and also stores the property value so that it can be restored
|
||||
* after a server restart.
|
||||
* @throws NoCorrespondingServiceRegisteredException service may have disappeared from registry in the meantime
|
||||
* @throws IllegalArgumentException if the property with name {@code propertyName} doesn't exist for the service
|
||||
* Sets the property of the service, and also stores the property value so that it can be restored after a server
|
||||
* restart.
|
||||
*
|
||||
* @throws NoCorrespondingServiceRegisteredException
|
||||
* service may have disappeared from registry in the meantime
|
||||
* @throws IllegalArgumentException
|
||||
* if the property with name {@code propertyName} doesn't exist for the service
|
||||
*/
|
||||
void setFileStorageServiceProperty(String serviceName, String propertyName, String propertyValue)
|
||||
throws NoCorrespondingServiceRegisteredException, IllegalArgumentException;
|
||||
|
||||
|
||||
/**
|
||||
* @return may be {@code null} if no service has been selected so far.
|
||||
* @throws NoCorrespondingServiceRegisteredException
|
||||
* if no service has been selected so far.
|
||||
*/
|
||||
FileStorageService getActiveFileStorageService();
|
||||
FileStorageService getActiveFileStorageService() throws NoCorrespondingServiceRegisteredException;
|
||||
|
||||
/**
|
||||
* @throws InvalidPropertiesException
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.sap.sse.filestorage.ui.shared;
|
||||
package com.sap.sse.filestorage.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.sap.sse.filestorage.ui.shared;
|
||||
package com.sap.sse.filestorage.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.sap.sse.filestorage.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.sap.sse.filestorage.InvalidPropertiesException;
|
||||
import com.sap.sse.filestorage.Property;
|
||||
|
||||
public class PropertyErrors implements Serializable {
|
||||
private static final long serialVersionUID = -7328897153875728802L;
|
||||
public Map<PropertyDTO, String> perPropertyMessages = new HashMap<>();
|
||||
public String message;
|
||||
|
||||
// for GWT
|
||||
PropertyErrors() {
|
||||
}
|
||||
|
||||
public PropertyErrors(InvalidPropertiesException e) {
|
||||
message = e.getMessage();
|
||||
for (Entry<Property, String> entry : e.getPerPropertyMessage().entrySet()) {
|
||||
this.perPropertyMessages.put(PropertyDTO.convert(entry.getKey()), entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
-3
@@ -92,7 +92,8 @@ public class AmazonS3FileStorageServiceImpl implements FileStorageService {
|
||||
|
||||
private URI getUri(String key) {
|
||||
try {
|
||||
// FIXME: region is missing s3-... see: http://stackoverflow.com/questions/10975475/amazon-s3-upload-file-and-get-url
|
||||
// FIXME: region is missing s3-... see:
|
||||
// http://stackoverflow.com/questions/10975475/amazon-s3-upload-file-and-get-url
|
||||
return new URI(retrievalProtocol, baseUrl, "/" + bucketName.getValue() + "/" + key, null);
|
||||
} catch (URISyntaxException e) {
|
||||
logger.log(Level.WARNING, "Could not create URI for uploaded file with key " + key, e);
|
||||
@@ -130,6 +131,7 @@ public class AmazonS3FileStorageServiceImpl implements FileStorageService {
|
||||
}
|
||||
logger.info("Removed file " + uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Property[] getProperties() {
|
||||
return new Property[] { accessId, accessKey, bucketName };
|
||||
@@ -163,12 +165,13 @@ public class AmazonS3FileStorageServiceImpl implements FileStorageService {
|
||||
s3.doesBucketExist(bucketName.getValue());
|
||||
} catch (Exception e) {
|
||||
throw new InvalidPropertiesException("invalid credentials or not enough access rights for the bucket", e,
|
||||
new Pair<>(accessId, "seems to be invalid"), new Pair<>(accessKey, "seems to be invalid"));
|
||||
new Pair<Property, String>(accessId, "seems to be invalid"), new Pair<Property, String>(accessKey,
|
||||
"seems to be invalid"));
|
||||
}
|
||||
|
||||
// test if bucket exists
|
||||
if (!s3.doesBucketExist(bucketName.getValue())) {
|
||||
throw new InvalidPropertiesException("invalid bucket", new Pair<>(bucketName,
|
||||
throw new InvalidPropertiesException("invalid bucket", new Pair<Property, String>(bucketName,
|
||||
"bucket does not exist"));
|
||||
}
|
||||
}
|
||||
|
||||
+3
@@ -21,6 +21,9 @@ public class TransientFileStorageManagementServiceImpl implements FileStorageMan
|
||||
|
||||
@Override
|
||||
public FileStorageService getActiveFileStorageService() {
|
||||
if (active == null) {
|
||||
throw new NoCorrespondingServiceRegisteredException();
|
||||
}
|
||||
return active;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
<module>com.sap.sse.common.test</module>
|
||||
<module>com.sap.sse.filestorage</module>
|
||||
<module>com.sap.sse.filestorage.test</module>
|
||||
<module>com.sap.sse.filestorage.ui</module>
|
||||
<module>com.sap.sse.osgi</module>
|
||||
<module>com.sap.sailing.domain.common</module>
|
||||
<module>com.sap.sailing.domain.shared.android</module>
|
||||
|
||||
Reference in New Issue
Block a user