how about your decorator being a dynamic proxy that implements all the
interfaces the decorated object implements, and delegates to the proxy
object method except for the ones you want to override?

/2c
On Mon, Feb 27, 2012 at 5:53 PM, Robert Coup
<[email protected]> wrote:
> Hi all,
>
> I use a custom security wrapper which among other things makes workspaces (&
> therefore datastores) read-only:
>
>     public WorkspaceAccessLimits getAccessLimits(Authentication user,
> WorkspaceInfo workspace) {
>         // canRead=true, canWrite=false
>         return new WorkspaceAccessLimits(CatalogMode.HIDE, true, false);
>     }
>
> Messing with SQL Views recently, I discovered that the Create SQL View link
> never appeared for a PostGIS datastore. Turns out this is because of the
> following check:
>
>     createSQLViewContainer.setVisible(da instanceof JDBCDataStore);
>
> and da is a ReadOnlyDataStore (DecoratingDataStore) which delegates to the
> original JDBCDataStore.
>
> It's not just enough to change that line/view, the SQL Views implementation
> uses JDBCDataStore everywhere.
>
> Not sure of the best approach here - Andrea's initial thoughts in IRC were
> "we'd need a new interface for JDBCDataStore and a ready only wrapper that
> maintains it", but he suggested I bring it here first. If this is likely to
> be a more widespread problem, is it better to start moving away from
> instanceof to another comparison that checks through wrappers?
>
> Cheers,
>
> Rob :)
> --
> Koordinates Ltd.
> PO Box 1604, Shortland St, Auckland 1140, New Zealand
> Phone +64-9-966 0433 Fax +64-9-969 0045
> Web http://koordinates.com/
>
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> _______________________________________________
> Geoserver-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geoserver-devel
>



-- 
Gabriel Roldan
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to