Overriding plugin functionality in app

View: New views
13 Messages — Rating Filter:   Alert me  

Overriding plugin functionality in app

by altosz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Good day, Grails and plugin developers,

I've encountered the following question when developing an app. I have a plugin and would like to override (expand) it functionality. How should it be done?

1. Is it possible to create the same class in app plugin folder? Whould it override the same class of the plugin?
2. Or the only way is to modify plugin code?

--
Regards,
Alexei

Re: Overriding plugin functionality in app

by nycsailor :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Is it possible with what you want to do, that you can create a plugin
that modifies the other plugin through MetaProgramming.  Groovy is very
flexible when it comes to modifying objects and classes and grails
allows you to specify plugins that need to be loaded before yours.

I'm not sure what you want to do, but this might be the easiest.

On Sun, 2009-07-05 at 09:36 -0700, altosz wrote:

> Good day, Grails and plugin developers,
>
> I've encountered the following question when developing an app. I have a
> plugin and would like to override (expand) it functionality. How should it
> be done?
>
> 1. Is it possible to create the same class in app plugin folder? Whould it
> override the same class of the plugin?
> 2. Or the only way is to modify plugin code?
>
> --
> Regards,
> Alexei


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Overriding plugin functionality in app

by altosz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

So I should create my own plugin which is loaded after the original plugin and there override the functionality I need?

But still is it possible to override the functionality of the plugins not messing with other plugins? Just in the application structure. And if it is ok I should better create a patch to the plugin then issue another one.


nycsailor wrote:
Is it possible with what you want to do, that you can create a plugin
that modifies the other plugin through MetaProgramming.  Groovy is very
flexible when it comes to modifying objects and classes and grails
allows you to specify plugins that need to be loaded before yours.

I'm not sure what you want to do, but this might be the easiest.

On Sun, 2009-07-05 at 09:36 -0700, altosz wrote:
> Good day, Grails and plugin developers,
>
> I've encountered the following question when developing an app. I have a
> plugin and would like to override (expand) it functionality. How should it
> be done?
>
> 1. Is it possible to create the same class in app plugin folder? Whould it
> override the same class of the plugin?
> 2. Or the only way is to modify plugin code?
>
> --
> Regards,
> Alexei


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Re: Overriding plugin functionality in app

by nycsailor :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm not absolutely sure, but I'm pretty sure the Bootstrap is started
after the plugins load (which is evident by Hibernate being available).

You could probably do what you want in there.

On Sun, 2009-07-05 at 10:07 -0700, altosz wrote:

> So I should create my own plugin which is loaded after the original plugin
> and there override the functionality I need?
>
> But still is it possible to override the functionality of the plugins not
> messing with other plugins? Just in the application structure. And if it is
> ok I should better create a patch to the plugin then issue another one.
>
>
>
> nycsailor wrote:
> >
> > Is it possible with what you want to do, that you can create a plugin
> > that modifies the other plugin through MetaProgramming.  Groovy is very
> > flexible when it comes to modifying objects and classes and grails
> > allows you to specify plugins that need to be loaded before yours.
> >
> > I'm not sure what you want to do, but this might be the easiest.
> >
> > On Sun, 2009-07-05 at 09:36 -0700, altosz wrote:
> >> Good day, Grails and plugin developers,
> >>
> >> I've encountered the following question when developing an app. I have a
> >> plugin and would like to override (expand) it functionality. How should
> >> it
> >> be done?
> >>
> >> 1. Is it possible to create the same class in app plugin folder? Whould
> >> it
> >> override the same class of the plugin?
> >> 2. Or the only way is to modify plugin code?
> >>
> >> --
> >> Regards,
> >> Alexei
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list, please visit:
> >
> >     http://xircles.codehaus.org/manage_email
> >
> >
> >
> >
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Overriding plugin functionality in app

by nycsailor :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Alexei,

I don't know how much you know about Groovy, and I am no expert, but I
thought I would put together a quick example.

Here is an example where I have a very simple class with one method in a
'plugin' in which I modify the behavior of the meth() method.

