Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question
0

SpaceDocument metadata

In comparing the relative merits of POJOs and Space Documents (and their hybrid versions), I'm struggling to identify which metadata attributes are supported for document-based entry types, and how to specify them. While the obvious attributes (id property, routing property, indexes) are relatively well-documented, others are mentioned either tangentially (sequence number property) or not at all (e.g. spaceVersionProperty), not sure if the latter means they're not supported for documents.

Is there a comprehensive spec supported for Document type metadata, showing the supported attributes and methods for specifying them? Basically I'm looking for the equivalent of Annotation based Metadata and XML based Metadata for documents.

Meanwhile, I've tried to put together a summary of the supported metadata attributes, below. Are these accurate?

Also, when using the extended SpaceDocument approach (wrapping document properties with accessors), it seems like it would be useful to be able to use the same annotations used for pojo classes and properties on SpaceDocument subclasses and properties, then generate a corresponding document typedescriptor (similar to how the POJO type management logic works). I've nearly completed the implementation of a Spring component scanner to do so, but I was wondering if anything like that was planned for XAP.

peter


Document and POJO

  • replicable
  • storageType
  • supportsOptimisticLocking
  • blobstoreEnabled
  • fixedProperty - only needed in Document types to override property document support or storage type
  • idProperty
  • routingProperty
  • fifoSupport
  • fifoGroupingProperty
  • fifoGroupingIndex
  • sequenceNumberProperty
  • propertyIndex
  • pathIndex
  • compoundIndex

POJO Only

  • objectClass
  • supportsDynamicProperties ??
  • spaceVersionProperty ??
  • spacePersistProperty ??
  • spaceLeaseExpirationProperty ??

Document Only

  • documentWrapperClass

asked 2015-08-19 15:22:19 -0500

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

SpaceDocument and POJO support the same meta data excluding SpaceLeaseExpiration , SpacePersist, and includeProperties that are not supported with the SpaceDocument.

If you have totally dynamic model that is created in run-time and you want the application to leverage document model directly you should use the SpaceDocument. This means your processing leveraging polling/notify container - these should also created dynamically.

If you have dynamic data model and want some control on the model by separating /abstracting the application from the data model - you should use the extended SpaceDocument.

If you have fixed / static data model you should go for the classic POJO.

If you have semi-dynamic data model you should go for the POJO with Dynamic Property approach. You will have a static portion and a dynamic portion you can index and query in real time.

Are you trying to implement extended SpaceDocument via the Spring component scanner ?

answered 2015-08-19 15:45:14 -0500

shay hassidim gravatar image
edit flag offensive delete link more

Comments

SpaceDocument and POJO support the same meta data excluding SpaceLeaseExpiration , SpacePersist, and includeProperties.

Ok, how does one declare a spaceVersionProperty on a SpaceDocument type? It's not in the openspaces-core.xsd, nor exposed by SpaceTypeDescriptorBuilder.

Are you trying to implement extended SpaceDocument via the Spring component scanner ?

No. I have a component that builds and registers TypeDescriptors for extended SpaceDocument classes by looking at the same metadata annotations used for POJO's (@SpaceId, @SpaceIndex, etc.). So my document class might look something like:

@ExtendedSpaceDocument(replicate=false, blobstoreEnabled=true)
@CompoundSpaceIndexes({
 @CompoundSpaceIndex(paths = {"organization", "productType"}) 
})
public MyClass extends SpaceDocument {

  @SpaceId
  public int getId() {
    return getProperty("id");
  }

  public void setId(int id) {
    setProperty("id", id);
  }

  @SpaceRouting
  public String getCategory() {
    return getProperty("category");
  }

  public void setCategory(String category) {
    setProperty("category", category);
  }

  // . . . etc.
}

where @ExtendedSpaceDocument is a new custom annotation used to mark extended classes and hang type attributes.

phalverson gravatar imagephalverson ( 2015-08-20 14:21:46 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-08-19 15:22:19 -0500

Seen: 260 times

Last updated: Aug 19 '15