Version 16 (modified by meddle, 16 years ago) (diff) |
---|
Analysis
(Give as much as possible of the needed information for designing and implementing the task in the following sections.)
Overview
Define a stable resource design. Explain and document what is achieved.
Resource is an object that can exist by itself and can be persisted. Some of the resources can be used as frame content or a timeline. Resources can be nested in other resources (i.g. book can have nested another book (embedded book)).
Base resource model should have the following information
- UUID
- Content
- Data
- URL
- MetaInfo (comments, versions, names, etc...)
Types of resources
- Text
- Plain
- RTF
- HTML
- Image
- Audio
- Movie
- Book
- Templates
- User
- Group
- Book
- Page
- Frame
- Workspace
- Server Root
MetaInfo of the resource is:
- The name of the resource
- The author of the resource
- The date the resource was created
- Version of the resource
- The date the resource was last modified
- Who was the last that modified the resource
- The dimensions of the image (if the target of the resource is an image)
- etc.
Operations over a resource:
- The resource can be created.
- The resource can be modified.
- The resource can be deleted.
- The resource can be persisted.
- The resource can be uploaded (downloaded) to a server, which is the same thing as persisting but on the server.
- The resource can be previewed (in a separate window).
Task requirements
- Define which properties should be immutable, default, list, etc.
- Define a way to refer (access) resources
- The resource reference should be like UID
- The resource reference should allow finding the resource even if it is not loaded yet (location)
- The reference mechanism should handle the case when the resource is not available (for example - server not available)
- Define methods for
- Checking if a resource is available (this should be different from get method)
- This should update the status property
- Getting resource location
- Resource getting it's parent
- Resource getting list of it's children
- Attaching a resource to another resource
- Detaching a resource from another resource
- Renaming a resource (Ensure that the locations will be preserved and the new name doesn't collide with the names of the resources-siblings)
- Cloning/Copying a resource
- Checking if a resource is available (this should be different from get method)
- Explain annotations
* annotations related to Resources * explain ownership related with Resources and use of @Own * make a parallel with referencing Resources * An annotation that marks a property in a resource as metadata
- Document the defined structure
- Apply the defined structure for the existing resources
Task result
The result of this task is source code and wiki pages.
Implementation idea
The reference id can be combination of unique id and path like in operating system. Refering children and other resources will be easy (./ ../ etc)
Related
How to demo
Show source code, working current resource viewer (maybe a palette), unit tests.
Design
A resource is represented by the Resource class and the ResourceSpace class. The Resource class is more like a representation of the content of the resource and the ResourceSpace is what manages it's Resource and it's sub-objects which state is trackable.
- Resource
- A Resource can only be created with a ResourceSpace!
- All the Resources referred from a Resource are represented by ResourceRefs.
- All the sub-resources that are owned by a Resource (The Resource is their parent) are contained in the children list. It is possible to have outer resources refered from it but they are not in that children list.
- The resource name is unique for the level in the Resource's hierarchy it is. The siblings of the Resource in the Resource tree have to have different names. The name is
set from the ResourceSpace at the resource's creation.
- The Resource's entity id is it's unique identifier, it can not be changed and it is generated and set by the ResourceSpace upon creation. It is used for searching in the ResourceLocalCache or on a outer location.
- The resource location is absolute location of the resource, it can be:
- Location on the file system
- Location on a server
- Temporary location in the Sophie 2 application if the Resource is not saved anywhere.
- Every resource type must implement the getResourceKind method that can identify the resource type.
- If there are important actions that must be executed when the resource is created and cached they must be put in the initialized method.
- All the meta information providing fields in a resource must be annotated with the @ResourceMeta annotation.
- Two Resources are equal if their entity id and location are the same.
- The entity id and the location of a Resource are held in the ResourceSpace of the Resource.
- All the ProObjects, which state is important for the state and the reconstruction of a Resource must be annotated with the annotation @Own
Implementation
(Describe and link the implementation results here (from the wiki or the repository).)
Testing
(Place the testing results here.)
Comments
(Write comments for this or later revisions here.)