Hi, thanks!!... but I couldn't make it work. I download de source code for
debbuging and I see something that I don't understand.

I'm do it this:
*DataStore data = DataStoreFinder.getDataStore( connectionParameters );*

In the class DataStoreFinder the method call the getAvailableDataStores(),
this return ShapeFileDataStore and MifFileDataStore in a HashMap.

This is the method
*DataStoreFinder*
    public static synchronized DataStore getDataStore(Map params) throws
IOException {
        Iterator<DataStoreFactorySpi> ps = getAvailableDataStores();
        DataAccess<? extends FeatureType, ? extends Feature> dataStore;
        dataStore = DataAccessFinder.getDataStore(params, ps);
        return (DataStore) dataStore;
    }

*this is the method in DataAccessFinder:*

   static DataAccess<? extends FeatureType, ? extends Feature> getDataStore(
            Map<String, Serializable> params, Iterator<? extends
DataAccessFactory> ps)
            throws IOException {
        DataAccessFactory fac;

        IOException canProcessButNotAvailable = null;
        while (ps.hasNext()) {
            fac = (DataAccessFactory) ps.next();
            boolean canProcess = false;
            try {
                *canProcess = fac.canProcess(params);*
            } catch (Throwable t) {
                LOGGER.log(Level.WARNING, "Problem asking " +
fac.getDisplayName()
                        + " if it can process request:" + t, t);
                // Protect against DataStores that don't carefully code
                // canProcess
                continue;
            }
           * if (canProcess) {*
                .....code here.....
            }
        }
        if (canProcessButNotAvailable != null) {
            throw canProcessButNotAvailable;
        }
        return null;
    }

*Then canProcess return false with this method*