I don't guarantee that any of this is done the best way, as I said, I am
no Groovy expert, but it is a quick example of how flexible Groovy is
and how the behavior of a class can be modified.

// Plugin code
class A {
    def meth() {
        println "original meth method"
    }
}



// code using plugin before modification
new A().meth()    // prints 'original meth method'



// My plugin modification code
A.metaClass.oldMeth = A.getMethod('meth')
A.metaClass.meth = {
    println "new meth method"
    oldMeth.invoke(delegate, null)
}




// code using plugin after modification
new A().meth()    // prints 'new meth method' and 'original meth method'





On Sun, 2009-07-05 at 10:07 -0700, altosz wrote:

> So I should create my own plugin which is loaded after the original plugin
> and there override the functionality I need?
>
> But still is it possible to override the functionality of the plugins not
> messing with other plugins? Just in the application structure. And if it is
> ok I should better create a patch to the plugin then issue another one.
>
>
>
> nycsailor wrote:
> >
> > Is it possible with what you want to do, that you can create a plugin
> > that modifies the other plugin through MetaProgramming.  Groovy is very
> > flexible when it comes to modifying objects and classes and grails
> > allows you to specify plugins that need to be loaded before yours.
> >
> > I'm not sure what you want to do, but this might be the easiest.
> >
> > On Sun, 2009-07-05 at 09:36 -0700, altosz wrote:
> >> Good day, Grails and plugin developers,
> >>
> >> I've encountered the following question when developing an app. I have a
> >> plugin and would like to override (expand) it functionality. How should
> >> it
> >> be done?
> >>
> >> 1. Is it possible to create the same class in app plugin folder? Whould
> >> it
> >> override the same class of the plugin?
> >> 2. Or the only way is to modify plugin code?
> >>
> >> --
> >> Regards,
> >> Alexei
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list, please visit:
> >
> >     http://xircles.codehaus.org/manage_email
> >
> >
> >
> >
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Overriding plugin functionality in app

by nycsailor :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sorry, I just re-read your email and what I think you are asking might
be if you can extend the functionality of a plugin.

The answer that has been given before is to contact the originator of
the plugin first before committing changes and re-releasing the plugin.
If you want to add functionality to a plugin, that is great.

My understanding is that plugins in the Grails repo are open-source and
as such are open to modification by the community.  I have released
three plugins so far and am very happy for others to extend them.

I also made changes to my AOPish example to include methods with
arguments.  I figured my last example was probably too simple.

Again, not a Groovy expert, but here it is.

// Plugin code
class A {
    def meth(String s) {
        println s
    }
}

// method before modification
new A().meth("Hello")    // prints 'hello'

// My code
A.metaClass.oldMeth = A.metaClass.getMetaMethod('meth',[String] as Object[])
A.metaClass.meth = { String s ->
    oldMeth.doMethodInvoke(delegate, ["${s} World!"] as Object[])
}


// code using plugin
new A().meth("Hello")    // prints 'Hello World!'





On Sun, 2009-07-05 at 10:07 -0700, altosz wrote:

> So I should create my own plugin which is loaded after the original plugin
> and there override the functionality I need?
>
> But still is it possible to override the functionality of the plugins not
> messing with other plugins? Just in the application structure. And if it is
> ok I should better create a patch to the plugin then issue another one.
>
>
>
> nycsailor wrote:
> >
> > Is it possible with what you want to do, that you can create a plugin
> > that modifies the other plugin through MetaProgramming.  Groovy is very
> > flexible when it comes to modifying objects and classes and grails
> > allows you to specify plugins that need to be loaded before yours.
> >
> > I'm not sure what you want to do, but this might be the easiest.
> >
> > On Sun, 2009-07-05 at 09:36 -0700, altosz wrote:
> >> Good day, Grails and plugin developers,
> >>
> >> I've encountered the following question when developing an app. I have a
> >> plugin and would like to override (expand) it functionality. How should
> >> it
> >> be done?
> >>
> >> 1. Is it possible to create the same class in app plugin folder? Whould
> >> it
> >> override the same class of the plugin?
> >> 2. Or the only way is to modify plugin code?
> >>
> >> --
> >> Regards,
> >> Alexei
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list, please visit:
> >
> >     http://xircles.codehaus.org/manage_email
> >
> >
> >
> >
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Overriding plugin functionality in app

