You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@gora.apache.org by Geoffry Roberts <th...@gmail.com> on 2014/03/27 21:09:41 UTC

Gora first time question

All,

I am trying out Gora/Accumulo.  My question is this:  Is Gora right the
tool for me?

I need to persist existing java objects all of which are based on, and
generated with EMF (eclipse Modeling Framework).  It would appear that with
Gora I am generating these classes all over again in order to store them
into Accuulo.  Must I do this?  Is there a way to store an existing object?

Thanks in advance.

-- 
There are ways and there are ways,

Geoffry Roberts

Re: Gora first time question

Posted by Renato Marroquín Mogrovejo <re...@gmail.com>.
Hi Geoffry,

Yes, I guess you'd have to write some sort of wrapper between your objects
and Gora objects. If you are using just annotations and if you haven't
already done much work, then maybe you could have started the other way
around. I mean creating your Gora objects and then annotating them to work
for EMF.


Renato M.


2014-03-28 17:29 GMT+01:00 Geoffry Roberts <th...@gmail.com>:

> "Models can be specified using annotated Java, XML documents, or modeling
> tools like Rational Rose, then imported into EMF. "
>
> I am past the import phase.  My EMF model has been generated as a set of
> java classes.  For purposes of this discussion, imagine we have a java
> bean. As I understand it, Gora would have me write some json  and use it
> or generate yet another class that then can be mapped into Accumulo.  I
> gather I would then have to write some code to pump data from my EMF object
> into the Accoumulo object.
>
> I think I am answering my own question.  Gora is creating work not saving
> it owing entirely to my situation.  No doubt it works well for others.
>
> To wit:
>
> **EMF generated class snippet:
>
> public interface CDAInstance extends EObject {
>
> String getDocumentId();
>
> void setDocumentId(String value);
>
> ...more getters and setters...
>
>
> **JSON required by avro snippet
>
>
> {
>
>     "type": "record",
>
>     "name": "CDAInstance",
>
>     "namespace": "iop.storet",
>
>     "fields": [
>
>         {"name": "documentId", "type": "string"},
>
> ...more fields...
>
>     ]
>
> }
>
> ** Class generated by Gora snippet
>
> public class CDAInstance extends PersistentBase {
>
>   public static final Schema _SCHEMA = Schema.parse
> ("{\"type\":\"record\",\"name\":\"CDAInstance\",\"namespace\":\"iop.storet\",\"fields\":[{\"name\":\"documentId\",\"type\":\"string\"},{\"name\":\"patientId\",\"type\":\"string\"},{\"name\":\"content\",\"type\":\"string\"},{\"name\":\"created\",\"type\":\"long\"},{\"name\":\"createdBy\",\"type\":\"string\"}]}");
>
>
>   public static enum Field {
>
>     DOCUMENT_ID(0,"documentId"),
>
> ...more fields...
>
>
> **Some pump code
>
>
> put(Field.DOCUMENT_ID, emf.getDocumentID(*));*
> ...More Fields...
>
>
> Thanks, I did get my question answered.
>
> On Thu, Mar 27, 2014 at 6:13 PM, Renato Marroquín Mogrovejo <
> renatoj.marroquin@gmail.com> wrote:
>
>> Hi Geoffry,
>>
>>
>> 2014-03-27 21:09 GMT+01:00 Geoffry Roberts <th...@gmail.com>:
>>
>>> All,
>>>
>>> I am trying out Gora/Accumulo.  My question is this:  Is Gora right the
>>> tool for me?
>>>
>>
>> This is kinda philosophical question at least IMHO. You can always tweak
>> tools to make them work for what you need. Of course, Gora has some use
>> cases where the use of it suits better and some others that you might want
>> to try something else.
>>
>>
>>> I need to persist existing java objects all of which are based on, and
>>> generated with EMF (eclipse Modeling Framework).  It would appear that with
>>> Gora I am generating these classes all over again in order to store them
>>> into Accuulo.  Must I do this?  Is there a way to store an existing object?
>>>
>>
>> So the same question as Lewis I guess, maybe if you could explain to us a
>> little bit about what you are exactly trying to do, then we would be able
>> to provide better feedback.
>>  Quoting EMF page:
>>
>> "Models can be specified using annotated Java, XML documents, or
>> modeling tools like Rational Rose, then imported into EMF. "
>>
>> In Gora we need two files, a JSON file to create our data schema, and an
>> XML mapping file which will tell Gora how it should map this schema into
>> the datastore. Are you trying to do the "Models" part? Maybe you could some
>> sort of mapping between whatever you model is into these files needed by
>> Gora, and then wait as much as you can for actually generating Java classes.
>>
>>
>> Renato M.
>>
>>
>>>
>>> Thanks in advance.
>>>
>>> --
>>> There are ways and there are ways,
>>>
>>> Geoffry Roberts
>>>
>>
>>
>
>
> --
> There are ways and there are ways,
>
> Geoffry Roberts
>

Re: Gora first time question

Posted by Geoffry Roberts <th...@gmail.com>.
"Models can be specified using annotated Java, XML documents, or modeling
tools like Rational Rose, then imported into EMF. "

I am past the import phase.  My EMF model has been generated as a set of
java classes.  For purposes of this discussion, imagine we have a java
bean. As I understand it, Gora would have me write some json  and use it or
generate yet another class that then can be mapped into Accumulo.  I gather
I would then have to write some code to pump data from my EMF object into
the Accoumulo object.

I think I am answering my own question.  Gora is creating work not saving
it owing entirely to my situation.  No doubt it works well for others.

To wit:

**EMF generated class snippet:

public interface CDAInstance extends EObject {

String getDocumentId();

void setDocumentId(String value);

...more getters and setters...


**JSON required by avro snippet


{

    "type": "record",

    "name": "CDAInstance",

    "namespace": "iop.storet",

    "fields": [

        {"name": "documentId", "type": "string"},

...more fields...

    ]

}

** Class generated by Gora snippet

public class CDAInstance extends PersistentBase {

  public static final Schema _SCHEMA = Schema.parse
("{\"type\":\"record\",\"name\":\"CDAInstance\",\"namespace\":\"iop.storet\",\"fields\":[{\"name\":\"documentId\",\"type\":\"string\"},{\"name\":\"patientId\",\"type\":\"string\"},{\"name\":\"content\",\"type\":\"string\"},{\"name\":\"created\",\"type\":\"long\"},{\"name\":\"createdBy\",\"type\":\"string\"}]}");


  public static enum Field {

    DOCUMENT_ID(0,"documentId"),

...more fields...


**Some pump code


put(Field.DOCUMENT_ID, emf.getDocumentID(*));*
...More Fields...


Thanks, I did get my question answered.

On Thu, Mar 27, 2014 at 6:13 PM, Renato Marroquín Mogrovejo <
renatoj.marroquin@gmail.com> wrote:

> Hi Geoffry,
>
>
> 2014-03-27 21:09 GMT+01:00 Geoffry Roberts <th...@gmail.com>:
>
>> All,
>>
>> I am trying out Gora/Accumulo.  My question is this:  Is Gora right the
>> tool for me?
>>
>
> This is kinda philosophical question at least IMHO. You can always tweak
> tools to make them work for what you need. Of course, Gora has some use
> cases where the use of it suits better and some others that you might want
> to try something else.
>
>
>> I need to persist existing java objects all of which are based on, and
>> generated with EMF (eclipse Modeling Framework).  It would appear that with
>> Gora I am generating these classes all over again in order to store them
>> into Accuulo.  Must I do this?  Is there a way to store an existing object?
>>
>
> So the same question as Lewis I guess, maybe if you could explain to us a
> little bit about what you are exactly trying to do, then we would be able
> to provide better feedback.
>  Quoting EMF page:
>
> "Models can be specified using annotated Java, XML documents, or modeling
> tools like Rational Rose, then imported into EMF. "
>
> In Gora we need two files, a JSON file to create our data schema, and an
> XML mapping file which will tell Gora how it should map this schema into
> the datastore. Are you trying to do the "Models" part? Maybe you could some
> sort of mapping between whatever you model is into these files needed by
> Gora, and then wait as much as you can for actually generating Java classes.
>
>
> Renato M.
>
>
>>
>> Thanks in advance.
>>
>> --
>> There are ways and there are ways,
>>
>> Geoffry Roberts
>>
>
>


-- 
There are ways and there are ways,

Geoffry Roberts

Re: Gora first time question

Posted by Renato Marroquín Mogrovejo <re...@gmail.com>.
Hi Geoffry,


2014-03-27 21:09 GMT+01:00 Geoffry Roberts <th...@gmail.com>:

> All,
>
> I am trying out Gora/Accumulo.  My question is this:  Is Gora right the
> tool for me?
>

This is kinda philosophical question at least IMHO. You can always tweak
tools to make them work for what you need. Of course, Gora has some use
cases where the use of it suits better and some others that you might want
to try something else.


> I need to persist existing java objects all of which are based on, and
> generated with EMF (eclipse Modeling Framework).  It would appear that with
> Gora I am generating these classes all over again in order to store them
> into Accuulo.  Must I do this?  Is there a way to store an existing object?
>

So the same question as Lewis I guess, maybe if you could explain to us a
little bit about what you are exactly trying to do, then we would be able
to provide better feedback.
Quoting EMF page:

"Models can be specified using annotated Java, XML documents, or modeling
tools like Rational Rose, then imported into EMF. "

In Gora we need two files, a JSON file to create our data schema, and an
XML mapping file which will tell Gora how it should map this schema into
the datastore. Are you trying to do the "Models" part? Maybe you could some
sort of mapping between whatever you model is into these files needed by
Gora, and then wait as much as you can for actually generating Java classes.


Renato M.


>
> Thanks in advance.
>
> --
> There are ways and there are ways,
>
> Geoffry Roberts
>