Hi Dishara,
Yes. 1 resource == 1 row.
The columns within that row represent the properties of the resource.
I suggest that you use standard property names where appropriate (eg
sling:resourceType is the Resource.resourceType etc)

The Resource itself should be adaptable to a generic CassandraResource
(which will probably implement Resource) which will have a map of
properties containing all the columns of the cassandra row. (optimise
later) A CassandraResource might look and feel like a Map<String, Object>
or it might have a Map<String, Object> getProperties() method, or better
still be adaptable to a Map. The essential think is dont hard code the
property names in the interface of CassandraResource for the moment. ie no
getContentType() and no getMimeType(), as we dont really know what a
CassandraResource will store.

ResourceMetadata should be built from a subset of the CassandraResource
properties.

You won't need to implement a ResourceResolver, only a ResourceProvider
(and Factory). I would use CQL in preference to other API methods.

There is one thing that hasnt been mentioned, and thats the URL ->
Cassandra Row mapping.
There are several ways of doing this.

eg:
URL = /content/cassandra/<columnFamily>/<rowID>
 Cassandra Column Family = columnFamily
 Cassandra RowID = rowID
or
URL = /content/cassandra/<columnFamilySelector>/remainder/of/the/path
 Cassandra  Cassandra Column Family =
mapOfColumnFamilies.get(columnFamilySelector)
 Cassandra  RowID = function(/remainder/of/the/path)

or to take that one stage further

public interface CassandraMapper {
      String getCQL(String columnFamilySelector, String path);
}

URL = /content/cassandra/<columnFamilySelector>/<remainderOfPath>

 String cqlQuery =
mapOfCassandraMappers.get(columnFamilySelector).getCQL(columnFamilySelector,
remainderOfPath);

Which would allow us provided one or more implementations of
CassandraMapper to map between URL and CQL.


HTH
Ian
















On 23 June 2013 19:29, Dishara Wijewardana <ddwijeward...@gmail.com> wrote:

> Hi Ian,
>
> What is the data mapping should be between Cassandra and Sling resource. I
> mean is a Sling Resource maps to a Cassandra Column ? Or Column Family ?
>
> Because to get this Cassandra and Sling story correct we need to finalize
> this.
> For an example what we eventually returns is a Sling resource. Everything
> that needs to fill in to create Sling resource should be stored in
> Cassandra.
> In a Sling resource,
>
>    - Path - direct sling resource path
>    - ResourceType - nt:cassandra
>    - ResourceSuperType - ?
>    - ResourceMetadata - we can create this on the fly with the data from
>    the corresponding column. At insertion, those need to be stored.
> Following
>    are the ones which I thought might be useful by default to be set for
> any
>    node. Please add if we need anything more.
>       - ContentType
>       - ContentLength
>       - CreationTime
>       - ModificationTime
>    - ResourceResolver -  Do we need a resolver in this case ?
>
>
>  So I believe in CQL context, one ROW should represent a Sling resource. If
> that is the case for ResourceMetadata we might need a separate column to
> store it since it has multiple values. I am not sure whether we can do it
> with CQL, but it should be possible with hector APIs may be.
>
> Appreciate your thoughts ?
>
>
> On Wed, Jun 19, 2013 at 1:19 AM, Dishara Wijewardana <
> ddwijeward...@gmail.com> wrote:
>
> > Hi Ian,
> > I am starting this thread to keep track on things related to the GSoC
> > project related milestone status updates and related discussions.
> > So the first task over view will be as follows as per GSoC proposal
> > provided.
> >
> > 1. Implementing a CassandraResourceProvider  to READ from Cassandra.
> > Implementation Details [1]
> >
> >
> >
> > [1] : Implementation Details:
> >
> >  1.A) Write a CassanrdaResourceProviderUtil  which is basically a
> > cassendra client which will facilitate all cassandra related operations
> > required by other modules (CassandraResourceProvider and
> > CassandraResourceResolver).
> >
> > 1.B) Implementation of  CassandraResourceProvider
> >
> > 1.C)  Implementation of CassandraResourceResolver
> >
> > 1.D) Implementation of CassandraResource
> >
> >
> > And I will start writing the CassanrdaResourceProviderUtil class which
> > will do basic add and get using hector API. Please provide any feedback
> > that will be useful to accomplish this task.
> > So for this how does path mapping should be done. Because for example,
> the
> > path of the cassendra node will not be same as the jcr node path. i.e
> > provider will ask a node path /system/myapps/test/foo and where should we
> > return it from Cassandra. Aren't we have to first consider the WRITE
> aspect
> > to Cassandra ?
> >
> >
> > --
> > Thanks
> > /Dishara
> >
>
>
>
> --
> Thanks
> /Dishara
>

Reply via email to