Hi everyone!
Today I was testing access to geoserver catalog in a WPS process, but I noticed that only some of my Workspaces and DataStores are listed.
My tests are based on the ImportProcess class and using geoserver UI, I created 4 WS and 4 DS:
Workspaces:
1- common
2- mm_50
3- mm_100
4- mm_250
Stores:
A- MovMassas_1_50000 - defined with workspace mm_50
B- MovMassas_1_100000 - defined with workspace
C- MovMassas_1_250000 - defined with workspace
D- IBGE - defined with workspace
The process bellow just prints information about Workspaces 1, 3 and 4… and about Stores B and C.
Stores A, B, C are PostGIS stores, and D is a WMS store.
I can’t find a reason why this is happening, once they are defined the same way, just changing names, and with the PostGIS stores, changing database schema too… I have only one layer published from store A, which is secured for some ROLES. There is another layer published from Store D, which is public.
Why just some of my ws and stores are visible when I access the catalog inside the WPS? If needed, I can share the ws ans stores definitions.
Here is the WPS code:
package br.rc.unesp.process;
import org.geoserver.catalog.Catalog;
import org.geoserver.catalog.DataStoreInfo;
import org.geoserver.catalog.WorkspaceInfo;
import org.geotools.process.ProcessException;
import org.geotools.process.factory.DescribeProcess;
import org.geotools.process.factory.DescribeResult;
import org.geotools.process.gs.GSProcess;
@DescribeProcess(title = “MyTest”, description = “MyTest test”)
public class MyTestProcess implements GSProcess {
private Catalog catalog;
public MyTestProcess(Catalog catalog) {
this.catalog = catalog;
}
@DescribeResult(name = “result”, description = “Return the infos”)
public String execute() throws ProcessException{
StringBuilder strBuilder = new StringBuilder();
strBuilder.append(“Workspaces:”);
strBuilder.append(“\n”);
strBuilder.append(“----------------------------------------”);
strBuilder.append(“\n”);
for(WorkspaceInfo wsi : catalog.getWorkspaces()){
strBuilder.append("ID: " + wsi.getId());
strBuilder.append(“\n”);
strBuilder.append("NAME: " + wsi.getName());
strBuilder.append(“\n\r”);
}
strBuilder.append(“DataStores:”);
strBuilder.append(“\n”);
strBuilder.append(“----------------------------------------”);
strBuilder.append(“\n”);
for(DataStoreInfo dsi : catalog.getDataStores()){
strBuilder.append("ID: " + dsi.getId());
strBuilder.append(“\n”);
strBuilder.append("NAME: " + dsi.getName());
strBuilder.append(“\n”);
strBuilder.append("DESCRITION: " + dsi.getDescription());
strBuilder.append(“\n”);
strBuilder.append("TYPE: " + dsi.getType());
strBuilder.append(“\n”);
strBuilder.append("WORKSPACE: " + dsi.getWorkspace().getName());
strBuilder.append(“\n\r”);
}
return strBuilder.toString();
}
}
It is defined at ApplicationContext.xml like this:
I’m trying to access the catalog to list published and unpublished layers in the postgis datastores inside this WPS.
Any help will be appreciated!!
Regards,
Rodrigo C. Antonialli
Rio Claro - SP - Brasil
LinkedIn: http://www.linkedin.com/in/rcaprofile
Contato: (19) 8136-2347
rcantonialli@anonymised.com
Skype: rc_antonialli