Commit f891c845 authored by Jan Kožusznik's avatar Jan Kožusznik

code: remove warning

parent b81619af
......@@ -17,8 +17,8 @@ public class PropertyHolder {
}
public String getValue(String key) {
Properties properties = getProperties();
return properties.getProperty(key);
Properties _properties = getProperties();
return _properties.getProperty(key);
}
public void setValue(String key, String value) {
......
......@@ -37,7 +37,7 @@ public abstract class PersistentSynchronizationProcess<T> {
private final PersistentIndex<T> index;
private final Queue<T> toProcessQueue = new LinkedBlockingQueue<T>();
private final Queue<T> toProcessQueue = new LinkedBlockingQueue<>();
private final Set<Thread> runningTransferThreads = Collections.synchronizedSet(new HashSet<>());
......@@ -107,10 +107,10 @@ public abstract class PersistentSynchronizationProcess<T> {
boolean interrupted = false;
this.notifier.addItem(INIT_TRANSFER_ITEM);
runningTransferThreads.add(Thread.currentThread());
TransferFileProgressForHaaSClient notifier = DUMMY_FILE_PROGRESS;
TransferFileProgressForHaaSClient actualnotifier = DUMMY_FILE_PROGRESS;
try (HaaSFileTransfer tr = fileTransferSupplier.get()) {
try {
tr.setProgress(notifier = getTransferFileProgress(tr));
tr.setProgress(actualnotifier = getTransferFileProgress(tr));
} catch (InterruptedIOException e1) {
interrupted = true;
}
......@@ -125,7 +125,7 @@ public abstract class PersistentSynchronizationProcess<T> {
}
T p = toProcessQueue.poll();
String item = p.toString();
notifier.addItem(item);
actualnotifier.addItem(item);
try {
processItem(tr, p);
fileTransfered(p);
......@@ -133,7 +133,7 @@ public abstract class PersistentSynchronizationProcess<T> {
toProcessQueue.clear();
interrupted = true;
}
notifier.itemDone(item);
actualnotifier.itemDone(item);
} while(true);
} finally {
runningTransferThreads.remove(Thread.currentThread());
......@@ -141,7 +141,7 @@ public abstract class PersistentSynchronizationProcess<T> {
if (startFinished) {
if (!interrupted && !Thread.interrupted()) {
processFinishedNotifier.run();
notifier.done();
actualnotifier.done();
} else {
notifyStop();
reRun.set(false);
......
......@@ -113,8 +113,8 @@ public class Synchronization implements Closeable {
}
private PersistentSynchronizationProcess<Path> createUploadProcess(Supplier<HaaSFileTransfer> fileTransferSupplier,
ExecutorService service, Runnable uploadFinishedNotifier) throws IOException {
return new PersistentSynchronizationProcess<Path>(service, fileTransferSupplier, uploadFinishedNotifier,
ExecutorService executorService, Runnable uploadFinishedNotifier) throws IOException {
return new PersistentSynchronizationProcess<Path>(executorService, fileTransferSupplier, uploadFinishedNotifier,
workingDirectory.resolve(FILE_INDEX_TO_UPLOAD_FILENAME), name -> inputDirectory.resolve(name)) {
@Override
......@@ -147,9 +147,9 @@ public class Synchronization implements Closeable {
}
private P_PersistentDownloadProcess createDownloadProcess(Supplier<HaaSFileTransfer> fileTransferSupplier,
ExecutorService service, Runnable uploadFinishedNotifier) throws IOException {
ExecutorService executorService, Runnable uploadFinishedNotifier) throws IOException {
return new P_PersistentDownloadProcess(service, fileTransferSupplier, uploadFinishedNotifier);
return new P_PersistentDownloadProcess(executorService, fileTransferSupplier, uploadFinishedNotifier);
}
private class P_PersistentDownloadProcess extends PersistentSynchronizationProcess<String> {
......@@ -183,8 +183,8 @@ public class Synchronization implements Closeable {
}
@Override
protected long getTotalSize(Iterable<String> items, HaaSFileTransfer tr) throws InterruptedIOException {
return tr.obtainSize(StreamSupport.stream(items.spliterator(), false).collect(Collectors.toList())).stream()
protected long getTotalSize(Iterable<String> files, HaaSFileTransfer tr) throws InterruptedIOException {
return tr.obtainSize(StreamSupport.stream(files.spliterator(), false).collect(Collectors.toList())).stream()
.collect(Collectors.summingLong(val -> val));
}
......
package cz.it4i.fiji.haas.ui;
import java.awt.Window;
import java.util.function.Supplier;
import org.slf4j.Logger;
......@@ -18,11 +17,8 @@ public abstract class FXFrameNative<T extends Parent&CloseableControl> {
private JFXPanel<T> fxPanel;
private Stage stage;
public FXFrameNative(Supplier<T> fxSupplier) {
this(null,fxSupplier);
}
public FXFrameNative(Window applicationFrame, Supplier<T> fxSupplier) {
public FXFrameNative(Supplier<T> fxSupplier) {
new javafx.embed.swing.JFXPanel();
JavaFXRoutines.runOnFxThread(() -> {
stage = new Stage();
......
......@@ -41,7 +41,7 @@ public class JFXPanel<T extends Parent> extends javafx.embed.swing.JFXPanel {
this.setMinimumSize(dim);
this.setMaximumSize(dim);
this.setPreferredSize(dim);
};
}
public T getControl() {
return control;
......
......@@ -32,9 +32,8 @@ public interface JavaFXRoutines {
try {
if (c.equals(parent.getClass())) {
return parent;
} else {
return c.newInstance();
}
return c.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
throw new RuntimeException(e);
}
......@@ -58,7 +57,7 @@ public interface JavaFXRoutines {
static public <U, T extends ObservableValue<U>, V> void setCellValueFactory(TableView<T> tableView, int index,
Function<U, V> mapper) {
((TableColumn<T, V>) tableView.getColumns().get(index))
.setCellValueFactory(f -> new ObservableValueAdapter<U, V>(f.getValue(), mapper));
.setCellValueFactory(f -> new ObservableValueAdapter<>(f.getValue(), mapper));
}
......@@ -86,9 +85,8 @@ public interface JavaFXRoutines {
public static <T> boolean notNullValue(ObservableValue<T> j, Predicate<T> pred) {
if (j == null || j.getValue() == null) {
return false;
} else {
return pred.test(j.getValue());
}
return pred.test(j.getValue());
}
static public<T,U extends ObservableValue<T>>void setOnDoubleClickAction(TableView<U> tableView ,ExecutorService executorService,Predicate<T> openAllowed, Consumer<T> r) {
......
......@@ -19,9 +19,6 @@ import javax.swing.JProgressBar;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import net.imagej.ui.swing.updater.SwingTools;
import net.imagej.updater.util.Progress;
import net.imagej.updater.util.UpdateCanceledException;
......@@ -30,11 +27,8 @@ import net.imagej.updater.util.UpdateCanceledException;
*
* @author Johannes Schindelin
*/
@SuppressWarnings("serial")
public class ProgressDialog extends JDialog implements Progress {
@SuppressWarnings("unused")
public final static Logger log = LoggerFactory.getLogger(cz.it4i.fiji.haas.ui.ProgressDialog.class);
JProgressBar progress;
JButton detailsToggle;
int toggleHeight = -1;
......@@ -80,7 +74,9 @@ public class ProgressDialog extends JDialog implements Progress {
public void actionPerformed(final ActionEvent e) {
canceled = true;
ProgressDialog.this.dispose();
cancelableAction.run();
if (cancelableAction != null) {
cancelableAction.run();
}
}
});
if(canCancel) {
......@@ -260,8 +256,8 @@ public class ProgressDialog extends JDialog implements Progress {
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
}
public void addDetail(final String title) {
addDetail(new Detail(title));
public void addDetail(final String panelTitle) {
addDetail(new Detail(panelTitle));
}
public void addDetail(final Detail detail) {
......
......@@ -69,8 +69,8 @@ public class TableViewContextMenu<T> {
public void handle(ContextMenuEvent event) {
T requestedItem = getRequestedItem();
updateColumnIndex(event.getSceneX());
int columnIndex = getRequestedColumn();
items.forEach(item -> item.updateEnable(requestedItem, columnIndex));
int requestedColumnIndex = getRequestedColumn();
items.forEach(item -> item.updateEnable(requestedItem, requestedColumnIndex));
}
private void updateColumnIndex(double sceneX) {
......@@ -93,7 +93,7 @@ public class TableViewContextMenu<T> {
}
private interface P_Updatable<T> {
public void updateEnable(T selected, int columnIndex);
public void updateEnable(T selected, int enabledColumnIndex);
}
private class P_UpdatableImpl<I extends MenuItem> implements P_Updatable<T> {
......@@ -108,7 +108,7 @@ public class TableViewContextMenu<T> {
}
@Override
public void updateEnable(T selected, int columnIndex) {
public void updateEnable(T selected, int enabledColumnIndex) {
item.setDisable(!enableHandler.test(selected));
}
......@@ -166,8 +166,8 @@ public class TableViewContextMenu<T> {
}
@Override
public void updateEnable(T selected, int columnIndex) {
super.updateEnable(selected, columnIndex);
public void updateEnable(T selected, int enabledColumnIndex) {
super.updateEnable(selected, enabledColumnIndex);
getItem().setSelected(property.apply(selected));
}
......
......@@ -48,12 +48,14 @@ public class UpdatableObservableValue<T> extends ObservableValueBase<T> {
if (oldState == null && state != null || oldState != null && (state == null || !oldState.equals(state))) {
fire = true;
}
case Updated:
//$FALL-THROUGH$
case Updated:
oldState = state;
if (fire) {
fireValueChangedEvent();
}
default:
//$FALL-THROUGH$
default:
return status;
}
......
......@@ -36,6 +36,7 @@
</classpathentry>
<classpathentry kind="src" output="target/classes" path="target/generated-sources/wsimport">
<attributes>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
......
......@@ -91,7 +91,7 @@ class HaaSFileTransferImp implements HaaSFileTransfer {
List<String> result = new LinkedList<>();
try {
for (String fileName : files) {
fileName = replaceIfFirstFirst(fileName, "/", "");
fileName = replaceIfFirstFirst(fileName);
try (ByteArrayOutputStream os = new ByteArrayOutputStream()) {
String fileToDownload = "'" + ft.getSharedBasepath() + "/" + fileName + "'";
scpClient.download(fileToDownload, os, progress);
......@@ -105,7 +105,7 @@ class HaaSFileTransferImp implements HaaSFileTransfer {
return result;
}
private String replaceIfFirstFirst(String fileName, String string, String string2) {
private String replaceIfFirstFirst(String fileName) {
if (fileName.length() < 0 && fileName.charAt(0) == '/') {
fileName = fileName.substring(1);
}
......
package cz.it4i.fiji.haas_java_client;
import cz.it4i.fiji.haas_java_client.proxy.JobFileContentExt;
import cz.it4i.fiji.haas_java_client.proxy.SynchronizableFilesExt;
class JobFileContentImpl implements JobFileContent{
private final JobFileContentExt contentExt;
public JobFileContentImpl(JobFileContentExt contentExt) {
this.contentExt = contentExt;
}
@Override
public String getContent() {
return contentExt.getContent();
}
@Override
public String getRelativePath() {
return contentExt.getRelativePath();
}
@Override
public Long getOffset() {
return contentExt.getOffset();
}
@Override
public SynchronizableFileType getFileType() {
return getFileType(contentExt.getFileType());
}
@Override
public Long getSubmittedTaskInfoId() {
return contentExt.getSubmittedTaskInfoId();
}
private SynchronizableFileType getFileType(SynchronizableFilesExt fileType) {
// TODO Auto-generated method stub
return null;
}
}
......@@ -20,40 +20,40 @@ public class JobSettingsBuilder {
private static final int DEFAULT_NUMBER_OF_CORES_PER_NODE = 24;
private long templateId = DEFAULT_TEMPLATE;
private int walltimeLimit = DEFAULT_WALLTIME;
private long clusterNodeType = DEFAULT_CLUSTER_NODE_TYPE;
private String jobName = DEFAULT_JOB_NAME;
private int numberOfNodes = DEFAULT_NUMBER_OF_NODES;
private int numberOfCoresPerNode = DEFAULT_NUMBER_OF_CORES_PER_NODE;
private long _templateId = DEFAULT_TEMPLATE;
private int _walltimeLimit = DEFAULT_WALLTIME;
private long _clusterNodeType = DEFAULT_CLUSTER_NODE_TYPE;
private String _jobName = DEFAULT_JOB_NAME;
private int _numberOfNodes = DEFAULT_NUMBER_OF_NODES;
private int _numberOfCoresPerNode = DEFAULT_NUMBER_OF_CORES_PER_NODE;
public JobSettingsBuilder templateId(long templateId) {
this.templateId = templateId;
this._templateId = templateId;
return this;
}
public JobSettingsBuilder walltimeLimit(int walltimeLimit) {
this.walltimeLimit = walltimeLimit;
this._walltimeLimit = walltimeLimit;
return this;
}
public JobSettingsBuilder clusterNodeType(long clusterNodeType) {
this.clusterNodeType = clusterNodeType;
this._clusterNodeType = clusterNodeType;
return this;
}
public JobSettingsBuilder jobName(String jobName) {
this.jobName = jobName;
this._jobName = jobName;
return this;
}
public JobSettingsBuilder numberOfNodes(int numberOfNodes) {
this.numberOfNodes = numberOfNodes;
this._numberOfNodes = numberOfNodes;
return this;
}
public JobSettingsBuilder numberOfCoresPerNode(int numberOfCoresPerNode) {
this.numberOfCoresPerNode = numberOfCoresPerNode;
this._numberOfCoresPerNode = numberOfCoresPerNode;
return this;
}
......@@ -62,32 +62,32 @@ public class JobSettingsBuilder {
@Override
public int getWalltimeLimit() {
return walltimeLimit;
return _walltimeLimit;
}
@Override
public long getTemplateId() {
return templateId;
return _templateId;
}
@Override
public int getNumberOfNodes() {
return numberOfNodes;
return _numberOfNodes;
}
@Override
public String getJobName() {
return jobName;
return _jobName;
}
@Override
public long getClusterNodeType() {
return clusterNodeType;
return _clusterNodeType;
}
@Override
public int getNumberOfCoresPerNode() {
return numberOfCoresPerNode;
return _numberOfCoresPerNode;
}
};
}
......
......@@ -27,9 +27,9 @@ import cz.it4i.fiji.haas_java_client.proxy.DataTransferMethodExt;
import cz.it4i.fiji.haas_java_client.proxy.DataTransferWs;
import cz.it4i.fiji.haas_java_client.proxy.DataTransferWsSoap;
class MidlewareTunnel implements Closeable {
class MiddlewareTunnel implements Closeable {
public static final Logger log = LoggerFactory.getLogger(cz.it4i.fiji.haas_java_client.MidlewareTunnel.class);
public static final Logger log = LoggerFactory.getLogger(cz.it4i.fiji.haas_java_client.MiddlewareTunnel.class);
private static final int TIMEOUT = 1000;
......@@ -63,7 +63,7 @@ class MidlewareTunnel implements Closeable {
private DataTransferMethodExt dataTransferMethod;
public MidlewareTunnel(ExecutorService executorService, long jobId, String hostIp, String sessionCode) {
public MiddlewareTunnel(ExecutorService executorService, long jobId, String hostIp, String sessionCode) {
this.jobId = jobId;
this.dataTransfer = new DataTransferWs().getDataTransferWsSoap12();
((BindingProvider) dataTransfer).getRequestContext().put("javax.xml.ws.client.connectionTimeout", "" + TIMEOUT);
......@@ -93,7 +93,7 @@ class MidlewareTunnel implements Closeable {
while (!Thread.interrupted() && !ss.isClosed()) {
try (Socket soc = ss.accept()) {
obtainTransferMethodIfNeeded(port);
doTransfer(soc, port);
doTransfer(soc);
if (log.isDebugEnabled()) {
log.debug("endDataTransfer");
}
......@@ -159,7 +159,7 @@ class MidlewareTunnel implements Closeable {
}
}
private void doTransfer(Socket soc, int port) {
private void doTransfer(Socket soc) {
log.debug("START: doTransfer");
if(lastConnection != null) {
lastConnection.finishIfNeeded();
......@@ -254,7 +254,6 @@ class MidlewareTunnel implements Closeable {
zeroCounter = 0;
}
}
;
return true;
}
......
......@@ -19,9 +19,9 @@ public class TransferFileProgressForHaaSClient implements TransferFileProgress {
this.notifier = notifier;
}
public void startNewFile(long fileSize) {
public void startNewFile(long initialFileSize) {
fileTransfered = 0;
this.fileSize = fileSize;
this.fileSize = initialFileSize;
}
@Override
......
package cz.it4i.fiji.haas_java_client;
import java.io.IOException;
import javax.xml.rpc.ServiceException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -18,7 +14,7 @@ public class GetJobInfo {
public static Logger log = LoggerFactory.getLogger(cz.it4i.fiji.haas_java_client.GetJobInfo.class);
public static void main(String[] args) throws ServiceException, IOException {
public static void main(String[] args) {
HaaSClientSettings settings = SettingsProvider.getSettings("OPEN-12-20", TestingConstants.CONFIGURATION_FILE_NAME);
HaaSClient client = new HaaSClient(settings);
JobInfo ji = client.obtainJobInfo(334);
......
......@@ -3,8 +3,6 @@ package cz.it4i.fiji.haas_java_client;
import java.io.IOException;
import java.util.Scanner;
import javax.xml.rpc.ServiceException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -15,7 +13,7 @@ public class TestCommunicationWithNodes {
private static String[] predefined = new String[2];
@SuppressWarnings("resource")
public static void main(String[] args) throws ServiceException, IOException, InterruptedException {
public static void main(String[] args) throws IOException, InterruptedException {
predefined[0] = "POST /modules/'command:net.imagej.ops.math.PrimitiveMath$IntegerAdd'?process=false HTTP/1.1\r\n" +
"Content-Type: application/json\r\n" +
"Host: localhost:8080\r\n" +
......
......@@ -3,8 +3,6 @@ package cz.it4i.fiji.haas_java_client;
import java.io.IOException;
import java.util.Arrays;
import javax.xml.rpc.ServiceException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -12,7 +10,8 @@ public class TestConcurentAccessToHaaSFileTransfer {
private static Logger log = LoggerFactory.getLogger(cz.it4i.fiji.haas_java_client.TestConcurentAccessToHaaSFileTransfer.class);
public static void main(String[] args) throws ServiceException, IOException {
@SuppressWarnings("resource")
public static void main(String[] args) throws IOException {
HaaSClient client = new HaaSClient(SettingsProvider.getSettings("OPEN-12-20",TestingConstants.CONFIGURATION_FILE_NAME));
HaaSFileTransfer tr1 = client.startFileTransfer(250, HaaSClient.DUMMY_TRANSFER_FILE_PROGRESS);
HaaSFileTransfer tr2 = client.startFileTransfer(249, HaaSClient.DUMMY_TRANSFER_FILE_PROGRESS);
......
......@@ -9,8 +9,6 @@ import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;
import javax.xml.rpc.ServiceException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -21,7 +19,7 @@ public class TestHaaSJavaClient {
private static Logger log = LoggerFactory.getLogger(cz.it4i.fiji.haas_java_client.TestHaaSJavaClient.class);
public static void main(String[] args) throws ServiceException, IOException {
public static void main(String[] args) throws IOException {
Map<String, String> params = new HashMap<>();
params.put("inputParam", "someStringParam");
Path baseDir = Paths.get("/home/koz01/aaa");
......
package cz.it4i.fiji.haas_java_client;
import static cz.it4i.fiji.haas_java_client.LambdaExceptionHandlerWrapper.wrap;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
......@@ -7,20 +9,17 @@ import java.nio.file.Paths;
import java.util.Collections;
import java.util.stream.StreamSupport;
import javax.xml.rpc.ServiceException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import cz.it4i.fiji.haas_java_client.HaaSClient.SynchronizableFiles;
import cz.it4i.fiji.haas_java_client.proxy.JobFileContentExt;
import static cz.it4i.fiji.haas_java_client.LambdaExceptionHandlerWrapper.wrap;
public class TestHaaSJavaClientWithSPIM {
private static Logger log = LoggerFactory.getLogger(cz.it4i.fiji.haas_java_client.TestHaaSJavaClientWithSPIM.class);
public static void main(String[] args) throws ServiceException, IOException {
public static void main(String[] args) throws IOException {
HaaSClient client = new HaaSClient(SettingsProvider.getSettings("DD-17-31", TestingConstants.CONFIGURATION_FILE_NAME));
Path baseDir = Paths.get("/home/koz01/Work/vyzkumnik/fiji/work/aaa");
......
package cz.it4i.fiji.haas_spim_benchmark.commands;
import java.io.Closeable;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.channels.FileChannel;
import java.nio.channels.OverlappingFileLockException;
......@@ -22,7 +21,7 @@ public class FileLock implements Closeable {
private java.nio.channels.FileLock lock;
public FileLock(Path lockPath) throws FileNotFoundException {
public FileLock(Path lockPath) {
this.localPath = lockPath;
}
......
......@@ -64,30 +64,26 @@ public class ManageSPIMBenchmark implements Command {
if (!Files.isDirectory(workingDirPath)) {
Files.createDirectories(workingDirPath);
}
@SuppressWarnings("resource")
final FileLock fl = new FileLock(workingDirPath.resolve(LOCK_FILE_NAME));
if(!fl.tryLock()) {
uiService.showDialog("Working directory is already used by someone else", MessageType.ERROR_MESSAGE);
return;
}
try {
final BenchmarkSPIMWindow dialog = new BenchmarkSPIMWindow(null,
new BenchmarkSPIMParametersImpl(userName, password, Constants.PHONE, email, workingDirPath));
dialog.executeAdjustment(() -> {
dialog.setTitle(Constants.MENU_ITEM_NAME + " " + Constants.SUBMENU_ITEM_NAME);
dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
dialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(final WindowEvent e) {
super.windowClosing(e);
fl.close();
}
});
dialog.setVisible(true);
final BenchmarkSPIMWindow dialog = new BenchmarkSPIMWindow(null,
new BenchmarkSPIMParametersImpl(userName, password, Constants.PHONE, email, workingDirPath));
dialog.executeAdjustment(() -> {
dialog.setTitle(Constants.MENU_ITEM_NAME + " " + Constants.SUBMENU_ITEM_NAME);
dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
dialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(final WindowEvent e) {
super.windowClosing(e);
fl.close();
}
});
} catch(final IOException e) {
fl.close();
throw e;
}
dialog.setVisible(true);
});
} catch (final IOException e) {
log.error(e.getMessage(), e);
}
......
......@@ -9,7 +9,6 @@ import static cz.it4i.fiji.haas_spim_benchmark.core.Constants.UI_TO_HAAS_FREQUEN
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;