[[data-access]]
= Using the Data Access Namespace

In addition to the core XML namespace (`gfe`), _Spring Data for Pivotal GemFire_ provides a data access XML namespace (`gfe-data`),
which is primarily intended to simplify the development of Pivotal GemFire client applications. This namespace currently contains
support for Pivotal GemFire <<gemfire-repositories, Repositories>> and function <<function-execution, execution>>
as well as includes a `<datasource>` tag offering a convenient way to connect to a Pivotal GemFire cluster.

[[data-access:datasource]]
== An Easy Way to Connect to Pivotal GemFire

For many applications, a basic connection to a Pivotal GemFire data grid using default values is sufficient.
_Spring Data for Pivotal GemFire's_ `<datasource>` tag provides a simple way to access data. The data source creates
a `ClientCache` and connection `Pool`. In addition, it will query the cluster servers for all existing root Regions
and create an (empty) client Region proxy for each one.

[source,xml]
----
<gfe-data:datasource>
  <locator host="remotehost" port="1234"/>
</gfe-data:datasource>
----

The `<datasource>` tag is syntactically similar to `<gfe:pool>`. It may be configured with one or more nested `locator`
or `server` tags to connect to an existing data grid. Additionally, all attributes available to configure a Pool
are supported. This configuration will automatically create client Region beans for each Region defined on
cluster members connected to the Locator, so they may be seamlessly referenced by _Spring Data_ mapping annotations,
`GemfireTemplate`, and wired into application classes.

Of course, you can explicitly configure client Regions. For example, if you want to cache data in local memory:

[source,xml]
----
<gfe-data:datasource>
  <locator host="remotehost" port="1234"/>
</gfe-data:datasource>

<gfe:client-region id="Example" shortcut="CACHING_PROXY"/>
----
