How to properly save a Resource ?

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

How to properly save a Resource ?

Jean Pommier - PI geosolutions
Hi,

I'm working on a Template management UI (FreeMarker GetFeatureInfo templates), as an extension for geoserver web UI.
I'm trying to figure out how to properly write the templates files in the data dir. I suppose I should not build myself the file path, but use some internal  resource management class, so that it would adapt to whatever config storage system is configured (default file storage or JDBC).
I guess the information is somewhere, but I've spent the whole afternoon looking for it, so I'd be glad if someone could give me some light on the matter.

By the way, is there an easy way to get the path corresponding to, say, a layer (the path to where its .xml config file is stored) ?
Thanks,
Jean


--

Jean Pommier -- pi-Geosolutions

Ingénieur, consultant indépendant

Tél. : (+33) 6 09 23 21 36
E-mail : [hidden email]
Web : www.pi-geosolutions.fr


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
Geoserver-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to properly save a Resource ?

jody.garnett
Hello Jean, 

The resource api has some examples here (used when we were porting from file to resource).


I have also tried to provide javadoc examples in the codebase (so it shows up in your IDE).


Let me know how you go?

There is a seperate class for getting the configuration objects associated with a layer (or any catalog objet):

These mostly are used to find the right path.

Depending on the catalog implementation used there may not be an xml file on disk to modify. To interact with the catalog objects use the catalog api - since changing these triggers event notification to update the internal state (or sync a cluster).


--
Jody Garnett

On 18 March 2016 at 08:15, Jean Pommier <[hidden email]> wrote:
Hi,

I'm working on a Template management UI (FreeMarker GetFeatureInfo templates), as an extension for geoserver web UI.
I'm trying to figure out how to properly write the templates files in the data dir. I suppose I should not build myself the file path, but use some internal  resource management class, so that it would adapt to whatever config storage system is configured (default file storage or JDBC).
I guess the information is somewhere, but I've spent the whole afternoon looking for it, so I'd be glad if someone could give me some light on the matter.

By the way, is there an easy way to get the path corresponding to, say, a layer (the path to where its .xml config file is stored) ?
Thanks,
Jean


--

Jean Pommier -- pi-Geosolutions

Ingénieur, consultant indépendant

Tél. : <a href="tel:%28%2B33%29%206%2009%2023%2021%2036" value="+33609232136" target="_blank">(+33) 6 09 23 21 36
E-mail : [hidden email]
Web : www.pi-geosolutions.fr


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
Geoserver-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel



------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
Geoserver-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to properly save a Resource ?

geowolf
In reply to this post by Jean Pommier - PI geosolutions
On Fri, Mar 18, 2016 at 4:15 PM, Jean Pommier <[hidden email]> wrote:
Hi,

I'm working on a Template management UI (FreeMarker GetFeatureInfo templates), as an extension for geoserver web UI.

Wondering, are you planning to donate that work to the GeoServer community? If so I'd suggest you to read the following two
documents, following their indications will ease the inclusion of your work in the official code base:

If you have any questions we're happy to assist and clarify

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


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.


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

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
Geoserver-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to properly save a Resource ?

Jean Pommier - PI geosolutions
Hi,

Yes, sure, as soon as I have something clean.
Thank you, Andrea & Jody. I'll look at what you gave me next week.
Thanks again,

Jean

Jean Pommier -- pi-Geosolutions

Ingénieur, consultant indépendant

Tél. : (+33) 6 09 23 21 36
E-mail : [hidden email]
Web : www.pi-geosolutions.fr

Le 19/03/2016 12:12, Andrea Aime a écrit :
On Fri, Mar 18, 2016 at 4:15 PM, Jean Pommier <[hidden email]> wrote:
Hi,

I'm working on a Template management UI (FreeMarker GetFeatureInfo templates), as an extension for geoserver web UI.

Wondering, are you planning to donate that work to the GeoServer community? If so I'd suggest you to read the following two
documents, following their indications will ease the inclusion of your work in the official code base:

If you have any questions we're happy to assist and clarify

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


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.


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


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
Geoserver-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to properly save a Resource ?

