Yeah, as he explained that is complicated by the fact that GeoServerDataDirectory and GeoServerResourceLoader are also resource store, but never "the" resource store (in fact, they depend upon it).

Solution #1
Use of a Spring "alias". An alias as higher priority than a normal name. However that only gives two levels of priority, once you have more than one alias you end up with the same issue. This may be sufficient for us though, assuming that we'd never need more than one custom ResourceStore in our context.

Solution #2
The pattern we used for geofence/geofence-server: using PropertyConfigurers we have full flexibility over priority. It would go something like this. In main applicationContext:

<bean id="resourcestore-configurer" 
class="org.geoserver.config.GeoServerPropertyConfigurer">
|*<property name="order" value="5"/>*
        <property name="properties">
            <props>
                <prop key="theResourceStore">dataDirectoryResourceStore</prop>
            </props>
        </property>
</bean>

 <bean id="resourceStore" 
class="org.geoserver.platform.resource.ResourceStoreProxy">
        <property name="delegate" ref="$theResourceStore"/>
 </bean>


Then in the jdbcstore applicationContext:

<bean id="resourcestore-configurer" 
class="org.geoserver.config.GeoServerPropertyConfigurer">
       *<property name="order" value="4"/>*
       <property name="properties">
            <props>
                <prop key="theResourceStore">jdbcResourceStore</prop>
            </props>
       </property>
</bean>

Quite an elegant solution, if you ask me.

Kind Regards
Niels


On 16-02-16 09:27, Andrea Aime wrote:
On Tue, Feb 16, 2016 at 2:31 AM, Jody Garnett <[email protected] <mailto:[email protected]>> wrote:


        Anyone have any thoughts? Is there something more basic I'm
        missing?


    The auto migration from file to jdbc makes this more complicated
    then strictly necessary. If not for this feature we could make a
    war that only had the JDBCResourceStore implementation.

    Does spring have a priority we could use to control extensions? Or
    we could bust out a -D command line option (to tell the proxy what
    to use? - with the default being the file based implementation).


I'm not aware of a bean priority that can be use for override in Spring.

The existing approach in all GeoServer for this cases is to have a default implementation created programmatically unless
a different one can be found using a scan of the application context.
See how the ResourceAccessManager is looked up in SecureCatalogImpl, or check how the catalog facade is setup with jdbc config
(the two approaches are different, both vaild).

Cheers
Andrea
--
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
==

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39  339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.


-------------------------------------------------------


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140


_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to