Astroboa Java API Overview
The Astroboa Java API provides full control and management of both local and remote repositories. Its main features include:
- Manage both local and remote repositories transarently
- Support lazy loading for really fast responses
- A single entity factory to create Astroboa entities: Taxonomies, Topics, ContentObjects, RepositoryUsers and Spaces
- Entity Services (TaxonomyService, TopicService, ContentService, RepositoryUserService, SpaceService) to work with entities
- Powerfull search through CmsCriteria. Search repositories
- Cache and pagination support to work with really big content repositories
- Import/Export capabilities of your content
Core Entities Overview
Astroboa comes with a small but rather versatile set of core entities which allow for modeling of various entity types; blogs, forums, persons, organizations are only just a few of them to name. The Astroboa core entities are: Taxonomy, Topic, Content Object, Repository User and Space. All these core entities are modeled as Java Interfaces.
A Taxonomy represents a dictionary of terms or a thesaurus where every element in the Taxonomy is represented by a Topic. For example, assume the Color taxonomy where every color red, green, black, white, yellow, green, blue is a unique Topic. The Content Object is used to represent various entity types, such as a Person, an Organization, a Blog, a Blog entry, a Forum, a Forum entry, etc. When referring to Content Object, bring in mind the Java Object class which every Java class inherits from. Every entity modeled in Astroboa, inherits properties from the generic Content Object. The RepositoryUser entity models a user registered in the Astroboa repository, which is capable of creating, deleting and manipulating Taxonomies, Topics and Content Objects. In addition every RepositoryUser has his/hers own private Space, where he/she can place Content Objects that can be shared with other Repository Users.
AstroboaClient
Access to Astroboa repository entities is offered through the AstroboaClient class which offers methods to discover Astroboa repositories hosted on a server and login to them. Consider the AstroboaClient as the gateway to both local (same JVM) and remote (different JVM) Astroboa repositories. As a gateway, the AstroboaClient provides methods to access the Astroboa entity factories to create new entities and methods to access entity services which manipulate the entities.
CmsRepositoryEntityFactory
New core entities are created through the CmsRepositoryEntityFactory. Methods newTaxonomy(), newTopic(), newContentObjectForType(typeName), newRepositoryUser() and new Space() create a new Taxonomy, Topic, Content Object, RepositoryUser and Space, respectively.
Entity Services
The aforementioned Astroboa core entities are managed through their respective services, TaxonomyService, TopicService, ContentService (note the missing Object :) ), RepositoryUserService and SpaceService. All services are modeled as Java Interfaces which define methods that include, but are not limited to, retrieving, saving, deleting and searching entities. The table below provides an overall summary of the core entities in Astroboa, how they are created and manipulated.
| Astroboa Entity | Created by: CmsRepositoryEntityFactory | Astroboa Service | Obtained from: AstroboaClient |
|---|---|---|---|
| Taxonomy | newTaxonomy() | TaxonomyService | getTaxonomyService() |
| Topic | newTopic() | TopicService | getTopicService() |
| ContentObject | newContentObjectForType() | ContentService | getContentService() |
| RepositoryUser | newRepositoryUser() | RepositoryService | getRepositoryService() |
| Space | newSpace() | SpaceService | getSpaceService() |
Search with criteria
Searching for Astroboa entities in a repository is possible through the usage of the CmsCriteria Java interface. A CmsCriteria object is a bucket which contains one or more objects which implement the Criterion interface. For each entity, a criteria interface is defined: TaxonomyCriteria, TopicCriteria, ContentObjectCriteria, RepositoryUserCriteria, SpaceCriteria. In the criteria objects you can add instances of criterion objects to further refine your search. The search methods defined in the entity services accept object instances which implement the respective criteria interface. For instance, the search method defined in RepositoryUserService accepts an object that implements the RepositoryUserCriteria. The table below sums up the which criteria relate to each entity and the search methods that consume them.
| Astroboa Entity | Criteria | Used with |
|---|---|---|
| Taxonomy | TaxonomyCriteria | |
| Topic | TopicCriteria | TopicService.search() |
| Content Object | ContentObjectCriteria | ContentService.search() |
| RepositoryUser | RepositoryUserCriteria | RepositoryUserService.search() |
| Space | SpaceCriteria | SpaceService.search() |
Cache and Pagination support
When working with really big Astroboa content repositories, cache and pagination two invaluable features. Pagination support is provided methods setOffset() and setLimit() which control how many results are actually feched by a query. It is supported for all kind of search queries in Astroboa as setOffset() and setLimit() are defined in the CmsCriteria that every entity criteria inherits from. Caching query results is also provided for all Astroboa criteria through the setCacheable() method defined in the CmsCriteria interface.
Import-Export content facilities
Your can export the content of your Astroboa repository either in XML or JSON format in at any time. The CmsRepositoryEntity interface defines methods json() and xml() which return a JSON or XML representation for the exported Astroboa entity. Importing content in a Astroboa repository is offered only for XML entity representations. Every entity service, TaxonomyService, TopicService, ContentService, RepositoryUserService and SpaceService define appropriate methods (import<EntityName>FromXml()) to import content from XML files.
Learn more about
Last Modified: 07 April 2011
Loading...