Jean Pommier - PI geosolutions
In reply to this post by jody.garnett
Hi Jody,

The links you provided gave me matters for thinking.
But looking at the existing code, I have the feeling that it is still a work in progress, am I right ?
Furthermore, I never used the JDBCconfig extension, but I definitely have the feeling that whatever the resource management system is, the templates are always file-based.
If this is the case, I guess I don't really have to care, for now,  about Resource management, since I will only deal with template files.
Unless I contribute to adapting the templates to this resource-based management, but for now, I don't feel like so (maybe later, who knows ? It doesn't look much complicated).
Am I right ?
Have I missed something ?
Thanks,

Jean

Jean Pommier -- pi-Geosolutions

Ingénieur, consultant indépendant

Tél. : (+33) 6 09 23 21 36
E-mail : [hidden email]
Web : www.pi-geosolutions.fr

Le 18/03/2016 23:08, Jody Garnett a écrit :
Hello Jean, 

The resource api has some examples here (used when we were porting from file to resource).


I have also tried to provide javadoc examples in the codebase (so it shows up in your IDE).


Let me know how you go?

There is a seperate class for getting the configuration objects associated with a layer (or any catalog objet):

These mostly are used to find the right path.

Depending on the catalog implementation used there may not be an xml file on disk to modify. To interact with the catalog objects use the catalog api - since changing these triggers event notification to update the internal state (or sync a cluster).


--
Jody Garnett

On 18 March 2016 at 08:15, Jean Pommier <[hidden email]> wrote:
Hi,

I'm working on a Template management UI (FreeMarker GetFeatureInfo templates), as an extension for geoserver web UI.
I'm trying to figure out how to properly write the templates files in the data dir. I suppose I should not build myself the file path, but use some internal  resource management class, so that it would adapt to whatever config storage system is configured (default file storage or JDBC).
I guess the information is somewhere, but I've spent the whole afternoon looking for it, so I'd be glad if someone could give me some light on the matter.

By the way, is there an easy way to get the path corresponding to, say, a layer (the path to where its .xml config file is stored) ?
Thanks,
Jean


--

Jean Pommier -- pi-Geosolutions

Ingénieur, consultant indépendant

Tél. : <a moz-do-not-send="true" href="tel:%28%2B33%29%206%2009%2023%2021%2036" value="+33609232136" target="_blank">(+33) 6 09 23 21 36
E-mail : [hidden email]
Web : www.pi-geosolutions.fr


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
Geoserver-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel




------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
_______________________________________________
Geoserver-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to properly save a Resource ?

jody.garnett
On 22 March 2016 at 03:00, Jean Pommier <[hidden email]> wrote:
Hi Jody,

The links you provided gave me matters for thinking.
But looking at the existing code, I have the feeling that it is still a work in progress, am I right ?

It is operational, but I will be more confident that we have caught everything after we see a couple more implementations.
 
Furthermore, I never used the JDBCconfig extension, but I definitely have the feeling that whatever the resource management system is, the templates are always file-based.

That is correct, so resource.file() will "unpack" the JDBC blob onto the local file system for the template engine to use. If you check master you can see a lot of work was done to remove file references and make use of input and output streams in the last six months so that a trip to the local file system is not required.
 
If this is the case, I guess I don't really have to care, for now,  about Resource management, since I will only deal with template files.

Please use resource.file() and check for changes using the api so that your solution can work in a clustered environment. There are a couple of FileWatcher examples used by the security system to detect changes to resources.
 
Unless I contribute to adapting the templates to this resource-based management, but for now, I don't feel like so (maybe later, who knows ? It doesn't look much complicated).

Do you have some specific code you are concerned with? There is some template code in geoserver already that has been converted - perhaps you can use it as an example?
 
Am I right ?
Have I missed something ?

Not sure, and again not sure :)


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
_______________________________________________
Geoserver-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to properly save a Resource ?

Jean Pommier - PI geosolutions
Hi Jody,

