Options for CRUD hooks into Metadata operations

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Options for CRUD hooks into Metadata operations

bserdar
We already have two CRUDController hooks that are called in metadata operations:
  - updateEntityInfo: called after entity info is updated or inserted
  - newSchema: called after a new schema is created

What we need now is two more: preUpdateEntityInfo and preNewSchema to give the CRUD implementation a chance to inspect the metadata and intervene if necessary. The question is about how to add these two to CRUDController. I have these options:

   - Add them to CRUDController interface. All CRUDController implementations have to override these.
   - Create four interfaces, each containing only one method: UpdateEntityInfo, NewSchema, PreUpdateEntityInfo, PreNewSchema. Call the hook method only if the CRUDController really implements the particular interface.

Do you have a better idea? If not, which one would you pick?
Reply | Threaded
Open this post in threaded view
|

Re: Options for CRUD hooks into Metadata operations

jewzaam
Administrator

Annotations instead of marker interfaces? Same thing but maybe less clunky. If you want the functionally of one of those hooks just annotate the method to fire. Could have same method annotated and method name would mean more to the impl.

On Nov 7, 2014 2:38 PM, "bserdar [via lightblue-dev]" <[hidden email]> wrote:
We already have two CRUDController hooks that are called in metadata operations:
  - updateEntityInfo: called after entity info is updated or inserted
  - newSchema: called after a new schema is created

What we need now is two more: preUpdateEntityInfo and preNewSchema to give the CRUD implementation a chance to inspect the metadata and intervene if necessary. The question is about how to add these two to CRUDController. I have these options:

   - Add them to CRUDController interface. All CRUDController implementations have to override these.
   - Create four interfaces, each containing only one method: UpdateEntityInfo, NewSchema, PreUpdateEntityInfo, PreNewSchema. Call the hook method only if the CRUDController really implements the particular interface.

Do you have a better idea? If not, which one would you pick?


If you reply to this email, your message will be added to the discussion below:
http://dev.forum.lightblue.io/Options-for-CRUD-hooks-into-Metadata-operations-tp215.html
To start a new topic under lightblue-dev, email [hidden email]
To unsubscribe from lightblue-dev, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: Options for CRUD hooks into Metadata operations

bserdar
nice, let me see what I can do.

On Fri, Nov 7, 2014 at 12:58 PM, jewzaam [via lightblue-dev]
<[hidden email]> wrote:

> Annotations instead of marker interfaces? Same thing but maybe less clunky.
> If you want the functionally of one of those hooks just annotate the method
> to fire. Could have same method annotated and method name would mean more to
> the impl.
>
> On Nov 7, 2014 2:38 PM, "bserdar [via lightblue-dev]" <[hidden email]>
> wrote:
>>
>> We already have two CRUDController hooks that are called in metadata
>> operations:
>>   - updateEntityInfo: called after entity info is updated or inserted
>>   - newSchema: called after a new schema is created
>>
>> What we need now is two more: preUpdateEntityInfo and preNewSchema to give
>> the CRUD implementation a chance to inspect the metadata and intervene if
>> necessary. The question is about how to add these two to CRUDController. I
>> have these options:
>>
>>    - Add them to CRUDController interface. All CRUDController
>> implementations have to override these.
>>    - Create four interfaces, each containing only one method:
>> UpdateEntityInfo, NewSchema, PreUpdateEntityInfo, PreNewSchema. Call the
>> hook method only if the CRUDController really implements the particular
>> interface.
>>
>> Do you have a better idea? If not, which one would you pick?
>>
>> ________________________________
>> If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://dev.forum.lightblue.io/Options-for-CRUD-hooks-into-Metadata-operations-tp215.html
>> To start a new topic under lightblue-dev, email [hidden email]
>> To unsubscribe from lightblue-dev, click here.
>> NAML
>
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://dev.forum.lightblue.io/Options-for-CRUD-hooks-into-Metadata-operations-tp215p216.html
> To start a new topic under lightblue-dev, email
> [hidden email]
> To unsubscribe from lightblue-dev, click here.
> NAML
Reply | Threaded
Open this post in threaded view
|

Re: Options for CRUD hooks into Metadata operations

bserdar
In reply to this post by jewzaam
So it turns out this is not so nice. There is no way to enforce a
method signature for a method with an annotation. Marker interfaces
are type-safe.

On Fri, Nov 7, 2014 at 12:59 PM, Burak Serdar <[hidden email]> wrote:

> nice, let me see what I can do.
>
> On Fri, Nov 7, 2014 at 12:58 PM, jewzaam [via lightblue-dev]
> <[hidden email]> wrote:
>> Annotations instead of marker interfaces? Same thing but maybe less clunky.
>> If you want the functionally of one of those hooks just annotate the method
>> to fire. Could have same method annotated and method name would mean more to
>> the impl.
>>
>> On Nov 7, 2014 2:38 PM, "bserdar [via lightblue-dev]" <[hidden email]>
>> wrote:
>>>
>>> We already have two CRUDController hooks that are called in metadata
>>> operations:
>>>   - updateEntityInfo: called after entity info is updated or inserted
>>>   - newSchema: called after a new schema is created
>>>
>>> What we need now is two more: preUpdateEntityInfo and preNewSchema to give
>>> the CRUD implementation a chance to inspect the metadata and intervene if
>>> necessary. The question is about how to add these two to CRUDController. I
>>> have these options:
>>>
>>>    - Add them to CRUDController interface. All CRUDController
>>> implementations have to override these.
>>>    - Create four interfaces, each containing only one method:
>>> UpdateEntityInfo, NewSchema, PreUpdateEntityInfo, PreNewSchema. Call the
>>> hook method only if the CRUDController really implements the particular
>>> interface.
>>>
>>> Do you have a better idea? If not, which one would you pick?
>>>
>>> ________________________________
>>> If you reply to this email, your message will be added to the discussion
>>> below:
>>>
>>> http://dev.forum.lightblue.io/Options-for-CRUD-hooks-into-Metadata-operations-tp215.html
>>> To start a new topic under lightblue-dev, email [hidden email]
>>> To unsubscribe from lightblue-dev, click here.
>>> NAML
>>
>>
>>
>> ________________________________
>> If you reply to this email, your message will be added to the discussion
>> below:
>> http://dev.forum.lightblue.io/Options-for-CRUD-hooks-into-Metadata-operations-tp215p216.html
>> To start a new topic under lightblue-dev, email
>> [hidden email]
>> To unsubscribe from lightblue-dev, click here.
>> NAML
Reply | Threaded
Open this post in threaded view
|

Re: Options for CRUD hooks into Metadata operations

bserdar
Here's what I'll do:

  - Remove the existing metadata hooks from CRUDController
  - Add a new method: getMetadataListener, or something like that, that returns an interface containing methods that hook into metadata operations


This'll require changes to mongo and rdbms, but mostly minor.