by altosz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for your answers,

it is what I wanted. I'll try to modify plugin functionality via extending plugin metaclass in Bootstrap and if it works and plugin's author is happy with it I would commit to common repository - otherwise such extension will leave in my app only.

nycsailor wrote:
I'm not absolutely sure, but I'm pretty sure the Bootstrap is started
after the plugins load (which is evident by Hibernate being available).

You could probably do what you want in there.

On Sun, 2009-07-05 at 10:07 -0700, altosz wrote:
> So I should create my own plugin which is loaded after the original plugin
> and there override the functionality I need?
>
> But still is it possible to override the functionality of the plugins not
> messing with other plugins? Just in the application structure. And if it is
> ok I should better create a patch to the plugin then issue another one.
>
>
>
> nycsailor wrote:
> >
> > Is it possible with what you want to do, that you can create a plugin
> > that modifies the other plugin through MetaProgramming.  Groovy is very
> > flexible when it comes to modifying objects and classes and grails
> > allows you to specify plugins that need to be loaded before yours.
> >
> > I'm not sure what you want to do, but this might be the easiest.
> >
> > On Sun, 2009-07-05 at 09:36 -0700, altosz wrote:
> >> Good day, Grails and plugin developers,
> >>
> >> I've encountered the following question when developing an app. I have a
> >> plugin and would like to override (expand) it functionality. How should
> >> it
> >> be done?
> >>
> >> 1. Is it possible to create the same class in app plugin folder? Whould
> >> it
> >> override the same class of the plugin?
> >> 2. Or the only way is to modify plugin code?
> >>
> >> --
> >> Regards,
> >> Alexei
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list, please visit:
> >
> >     http://xircles.codehaus.org/manage_email
> >
> >
> >
> >
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Re: Overriding plugin functionality in app

by Burt Beckwith :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Which plugin?


Burt


On Monday 06 July 2009 12:43:37 am altosz wrote:
>
> Thanks for your answers,
>
> it is what I wanted. I'll try to modify plugin functionality via extending
> plugin metaclass in Bootstrap and if it works and plugin's author is happy
> with it I would commit to common repository - otherwise such extension will
> leave in my app only.
>
>
> nycsailor wrote:
> >
> > I'm not absolutely sure, but I'm pretty sure the Bootstrap is started
> > after the plugins load (which is evident by Hibernate being available).
> >
> > You could probably do what you want in there.
> >
> > On Sun, 2009-07-05 at 10:07 -0700, altosz wrote:
> >> So I should create my own plugin which is loaded after the original
> >> plugin
> >> and there override the functionality I need?
> >>
> >> But still is it possible to override the functionality of the plugins not
> >> messing with other plugins? Just in the application structure. And if it
> >> is
> >> ok I should better create a patch to the plugin then issue another one.
> >>
> >>
> >>
> >> nycsailor wrote:
> >> >
> >> > Is it possible with what you want to do, that you can create a plugin
> >> > that modifies the other plugin through MetaProgramming. Groovy is very
> >> > flexible when it comes to modifying objects and classes and grails
> >> > allows you to specify plugins that need to be loaded before yours.
> >> >
> >> > I'm not sure what you want to do, but this might be the easiest.
> >> >
> >> > On Sun, 2009-07-05 at 09:36 -0700, altosz wrote:
> >> >> Good day, Grails and plugin developers,
> >> >>
> >> >> I've encountered the following question when developing an app. I have
> >> a
> >> >> plugin and would like to override (expand) it functionality. How
> >> should
> >> >> it
> >> >> be done?
> >> >>
> >> >> 1. Is it possible to create the same class in app plugin folder?
> >> Whould
> >> >> it
> >> >> override the same class of the plugin?
> >> >> 2. Or the only way is to modify plugin code?
> >> >>
> >> >> --
> >> >> Regards,
> >> >> Alexei




signature.asc (204 bytes) Download Attachment

Re: Overriding plugin functionality in app

