[Geoserver-devel] Again on freemarker template handling

Hi,
still working on template, I realized that there's another issue with them.
We have a system that looks for the template first in the user directory, and then, if not found, looks in the classpath and copies
the content to the data directory.
This allows Geoserver to work out of the box even with an emtpy
data directory, and provides a sample for the user to hack against or copy, so it's good, yet has some issues.

What if the user upgraded Geoserver, and we have new templates?
They won't be replaced because the data directory, which the
user preserved, already has them.

Yet, we should not replace them if the user changed them, because
we would be overwriting its work without mercy.

Finally, during template development, and only for geoserver developers, it would be nice to work against the template in the classpath, and
have the copy in the data dir always replaced.

Hum, though issues. In development mode, I probably would like it
to serve stuff directly from classpath, without the copy.
On upgrade, we would have to tell the users to wipe out stuff, or
else, play like in the above development mode, and give a way to
users to grab the templates (this way, the data directory would
contain only custom ones). The way for users to grab the templates
could be a web page, listing all the templates (this would mean
that we have to register in some central location for the page
to list them).

Ho hum, I accept suggestions
Cheers
Andrea

Perhaps by allowing the user to change the default templates by copying
them into the data directory is something we don't want to do. Perhaps
just allowing to override at the feature type level is good enough. I do
think it would be simpler to have the single template around to muck
with instead of two.

-Justin

Andrea Aime wrote:

Hi,
still working on template, I realized that there's another issue with them.
We have a system that looks for the template first in the user
directory, and then, if not found, looks in the classpath and copies
the content to the data directory.
This allows Geoserver to work out of the box even with an emtpy
data directory, and provides a sample for the user to hack against or
copy, so it's good, yet has some issues.

What if the user upgraded Geoserver, and we have new templates?
They won't be replaced because the data directory, which the
user preserved, already has them.

Yet, we should not replace them if the user changed them, because
we would be overwriting its work without mercy.

Finally, during template development, and only for geoserver developers,
it would be nice to work against the template in the classpath, and
have the copy in the data dir always replaced.

Hum, though issues. In development mode, I probably would like it
to serve stuff directly from classpath, without the copy.
On upgrade, we would have to tell the users to wipe out stuff, or
else, play like in the above development mode, and give a way to
users to grab the templates (this way, the data directory would
contain only custom ones). The way for users to grab the templates
could be a web page, listing all the templates (this would mean
that we have to register in some central location for the page
to list them).

Ho hum, I accept suggestions
Cheers
Andrea

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

--
Justin Deoliveira
The Open Planning Project
jdeolive@anonymised.com

Justin Deoliveira ha scritto:

Perhaps by allowing the user to change the default templates by copying
them into the data directory is something we don't want to do. Perhaps
just allowing to override at the feature type level is good enough. I do
think it would be simpler to have the single template around to muck
with instead of two.

Agreed, but going this way we prevent the user from gathering the templates. That's why I proposed the following:

On upgrade, we would have to tell the users to wipe out stuff, or
else, play like in the above development mode, and give a way to
users to grab the templates (this way, the data directory would
contain only custom ones). The way for users to grab the templates
could be a web page, listing all the templates (this would mean
that we have to register in some central location for the page
to list them).

Do you have any better idea to make users access the templates?
Modifying the geoserver templates is probably what most people
will try to do, and it's a powerful learning tool.

Cheers
Andrea

On upgrade, we would have to tell the users to wipe out stuff, or
else, play like in the above development mode, and give a way to
users to grab the templates (this way, the data directory would
contain only custom ones). The way for users to grab the templates
could be a web page, listing all the templates (this would mean
that we have to register in some central location for the page
to list them).

Do you have any better idea to make users access the templates?
Modifying the geoserver templates is probably what most people
will try to do, and it's a powerful learning tool.

Hmm, yeah perhaps just throwing them on a webpage might be the best
thing to do. We could even link straight into the svn repo. Its a tough
trade off, providing flexibility for users vs shooting your own foot off.

Cheers
Andrea

--
Justin Deoliveira
The Open Planning Project
jdeolive@anonymised.com

Justin Deoliveira ha scritto:

On upgrade, we would have to tell the users to wipe out stuff, or
else, play like in the above development mode, and give a way to
users to grab the templates (this way, the data directory would
contain only custom ones). The way for users to grab the templates
could be a web page, listing all the templates (this would mean
that we have to register in some central location for the page
to list them).

Do you have any better idea to make users access the templates?
Modifying the geoserver templates is probably what most people
will try to do, and it's a powerful learning tool.

Hmm, yeah perhaps just throwing them on a webpage might be the best
thing to do. We could even link straight into the svn repo. Its a tough
trade off, providing flexibility for users vs shooting your own foot off.

What about an alternative that uses exactly the templates that are in
the classpath instead?
Since only output formats are using template, and they are registered
in the Spring context (maybe not every single one, a few may still be
using the SPI), can we make them implement an extra interface that
returns enough description to build a page listing the template
names with a link to their contents (to be served straight
from classpath)?

Cheers
Andrea

Andrea Aime wrote:

What about an alternative that uses exactly the templates that are in
the classpath instead?
Since only output formats are using template, and they are registered
in the Spring context (maybe not every single one, a few may still be
using the SPI), can we make them implement an extra interface that
returns enough description to build a page listing the template
names with a link to their contents (to be served straight
from classpath)?

Hmm, yeah we could... but this is a bit of overkill imho. I would rather
must create another release artifact with all the templates in it and
allow the user to dump them all into the "templates" directory and go to
town.

-Justin

Cheers
Andrea

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

--
Justin Deoliveira
The Open Planning Project
jdeolive@anonymised.com

Justin Deoliveira ha scritto:

Andrea Aime wrote:

What about an alternative that uses exactly the templates that are in
the classpath instead?
Since only output formats are using template, and they are registered
in the Spring context (maybe not every single one, a few may still be
using the SPI), can we make them implement an extra interface that
returns enough description to build a page listing the template
names with a link to their contents (to be served straight
from classpath)?

Hmm, yeah we could... but this is a bit of overkill imho. I would rather
must create another release artifact with all the templates in it and
allow the user to dump them all into the "templates" directory and go to
town.

Ah, didn't thought about this one. Yeah, we should take care of giving
templates decent names, and maybe comment inside the template what operation uses them, and we should be gold.
+1 for me.

Cheers
Andrea