Skip to content

Commit 39ac449

Browse files
authored
Merge pull request #3 from Enet4/new/dicoogle3
Migrate to Dicoogle 3
2 parents f3b8dc0 + 78637d2 commit 39ac449

File tree

4 files changed

+11
-63
lines changed

4 files changed

+11
-63
lines changed

pom.xml

+7-10
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>pt.ua.dicoogle</groupId>
55
<artifactId>nifti</artifactId>
6-
<version>1.0-SNAPSHOT</version>
6+
<version>2.0.0</version>
77
<packaging>jar</packaging>
88
<name>dicoogle-nifti</name>
99
<description>NIFTI-1 file convertion and storage for Dicoogle</description>
@@ -12,10 +12,7 @@
1212
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1313

1414
<!-- Dicoogle SDK version here -->
15-
<dicoogle.version>2.4.0</dicoogle.version>
16-
17-
<!-- Jetty server version here -->
18-
<jetty.version>9.0.3.v20130506</jetty.version>
15+
<dicoogle.version>3.0.2</dicoogle.version>
1916
</properties>
2017

2118
<build>
@@ -75,34 +72,34 @@
7572
<repository>
7673
<id>maven-restlet</id>
7774
<name>Public online Restlet repository</name>
78-
<url>http://maven.restlet.org</url>
75+
<url>https://maven.restlet.org</url>
7976
</repository>
8077
<repository>
8178
<id>mavencentral</id>
82-
<url>http://repo1.maven.org/maven2/</url>
79+
<url>https://repo1.maven.org/maven2/</url>
8380
<snapshots>
8481
<enabled>true</enabled>
8582
</snapshots>
8683
</repository>
8784
<repository>
8885
<id>dcm4che</id>
89-
<url>http://www.dcm4che.org/maven2/</url>
86+
<url>https://www.dcm4che.org/maven2/</url>
9087
<snapshots>
9188
<enabled>true</enabled>
9289
</snapshots>
9390
</repository>
9491

9592
<repository>
9693
<id>mi</id>
97-
<url>http://bioinformatics.ua.pt/maven/content/repositories/mi</url>
94+
<url>https://bioinformatics.ua.pt/maven/content/repositories/mi</url>
9895
<snapshots>
9996
<enabled>false</enabled>
10097
</snapshots>
10198
</repository>
10299

103100
<repository>
104101
<id>mi-snapshots</id>
105-
<url>http://bioinformatics.ua.pt/maven/content/repositories/mi-snapshots</url>
102+
<url>https://bioinformatics.ua.pt/maven/content/repositories/mi-snapshots</url>
106103
<snapshots>
107104
<enabled>true</enabled>
108105
</snapshots>

src/main/java/pt/ua/dicoogle/nifti/NIFTIPluginSet.java

-31
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,11 @@
2323
import java.util.Collection;
2424
import java.util.Collections;
2525
import net.xeoh.plugins.base.annotations.PluginImplementation;
26-
import org.restlet.resource.ServerResource;
2726
import org.slf4j.Logger;
2827
import org.slf4j.LoggerFactory;
2928
import pt.ua.dicoogle.nifti.config.NIFTIPluginSettings;
30-
import pt.ua.dicoogle.sdk.GraphicalInterface;
31-
import pt.ua.dicoogle.sdk.IndexerInterface;
3229
import pt.ua.dicoogle.sdk.JettyPluginInterface;
3330
import pt.ua.dicoogle.sdk.PluginSet;
34-
import pt.ua.dicoogle.sdk.QueryInterface;
35-
import pt.ua.dicoogle.sdk.StorageInterface;
3631
import pt.ua.dicoogle.sdk.settings.ConfigurationHolder;
3732

