Changes between Version 1 and Version 2 of GritsEntryProperty

10/01/2014 11:10:21 PM (8 years ago)
Rene Ranzinger



  • GritsEntryProperty

    v1 v2  
     20As part of the main application there are two property classes:
     21* {{{WorkspaceProperty}}}
     22* {{{ProjectProperty}}}
     24{{{WorkspaceProperty}}} is a helper class that gets automatically created the moment a workspace is opened. The entry with this property serves as the parent for all project entries (root of the tree) and does not have a parent itself. It only contains the path of the workspace in the file system (location).
     26{{{ProjectProperty}}} is the property class for a project entry. It contains:
     27* Creator of the entry
     28* Description
     29* Creation time of the project
     30* Last modification time of the project
     31* A boolean flag indicating if the project is opened
     33== !DataModelHandler ==
     34The {{{DatamodelHandler}}} is a class that serves a container and management interface for the data model. The class is a singleton and a instance can be accessed by calling the static method {{{DataModelHandler.instance()}}}.
     38The class contains a single Entry which contains a {{{WorkspaceProperty}}} and is the root entry for all projects. The handler also contains a list of {{{DataModelChangeListener}}}’s which allows other classes or plugins to register and be notified for changes to the data model:
     39* Add a new entry
     40* Remove an entry
     42== Access to the data model ==
     43Any plugin can get access to the data model using the {{{PropertyHandler}}}, which stores the singleton of the {{{DataModelHandler}}}. Simply call {{{PropertyHandler.getDataModel()}}}.
     45== Serialization and De-serialization ==
     46All entries of a single project (direct child entries of the root entry) get serialized into the .project.xml file in the project folder. The file has the following format:
     49<?xml version="1.0" encoding="UTF-8"?>
     51    <entry type="project" id="0" name="My project">
     52        <entry type="sample" id="1" name="My sample" />
     53    </entry>
     54    <property id="0">
     55        ...
     56    </property>
     57    <property id="1">
     58        ...
     59    </property>
     63The file starts with a single '''entry''' tag with the information from the entry for the project. This tag can have up to several sub tag of type '''entry''', mirroring the tree architecture of the project. During serialization each entry gets assigned a unique '''id'''. This ID is only valid within a single file and my change if the file is serialized again.
     65Following the '''entry''' tag a list of property tags is written. Each property tag has an id attribute linking it back to the corresponding entry in the beginning of the file. Each property can thereby have different sub tags and attributes depending of the entry type that get serialized.
     67== Creating new entry types ==
     68Creating new entry types may be necessary to store new types of data in the project tree (e.g. MS data, MS annotation data) and if no existing entry type can be reused.
     70=== Create data classes ===
     71To create a new type of entry in the project hierarchy extend the {{{Property}}} class in ''package''. '''DO NOT''' extend or modify the {{{Entry}}} class. The new subclass should contain all the information that need to be stored for an entry. Please not that if the entry represents a large data set (e.g. experimental raw) it is favorable to store this data in a separate file inside the project folder rather than in the property class. Since the entire project tree is loading once a project is opened this is more memory and time efficient. In such cases this property class will only contain a handle to the file with the data (e.g. relative path and file) and a class processing or displaying this entry will know how to find and read the data.
     73=== Writing the property sub class to .project.xml ===
     75=== Reading the property sub class from .project.xml ===
     78<extension point="edu.uga.ccrc.simiantools.entryreader">
     79    <reader
     80        class=""
     81        entry="edu.uga.ccrc.simiantools.entry.project">
     82    </reader>