by altosz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I want to extend multi-tenant plugin functionality

Burt Beckwith wrote:
Which plugin?

Burt

On Monday 06 July 2009 12:43:37 am altosz wrote:
>
> Thanks for your answers,
>
> it is what I wanted. I'll try to modify plugin functionality via extending
> plugin metaclass in Bootstrap and if it works and plugin's author is happy
> with it I would commit to common repository - otherwise such extension will
> leave in my app only.
>
>
> nycsailor wrote:
> >
> > I'm not absolutely sure, but I'm pretty sure the Bootstrap is started
> > after the plugins load (which is evident by Hibernate being available).
> >
> > You could probably do what you want in there.
> >
> > On Sun, 2009-07-05 at 10:07 -0700, altosz wrote:
> >> So I should create my own plugin which is loaded after the original
> >> plugin
> >> and there override the functionality I need?
> >>
> >> But still is it possible to override the functionality of the plugins not
> >> messing with other plugins? Just in the application structure. And if it
> >> is
> >> ok I should better create a patch to the plugin then issue another one.
> >>
> >>
> >>
> >> nycsailor wrote:
> >> >
> >> > Is it possible with what you want to do, that you can create a plugin
> >> > that modifies the other plugin through MetaProgramming.  Groovy is very
> >> > flexible when it comes to modifying objects and classes and grails
> >> > allows you to specify plugins that need to be loaded before yours.
> >> >
> >> > I'm not sure what you want to do, but this might be the easiest.
> >> >
> >> > On Sun, 2009-07-05 at 09:36 -0700, altosz wrote:
> >> >> Good day, Grails and plugin developers,
> >> >>
> >> >> I've encountered the following question when developing an app. I have
> >> a
> >> >> plugin and would like to override (expand) it functionality. How
> >> should
> >> >> it
> >> >> be done?
> >> >>
> >> >> 1. Is it possible to create the same class in app plugin folder?
> >> Whould
> >> >> it
> >> >> override the same class of the plugin?
> >> >> 2. Or the only way is to modify plugin code?
> >> >>
> >> >> --
> >> >> Regards,
> >> >> Alexei

 

Re: Overriding plugin functionality in app

by Brad Booth :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The multi tenant plugin is under active development.  What exactly are  
you trying to do?  We might be able just put in a feature request and  
we can get it in.

Sent from my iPhone

On Jul 5, 2009, at 9:53 PM, altosz <altos.z@...> wrote:

>
> I want to extend multi-tenant plugin functionality
>
>
> Burt Beckwith wrote:
>>
>> Which plugin?
>>
>> Burt
>>
>> On Monday 06 July 2009 12:43:37 am altosz wrote:
>>>
>>> Thanks for your answers,
>>>
>>> it is what I wanted. I'll try to modify plugin functionality via
>>> extending
>>> plugin metaclass in Bootstrap and if it works and plugin's author is
>>> happy
>>> with it I would commit to common repository - otherwise such  
>>> extension
>>> will
>>> leave in my app only.
>>>
>>>
>>> nycsailor wrote:
>>>>
>>>> I'm not absolutely sure, but I'm pretty sure the Bootstrap is  
>>>> started
>>>> after the plugins load (which is evident by Hibernate being  
>>>> available).
>>>>
>>>> You could probably do what you want in there.
>>>>
>>>> On Sun, 2009-07-05 at 10:07 -0700, altosz wrote:
>>>>> So I should create my own plugin which is loaded after the  
>>>>> original
>>>>> plugin
>>>>> and there override the functionality I need?
>>>>>
>>>>> But still is it possible to override the functionality of the  
>>>>> plugins
>>> not
>>>>> messing with other plugins? Just in the application structure.  
>>>>> And if
>>> it
>>>>> is
>>>>> ok I should better create a patch to the plugin then issue another
>>> one.
>>>>>
>>>>>
>>>>>
>>>>> nycsailor wrote:
>>>>>>
>>>>>> Is it possible with what you want to do, that you can create a
>>> plugin
>>>>>> that modifies the other plugin through MetaProgramming.  Groovy  
>>>>>> is
>>> very
>>>>>> flexible when it comes to modifying objects and classes and  
>>>>>> grails
>>>>>> allows you to specify plugins that need to be loaded before  
>>>>>> yours.
>>>>>>
>>>>>> I'm not sure what you want to do, but this might be the easiest.
>>>>>>
>>>>>> On Sun, 2009-07-05 at 09:36 -0700, altosz wrote:
>>>>>>> Good day, Grails and plugin developers,
>>>>>>>
>>>>>>> I've encountered the following question when developing an  
>>>>>>> app. I
>>> have
>>>>> a
>>>>>>> plugin and would like to override (expand) it functionality. How
>>>>> should
>>>>>>> it
>>>>>>> be done?
>>>>>>>
>>>>>>> 1. Is it possible to create the same class in app plugin folder?
>>>>> Whould
>>>>>>> it
>>>>>>> override the same class of the plugin?
>>>>>>> 2. Or the only way is to modify plugin code?
>>>>>>>
>>>>>>> --
>>>>>>> Regards,
>>>>>>> Alexei
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Overriding-plugin-functionality-in-app-tp24344656p24349794.html
> Sent from the grails - dev mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Adding functionality into multi-tenant plugin