3833
/** The main plugin set.
@@ -60,16 +55,6 @@ public NIFTIPluginSet() throws IOException {
6055

6156
logger.info("NIFTI Plugin Set is ready");
6257
}
63-
64-
@Override
65-
public Collection<IndexerInterface> getIndexPlugins() {
66-
return Collections.EMPTY_LIST;
67-
}
68-
69-
@Override
70-
public Collection<QueryInterface> getQueryPlugins() {
71-
return Collections.EMPTY_LIST;
72-
}
7358

7459
/** This method is used to retrieve a name for identifying the plugin set. Keep it as a constant value.
7560
*
@@ -80,11 +65,6 @@ public String getName() {
8065
return "NIFTI";
8166
}
8267

83-
@Override
84-
public Collection<ServerResource> getRestPlugins() {
85-
return Collections.EMPTY_LIST;
86-
}
87-
8868
@Override
8969
public Collection<JettyPluginInterface> getJettyPlugins() {
9070
return Collections.singleton(this.jettyWeb);
@@ -95,11 +75,6 @@ public void shutdown() {
9575
logger.info("NIFTI plugin is shutting down");
9676
}
9777

98-
@Override
99-
public Collection<StorageInterface> getStoragePlugins() {
100-
return Collections.EMPTY_LIST;
101-
}
102-
10378
@Override
10479
public void setSettings(ConfigurationHolder xmlSettings) {
10580
this.settings = xmlSettings;
@@ -110,10 +85,4 @@ public void setSettings(ConfigurationHolder xmlSettings) {
11085
public ConfigurationHolder getSettings() {
11186
return this.settings;
11287
}
113-
114-
@Override
115-
public Collection<GraphicalInterface> getGraphicalPlugins() {
116-
// Graphical plugins are deprecated. Do not use or provide any.
117-
return Collections.EMPTY_LIST;
118-
}
11988
}

src/main/java/pt/ua/dicoogle/nifti/ws/NIFTIConvertWebServlet.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import java.util.concurrent.ExecutionException;
2929
import java.util.concurrent.ForkJoinPool;
3030
import java.util.function.UnaryOperator;
31-
import java.util.logging.Level;
3231
import java.util.stream.Collectors;
3332
import java.util.stream.Stream;
3433
import java.util.zip.GZIPInputStream;
@@ -38,7 +37,6 @@
3837
import javax.servlet.http.HttpServletResponse;
3938
import javax.servlet.http.Part;
4039
import net.sf.json.JSONObject;
41-
import org.apache.commons.lang3.tuple.Pair;
4240
import org.dcm4che2.data.DicomObject;
4341
import org.dcm4che2.data.Tag;
4442
import org.dcm4che2.data.VR;
@@ -77,7 +75,9 @@ public NiftiFileEntry(String name, S inputStream) {
7775
@Override
7876
protected void doGet(HttpServletRequest req, HttpServletResponse response)
7977
throws ServletException, IOException {
80-
response.setStatus(418, "I'm a teapot");
78+
response.setStatus(405);
79+
response.setHeader("Content-Type", "text/plain; charset=UTF-8");
80+
response.getWriter().println("⚠ Please use POST to upload nifti files");
8181
}
8282

8383
@Override
@@ -92,7 +92,7 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws S
9292

9393
Stream<NiftiFileEntry<InputStream>> niftiObjects;
9494
int nFiles;
95-
resp.setContentType("application/json");
95+
resp.setContentType("application/json; charset=UTF-8");
9696
if (req.getContentType() == null) {
9797
JSONObject reply = new JSONObject();
9898
reply.put("error", "no content");

src/main/java/pt/ua/dicoogle/nifti/ws/NIFTIServletPlugin.java

-18
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
import org.eclipse.jetty.server.handler.HandlerList;
2323
import org.eclipse.jetty.servlet.ServletContextHandler;
2424
import org.eclipse.jetty.servlet.ServletHolder;
25-
import org.slf4j.Logger;
26-
import org.slf4j.LoggerFactory;
2725

2826
import pt.ua.dicoogle.sdk.JettyPluginInterface;
2927
import pt.ua.dicoogle.sdk.core.DicooglePlatformInterface;
@@ -35,13 +33,10 @@
3533
* @author Luís A. Bastião Silva - <bastiao@ua.pt>
3634
*/
3735
public class NIFTIServletPlugin implements JettyPluginInterface, PlatformCommunicatorInterface {
38-
private static final Logger logger = LoggerFactory.getLogger(NIFTIServletPlugin.class);
39-
4036
private static final String NIFTI_FILE_PATH = System.getProperty("java.io.tmpdir");
4137

4238
private boolean enabled;
4339
private ConfigurationHolder settings;
44-
private DicooglePlatformInterface platform;
4540
private final NIFTIConvertWebServlet wsConvert;
4641

4742
public NIFTIServletPlugin() {
@@ -51,7 +46,6 @@ public NIFTIServletPlugin() {
5146

5247
@Override
5348
public void setPlatformProxy(DicooglePlatformInterface pi) {
54-
this.platform = pi;
5549
// since web service is not a plugin interface, the platform interface must be provided manually
5650
this.wsConvert.setPlatformProxy(pi);
5751
}
@@ -101,20 +95,8 @@ public HandlerList getJettyHandlers() {
10195
convertServletHolder.getRegistration().setMultipartConfig(new MultipartConfigElement(NIFTI_FILE_PATH));
10296
handler.addServlet(convertServletHolder, "/convert");
10397

104-
// URL url = NIFTIServletPlugin.class.getResource("/WEBAPP");
105-
// logger.debug("Retrieving web app from \"{}\"", url);
106-
// String directoryToServeAssets = url.toString();
107-
//
108-
// final WebAppContext webpages = new WebAppContext(directoryToServeAssets, "/dashboardSample");
109-
// webpages.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "true"); // disables directory listing
110-
// webpages.setInitParameter("useFileMappedBuffer", "false");
111-
// webpages.setInitParameter("cacheControl", "max-age=0, public");
112-
//
113-
// webpages.setWelcomeFiles(new String[]{"index.html"});
114-
11598
HandlerList l = new HandlerList();
11699
l.addHandler(handler);
117-
//l.addHandler(webpages);
118100

119101
return l;
120102
}

0 commit comments

Comments
 (0)