diff --git a/screening/build/build.xml b/screening/build/build.xml index 15ede5628572d32bacb18005339723d5fa97e03f..7dc07bacac4ac94fc5c1626e8385f92b0c515707 100644 --- a/screening/build/build.xml +++ b/screening/build/build.xml @@ -28,7 +28,7 @@ --> <target name="dist" depends="openbis.make-dist, make-full-dss-dist, dss-plugin-jar, datastore_server.make-plugin-dist, screening-api"> - <zip destfile="${server.dist.file}" update="true"> + <zip update="true" destfile="${server.dist.file}"> <zipfileset file="${jars.to.be.signed.zip}"/> </zip> </target> @@ -166,6 +166,14 @@ <mkdir dir="${targets.www.openbis}" /> <delete dir="${jars.to.be.signed.dir}" /> <mkdir dir="${jars.to.be.signed.dir}" /> + <zip update="true" destfile="${dist}/${jar.file.name}"> + <zipfileset src="${lib}/gwt2.0/gwt-user.jar"> + <include name="com/google/gwt/user/client/rpc/IsSerializable.class" /> + <include name="com/google/gwt/user/client/rpc/SerializableException.class" /> + </zipfileset> + </zip> + + <antcall target="copy-and-sign-jar"> <param name="dir" value="${dist}" /> <param name="jar" value="${jar.file.name}" /> diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/BuildAndEnvironmentInfo.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/BuildAndEnvironmentInfo.java deleted file mode 100644 index 336c637667a4fbdf0a656561ea85ddf8293182cd..0000000000000000000000000000000000000000 --- a/screening/source/java/ch/systemsx/cisd/openbis/dss/BuildAndEnvironmentInfo.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2009 ETH Zuerich, CISD - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ch.systemsx.cisd.openbis.dss; - -import ch.systemsx.cisd.base.utilities.AbstractBuildAndEnvironmentInfo; - - -/** - * The build and environment information for Data Store Server. - * - * @author Tomasz Pylak - */ -public class BuildAndEnvironmentInfo extends AbstractBuildAndEnvironmentInfo -{ - private final static String BASE = "screening"; - - public final static BuildAndEnvironmentInfo INSTANCE = new BuildAndEnvironmentInfo(); - - private BuildAndEnvironmentInfo() - { - super(BASE); - } - - /** - * Shows build and environment information on the console. - */ - public static void main(String[] args) - { - System.out.println(INSTANCE); - } - -} diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/api/v1/ImageViewer.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/api/v1/ImageViewer.java new file mode 100644 index 0000000000000000000000000000000000000000..c6f3378bf3ee20db94697ae6ffa25164c0078fff --- /dev/null +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/api/v1/ImageViewer.java @@ -0,0 +1,117 @@ +/* + * Copyright 2010 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.plugin.screening.client.api.v1; + +import java.awt.Container; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.swing.BoxLayout; +import javax.swing.ImageIcon; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; + +import org.apache.commons.lang.StringUtils; + +import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.IDatasetIdentifier; +import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.ImageSize; + + +/** + * + * + * @author Franz-Josef Elmer + */ +public class ImageViewer +{ + + private static final class DataSetAndWells + { + private final String dataSetCode; + private final List<String> wells = new ArrayList<String>(); + + DataSetAndWells(String description) + { + int indexOfColon = description.indexOf(':'); + if (indexOfColon < 0) + { + dataSetCode = description; + } else + { + dataSetCode = description.substring(0, indexOfColon); + wells.addAll(Arrays.asList(StringUtils.split(description.substring(indexOfColon + 1)))); + } + } + + public final String getDataSetCode() + { + return dataSetCode; + } + + public final List<String> getWells() + { + return wells; + } + } + + public static void main(String[] args) + { + String serviceURL = args[0]; + String sessionToken = args[1]; + long experimentID = Long.parseLong(args[2]); + String channel = args[3]; + Map<String, DataSetAndWells> dataSets = new HashMap<String, DataSetAndWells>(); + for (int i = 4; i < args.length; i++) + { + DataSetAndWells dataSetAndWells = new DataSetAndWells(args[i]); + dataSets.put(dataSetAndWells.getDataSetCode(), dataSetAndWells); + } + JFrame frame = new JFrame("Image Viewer"); + frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + Container contentPane = frame.getContentPane(); + JPanel content = new JPanel(); + content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS)); + contentPane.add(content); + ImageSize thumbnailSize = new ImageSize(200, 160); + try + { + IScreeningOpenbisServiceFacade facade = ScreeningOpenbisServiceFacadeFactory.tryCreate(sessionToken, serviceURL); + List<IDatasetIdentifier> dsIdentifier = facade.getDatasetIdentifiers(new ArrayList<String>(dataSets.keySet())); + for (IDatasetIdentifier identifier : dsIdentifier) + { + List<byte[]> imageBytes = + facade.loadImages(identifier, dataSets.get(identifier.getDatasetCode()) + .getWells(), channel, thumbnailSize); + for (byte[] bytes : imageBytes) + { + content.add(new JLabel(new ImageIcon(bytes))); + } + } + } catch (Exception ex) + { + content.add(new JLabel(ex.toString())); + } + + frame.pack(); + frame.setVisible(true); + } + +} diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/server/ImageViewerLaunchServlet.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/server/ImageViewerLaunchServlet.java index ec26b2b97dc039f30d08c0ba0bfb509360b70291..03ae3ba93779d5fb99947b717819a050719c1c9f 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/server/ImageViewerLaunchServlet.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/web/server/ImageViewerLaunchServlet.java @@ -67,13 +67,21 @@ public class ImageViewerLaunchServlet extends AbstractServlet + " </security>\n" + " <resources>\n" + " <j2se version='1.5+'/>\n" + + " <jar href='screening.jar'/>\n" + " <jar href='cisd-base.jar'/>\n" - + " <jar href='spring.jar'/>\n" + + " <jar href='spring-web.jar'/>\n" + + " <jar href='spring-context.jar'/>\n" + + " <jar href='spring-beans.jar'/>\n" + + " <jar href='spring-aop.jar'/>\n" + + " <jar href='spring-core.jar'/>\n" + + " <jar href='aopalliance.jar'/>\n" + + " <jar href='stream-supporting-httpinvoker.jar'/>\n" + " <jar href='commons-codec.jar'/>\n" + " <jar href='commons-httpclient.jar'/>\n" + " <jar href='commons-io.jar'/>\n" + " <jar href='commons-lang.jar'/>\n" + " <jar href='commons-logging.jar'/>\n" + + " <jar href='ij.jar'/>\n" + " </resources>\n" + " <application-desc main-class='${main-class}'>\n" + " <argument>${service-URL}</argument>\n" @@ -102,9 +110,9 @@ public class ImageViewerLaunchServlet extends AbstractServlet template.bind("title", "Image Viewer"); template.bind("description", "Image Viewer for testing image transformations."); String basicURL = getBasicURL(request); - template.bind("base-URL", basicURL); - template.bind("main-class", "blabla"); - template.bind("service-URL", basicURL + "/blabla"); + template.bind("base-URL", createBaseURL(request)); + template.bind("main-class", getMainClass()); + template.bind("service-URL", basicURL); template.bind("session-id", getSessionToken(request)); template.bind("experiment-id", getParam(request, ParameterNames.EXPERIMENT_ID)); template.bind("channel", getParam(request, ParameterNames.CHANNEL)); @@ -122,6 +130,24 @@ public class ImageViewerLaunchServlet extends AbstractServlet } } + private String getMainClass() + { + return "ch.systemsx.cisd.openbis.plugin.screening.client.api.v1.ImageViewer"; + } + + private String createBaseURL(HttpServletRequest request) + { + String url = getBasicURL(request); + if (url.indexOf("localhost:8888") > 0 || url.indexOf("127.0.0.1:888") > 0) + { + url = url + "/ch.systemsx.cisd.openbis.plugin.screening.OpenBIS/"; + } else + { + url = url + "/"; + } + return url; + } + private String getBasicURL(HttpServletRequest request) { final String scheme = request.getScheme();