by altosz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok, and how can a feature request be created?

The things I really need are (in the sequence of importance for me)

1. it necessary to allow some user (if we use acegi resolver, or from some dns - in case of dns resolver) have access to domain objects of any tenant - I call it supertenant :) Obviously it is an administrator or some other user which participates in interaction with tenants. I suppose it is necessary to add another property to Tenant, e.g. isSuperTenant() which can show whether domain objects restrictions should be applied for this tenant (TenantEventHandler should be updated too). isSuperTenant() can judge by e.g. tenantId (=0).

2. it is necessary to keep it DRY the following thing: when there is one domain object per tenant, I use

   Tenant currentTenant
   ....
   Company.get(currentTenant.get())

and have currentTenant injected in my pojo.

I would like to query like
   currentTenant.Company
or something like this as it is obvious that there is one company per tenant.

If it is possible to do it with latest version of plugin please tell me.
If not then any feedback is welcome.

Regards,
Alexei

Brad Booth wrote:
The multi tenant plugin is under active development.  What exactly are  
you trying to do?  We might be able just put in a feature request and  
we can get it in.

Sent from my iPhone

On Jul 5, 2009, at 9:53 PM, altosz <altos.z@gmail.com> wrote:

>
> I want to extend multi-tenant plugin functionality
>
>
> Burt Beckwith wrote:
>>
>> Which plugin?
>>
>> Burt
>>
>> On Monday 06 July 2009 12:43:37 am altosz wrote:
>>>
>>> Thanks for your answers,
>>>
>>> it is what I wanted. I'll try to modify plugin functionality via
>>> extending
>>> plugin metaclass in Bootstrap and if it works and plugin's author is
>>> happy
>>> with it I would commit to common repository - otherwise such  
>>> extension
>>> will
>>> leave in my app only.
>>>
>>>
>>> nycsailor wrote:
>>>>
>>>> I'm not absolutely sure, but I'm pretty sure the Bootstrap is  
>>>> started
>>>> after the plugins load (which is evident by Hibernate being  
>>>> available).
>>>>
>>>> You could probably do what you want in there.
>>>>
>>>> On Sun, 2009-07-05 at 10:07 -0700, altosz wrote:
>>>>> So I should create my own plugin which is loaded after the  
>>>>> original
>>>>> plugin
>>>>> and there override the functionality I need?
>>>>>
>>>>> But still is it possible to override the functionality of the  
>>>>> plugins
>>> not
>>>>> messing with other plugins? Just in the application structure.  
>>>>> And if
>>> it
>>>>> is
>>>>> ok I should better create a patch to the plugin then issue another
>>> one.
>>>>>
>>>>>
>>>>>
>>>>> nycsailor wrote:
>>>>>>
>>>>>> Is it possible with what you want to do, that you can create a
>>> plugin
>>>>>> that modifies the other plugin through MetaProgramming.  Groovy  
>>>>>> is
>>> very
>>>>>> flexible when it comes to modifying objects and classes and  
>>>>>> grails
>>>>>> allows you to specify plugins that need to be loaded before  
>>>>>> yours.
>>>>>>
>>>>>> I'm not sure what you want to do, but this might be the easiest.
>>>>>>
>>>>>> On Sun, 2009-07-05 at 09:36 -0700, altosz wrote:
>>>>>>> Good day, Grails and plugin developers,
>>>>>>>
>>>>>>> I've encountered the following question when developing an  
>>>>>>> app. I
>>> have
>>>>> a
>>>>>>> plugin and would like to override (expand) it functionality. How
>>>>> should
>>>>>>> it
>>>>>>> be done?
>>>>>>>
>>>>>>> 1. Is it possible to create the same class in app plugin folder?
>>>>> Whould
>>>>>>> it
>>>>>>> override the same class of the plugin?
>>>>>>> 2. Or the only way is to modify plugin code?
>>>>>>>
>>>>>>> --
>>>>>>> Regards,
>>>>>>> Alexei
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Overriding-plugin-functionality-in-app-tp24344656p24349794.html
> Sent from the grails - dev mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Re: Adding functionality into multi-tenant plugin