I think I've got it. It's pretty much operational now, and uses the resource way.
I've still got to implement a few functionalities.
I'll also have a look at FileWatcher examples, thanks for the tip.

I'll try to find, in the next days, some time to write a description of the module, so that I can propose it as a community module...
Thanks again,

Jean

Jean Pommier -- pi-Geosolutions

Ingénieur, consultant indépendant

Tél. : (+33) 6 09 23 21 36
E-mail : [hidden email]
Web : www.pi-geosolutions.fr

Le 22/03/2016 17:33, Jody Garnett a écrit :
On 22 March 2016 at 03:00, Jean Pommier <[hidden email]> wrote:
Hi Jody,

The links you provided gave me matters for thinking.
But looking at the existing code, I have the feeling that it is still a work in progress, am I right ?

It is operational, but I will be more confident that we have caught everything after we see a couple more implementations.
 
Furthermore, I never used the JDBCconfig extension, but I definitely have the feeling that whatever the resource management system is, the templates are always file-based.

That is correct, so resource.file() will "unpack" the JDBC blob onto the local file system for the template engine to use. If you check master you can see a lot of work was done to remove file references and make use of input and output streams in the last six months so that a trip to the local file system is not required.
 
If this is the case, I guess I don't really have to care, for now,  about Resource management, since I will only deal with template files.

Please use resource.file() and check for changes using the api so that your solution can work in a clustered environment. There are a couple of FileWatcher examples used by the security system to detect changes to resources.
 
Unless I contribute to adapting the templates to this resource-based management, but for now, I don't feel like so (maybe later, who knows ? It doesn't look much complicated).

Do you have some specific code you are concerned with? There is some template code in geoserver already that has been converted - perhaps you can use it as an example?
 
Am I right ?
Have I missed something ?

Not sure, and again not sure :)



------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
_______________________________________________
Geoserver-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to properly save a Resource ?

jody.garnett
Thanks Jean, and any feedback you have on the Resource API is welcome - we tried to cut down on much of the cut&paste code in our codebase.

--
Jody Garnett

On 23 March 2016 at 13:26, Jean Pommier <[hidden email]> wrote:
Hi Jody,

I think I've got it. It's pretty much operational now, and uses the resource way.
I've still got to implement a few functionalities.
I'll also have a look at FileWatcher examples, thanks for the tip.

I'll try to find, in the next days, some time to write a description of the module, so that I can propose it as a community module...
Thanks again,

Jean

Jean Pommier -- pi-Geosolutions

Ingénieur, consultant indépendant

Tél. : <a href="tel:%28%2B33%29%206%2009%2023%2021%2036" value="+33609232136" target="_blank">(+33) 6 09 23 21 36
E-mail : [hidden email]
Web : www.pi-geosolutions.fr

Le 22/03/2016 17:33, Jody Garnett a écrit :
On 22 March 2016 at 03:00, Jean Pommier <[hidden email]> wrote:
Hi Jody,

The links you provided gave me matters for thinking.
But looking at the existing code, I have the feeling that it is still a work in progress, am I right ?

It is operational, but I will be more confident that we have caught everything after we see a couple more implementations.
 
Furthermore, I never used the JDBCconfig extension, but I definitely have the feeling that whatever the resource management system is, the templates are always file-based.

That is correct, so resource.file() will "unpack" the JDBC blob onto the local file system for the template engine to use. If you check master you can see a lot of work was done to remove file references and make use of input and output streams in the last six months so that a trip to the local file system is not required.
 
If this is the case, I guess I don't really have to care, for now,  about Resource management, since I will only deal with template files.

Please use resource.file() and check for changes using the api so that your solution can work in a clustered environment. There are a couple of FileWatcher examples used by the security system to detect changes to resources.
 
Unless I contribute to adapting the templates to this resource-based management, but for now, I don't feel like so (maybe later, who knows ? It doesn't look much complicated).

Do you have some specific code you are concerned with? There is some template code in geoserver already that has been converted - perhaps you can use it as an example?
 
Am I right ?
Have I missed something ?

Not sure, and again not sure :)




------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
_______________________________________________
Geoserver-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel