diff --git a/bds/source/java/ch/systemsx/cisd/bds/ExperimentIdentifier.java b/bds/source/java/ch/systemsx/cisd/bds/ExperimentIdentifier.java index 53e3a16ce6b8d8aafc74df11334198d93d0449e1..d59a850ca6d52c3254ef8df060d5dd76ae4b9b01 100644 --- a/bds/source/java/ch/systemsx/cisd/bds/ExperimentIdentifier.java +++ b/bds/source/java/ch/systemsx/cisd/bds/ExperimentIdentifier.java @@ -87,10 +87,10 @@ public class ExperimentIdentifier public void saveTo(IDirectory directory) { - IDirectory folder = directory.appendDirectory(FOLDER); - folder.appendKeyValuePair(GROUP_CODE, groupCode); - folder.appendKeyValuePair(PROJECT_CODE, projectCode); - folder.appendKeyValuePair(EXPERIMENT_CODE, experimentCode); + IDirectory folder = directory.makeDirectory(FOLDER); + folder.addKeyValuePair(GROUP_CODE, groupCode); + folder.addKeyValuePair(PROJECT_CODE, projectCode); + folder.addKeyValuePair(EXPERIMENT_CODE, experimentCode); } @Override diff --git a/bds/source/java/ch/systemsx/cisd/bds/IDataStructure.java b/bds/source/java/ch/systemsx/cisd/bds/IDataStructure.java deleted file mode 100644 index e8c6b1bc5260518b31a43ac861cc7df3c55e5b5a..0000000000000000000000000000000000000000 --- a/bds/source/java/ch/systemsx/cisd/bds/IDataStructure.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2007 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.bds; - -import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException; - -/** - * Common interface of all versions of data structures. - * - * @author Franz-Josef Elmer - */ -public interface IDataStructure extends IHasVersion -{ - /** - * Returns the name of this data structure. - */ - public String getName(); - - /** - * Save the current structure. - * - * @throws EnvironmentFailureException if it couldn't saved. - */ - public void save() throws EnvironmentFailureException; -} diff --git a/bds/source/java/ch/systemsx/cisd/bds/IDataStructureV1_0.java b/bds/source/java/ch/systemsx/cisd/bds/IDataStructureV1_0.java deleted file mode 100644 index 2a6eb2643a1dcdab0a387c361bd5eb8333d0dd6e..0000000000000000000000000000000000000000 --- a/bds/source/java/ch/systemsx/cisd/bds/IDataStructureV1_0.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2007 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.bds; - -import ch.systemsx.cisd.bds.storage.IDirectory; - -/** - * Data structure interface for Version 1.0. - * - * @author Franz-Josef Elmer - */ -public interface IDataStructureV1_0 extends IDataStructure -{ - public IDirectory getOriginalData(); - - public IFormatedData getFormatedData(); - - public ExperimentIdentifier getExperimentIdentifier(); - - public void setExperimentIdentifier(ExperimentIdentifier id); - - public ProcessingType getProcessingType(); - - public void setProcessingType(ProcessingType type); -} diff --git a/bds/source/java/ch/systemsx/cisd/bds/IDirectory.java b/bds/source/java/ch/systemsx/cisd/bds/IDirectory.java deleted file mode 100644 index dc9c18da657e83183511e5165bcf30d5082c52ee..0000000000000000000000000000000000000000 --- a/bds/source/java/ch/systemsx/cisd/bds/IDirectory.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2007 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.bds; - -import java.io.File; - -/** - * - * - * @author Franz-Josef Elmer - */ -public interface IDirectory extends INode, Iterable<INode> -{ - public INode getNode(String name); - - public IDirectory appendDirectory(String name); - - public void appendNode(INode node); - - public void appendRealFile(File file); - - public void appendKeyValuePair(String key, String value); - - public void appendLink(String name, INode node); -} diff --git a/bds/source/java/ch/systemsx/cisd/bds/IFile.java b/bds/source/java/ch/systemsx/cisd/bds/IFile.java deleted file mode 100644 index 1eae746f513a7eb2ffd17adf31a33f25777c0cc8..0000000000000000000000000000000000000000 --- a/bds/source/java/ch/systemsx/cisd/bds/IFile.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2007 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.bds; - -/** - * Role of a file with a value (content) of type <code>T</code>. - * - * @author Franz-Josef Elmer - */ -public interface IFile<T> extends INode -{ - /** - * Returns the value (or content) of this file node. - */ - public T getValue(); -} diff --git a/bds/source/java/ch/systemsx/cisd/bds/ILink.java b/bds/source/java/ch/systemsx/cisd/bds/ILink.java deleted file mode 100644 index 84c8324e11a2ee879362ca0cfc70647795b3e7e9..0000000000000000000000000000000000000000 --- a/bds/source/java/ch/systemsx/cisd/bds/ILink.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2007 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.bds; - -/** - * - * - * @author Franz-Josef Elmer - */ -public interface ILink extends INode -{ - public INode getReference(); -} diff --git a/bds/source/java/ch/systemsx/cisd/bds/INode.java b/bds/source/java/ch/systemsx/cisd/bds/INode.java deleted file mode 100644 index 4361171ded5a5ce15e283599777b27a9f6d0220f..0000000000000000000000000000000000000000 --- a/bds/source/java/ch/systemsx/cisd/bds/INode.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2007 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.bds; - -import java.io.File; - -import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException; -import ch.systemsx.cisd.common.exceptions.UserFailureException; - -/** - * Role of a node in the data structure. - * - * @author Franz-Josef Elmer - */ -public interface INode -{ - /** - * Returns the name of this node. - */ - public String getName(); - - /** - * Returns the parent directory of this node or <code>null</code> if it is the root node. - */ - public IDirectory tryToGetParent(); - - /** - * Extracts this node to the specified directory of the file system. All descendants are also extracted. - * - * @throws UserFailureException if this or a descended node is a link referring to a node which is not this - * node or a descended node. - * @throws EnvironmentFailureException if extraction causes an IOException. - */ - public void extractTo(File directory) throws UserFailureException, EnvironmentFailureException; -} diff --git a/bds/source/java/ch/systemsx/cisd/bds/IStorage.java b/bds/source/java/ch/systemsx/cisd/bds/IStorage.java deleted file mode 100644 index 8441062e2298fd00ed4a4619c473c24c69dcf005..0000000000000000000000000000000000000000 --- a/bds/source/java/ch/systemsx/cisd/bds/IStorage.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2007 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.bds; - -/** - * - * - * @author Franz-Josef Elmer - */ -public interface IStorage -{ - public void load(); - - public IDirectory getRoot(); - - public void save(); -} diff --git a/bds/source/java/ch/systemsx/cisd/bds/ProcessingType.java b/bds/source/java/ch/systemsx/cisd/bds/ProcessingType.java index c84a55cb218ae36406b3c6cb023828a6197e1bd6..e4aaaa5875beac7b0a796a0c78c710a5adb224ce 100644 --- a/bds/source/java/ch/systemsx/cisd/bds/ProcessingType.java +++ b/bds/source/java/ch/systemsx/cisd/bds/ProcessingType.java @@ -48,6 +48,6 @@ public enum ProcessingType public void saveTo(IDirectory directory) { - directory.appendKeyValuePair(PROCESSING_TYPE, toString()); + directory.addKeyValuePair(PROCESSING_TYPE, toString()); } } diff --git a/bds/source/java/ch/systemsx/cisd/bds/Version.java b/bds/source/java/ch/systemsx/cisd/bds/Version.java index 0770d4e4e48b5c6c0def65e2e38422dafb20e2be..561d8090d5fa013a23e8607e8e429dfb3176b7d4 100644 --- a/bds/source/java/ch/systemsx/cisd/bds/Version.java +++ b/bds/source/java/ch/systemsx/cisd/bds/Version.java @@ -106,9 +106,9 @@ public final class Version public void saveTo(IDirectory directory) { - IDirectory versionFolder = directory.appendDirectory(VERSION); - versionFolder.appendKeyValuePair(MAJOR, Integer.toString(major)); - versionFolder.appendKeyValuePair(MINOR, Integer.toString(minor)); + IDirectory versionFolder = directory.makeDirectory(VERSION); + versionFolder.addKeyValuePair(MAJOR, Integer.toString(major)); + versionFolder.addKeyValuePair(MINOR, Integer.toString(minor)); } @Override diff --git a/bds/source/java/ch/systemsx/cisd/bds/storage/IDirectory.java b/bds/source/java/ch/systemsx/cisd/bds/storage/IDirectory.java index 98c493481acfde313b49ee24f5934ebe671e1aa1..c686840a3e9ef6772390279eefd3073728716ec9 100644 --- a/bds/source/java/ch/systemsx/cisd/bds/storage/IDirectory.java +++ b/bds/source/java/ch/systemsx/cisd/bds/storage/IDirectory.java @@ -27,13 +27,13 @@ public interface IDirectory extends INode, Iterable<INode> { public INode getNode(String name); - public IDirectory appendDirectory(String name); + public IDirectory makeDirectory(String name); - public void appendNode(INode node); + public void addNode(INode node); - public void appendRealFile(File file); + public IFile<File> addRealFile(File file); - public void appendKeyValuePair(String key, String value); + public IFile<String> addKeyValuePair(String key, String value); - public void appendLink(String name, INode node); + public ILink addLink(String name, INode node); } diff --git a/bds/source/java/ch/systemsx/cisd/bds/storage/filesystem/Directory.java b/bds/source/java/ch/systemsx/cisd/bds/storage/filesystem/Directory.java index d59a75491c048c589f6c88a7898d6814af0fa5b7..6f2d6668ba7d3e803d8a2f62bddc667c2aceff2f 100644 --- a/bds/source/java/ch/systemsx/cisd/bds/storage/filesystem/Directory.java +++ b/bds/source/java/ch/systemsx/cisd/bds/storage/filesystem/Directory.java @@ -22,6 +22,8 @@ import java.io.IOException; import java.util.Iterator; import ch.systemsx.cisd.bds.storage.IDirectory; +import ch.systemsx.cisd.bds.storage.IFile; +import ch.systemsx.cisd.bds.storage.ILink; import ch.systemsx.cisd.bds.storage.INode; import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException; import ch.systemsx.cisd.common.exceptions.UserFailureException; @@ -45,13 +47,13 @@ class Directory extends AbstractNode implements IDirectory return null; } - public IDirectory appendDirectory(String name) + public IDirectory makeDirectory(String name) { // TODO Auto-generated method stub return null; } - public void appendKeyValuePair(String key, String value) + public IFile<String> addKeyValuePair(String key, String value) { File file = new File(fileNode, key); try @@ -64,15 +66,16 @@ class Directory extends AbstractNode implements IDirectory file.delete(); throw new EnvironmentFailureException("Can not create " + file.getAbsolutePath() + ": " + ex); } + return null; } - public void appendNode(INode node) + public void addNode(INode node) { // TODO Auto-generated method stub } - public void appendRealFile(File file) + public IFile<File> addRealFile(File file) { File newFile = new File(fileNode, file.getName()); if (file.renameTo(newFile) == false) @@ -80,12 +83,13 @@ class Directory extends AbstractNode implements IDirectory throw new EnvironmentFailureException("Couldn't move file " + file.getAbsolutePath() + " to " + fileNode.getAbsolutePath()); } + return null; } - public void appendLink(String name, INode node) + public ILink addLink(String name, INode node) { // TODO Auto-generated method stub - + return null; } public Iterator<INode> iterator()