Hi people,
 
Like I said in my last mail and my first
one, I am new in developing with uDIG and RCP.
I am trying for 3 days to add layers to a
project programmatically bringing them from GeoServer. What I can do was connect
to Geoserver and bring all the features to the project, but I can’t bring
a particular feature, the ones I really want and not all of them. I did it in
two different ways:
1.      
With IGeoResource, I bring and
add all the features that exist at GeoServer:
 
URL url = "">new URL("http://localhost:8080/geoserver/ows?service=WFS&request=GetCapabilities");
      
            Map<String,Serializable>
params = new HashMap<String,Serializable>();
            params.put(
WFSDataStoreFactory.URL.key, url
);
            params.put(
WFSDataStoreFactory.LENIENT.key, true );
            params.put(
WFSDataStoreFactory.TRY_GZIP.key, true );
            IServiceFactory
serviceFactory = CatalogPlugin.getDefault().getServiceFactory();                  
            IService
service = serviceFactory.createService( params ).get(0);
            try {
                  IServiceInfo
info = service.getInfo( null );  //
try connecting to make sure the service works                     
                 
//CatalogPlugin.getDefault().getLocalCatalog().add( service );
                 
List<IGeoResource> resources = (List<IGeoResource>)
service.resources(new
NullProgressMonitor());                    
                 
ApplicationGIS.addLayersToMap(ApplicationGIS.getActiveMap(), resources,
-1,ApplicationGIS.getActiveProject(), true);                  
            }
 
2.      
With Geotools API, I can bring
one in particular but don’t know how to add it to the map:
 
URL url = "">new URL("http://localhost:8080/geoserver/ows?service=WFS&request=GetCapabilities");
                  
            Map<String,Serializable>
params = new HashMap<String,Serializable>();
            params.put(
WFSDataStoreFactory.URL.key, url
);
            params.put(
WFSDataStoreFactory.LENIENT.key, true );
            params.put(
WFSDataStoreFactory.TRY_GZIP.key, true );
            DataStore
dataStore = DataStoreFinder.getDataStore(params);
                  
            //String
[] features = dataStore.getTypeNames();
                  
            FeatureSource
featureSource = dataStore.getFeatureSource( "CFConstrucciones" );                  
            FeatureCollection
collection = featureSource.getFeatures();            
 
The name "CFConstrucciones" is the one I want to “upload” to the map.
 
Please help me with this because I am sure it
might be very simple.
Thank you and sorry for my English (I am
from Uruguay – South America).
 
Sebastian