by Eric Martineau-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I think you'd need two modes to really be able to support what you want to do:

  1. Maintenance mode:  A super-user can freely change his identity to another tenant to perform maintenance tasks for that tenant.  When acting in proxy for another tenant, all read/write operations are enforced as the proxied tenant.
  2. Aggregated reporting mode:  All tenant filtering is dropped, and a super-user can view data across all tenants.  This mode would be read-only and would only work when running the database in multi-tenant mode
What do you think?

Eric

On Mon, Jul 6, 2009 at 10:00 AM, altosz <altos.z@...> wrote:

Ok, and how can a feature request be created?

The things I really need are (in the sequence of importance for me)

1. it necessary to allow some user (if we use acegi resolver, or from some
dns - in case of dns resolver) have access to domain objects of any tenant -
I call it supertenant :) Obviously it is an administrator or some other user
which participates in interaction with tenants. I suppose it is necessary to
add another property to Tenant, e.g. isSuperTenant() which can show whether
domain objects restrictions should be applied for this tenant
(TenantEventHandler should be updated too). isSuperTenant() can judge by
e.g. tenantId (=0).

2. it is necessary to keep it DRY the following thing: when there is one
domain object per tenant, I use

  Tenant currentTenant
  ....
  Company.get(currentTenant.get())

and have currentTenant injected in my pojo.

I would like to query like
  currentTenant.Company
or something like this as it is obvious that there is one company per
tenant.

If it is possible to do it with latest version of plugin please tell me.
If not then any feedback is welcome.

Regards,
Alexei


