[Geoserver-devel] Output format management in geoserver trunk

Hi,
today I stumbled upon an apparent limitation in output format
handling in geoserver trunk.

To summarize for people not knowing about the new dispatch system,
a service is pure java class, and the service call are method
calls on that class. Each method returns an object that
gets encoded by an output format.

Each output formats is registered in the Spring context, and binds itself to a result class, plus has the ability to say whether
it can really handle a certain result by analyzing the request
too. This allows for the wfs getfeature hits output format to avoid
handling a request that asked for a GML output.

This is problematic in my case, because I'm creating a new operation,
GetLog, that returns a feature collection, but it's not a GetFeature!
The code in the GML output formats looks like:

public final boolean canHandle(Operation operation) {
         //GetFeature operation?
         if ("GetFeature".equalsIgnoreCase(operation.getId())
                 || "GetFeatureWithLock".equalsIgnoreCase(operation.getId())) {
             //also check that the resultType is "results"
             GetFeatureType request = (GetFeatureType) OwsUtils.parameter(operation.getParameters(),
                     GetFeatureType.class);
...

well, in my case the operation is GetLog, and the parameter is a GetLogType (GetLogType is a class that represents the requests, it's
been generated from the XML schema).

So, apparently I'll have to code subclasses of the GML outputs in
order to handle GetLog outputs... this is not good imho.

A better way would be for service objects to specify the econding
in the resulting object, and have the output formats inspect only
the output object to decide whether they want to handle it, or not.
I understand this is a little of a problem since also the result
classes are generated from xml schema. So we either hand modify
them (should not be a big issue, ain't it?) to add a format parameter,
or we put the output format in the request chain "environment",
for example, in a thread local, for output formats to pick.

What do you think?

Cheers
Andrea

Andrea Aime ha scritto:

Hi,
today I stumbled upon an apparent limitation in output format
handling in geoserver trunk.

... btw, I also noticed the output format classes do end in
xxxOutputFormat, xxxTypeFormat, xxxResponse.... hmmm...
I see these are handling slightly different use cases, but
nevertheless, shall we name all of them the same way?

Cheers
Andrea

I have scheduled myself a jira to switch the output format stuff back to
the delegate system it has on 1.5.x and before, more or less.

Andrea Aime wrote:

Andrea Aime ha scritto:

Hi,
today I stumbled upon an apparent limitation in output format
handling in geoserver trunk.

... btw, I also noticed the output format classes do end in
xxxOutputFormat, xxxTypeFormat, xxxResponse.... hmmm...
I see these are handling slightly different use cases, but
nevertheless, shall we name all of them the same way?

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

!DSPAM:1004,45f8030c293181362196140!

--
Justin Deoliveira
The Open Planning Project
http://topp.openplans.org

Justin Deoliveira ha scritto:

I have scheduled myself a jira to switch the output format stuff back to
the delegate system it has on 1.5.x and before, more or less.

So my quick solution is anyways to roll my own output formats for GetLog, right?

Cheers
Andrea

Yeah, i think your best bet will be to create a response object which
latches onto GetLog and then have it delegate to the existing output
format you want. This will more or less be the approach after the change.

Andrea Aime wrote:

Justin Deoliveira ha scritto:

I have scheduled myself a jira to switch the output format stuff back to
the delegate system it has on 1.5.x and before, more or less.

So my quick solution is anyways to roll my own output formats for
GetLog, right?

Cheers
Andrea

!DSPAM:1004,45f8112b307471410093335!

--
Justin Deoliveira
The Open Planning Project
http://topp.openplans.org