Author: glandais Date: 2007-12-10 15:19:28 +0000 (Mon, 10 Dec 2007) New Revision: 58 Added: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/BaseEntity.java trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/Code.java trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/Component.java trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/Constant.java trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/ConstantValue.java trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/DataEntity.java trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/ExplorationApplication.java trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/ExplorationData.java trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/Library.java trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/LoggableElement.java trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/Repository.java trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/Result.java trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/Structure.java trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/metadata/ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/metadata/MetaDataEntity.java trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/metadata/Version.java Removed: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Code.java trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Component.java trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Constant.java trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/ConstantValue.java trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Descriptor.java trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Entity.java trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/ExplorationApplication.java trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/ExplorationData.java trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/FileEntity.java trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Library.java trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/LoggableElement.java trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Repository.java trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Result.java trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Structure.java trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Version.java Log: Extraction des Metadata Added: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/BaseEntity.java =================================================================== --- trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/BaseEntity.java (rev 0) +++ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/BaseEntity.java 2007-12-10 15:19:28 UTC (rev 58) @@ -0,0 +1,5 @@ +package fr.cemagref.simexplorer.is.storage.entities; + +public abstract class BaseEntity { + +} Deleted: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Code.java =================================================================== --- trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Code.java 2007-12-10 15:18:35 UTC (rev 57) +++ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Code.java 2007-12-10 15:19:28 UTC (rev 58) @@ -1,24 +0,0 @@ -package fr.cemagref.simexplorer.is.storage.entities; - -public class Code extends Entity { - - private String language; - private String code; - - public String getLanguage() { - return language; - } - - public void setLanguage(String language) { - this.language = language; - } - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - -} Deleted: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Component.java =================================================================== --- trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Component.java 2007-12-10 15:18:35 UTC (rev 57) +++ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Component.java 2007-12-10 15:19:28 UTC (rev 58) @@ -1,62 +0,0 @@ -package fr.cemagref.simexplorer.is.storage.entities; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import fr.cemagref.simexplorer.is.storage.attachment.type.ContentType; - -public class Component extends LoggableElement { - - Set<Constant> constants; - Set<Structure> structures; - Set<Code> codes; - Set<Library> libraries; - - public Set<Constant> getConstants() { - return constants; - } - - public void setConstants(Set<Constant> constants) { - this.constants = constants; - } - - public Set<Structure> getStructures() { - return structures; - } - - public void setStructures(Set<Structure> structures) { - this.structures = structures; - } - - public Set<Code> getCodes() { - return codes; - } - - public void setCodes(Set<Code> codes) { - this.codes = codes; - } - - public Set<Library> getLibraries() { - return libraries; - } - - public void setLibraries(Set<Library> libraries) { - this.libraries = libraries; - } - - @Override - public Set<LoggableElement> getChildren() { - Set<LoggableElement> elements = new HashSet<LoggableElement>(); - elements.addAll(libraries); - return elements; - } - - @Override - public Map<String, ContentType> getContentTypes() throws Exception { - Map<String, ContentType> contentTypes = new HashMap<String, ContentType>(); - return contentTypes; - } - -} Deleted: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Constant.java =================================================================== --- trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Constant.java 2007-12-10 15:18:35 UTC (rev 57) +++ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Constant.java 2007-12-10 15:19:28 UTC (rev 58) @@ -1,24 +0,0 @@ -package fr.cemagref.simexplorer.is.storage.entities; - -public class Constant extends Entity { - - private String name; - private Class<?> type; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Class<?> getType() { - return type; - } - - public void setType(Class<?> type) { - this.type = type; - } - -} Deleted: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/ConstantValue.java =================================================================== --- trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/ConstantValue.java 2007-12-10 15:18:35 UTC (rev 57) +++ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/ConstantValue.java 2007-12-10 15:19:28 UTC (rev 58) @@ -1,24 +0,0 @@ -package fr.cemagref.simexplorer.is.storage.entities; - -public class ConstantValue extends Entity { - - private String value; - private Constant constant; - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public Constant getConstant() { - return constant; - } - - public void setConstant(Constant constant) { - this.constant = constant; - } - -} Deleted: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Descriptor.java =================================================================== --- trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Descriptor.java 2007-12-10 15:18:35 UTC (rev 57) +++ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Descriptor.java 2007-12-10 15:19:28 UTC (rev 58) @@ -1,24 +0,0 @@ -package fr.cemagref.simexplorer.is.storage.entities; - -public class Descriptor extends Entity { - - private String name; - private String value; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - -} Deleted: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Entity.java =================================================================== --- trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Entity.java 2007-12-10 15:18:35 UTC (rev 57) +++ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Entity.java 2007-12-10 15:19:28 UTC (rev 58) @@ -1,15 +0,0 @@ -package fr.cemagref.simexplorer.is.storage.entities; - -public abstract class Entity { - - private LoggableElement owner; - - public LoggableElement getOwner() { - return owner; - } - - public void setOwner(LoggableElement owner) { - this.owner = owner; - } - -} Deleted: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/ExplorationApplication.java =================================================================== --- trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/ExplorationApplication.java 2007-12-10 15:18:35 UTC (rev 57) +++ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/ExplorationApplication.java 2007-12-10 15:19:28 UTC (rev 58) @@ -1,49 +0,0 @@ -package fr.cemagref.simexplorer.is.storage.entities; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import fr.cemagref.simexplorer.is.storage.attachment.type.ContentType; -import fr.cemagref.simexplorer.is.storage.attachment.type.ContentTypeFactory; -import fr.cemagref.simexplorer.is.storage.attachment.type.RawType; - -public class ExplorationApplication extends LoggableElement { - - private Set<ExplorationData> explorations; - private Set<Component> components; - - public Set<ExplorationData> getExplorations() { - return explorations; - } - - public void setExplorations(Set<ExplorationData> explorations) { - this.explorations = explorations; - } - - public Set<Component> getComponents() { - return components; - } - - public void setComponents(Set<Component> components) { - this.components = components; - } - - @Override - public Set<LoggableElement> getChildren() { - Set<LoggableElement> elements = new HashSet<LoggableElement>(); - elements.addAll(explorations); - elements.addAll(components); - return elements; - } - - @Override - public Map<String, ContentType> getContentTypes() throws Exception { - Map<String, ContentType> contentTypes = new HashMap<String, ContentType>(); - contentTypes.put("xml", ContentTypeFactory - .getContentTypeInstance(RawType.class)); - return contentTypes; - } - -} Deleted: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/ExplorationData.java =================================================================== --- trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/ExplorationData.java 2007-12-10 15:18:35 UTC (rev 57) +++ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/ExplorationData.java 2007-12-10 15:19:28 UTC (rev 58) @@ -1,75 +0,0 @@ -package fr.cemagref.simexplorer.is.storage.entities; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import fr.cemagref.simexplorer.is.storage.attachment.type.ContentType; -import fr.cemagref.simexplorer.is.storage.attachment.type.ContentTypeFactory; -import fr.cemagref.simexplorer.is.storage.attachment.type.RawType; - -public class ExplorationData extends LoggableElement { - - private Set<ConstantValue> valuesMap; - private Result result; - - private ConstantValue findConstantValue(Constant c) { - for (ConstantValue constantValue : valuesMap) { - if (c.equals(constantValue.getConstant())) { - return constantValue; - } - } - return null; - } - - public void setConstantValue(Constant c, String value) { - ConstantValue constantValue = findConstantValue(c); - if (constantValue == null) { - constantValue = new ConstantValue(); - constantValue.setConstant(c); - valuesMap.add(constantValue); - } - constantValue.setValue(value); - } - - public Object getConstantValue(Constant c) { - ConstantValue constantValue = findConstantValue(c); - if (constantValue == null) { - return null; - } else { - return constantValue.getValue(); - } - } - - public Result getResult() { - return result; - } - - public void setResult(Result result) { - this.result = result; - } - - public Set<ConstantValue> getValuesMap() { - return valuesMap; - } - - public void setValuesMap(Set<ConstantValue> valuesMap) { - this.valuesMap = valuesMap; - } - - @Override - public Set<LoggableElement> getChildren() { - Set<LoggableElement> elements = new HashSet<LoggableElement>(); - return elements; - } - - @Override - public Map<String, ContentType> getContentTypes() throws Exception { - Map<String, ContentType> contentTypes = new HashMap<String, ContentType>(); - contentTypes.put("xml", ContentTypeFactory - .getContentTypeInstance(RawType.class)); - return contentTypes; - } - -} Deleted: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/FileEntity.java =================================================================== --- trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/FileEntity.java 2007-12-10 15:18:35 UTC (rev 57) +++ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/FileEntity.java 2007-12-10 15:19:28 UTC (rev 58) @@ -1,11 +0,0 @@ -package fr.cemagref.simexplorer.is.storage.entities; - -import java.util.Map; - -import fr.cemagref.simexplorer.is.storage.attachment.type.ContentType; - -public abstract class FileEntity extends Entity { - - public abstract Map<String, ContentType> getContentTypes() throws Exception; - -} Deleted: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Library.java =================================================================== --- trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Library.java 2007-12-10 15:18:35 UTC (rev 57) +++ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Library.java 2007-12-10 15:19:28 UTC (rev 58) @@ -1,28 +0,0 @@ -package fr.cemagref.simexplorer.is.storage.entities; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import fr.cemagref.simexplorer.is.storage.attachment.type.ContentType; -import fr.cemagref.simexplorer.is.storage.attachment.type.ContentTypeFactory; -import fr.cemagref.simexplorer.is.storage.attachment.type.RawType; - -public class Library extends LoggableElement { - - @Override - public Set<LoggableElement> getChildren() { - Set<LoggableElement> elements = new HashSet<LoggableElement>(); - return elements; - } - - @Override - public Map<String, ContentType> getContentTypes() throws Exception { - Map<String, ContentType> contentTypes = new HashMap<String, ContentType>(); - contentTypes.put("library", ContentTypeFactory - .getContentTypeInstance(RawType.class)); - return contentTypes; - } - -} Deleted: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/LoggableElement.java =================================================================== --- trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/LoggableElement.java 2007-12-10 15:18:35 UTC (rev 57) +++ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/LoggableElement.java 2007-12-10 15:19:28 UTC (rev 58) @@ -1,148 +0,0 @@ -package fr.cemagref.simexplorer.is.storage.entities; - -import java.util.Date; -import java.util.Set; - -public abstract class LoggableElement extends FileEntity { - - private String uuid; - private String name; - private String type; - private String description; - private Version version; - private Date creationDate; - private String hash; - private Set<Descriptor> descriptors; - private LoggableElement parentVersion; - - public abstract Set<LoggableElement> getChildren(); - - /** - * @return the uuid - */ - public String getUuid() { - return uuid; - } - - /** - * @param uuid the uuid to set - */ - public void setUuid(String uuid) { - this.uuid = uuid; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the type - */ - public String getType() { - return type; - } - - /** - * @param type the type to set - */ - public void setType(String type) { - this.type = type; - } - - /** - * @return the description - */ - public String getDescription() { - return description; - } - - /** - * @param description the description to set - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * @return the version - */ - public Version getVersion() { - return version; - } - - /** - * @param version the version to set - */ - public void setVersion(String version) { - this.version = new Version(version); - } - - /** - * @return the creationDate - */ - public Date getCreationDate() { - return creationDate; - } - - /** - * @param creationDate the creationDate to set - */ - public void setCreationDate(Date creationDate) { - this.creationDate = creationDate; - } - - /** - * @return the hash - */ - public String getHash() { - return hash; - } - - /** - * @param hash the hash to set - */ - public void setHash(String hash) { - this.hash = hash; - } - - /** - * @return the descriptors - */ - public Set<Descriptor> getDescriptors() { - return descriptors; - } - - /** - * @param descriptors the descriptors to set - */ - public void setDescriptors(Set<Descriptor> descriptors) { - this.descriptors = descriptors; - } - - /** - * @return the parentVersion - */ - public LoggableElement getParentVersion() { - return parentVersion; - } - - /** - * @param parentVersion the parentVersion to set - */ - public void setParentVersion(LoggableElement parentVersion) { - this.parentVersion = parentVersion; - } - - - -} Deleted: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Repository.java =================================================================== --- trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Repository.java 2007-12-10 15:18:35 UTC (rev 57) +++ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Repository.java 2007-12-10 15:19:28 UTC (rev 58) @@ -1,5 +0,0 @@ -package fr.cemagref.simexplorer.is.storage.entities; - -public class Repository extends Entity { - -} Deleted: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Result.java =================================================================== --- trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Result.java 2007-12-10 15:18:35 UTC (rev 57) +++ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Result.java 2007-12-10 15:19:28 UTC (rev 58) @@ -1,20 +0,0 @@ -package fr.cemagref.simexplorer.is.storage.entities; - -import java.util.HashMap; -import java.util.Map; - -import fr.cemagref.simexplorer.is.storage.attachment.type.ContentType; -import fr.cemagref.simexplorer.is.storage.attachment.type.ContentTypeFactory; -import fr.cemagref.simexplorer.is.storage.attachment.type.RawType; - -public class Result extends FileEntity { - - @Override - public Map<String, ContentType> getContentTypes() throws Exception { - Map<String, ContentType> contentTypes = new HashMap<String, ContentType>(); - contentTypes.put("result", ContentTypeFactory - .getContentTypeInstance(RawType.class)); - return contentTypes; - } - -} Deleted: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Structure.java =================================================================== --- trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Structure.java 2007-12-10 15:18:35 UTC (rev 57) +++ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Structure.java 2007-12-10 15:19:28 UTC (rev 58) @@ -1,5 +0,0 @@ -package fr.cemagref.simexplorer.is.storage.entities; - -public abstract class Structure extends Entity { - -} Deleted: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Version.java =================================================================== --- trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Version.java 2007-12-10 15:18:35 UTC (rev 57) +++ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Version.java 2007-12-10 15:19:28 UTC (rev 58) @@ -1,86 +0,0 @@ -package fr.cemagref.simexplorer.is.storage.entities; - -import java.util.ArrayList; -import java.util.List; -import java.util.StringTokenizer; - -public class Version implements Comparable<Version> { - - private List<Integer> pointedVersion; - - public Version(String version) { - super(); - pointedVersion = new ArrayList<Integer>(); - StringTokenizer st = new StringTokenizer(version, "."); - while (st.hasMoreTokens()) { - pointedVersion.add(new Integer(st.nextToken())); - } - } - - public Integer getVersion(int position) { - if (position < pointedVersion.size()) { - return pointedVersion.get(position); - } else { - return null; - } - } - - public void setVersion(int position, int subVersion) { - while (getVersion(position) == null) { - addSubVersion(0); - } - pointedVersion.set(position, subVersion); - } - - public void addSubVersion(int subVersion) { - pointedVersion.add(subVersion); - } - - public Version incVersion(int position) { - Version result = new Version(toString()); - while (result.getVersion(position) == null) { - result.addSubVersion(0); - } - result.setVersion(position, result.getVersion(position) + 1); - return result; - } - - @Override - public String toString() { - StringBuffer result = new StringBuffer(""); - for (Integer i : pointedVersion) { - result.append(i).append("."); - } - result.setLength(result.length() - 1); - return result.toString(); - } - - public int compareTo(Version v) { - int result = 0; - int position = 0; - boolean compared = false; - while (!compared) { - if (getVersion(position) == null && v.getVersion(position) == null) { - result = 0; - compared = true; - } else { - if (getVersion(position) == null) { - result = -1; - compared = true; - } else { - if (v.getVersion(position) == null) { - result = 1; - compared = true; - } else { - result = getVersion(position).compareTo( - v.getVersion(position)); - compared = (result != 0); - } - } - } - position++; - } - return result; - } - -} Copied: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/Code.java (from rev 55, trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Code.java) =================================================================== --- trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/Code.java (rev 0) +++ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/Code.java 2007-12-10 15:19:28 UTC (rev 58) @@ -0,0 +1,24 @@ +package fr.cemagref.simexplorer.is.storage.entities.data; + +public class Code extends DataEntity { + + private String language; + private String code; + + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + +} Copied: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/Component.java (from rev 55, trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Component.java) =================================================================== --- trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/Component.java (rev 0) +++ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/Component.java 2007-12-10 15:19:28 UTC (rev 58) @@ -0,0 +1,50 @@ +package fr.cemagref.simexplorer.is.storage.entities.data; + +import java.util.Set; + +public class Component extends LoggableElement { + + Set<Constant> constants; + Set<Structure> structures; + Set<Code> codes; + Set<Library> libraries; + + public Set<Constant> getConstants() { + return constants; + } + + public void setConstants(Set<Constant> constants) { + this.constants = constants; + } + + public Set<Structure> getStructures() { + return structures; + } + + public void setStructures(Set<Structure> structures) { + this.structures = structures; + } + + public Set<Code> getCodes() { + return codes; + } + + public void setCodes(Set<Code> codes) { + this.codes = codes; + } + + public Set<Library> getLibraries() { + return libraries; + } + + public void setLibraries(Set<Library> libraries) { + this.libraries = libraries; + } + + /* + * @Override public Set<LoggableElement> getChildren() { Set<LoggableElement> + * elements = new HashSet<LoggableElement>(); elements.addAll(libraries); + * return elements; } + */ + +} Copied: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/Constant.java (from rev 55, trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Constant.java) =================================================================== --- trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/Constant.java (rev 0) +++ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/Constant.java 2007-12-10 15:19:28 UTC (rev 58) @@ -0,0 +1,24 @@ +package fr.cemagref.simexplorer.is.storage.entities.data; + +public class Constant extends DataEntity { + + private String name; + private Class<?> type; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Class<?> getType() { + return type; + } + + public void setType(Class<?> type) { + this.type = type; + } + +} Copied: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/ConstantValue.java (from rev 55, trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/ConstantValue.java) =================================================================== --- trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/ConstantValue.java (rev 0) +++ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/ConstantValue.java 2007-12-10 15:19:28 UTC (rev 58) @@ -0,0 +1,24 @@ +package fr.cemagref.simexplorer.is.storage.entities.data; + +public class ConstantValue extends DataEntity { + + private String value; + private Constant constant; + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public Constant getConstant() { + return constant; + } + + public void setConstant(Constant constant) { + this.constant = constant; + } + +} Added: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/DataEntity.java =================================================================== --- trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/DataEntity.java (rev 0) +++ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/DataEntity.java 2007-12-10 15:19:28 UTC (rev 58) @@ -0,0 +1,39 @@ +package fr.cemagref.simexplorer.is.storage.entities.data; + +import fr.cemagref.simexplorer.is.storage.entities.BaseEntity; + +public abstract class DataEntity extends BaseEntity { + + private DataEntity parentData; + + public LoggableElement getParentLoggableElement() { + LoggableElement parentLoggableElement = null; + if (getParentData() instanceof LoggableElement) { + parentLoggableElement = (LoggableElement) getParentData(); + } else { + if (getParentData() == null) { + parentLoggableElement = null; + } else { + parentLoggableElement = getParentData() + .getParentLoggableElement(); + } + } + return parentLoggableElement; + } + + /** + * @return the parentData + */ + public DataEntity getParentData() { + return parentData; + } + + /** + * @param parentData + * the parentData to set + */ + public void setParentData(DataEntity parentData) { + this.parentData = parentData; + } + +} Copied: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/ExplorationApplication.java (from rev 55, trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/ExplorationApplication.java) =================================================================== --- trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/ExplorationApplication.java (rev 0) +++ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/ExplorationApplication.java 2007-12-10 15:19:28 UTC (rev 58) @@ -0,0 +1,33 @@ +package fr.cemagref.simexplorer.is.storage.entities.data; + +import java.util.Set; + +public class ExplorationApplication extends LoggableElement { + + private Set<ExplorationData> explorations; + private Set<Component> components; + + public Set<ExplorationData> getExplorations() { + return explorations; + } + + public void setExplorations(Set<ExplorationData> explorations) { + this.explorations = explorations; + } + + public Set<Component> getComponents() { + return components; + } + + public void setComponents(Set<Component> components) { + this.components = components; + } + + /* + * @Override public Set<LoggableElement> getChildren() { Set<LoggableElement> + * elements = new HashSet<LoggableElement>(); + * elements.addAll(explorations); elements.addAll(components); return + * elements; } + */ + +} Copied: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/ExplorationData.java (from rev 55, trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/ExplorationData.java) =================================================================== --- trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/ExplorationData.java (rev 0) +++ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/ExplorationData.java 2007-12-10 15:19:28 UTC (rev 58) @@ -0,0 +1,60 @@ +package fr.cemagref.simexplorer.is.storage.entities.data; + +import java.util.HashSet; +import java.util.Set; + +public class ExplorationData extends LoggableElement { + + private Set<ConstantValue> valuesMap; + private Result result; + + private ConstantValue findConstantValue(Constant c) { + for (ConstantValue constantValue : valuesMap) { + if (c.equals(constantValue.getConstant())) { + return constantValue; + } + } + return null; + } + + public void setConstantValue(Constant c, String value) { + ConstantValue constantValue = findConstantValue(c); + if (constantValue == null) { + constantValue = new ConstantValue(); + constantValue.setConstant(c); + valuesMap.add(constantValue); + } + constantValue.setValue(value); + } + + public Object getConstantValue(Constant c) { + ConstantValue constantValue = findConstantValue(c); + if (constantValue == null) { + return null; + } else { + return constantValue.getValue(); + } + } + + public Result getResult() { + return result; + } + + public void setResult(Result result) { + this.result = result; + } + + public Set<ConstantValue> getValuesMap() { + return valuesMap; + } + + public void setValuesMap(Set<ConstantValue> valuesMap) { + this.valuesMap = valuesMap; + } + + /* + * @Override public Set<LoggableElement> getChildren() { Set<LoggableElement> + * elements = new HashSet<LoggableElement>(); return elements; } + */ + +} Copied: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/Library.java (from rev 55, trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Library.java) =================================================================== --- trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/Library.java (rev 0) +++ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/Library.java 2007-12-10 15:19:28 UTC (rev 58) @@ -0,0 +1,15 @@ +package fr.cemagref.simexplorer.is.storage.entities.data; + +public class Library extends LoggableElement { + + /* + * @Override public Set<LoggableElement> getChildren() { Set<LoggableElement> + * elements = new HashSet<LoggableElement>(); return elements; } + * + * @Override public Map<String, ContentType> getContentTypes() throws + * Exception { Map<String, ContentType> contentTypes = + * super.getContentTypes(); contentTypes.put("library", ContentTypeFactory + * .getContentTypeInstance(RawType.class)); return contentTypes; } + */ + +} Added: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/LoggableElement.java =================================================================== --- trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/LoggableElement.java (rev 0) +++ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/LoggableElement.java 2007-12-10 15:19:28 UTC (rev 58) @@ -0,0 +1,28 @@ +package fr.cemagref.simexplorer.is.storage.entities.data; + +import java.util.Set; + +import fr.cemagref.simexplorer.is.storage.entities.metadata.MetaDataEntity; + +public abstract class LoggableElement extends DataEntity { + + private MetaDataEntity metaData; + + //public abstract Set<LoggableElement> getChildren(); + + /** + * @return the metaData + */ + public MetaDataEntity getMetaData() { + return metaData; + } + + /** + * @param metaData + * the metaData to set + */ + public void setMetaData(MetaDataEntity metaData) { + this.metaData = metaData; + } + +} Copied: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/Repository.java (from rev 55, trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Repository.java) =================================================================== --- trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/Repository.java (rev 0) +++ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/Repository.java 2007-12-10 15:19:28 UTC (rev 58) @@ -0,0 +1,5 @@ +package fr.cemagref.simexplorer.is.storage.entities.data; + +public class Repository extends DataEntity { + +} Copied: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/Result.java (from rev 55, trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Result.java) =================================================================== --- trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/Result.java (rev 0) +++ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/Result.java 2007-12-10 15:19:28 UTC (rev 58) @@ -0,0 +1,5 @@ +package fr.cemagref.simexplorer.is.storage.entities.data; + +public class Result extends DataEntity { + +} Copied: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/Structure.java (from rev 55, trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/Structure.java) =================================================================== --- trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/Structure.java (rev 0) +++ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/data/Structure.java 2007-12-10 15:19:28 UTC (rev 58) @@ -0,0 +1,5 @@ +package fr.cemagref.simexplorer.is.storage.entities.data; + +public abstract class Structure extends DataEntity { + +} Added: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/metadata/MetaDataEntity.java =================================================================== --- trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/metadata/MetaDataEntity.java (rev 0) +++ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/metadata/MetaDataEntity.java 2007-12-10 15:19:28 UTC (rev 58) @@ -0,0 +1,182 @@ +package fr.cemagref.simexplorer.is.storage.entities.metadata; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import fr.cemagref.simexplorer.is.storage.attachment.type.ContentType; +import fr.cemagref.simexplorer.is.storage.attachment.type.ContentTypeFactory; +import fr.cemagref.simexplorer.is.storage.attachment.type.RawType; +import fr.cemagref.simexplorer.is.storage.entities.BaseEntity; + +public class MetaDataEntity extends BaseEntity { + + private String uuid; + private String name; + private String type; + private String description; + private Version version; + private Date creationDate; + private String hash; + private Map<String, String> descriptors; + private MetaDataEntity parentData; + private MetaDataEntity parentVersion; + + /** + * @return the uuid + */ + public String getUuid() { + return uuid; + } + + /** + * @param uuid + * the uuid to set + */ + public void setUuid(String uuid) { + this.uuid = uuid; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name + * the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the type + */ + public String getType() { + return type; + } + + /** + * @param type + * the type to set + */ + public void setType(String type) { + this.type = type; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @param description + * the description to set + */ + public void setDescription(String description) { + this.description = description; + } + + /** + * @return the version + */ + public Version getVersion() { + return version; + } + + /** + * @param version + * the version to set + */ + public void setVersion(String version) { + this.version = new Version(version); + } + + /** + * @return the creationDate + */ + public Date getCreationDate() { + return creationDate; + } + + /** + * @param creationDate + * the creationDate to set + */ + public void setCreationDate(Date creationDate) { + this.creationDate = creationDate; + } + + /** + * @return the hash + */ + public String getHash() { + return hash; + } + + /** + * @param hash + * the hash to set + */ + public void setHash(String hash) { + this.hash = hash; + } + + /** + * @return the descriptors + */ + public Map<String, String> getDescriptors() { + return descriptors; + } + + /** + * @param descriptors + * the descriptors to set + */ + public void setDescriptors(Map<String, String> descriptors) { + this.descriptors = descriptors; + } + + /** + * @return the parentData + */ + public MetaDataEntity getParentData() { + return parentData; + } + + /** + * @param parentData + * the parentData to set + */ + public void setParentData(MetaDataEntity parentData) { + this.parentData = parentData; + } + + /** + * @return the parentVersion + */ + public MetaDataEntity getParentVersion() { + return parentVersion; + } + + /** + * @param parentVersion + * the parentVersion to set + */ + public void setParentVersion(MetaDataEntity parentVersion) { + this.parentVersion = parentVersion; + } + + public Map<String, ContentType> getContentTypes() throws Exception { + Map<String, ContentType> contentTypes = new HashMap<String, ContentType>(); + contentTypes.put("xml", ContentTypeFactory + .getContentTypeInstance(RawType.class)); + return contentTypes; + } + +} Added: trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/metadata/Version.java =================================================================== --- trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/metadata/Version.java (rev 0) +++ trunk/simexplorer-si-storage/src/java/fr/cemagref/simexplorer/is/storage/entities/metadata/Version.java 2007-12-10 15:19:28 UTC (rev 58) @@ -0,0 +1,90 @@ +package fr.cemagref.simexplorer.is.storage.entities.metadata; + +import java.util.ArrayList; +import java.util.List; +import java.util.StringTokenizer; + +public class Version implements Comparable<Version> { + + private List<Integer> pointedVersion; + + public Version(String version) { + super(); + pointedVersion = new ArrayList<Integer>(); + if (version != null) { + StringTokenizer st = new StringTokenizer(version, "."); + while (st.hasMoreTokens()) { + pointedVersion.add(new Integer(st.nextToken())); + } + } + } + + public Integer getVersion(int position) { + if (position < pointedVersion.size()) { + return pointedVersion.get(position); + } else { + return null; + } + } + + public void setVersion(int position, int subVersion) { + while (getVersion(position) == null) { + addSubVersion(0); + } + pointedVersion.set(position, subVersion); + } + + public void addSubVersion(int subVersion) { + pointedVersion.add(subVersion); + } + + public Version incVersion(int position) { + Version result = new Version(toString()); + while (result.getVersion(position) == null) { + result.addSubVersion(0); + } + result.setVersion(position, result.getVersion(position) + 1); + return result; + } + + @Override + public String toString() { + StringBuffer result = new StringBuffer(""); + for (Integer i : pointedVersion) { + result.append(i).append("."); + } + if (result.length() > 0) { + result.setLength(result.length() - 1); + } + return result.toString(); + } + + public int compareTo(Version v) { + int result = 0; + int position = 0; + boolean compared = false; + while (!compared) { + if (getVersion(position) == null && v.getVersion(position) == null) { + result = 0; + compared = true; + } else { + if (getVersion(position) == null) { + result = -1; + compared = true; + } else { + if (v.getVersion(position) == null) { + result = 1; + compared = true; + } else { + result = getVersion(position).compareTo( + v.getVersion(position)); + compared = (result != 0); + } + } + } + position++; + } + return result; + } + +}