Brad Booth wrote:
>
> The multi tenant plugin is under active development.  What exactly are
> you trying to do?  We might be able just put in a feature request and
> we can get it in.
>
> Sent from my iPhone
>
> On Jul 5, 2009, at 9:53 PM, altosz <altos.z@...> wrote:
>
>>
>> I want to extend multi-tenant plugin functionality
>>
>>
>> Burt Beckwith wrote:
>>>
>>> Which plugin?
>>>
>>> Burt
>>>
>>> On Monday 06 July 2009 12:43:37 am altosz wrote:
>>>>
>>>> Thanks for your answers,
>>>>
>>>> it is what I wanted. I'll try to modify plugin functionality via
>>>> extending
>>>> plugin metaclass in Bootstrap and if it works and plugin's author is
>>>> happy
>>>> with it I would commit to common repository - otherwise such
>>>> extension
>>>> will
>>>> leave in my app only.
>>>>
>>>>
>>>> nycsailor wrote:
>>>>>
>>>>> I'm not absolutely sure, but I'm pretty sure the Bootstrap is
>>>>> started
>>>>> after the plugins load (which is evident by Hibernate being
>>>>> available).
>>>>>
>>>>> You could probably do what you want in there.
>>>>>
>>>>> On Sun, 2009-07-05 at 10:07 -0700, altosz wrote:
>>>>>> So I should create my own plugin which is loaded after the
>>>>>> original
>>>>>> plugin
>>>>>> and there override the functionality I need?
>>>>>>
>>>>>> But still is it possible to override the functionality of the
>>>>>> plugins
>>>> not
>>>>>> messing with other plugins? Just in the application structure.
>>>>>> And if
>>>> it
>>>>>> is
>>>>>> ok I should better create a patch to the plugin then issue another
>>>> one.
>>>>>>
>>>>>>
>>>>>>
>>>>>> nycsailor wrote:
>>>>>>>
>>>>>>> Is it possible with what you want to do, that you can create a
>>>> plugin
>>>>>>> that modifies the other plugin through MetaProgramming.  Groovy
>>>>>>> is
>>>> very
>>>>>>> flexible when it comes to modifying objects and classes and
>>>>>>> grails
>>>>>>> allows you to specify plugins that need to be loaded before
>>>>>>> yours.
>>>>>>>
>>>>>>> I'm not sure what you want to do, but this might be the easiest.
>>>>>>>
>>>>>>> On Sun, 2009-07-05 at 09:36 -0700, altosz wrote:
>>>>>>>> Good day, Grails and plugin developers,
>>>>>>>>
>>>>>>>> I've encountered the following question when developing an
>>>>>>>> app. I
>>>> have
>>>>>> a
>>>>>>>> plugin and would like to override (expand) it functionality. How
>>>>>> should
>>>>>>>> it
>>>>>>>> be done?
>>>>>>>>
>>>>>>>> 1. Is it possible to create the same class in app plugin folder?
>>>>>> Whould
>>>>>>>> it
>>>>>>>> override the same class of the plugin?
>>>>>>>> 2. Or the only way is to modify plugin code?
>>>>>>>>
>>>>>>>> --
>>>>>>>> Regards,
>>>>>>>> Alexei
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Overriding-plugin-functionality-in-app-tp24344656p24349794.html
>> Sent from the grails - dev mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>
>

--
View this message in context: http://www.nabble.com/Overriding-plugin-functionality-in-app-tp24344656p24359069.html
Sent from the grails - dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email




Re: Adding functionality into multi-tenant plugin

by altosz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have a case when using only maintenance mode (though it depends on realisation I suppose) is not sufficient. E.g. to get a list of "pending tasks (jobs)" "super-user" (not an admin) needs to make lookup through all tenants - this should be done before he is acting like one from another tenant.

Maintenance mode is something like
   withTenant(company.id) {
       ....
   }

But it is neseccary to query on all instances without tenant inforced criteria:
   def companyList = Company.withCriteria { ... }
And then
   companyList.each { withTenant(it.id) { ... } }


Eric Martineau-2 wrote:
I think you'd need two modes to really be able to support what you want to
do:


   1. Maintenance mode:  A super-user can freely change his identity to
   another tenant to perform maintenance tasks for that tenant.  When acting in
   proxy for another tenant, all read/write operations are enforced as the
   proxied tenant.
   2. Aggregated reporting mode:  All tenant filtering is dropped, and a
   super-user can view data across all tenants.  This mode would be read-only
   and would only work when running the database in multi-tenant mode

What do you think?

Eric

On Mon, Jul 6, 2009 at 10:00 AM, altosz <altos.z@gmail.com> wrote:

