diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/AbstractCommand.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/AbstractCommand.java index 9ad21efd50b63cf54a2ce0558b1a25a05c94bada..3a15123b860d95a9cb4ab0135d1a71645358fdc9 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/AbstractCommand.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/AbstractCommand.java @@ -48,7 +48,7 @@ abstract class AbstractCommand implements ICommand out.println(getUsagePrefixString() + " [options] <data set code> <path>"); parser.printUsage(out); out.println(" Example : " + getCommandCallString() + " " - + parser.printExample(ExampleMode.ALL)); + + parser.printExample(ExampleMode.ALL) + " <data set code> <path>"); } /** @@ -82,15 +82,15 @@ abstract class AbstractCommand implements ICommand protected IDssComponent login(GlobalArguments arguments) { IDssComponent component = - DssComponentFactory.tryCreate(arguments.getUsername(), arguments.getPassword(), arguments - .getServerBaseUrl()); + DssComponentFactory.tryCreate(arguments.getUsername(), arguments.getPassword(), + arguments.getServerBaseUrl()); return component; } /** * Retuns a proxy to the DSS object referenced by the arguments. */ - protected IDataSetDss getDataSet(IDssComponent component, GlobalArguments arguments) + protected IDataSetDss getDataSet(IDssComponent component, DataSetArguments arguments) { return component.getDataSet(arguments.getDataSetCode()); } diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/CommandFactory.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/CommandFactory.java index 69a85b4293c31239858628cc7b3aced7114a08fe..0a4aa2b36b02e1e0609368ec72ff939ac64e5cef 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/CommandFactory.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/CommandFactory.java @@ -26,7 +26,7 @@ class CommandFactory { private static enum Command { - LS, GET, HELP + LS, GET, HELP, PUT } /** @@ -58,6 +58,9 @@ class CommandFactory case HELP: result = new CommandHelp(this); break; + case PUT: + result = new CommandPut(); + break; default: result = null; break; @@ -69,7 +72,7 @@ class CommandFactory List<String> getKnownCommands() { String[] commands = - { "ls", "get" }; + { "ls", "get", "put" }; return Arrays.asList(commands); } } diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/CommandGet.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/CommandGet.java index 0bb5ad827ac6c641055306d7712c3e7f84619cae..fadc4afb8f17753723b11bc595aaf55e025b9dd7 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/CommandGet.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/CommandGet.java @@ -39,7 +39,7 @@ import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.FileInfoDssDTO; */ class CommandGet extends AbstractCommand { - private static class CommandGetArguments extends GlobalArguments + private static class CommandGetArguments extends DataSetArguments { @Option(name = "r", longName = "recursive", usage = "Recurse into directories") private boolean recursive = false; diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/CommandHelp.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/CommandHelp.java index c322746882e4809200ed6c211e8ffec18d541aea..1abb4582e7c61a9fa1362b697e0d6af6059b8dba 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/CommandHelp.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/CommandHelp.java @@ -74,7 +74,7 @@ class CommandHelp extends AbstractCommand @Override public void printUsage(PrintStream out) { - out.println("usage: " + getProgramCallString() + " COMMAND [options...] DATA_SET_CODE"); + out.println("usage: " + getProgramCallString() + " COMMAND [options...] <command arguments>"); List<String> commands = commandFactory.getKnownCommands(); out.println("\nCommands:"); for (String cmd : commands) diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/CommandLs.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/CommandLs.java index 0e628533b885ff0c3faa337aa0336e764bb5ae5c..9d9d8f6b96a12f3c619f4daae97ca8d13fb2a20c 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/CommandLs.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/CommandLs.java @@ -31,7 +31,7 @@ import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.FileInfoDssDTO; */ class CommandLs extends AbstractCommand { - private static class CommandLsArguments extends GlobalArguments + private static class CommandLsArguments extends DataSetArguments { @Option(name = "r", longName = "recursive", usage = "Recurse into directories") private boolean recursive = false; diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/CommandPut.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/CommandPut.java new file mode 100644 index 0000000000000000000000000000000000000000..568adc01e664766cdc98bf8ef420ed7b382d10f8 --- /dev/null +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/CommandPut.java @@ -0,0 +1,139 @@ +/* + * 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.dss.client.api.cli; + +import java.io.InputStream; +import java.io.PrintStream; + +import ch.systemsx.cisd.args4j.CmdLineParser; +import ch.systemsx.cisd.args4j.ExampleMode; +import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException; +import ch.systemsx.cisd.common.exceptions.UserFailureException; +import ch.systemsx.cisd.openbis.dss.client.api.v1.IDssComponent; +import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.IDssServiceRpcGeneric; +import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.NewDataSetDssDTO; + +/** + * Command that lists files in the data set. + * + * @author Chandrasekhar Ramakrishnan + */ +class CommandPut extends AbstractCommand +{ + private static class CommandPutArguments extends GlobalArguments + { + public String getStorageProcess() + { + return getArguments().get(0); + } + + public String getFilePath() + { + return getArguments().get(1); + } + + @Override + public boolean isComplete() + { + if (false == super.isComplete()) + return false; + + if (getArguments().size() < 2) + return false; + + return true; + } + } + + private static class CommandPutExecutor + { + private final CommandPutArguments arguments; + + private final IDssServiceRpcGeneric dssService; + + CommandPutExecutor(IDssServiceRpcGeneric dataSet, CommandPutArguments arguments) + { + this.arguments = arguments; + this.dssService = dataSet; + } + + int execute() + { + NewDataSetDssDTO newDataSet = getNewDataSet(); + dssService.putDataSet("", newDataSet); + + return 0; + } + + private NewDataSetDssDTO getNewDataSet() + { + String storageProcessName = arguments.getStorageProcess(); + String filePath = arguments.getFilePath(); + filePath.length(); + InputStream fileInputStream = null; + return new NewDataSetDssDTO(storageProcessName, fileInputStream); + } + } + + private final CommandPutArguments arguments; + + CommandPut() + { + arguments = new CommandPutArguments(); + parser = new CmdLineParser(arguments); + } + + public int execute(String[] args) throws UserFailureException, EnvironmentFailureException + { + parser.parseArgument(args); + + // Show help and exit + if (arguments.isHelp()) + { + printUsage(System.out); + return 0; + } + + // Show usage and exit + if (arguments.isComplete() == false) + { + printUsage(System.err); + return 1; + } + + IDssComponent component = login(arguments); + IDssServiceRpcGeneric dssService = component.getDefaultDssService(); + return new CommandPutExecutor(dssService, arguments).execute(); + } + + public String getName() + { + return "put"; + } + + /** + * Print usage information about the command. + */ + @Override + public void printUsage(PrintStream out) + { + out.println(getUsagePrefixString() + " [options] <storage process> <path>"); + parser.printUsage(out); + out.println(" Example : " + getCommandCallString() + " " + + parser.printExample(ExampleMode.ALL) + " <storage process> <path>"); + } +} diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/DataSetArguments.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/DataSetArguments.java new file mode 100644 index 0000000000000000000000000000000000000000..bce2b8ad1ceae843c9d8abb8ba37c693ab29198d --- /dev/null +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/DataSetArguments.java @@ -0,0 +1,69 @@ +/* + * 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.dss.client.api.cli; + +import java.util.List; + +/** + * Command line arguments for dss commands that refer to data sets. The format is: + * <p> + * <code> + * [options] DATA_SET_CODE [PATH] + * </code> + * + * @author Chandrasekhar Ramakrishnan + */ +class DataSetArguments extends GlobalArguments +{ + public String getDataSetCode() + { + List<String> args = getArguments(); + if (args.size() < 1) + { + return ""; + } + return args.get(0); + } + + public String getRequestedPath() + { + List<String> args = getArguments(); + String path; + if (args.size() < 2) + { + path = "/"; + } else + { + path = args.get(1); + } + return path; + } + + @Override + public boolean isComplete() + { + if (false == super.isComplete()) + return false; + + if (getDataSetCode().length() < 1) + { + return false; + } + + return true; + } +} diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/DssClient.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/DssClient.java index ea3cc23dd303728f9505f03df038dede9af92f3b..61dbaf648bcf3bd652d548cf200d5c11be5ace48 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/DssClient.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/DssClient.java @@ -157,6 +157,7 @@ public class DssClient } String commandName = args[0]; + System.out.println("Command " + commandName); ICommand command = commandFactory.tryCommandForName(commandName); if (null == command) { diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/GlobalArguments.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/GlobalArguments.java index 049957a324ee3c6891ab97ca5038fdc1306c1f9d..df643c41a804b752ca07d9862c6cf5eea19fc19b 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/GlobalArguments.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/cli/GlobalArguments.java @@ -88,30 +88,6 @@ class GlobalArguments this.serverBaseUrl = serverBaseUrl; } - public String getDataSetCode() - { - List<String> args = getArguments(); - if (args.size() < 1) - { - return ""; - } - return args.get(0); - } - - public String getRequestedPath() - { - List<String> args = getArguments(); - String path; - if (args.size() < 2) - { - path = "/"; - } else - { - path = args.get(1); - } - return path; - } - public List<String> getArguments() { return arguments; @@ -141,12 +117,7 @@ class GlobalArguments { return false; } - if (getDataSetCode().length() < 1) - { - return false; - } return true; - } } diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/v1/IDssComponent.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/v1/IDssComponent.java index b5e8491c652af4672a0ef59a4ca0c0f5d7920625..00645ff158e6195b74a18d79f422acb34febed20 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/v1/IDssComponent.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/v1/IDssComponent.java @@ -18,6 +18,7 @@ package ch.systemsx.cisd.openbis.dss.client.api.v1; import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException; import ch.systemsx.cisd.common.exceptions.InvalidSessionException; +import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.IDssServiceRpcGeneric; /** * A component that manages a connection to openBIS and 1 or more data store servers. @@ -63,6 +64,16 @@ public interface IDssComponent public IDataSetDss getDataSet(String code) throws IllegalStateException, EnvironmentFailureException; + /** + * Get a proxy to the default DSS server for the openBIS AS. + * + * @throws IllegalStateException Thrown if the user has not yet been authenticated. + * @throws EnvironmentFailureException Thrown in cases where it is not possible to connect to + * the server. + */ + public IDssServiceRpcGeneric getDefaultDssService() throws IllegalStateException, + EnvironmentFailureException; + /** * Logs the current user out. */ diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/v1/impl/DssComponent.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/v1/impl/DssComponent.java index 4cdbcc43e3308e37157c914212ac792d71519705..9022a921646c77a041de0cc0a350b2646b1b4342 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/v1/impl/DssComponent.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/client/api/v1/impl/DssComponent.java @@ -177,6 +177,12 @@ public class DssComponent implements IDssComponent state.login(user, password); state = new AuthenticatedState(openBisService, dssServiceFactory, state.getSessionToken()); } + + public IDssServiceRpcGeneric getDefaultDssService() throws IllegalStateException, + EnvironmentFailureException + { + return state.getDefaultDssService(); + } } /** @@ -206,6 +212,11 @@ abstract class AbstractDssComponentState implements IDssComponent throw new IllegalStateException("Please log in"); } + public IDssServiceRpcGeneric getDefaultDssService() throws IllegalStateException + { + throw new IllegalStateException("Please log in"); + } + /** * Authenticates the <code>user</code> with given <code>password</code>. * @@ -326,7 +337,13 @@ class AuthenticatedState extends AbstractDssComponentState IDssServiceRpcGeneric dssService = getDssServiceForUrl(url); // Return a proxy to the data set return new DataSetDss(code, dssService, this); + } + @Override + public IDssServiceRpcGeneric getDefaultDssService() + { + + return null; } /** diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/api/v1/DssServiceRpcGeneric.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/api/v1/DssServiceRpcGeneric.java index 14da6f0f72f17151b71b9d909ee585a488b97d7f..b3a25d317d063df69ec79cc921632d9974105bee 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/api/v1/DssServiceRpcGeneric.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/server/api/v1/DssServiceRpcGeneric.java @@ -26,9 +26,9 @@ import ch.systemsx.cisd.base.exceptions.IOExceptionUnchecked; import ch.systemsx.cisd.openbis.dss.generic.server.AbstractDssServiceRpc; import ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService; import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.FileInfoDssDTO; -import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.FileReferenceDTO; +import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.FileReferenceDssDTO; import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.IDssServiceRpcGeneric; -import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.NewDatasetDTO; +import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.NewDataSetDssDTO; /** * Implementation of the generic RPC interface. @@ -86,7 +86,7 @@ public class DssServiceRpcGeneric extends AbstractDssServiceRpc implements IDssS } } - public void putDataSet(String sessionToken, NewDatasetDTO newDataSet) + public void putDataSet(String sessionToken, NewDataSetDssDTO newDataSet) throws IOExceptionUnchecked, IllegalArgumentException { @@ -121,14 +121,14 @@ public class DssServiceRpcGeneric extends AbstractDssServiceRpc implements IDssS factory.appendFileInfosForFile(requestedFile, list, isRecursive); } - public InputStream getFileForDataSet(String sessionToken, FileReferenceDTO fileOrFolder) + public InputStream getFileForDataSet(String sessionToken, FileReferenceDssDTO fileOrFolder) throws IOExceptionUnchecked, IllegalArgumentException { return this.getFileForDataSet(sessionToken, fileOrFolder.getDataSetCode(), fileOrFolder .getPath()); } - public FileInfoDssDTO[] listFilesForDataSet(String sessionToken, FileReferenceDTO fileOrFolder) + public FileInfoDssDTO[] listFilesForDataSet(String sessionToken, FileReferenceDssDTO fileOrFolder) throws IOExceptionUnchecked, IllegalArgumentException { return this.listFilesForDataSet(sessionToken, fileOrFolder.getDataSetCode(), fileOrFolder diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/api/v1/FileReferenceDTO.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/api/v1/FileReferenceDssDTO.java similarity index 90% rename from datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/api/v1/FileReferenceDTO.java rename to datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/api/v1/FileReferenceDssDTO.java index 85e6c2852463eed386f45b304f6e82489856b614..27027f05454f81ccf3925aab6827f65049d4bad8 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/api/v1/FileReferenceDTO.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/api/v1/FileReferenceDssDTO.java @@ -23,7 +23,7 @@ import java.io.Serializable; * * @author Chandrasekhar Ramakrishnan */ -public class FileReferenceDTO implements Serializable +public class FileReferenceDssDTO implements Serializable { private static final long serialVersionUID = 1L; @@ -33,7 +33,7 @@ public class FileReferenceDTO implements Serializable private final boolean isRecursive; - public FileReferenceDTO(String dataSetCode, String path, boolean isRecursive) + public FileReferenceDssDTO(String dataSetCode, String path, boolean isRecursive) { this.dataSetCode = dataSetCode; this.path = path; diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/api/v1/IDssServiceRpcGeneric.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/api/v1/IDssServiceRpcGeneric.java index 5557b9245ecd1dc891584423489ae02abcd7fea7..5a02d1480ff8b69c78667d6bd1b284bb01e43201 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/api/v1/IDssServiceRpcGeneric.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/api/v1/IDssServiceRpcGeneric.java @@ -38,7 +38,7 @@ public interface IDssServiceRpcGeneric extends IRpcService * @throws IOExceptionUnchecked Thrown if an IOException occurs when listing the files * @throws IllegalArgumentException Thrown if the dataSetCode or startPath are not valid */ - public FileInfoDssDTO[] listFilesForDataSet(String sessionToken, FileReferenceDTO fileOrFolder) + public FileInfoDssDTO[] listFilesForDataSet(String sessionToken, FileReferenceDssDTO fileOrFolder) throws IOExceptionUnchecked, IllegalArgumentException; /** @@ -49,7 +49,7 @@ public interface IDssServiceRpcGeneric extends IRpcService * @throws IOExceptionUnchecked Thrown if an IOException occurs when listing the files * @throws IllegalArgumentException Thrown if the dataSetCode or startPath are not valid */ - public InputStream getFileForDataSet(String sessionToken, FileReferenceDTO fileOrFolder) + public InputStream getFileForDataSet(String sessionToken, FileReferenceDssDTO fileOrFolder) throws IOExceptionUnchecked, IllegalArgumentException; /** @@ -85,6 +85,6 @@ public interface IDssServiceRpcGeneric extends IRpcService * @throws IOExceptionUnchecked Thrown if an IOException occurs when listing the files * @throws IllegalArgumentException Thrown if the dataSetCode or startPath are not valid */ - public void putDataSet(String sessionToken, NewDatasetDTO newDataset) + public void putDataSet(String sessionToken, NewDataSetDssDTO newDataset) throws IOExceptionUnchecked, IllegalArgumentException; } diff --git a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/api/v1/NewDatasetDTO.java b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/api/v1/NewDataSetDssDTO.java similarity index 93% rename from datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/api/v1/NewDatasetDTO.java rename to datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/api/v1/NewDataSetDssDTO.java index 6f392c51570b63cd0f2e59f47fb00093cd7c1a5f..ddddc8fef65e5cb573b037b7065f6009137e7f75 100644 --- a/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/api/v1/NewDatasetDTO.java +++ b/datastore_server/source/java/ch/systemsx/cisd/openbis/dss/generic/shared/api/v1/NewDataSetDssDTO.java @@ -29,7 +29,7 @@ import ch.systemsx.cisd.common.io.ConcatenatedFileInputStream; * * @author Chandrasekhar Ramakrishnan */ -public class NewDatasetDTO implements Serializable +public class NewDataSetDssDTO implements Serializable { private static final long serialVersionUID = 1L; @@ -44,7 +44,7 @@ public class NewDatasetDTO implements Serializable * @param inputStream An input stream on the file or folder to register. If a folder is to be * registered, the input stream must be a {@link ConcatenatedFileInputStream}. */ - public NewDatasetDTO(String storageProcessName, InputStream inputStream) + public NewDataSetDssDTO(String storageProcessName, InputStream inputStream) { this.storageProcessName = storageProcessName; this.inputStream = inputStream; diff --git a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/client/api/cli/DataSetArgumentsTest.java b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/client/api/cli/DataSetArgumentsTest.java new file mode 100644 index 0000000000000000000000000000000000000000..67c25660cc832075b9f20f33a1addf727cf98b18 --- /dev/null +++ b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/client/api/cli/DataSetArgumentsTest.java @@ -0,0 +1,78 @@ +/* + * 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.dss.client.api.cli; + +import org.testng.AssertJUnit; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +import ch.systemsx.cisd.args4j.CmdLineException; +import ch.systemsx.cisd.args4j.CmdLineParser; + +/** + * @author Chandrasekhar Ramakrishnan + */ +public class DataSetArgumentsTest extends AssertJUnit +{ + + private DataSetArguments arguments; + + private CmdLineParser parser; + + @BeforeMethod + public void setUp() + { + arguments = new DataSetArguments(); + parser = new CmdLineParser(arguments); + } + + @Test + public void testParseBasicArguments() + { + String[] args = + { "-u", "foo", "-p", "bar", "-s", "http://localhost:8888/openbis", + "20100318094819344-4" }; + try + { + parser.parseArgument(args); + assertEquals("foo", arguments.getUsername()); + assertEquals("bar", arguments.getPassword()); + assertEquals("http://localhost:8888/openbis", arguments.getServerBaseUrl()); + assertEquals("20100318094819344-4", arguments.getDataSetCode()); + assertTrue(arguments.isComplete()); + assertFalse(arguments.isHelp()); + } catch (CmdLineException c) + { + fail("Should have parsed arguments"); + } + } + + @Test + public void testParseIncompleteArguments() + { + String[] args = + { "-u", "foo", "-p", "bar", "-s", "http://localhost:8888/openbis" }; + try + { + parser.parseArgument(args); + assertFalse(arguments.isComplete()); + } catch (CmdLineException c) + { + fail("Should have parsed arguments"); + } + } +} diff --git a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/client/api/cli/GlobalArgumentsTest.java b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/client/api/cli/GlobalArgumentsTest.java index d201f65e7c5c6959d8df5141b4d321c14fce9385..20eb5bc5ca564cc95568aefbeb1cea1afa581035 100644 --- a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/client/api/cli/GlobalArgumentsTest.java +++ b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/client/api/cli/GlobalArgumentsTest.java @@ -22,7 +22,6 @@ import org.testng.annotations.Test; import ch.systemsx.cisd.args4j.CmdLineException; import ch.systemsx.cisd.args4j.CmdLineParser; -import ch.systemsx.cisd.openbis.dss.client.api.cli.GlobalArguments; /** * @author Chandrasekhar Ramakrishnan @@ -41,42 +40,6 @@ public class GlobalArgumentsTest extends AssertJUnit parser = new CmdLineParser(arguments); } - @Test - public void testParseBasicArguments() - { - String[] args = - { "-u", "foo", "-p", "bar", "-s", "http://localhost:8888/openbis", - "20100318094819344-4" }; - try - { - parser.parseArgument(args); - assertEquals("foo", arguments.getUsername()); - assertEquals("bar", arguments.getPassword()); - assertEquals("http://localhost:8888/openbis", arguments.getServerBaseUrl()); - assertEquals("20100318094819344-4", arguments.getDataSetCode()); - assertTrue(arguments.isComplete()); - assertFalse(arguments.isHelp()); - } catch (CmdLineException c) - { - fail("Should have parsed arguments"); - } - } - - @Test - public void testParseIncompleteArguments() - { - String[] args = - { "-u", "foo", "-p", "bar", "-s", "http://localhost:8888/openbis" }; - try - { - parser.parseArgument(args); - assertFalse(arguments.isComplete()); - } catch (CmdLineException c) - { - fail("Should have parsed arguments"); - } - } - @Test public void testHelp() { diff --git a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/client/api/v1/impl/DssComponentTest.java b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/client/api/v1/impl/DssComponentTest.java index d241c21e7d08aecb8fb7d54bddfea450c6667435..ed80188340f5a2fffc3e3ba9506c7d951123aa3d 100644 --- a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/client/api/v1/impl/DssComponentTest.java +++ b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/client/api/v1/impl/DssComponentTest.java @@ -36,7 +36,7 @@ import ch.systemsx.cisd.common.api.RpcServiceInterfaceDTO; import ch.systemsx.cisd.common.api.RpcServiceInterfaceVersionDTO; import ch.systemsx.cisd.openbis.dss.client.api.v1.IDataSetDss; import ch.systemsx.cisd.openbis.dss.client.api.v1.impl.DssComponent; -import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.FileInfoDssBuilder; +import ch.systemsx.cisd.openbis.dss.generic.server.api.v1.FileInfoDssBuilder; import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.FileInfoDssDTO; import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.IDssServiceRpcGeneric; import ch.systemsx.cisd.openbis.generic.shared.IETLLIMSService;