*ShapefileDataStoreFactory*
    public boolean canProcess(Map params) {
        boolean accept = false;
       * if (params.containsKey(URLP.key)) {*
            try {
                URL url = (URL) URLP.lookUp(params);
                accept = canProcess(url);
            } catch (IOException ioe) {
                // yes, I am eating this - since it is my job to return a
                // true/false
            }
        }
        return accept;


Becouse of this method (*canProcess*), ther return of *getDataStore* is
null.  This line *params.containsKey(URLP.key) *, search for a key with the
value "*url*". But the value of the key that I send is "*
WFSDataStoreFactoy:GET_CAPABILITIES_URL*". And if I put the key value "*url*"
then search for "*.shp*" so my URL to geoserver is useless.

I'm using gt-main.jar and gt-shapefile.jar, version 2.6-M2. Maybe *
getAvailableDataStores()* has to give me more than 2
(org.geotools.data.mif.MIFDataStoreFactory,
org.geotools.data.shapefile.ShapefileDataStoreFactory).

Anyone has this problem? or has this running?.... If you have this running
please look what is the result of this.

*DataStoreFinder.getAvailableDataStores();*

Thanks a lot!!!..
Eze.

2009/11/2 Gabriel Roldan <[email protected]>

> Hi Ezequiel,
>
> may be this was already answered, but just in case:
>
> you're trying to connect to the WMS as if it were a WFS.
>
> to make it clearer use the following url instead, so you're forced to
> include the service param:
>
> String getCapabilities = "
> http://localhost:8080/geoserver/ows?SERVICE=WFS&REQUEST=GetCapabilities";;
>
> hope that helps,
>
> Gabriel
>
> Ezequiel Coronel wrote:
>
>> Hi,  I try for another ways but I couldn't do this. When I do this:
>>
>>
>> String getCapabilities = "
>> http://localhost:8080/geoserver/wms?REQUEST=GetCapabilities";;
>>           Map connectionParameters = new HashMap();
>> connectionParameters.put("WFSDataStoreFactory:GET_CAPABILITIES_URL",
>> getCapabilities );
>>                   // Step 2 - connection
>> DataStore data = DataStoreFinder.getDataStore( connectionParameters );
>>
>> de parameter "data" return in null.
>>
>> Anyone can do this through geoserver?? because now I reading my maps from
>> hard disk and I think it should be better to do it through geoserver.
>>
>> Thanks a lot!!
>> Ezequiel.
>>
>> 2009/10/16 Jody Garnett <[email protected] <mailto:
>> [email protected]>>
>>
>>
>>    WMS is a different beast; the class is WebMapServer.
>>
>>    Jody
>>
>>    On 17/10/2009, at 7:32 AM, Ezequiel Coronel wrote:
>>
>>     Thanks Jody... I'm trying to do it but I have this problem
>>>
>>>    String getCapabilities =
>>>    "http://localhost:8080/geoserver/wms?REQUEST=GetCapabilities";;
>>>                  Map connectionParameters = new HashMap();
>>>    connectionParameters.put("WFSDataStoreFactory:GET_CAPABILITIES_URL",
>>>    getCapabilities );
>>>                          // Step 2 - connection
>>>    DataStore data = DataStoreFinder.getDataStore( connectionParameters );
>>>
>>>    but DataStore data is null , I don't know if I have to change
>>>    something because the url that you gave me it's for WFS and I'm
>>>    using WMS (I think that it is the same)
>>>
>>>    When I put this url
>>>    (http://localhost:8080/geoserver/wms?REQUEST=GetCapabilities) in
>>>    the web browser, this XML is the result. (It is a big file so I
>>>    put some, if you need more let me know.)
>>>
>>>    <?xml version="1.0" encoding="UTF-8"?>
>>>    <!DOCTYPE WMT_MS_Capabilities SYSTEM
>>>    "
>>> http://localhost:8080/geoserver/schemas/wms/1.1.1/WMS_MS_Capabilities.dtd
>>> ">
>>>    <WMT_MS_Capabilities version="1.1.1" updateSequence="104">
>>>      <Service>
>>>        <Name>OGC:WMS</Name>
>>>        <Title>GeoServer Web Map Service</Title>
>>>        <Abstract>A compliant implementation of WMS 1.1.1 plus most of
>>>    the SLD 1.0 extension (dynamic styling). Can also generate PDF,
>>>    SVG, KML, GeoRSS</Abstract>
>>>        <KeywordList>
>>>          <Keyword>WFS</Keyword>
>>>          <Keyword>WMS</Keyword>
>>>          <Keyword>GEOSERVER</Keyword>
>>>        </KeywordList>
>>>        <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink";
>>>    xlink:type="simple" xlink:href="http://localhost:8080/geoserver/wms
>>> "/>
>>>        <ContactInformation>
>>>          <ContactPersonPrimary>
>>>            <ContactPerson>Claudius Ptolomaeus</ContactPerson>
>>>            <ContactOrganization>The ancient geographes
>>>    INC</ContactOrganization>
>>>          </ContactPersonPrimary>
>>>          <ContactPosition>Chief geographer</ContactPosition>
>>>          <ContactAddress>
>>>            <AddressType>Work</AddressType>
>>>            <Address/>
>>>            <City>Alexandria</City>
>>>            <StateOrProvince/>
>>>            <PostCode/>
>>>            <Country>Egypt</Country>
>>>          </ContactAddress>
>>>          <ContactVoiceTelephone/>
>>>          <ContactFacsimileTelephone/>
>>>          <ContactElectronicMailAddress>[email protected]
>>>    <mailto:[email protected]></ContactElectronicMailAddress>
>>>
>>>        </ContactInformation>
>>>        <Fees>NONE</Fees>
>>>        <AccessConstraints>NONE</AccessConstraints>
>>>      </Service>
>>>
>>>    Thanks!!!...
>>>    Ezequiel.
>>>
>>>
>>>    2009/10/9 Jody Garnett <[email protected]
>>>    <mailto:[email protected]>>
>>>
>>>
>>>        Hi Ezequiel.
>>>
>>>        Accessing geoserver is the same as any other datastore
>>>        (shapefile, postgis, etc...) - it makes use of the web feature
>>>        server protocol.
>>>
>>>        The only difference should be in the connection parameters.
>>>        - http://docs.codehaus.org/display/GEOTDOC/WFS+Plugin
>>>
>>>        When you set up your URL to start from (the one pointing to
>>>        the capabilities document you have a choice of "VERSION=1.1.0"
>>>        or "VERSION=1.0.0".
>>>
>>>        Right now only version 1.0 supports read-write.
>>>
>>>        Jody
>>>
>>>        On 10/10/2009, at 4:03 AM, Ezequiel Coronel wrote:
>>>
>>>         Hi, I'm trying to get maps through Geo Server. I'm doing
>>>>        something like this to get the maps from my hard disk.
>>>>
>>>>        FeatureSource featureSource =
>>>>        (FeatureSource)featuresSources.get("C_CapFed_c_v01_polyline");
>>>>
>>>>        So, my idea is get the map from my server....
>>>>        FeatureSource featureSource =
>>>>        (FeatureSource)featuresSources.get("
>>>> http://localhost:8080/geoserver/.....";);
>>>>
>>>>        It is possible to do this??, maybe I have to do another thing
>>>>        or way.
>>>>
>>>>        Thanks very much!!!
>>>>        Ezequiel.
>>>>
>>>>
>>>>  
>>>> ------------------------------------------------------------------------------
>>>>        Come build with us! The BlackBerry(R) Developer Conference in
>>>>        SF, CA
>>>>        is the only developer event you need to attend this year.
>>>>        Jumpstart your
>>>>        developing skills, take BlackBerry mobile applications to
>>>>        market and stay
>>>>        ahead of the curve. Join us from November 9 - 12, 2009.
>>>>        Register now!
>>>>
>>>> http://p.sf.net/sfu/devconference_______________________________________________
>>>>        Geotools-gt2-users mailing list
>>>>        [email protected]
>>>>        <mailto:[email protected]>
>>>>
>>>>        https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>>>>
>>>
>>>
>>>
>>>  
>>> ------------------------------------------------------------------------------
>>>    Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>>>    is the only developer event you need to attend this year.
>>>    Jumpstart your
>>>    developing skills, take BlackBerry mobile applications to market
>>>    and stay
>>>    ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>>>
>>> http://p.sf.net/sfu/devconference_______________________________________________
>>>    Geotools-gt2-users mailing list
>>>    [email protected]
>>>    <mailto:[email protected]>
>>>
>>>    https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>>>
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart your
>> developing skills, take BlackBerry mobile applications to market and stay
>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>> http://p.sf.net/sfu/devconference
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Geotools-gt2-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>>
>
>
> --
> Gabriel Roldan
> OpenGeo - http://opengeo.org
> Expert service straight from the developers.
>
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to