>
> Ok, and how can a feature request be created?
>
> The things I really need are (in the sequence of importance for me)
>
> 1. it necessary to allow some user (if we use acegi resolver, or from some
> dns - in case of dns resolver) have access to domain objects of any tenant
> -
> I call it supertenant :) Obviously it is an administrator or some other
> user
> which participates in interaction with tenants. I suppose it is necessary
> to
> add another property to Tenant, e.g. isSuperTenant() which can show whether
> domain objects restrictions should be applied for this tenant
> (TenantEventHandler should be updated too). isSuperTenant() can judge by
> e.g. tenantId (=0).
>
> 2. it is necessary to keep it DRY the following thing: when there is one
> domain object per tenant, I use
>
>   Tenant currentTenant
>   ....
>   Company.get(currentTenant.get())
>
> and have currentTenant injected in my pojo.
>
> I would like to query like
>   currentTenant.Company
> or something like this as it is obvious that there is one company per
> tenant.
>
> If it is possible to do it with latest version of plugin please tell me.
> If not then any feedback is welcome.
>
> Regards,
> Alexei
>
>
> Brad Booth wrote:
> >
> > The multi tenant plugin is under active development.  What exactly are
> > you trying to do?  We might be able just put in a feature request and
> > we can get it in.
> >
> > Sent from my iPhone
> >
> > On Jul 5, 2009, at 9:53 PM, altosz <altos.z@gmail.com> wrote:
> >
> >>
> >> I want to extend multi-tenant plugin functionality
> >>
> >>
> >> Burt Beckwith wrote:
> >>>
> >>> Which plugin?
> >>>
> >>> Burt
> >>>
> >>> On Monday 06 July 2009 12:43:37 am altosz wrote:
> >>>>
> >>>> Thanks for your answers,
> >>>>
> >>>> it is what I wanted. I'll try to modify plugin functionality via
> >>>> extending
> >>>> plugin metaclass in Bootstrap and if it works and plugin's author is
> >>>> happy
> >>>> with it I would commit to common repository - otherwise such
> >>>> extension
> >>>> will
> >>>> leave in my app only.
> >>>>
> >>>>
> >>>> nycsailor wrote:
> >>>>>
> >>>>> I'm not absolutely sure, but I'm pretty sure the Bootstrap is
> >>>>> started
> >>>>> after the plugins load (which is evident by Hibernate being
> >>>>> available).
> >>>>>
> >>>>> You could probably do what you want in there.
> >>>>>
> >>>>> On Sun, 2009-07-05 at 10:07 -0700, altosz wrote:
> >>>>>> So I should create my own plugin which is loaded after the
> >>>>>> original
> >>>>>> plugin
> >>>>>> and there override the functionality I need?
> >>>>>>
> >>>>>> But still is it possible to override the functionality of the
> >>>>>> plugins
> >>>> not
> >>>>>> messing with other plugins? Just in the application structure.
> >>>>>> And if
> >>>> it
> >>>>>> is
> >>>>>> ok I should better create a patch to the plugin then issue another
> >>>> one.
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>> nycsailor wrote:
> >>>>>>>
> >>>>>>> Is it possible with what you want to do, that you can create a
> >>>> plugin
> >>>>>>> that modifies the other plugin through MetaProgramming.  Groovy
> >>>>>>> is
> >>>> very
> >>>>>>> flexible when it comes to modifying objects and classes and
> >>>>>>> grails
> >>>>>>> allows you to specify plugins that need to be loaded before
> >>>>>>> yours.
> >>>>>>>
> >>>>>>> I'm not sure what you want to do, but this might be the easiest.
> >>>>>>>
> >>>>>>> On Sun, 2009-07-05 at 09:36 -0700, altosz wrote:
> >>>>>>>> Good day, Grails and plugin developers,
> >>>>>>>>
> >>>>>>>> I've encountered the following question when developing an
> >>>>>>>> app. I
> >>>> have
> >>>>>> a
> >>>>>>>> plugin and would like to override (expand) it functionality. How
> >>>>>> should
> >>>>>>>> it
> >>>>>>>> be done?
> >>>>>>>>
> >>>>>>>> 1. Is it possible to create the same class in app plugin folder?
> >>>>>> Whould
> >>>>>>>> it
> >>>>>>>> override the same class of the plugin?
> >>>>>>>> 2. Or the only way is to modify plugin code?
> >>>>>>>>
> >>>>>>>> --
> >>>>>>>> Regards,
> >>>>>>>> Alexei
> >>>
> >>>
> >>>
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Overriding-plugin-functionality-in-app-tp24344656p24349794.html
> >> Sent from the grails - dev mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe from this list, please visit:
> >>
> >>    http://xircles.codehaus.org/manage_email
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list, please visit:
> >
> >     http://xircles.codehaus.org/manage_email
> >
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Overriding-plugin-functionality-in-app-tp24344656p24359069.html
> Sent from the grails - dev mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>