Browse Source

add missing language tags for docs

pull/1/head
Mark Pollack 15 years ago
parent
commit
f6d4cc615a
  1. 26
      src/docbkx/reference/jmx.xml
  2. 7
      src/docbkx/reference/mapping.xml
  3. 21
      src/docbkx/reference/mongo-repositories.xml
  4. 41
      src/docbkx/reference/mongodb.xml

26
src/docbkx/reference/jmx.xml

@ -34,30 +34,28 @@ @@ -34,30 +34,28 @@
http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<beans>
<beans>
<!-- Default bean name is 'mongo' -->
<mongo:mongo host="localhost" port="27017"/>
<!-- Default bean name is 'mongo' -->
<mongo:mongo host="localhost" port="27017"/>
<!-- by default look for a Mongo object named 'mongo' -->
<mongo:jmx/>
<!-- by default look for a Mongo object named 'mongo' -->
<mongo:jmx/>
<context:mbean-export/>
<context:mbean-export/>
<!-- To translate any MongoExceptions thrown in @Repository annotated classes -->
<context:annotation-config/>
<!-- To translate any MongoExceptions thrown in @Repository annotated classes -->
<context:annotation-config/>
<bean id="registry" class="org.springframework.remoting.rmi.RmiRegistryFactoryBean"
p:port="1099" />
<bean id="registry" class="org.springframework.remoting.rmi.RmiRegistryFactoryBean" p:port="1099" />
<!-- Expose JMX over RMI -->
<bean id="serverConnector" class="org.springframework.jmx.support.ConnectorServerFactoryBean"
<!-- Expose JMX over RMI -->
<bean id="serverConnector" class="org.springframework.jmx.support.ConnectorServerFactoryBean"
depends-on="registry"
p:objectName="connector:name=rmi"
p:serviceUrl="service:jmx:rmi://localhost/jndi/rmi://localhost:1099/myconnector" />
</beans>
</programlisting>
&lt;/beans&gt; </programlisting>
</example>
<para>This will expose several MBeans</para>

7
src/docbkx/reference/mapping.xml

@ -25,8 +25,7 @@ @@ -25,8 +25,7 @@
<example>
<title>@Configuration class to configure MongoDB mapping support</title>
<programlisting language="xml">
@Configuration
<programlisting language="java">@Configuration
public class GeoSpatialAppConfig extends AbstractMongoConfiguration {
@Bean
@ -49,8 +48,6 @@ public class GeoSpatialAppConfig extends AbstractMongoConfiguration { @@ -49,8 +48,6 @@ public class GeoSpatialAppConfig extends AbstractMongoConfiguration {
public LoggingEventListener&lt;MongoMappingEvent&gt; mappingEventsListener() {
return new LoggingEventListener&lt;MongoMappingEvent&gt;();
}
}</programlisting>
</example>
@ -219,7 +216,7 @@ public class Person { @@ -219,7 +216,7 @@ public class Person {
<para>Here is an example of a more complex mapping.</para>
<programlisting>@Document
<programlisting language="java">@Document
@CompoundIndexes({
@CompoundIndex(name = "age_idx", def = "{'lastName': 1, 'age': -1}")
})

21
src/docbkx/reference/mongo-repositories.xml

@ -111,7 +111,7 @@ @@ -111,7 +111,7 @@
<example>
<title>Paging access to Person entities</title>
<programlisting>@RunWith(SpringJUnit4ClassRunner.class)
<programlisting language="java">@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
public class PersonRepositoryTests {
@ -145,7 +145,7 @@ public class PersonRepositoryTests { @@ -145,7 +145,7 @@ public class PersonRepositoryTests {
<example>
<title>PersonRepository with query methods</title>
<programlisting>public interface PersonRepository extends MongoRepository&lt;Person, String&gt; {
<programlisting language="java">public interface PersonRepository extends MongoRepository&lt;Person, String&gt; {
List&lt;Person&gt; findByLastname(String lastname);
@ -266,7 +266,7 @@ public class PersonRepositoryTests { @@ -266,7 +266,7 @@ public class PersonRepositoryTests {
</table></para>
<section>
<title>Mongo JSON based query methods and field restriction </title>
<title>Mongo JSON based query methods and field restriction</title>
<para>By adding the annotation
<classname>org.springframework.data.document.mongodb.repository.Query</classname>
@ -274,7 +274,7 @@ public class PersonRepositoryTests { @@ -274,7 +274,7 @@ public class PersonRepositoryTests {
use instead of having the query derived from the method name. For
example</para>
<programlisting>public interface PersonRepository extends MongoRepository&lt;Person, String&gt;
<programlisting language="java">public interface PersonRepository extends MongoRepository&lt;Person, String&gt;
@Query("{ 'firstname' : ?0 }")
List&lt;Person&gt; findByThePersonsFirstname(String firstname);
@ -285,10 +285,9 @@ public class PersonRepositoryTests { @@ -285,10 +285,9 @@ public class PersonRepositoryTests {
arguments into the JSON query string.</para>
<para>You can also use the filter property to restrict the set of
properties that will be mapped into the Java object. For example,
</para>
properties that will be mapped into the Java object. For example,</para>
<programlisting>public interface PersonRepository extends MongoRepository&lt;Person, String&gt;
<programlisting language="java">public interface PersonRepository extends MongoRepository&lt;Person, String&gt;
@Query(value="{ 'firstname' : ?0 }", fields="firstname,lastname")
List&lt;Person&gt; findByThePersonsFirstname(String firstname);
@ -330,7 +329,7 @@ public class PersonRepositoryTests { @@ -330,7 +329,7 @@ public class PersonRepositoryTests {
</listitem>
<listitem>
<para>Incremental query definition is easier </para>
<para>Incremental query definition is easier</para>
</listitem>
</itemizedlist>
@ -344,7 +343,7 @@ public class PersonRepositoryTests { @@ -344,7 +343,7 @@ public class PersonRepositoryTests {
<para>Using QueryDSL you will be able to write queries as shown
below</para>
<programlisting>QPerson person = new QPerson("person");
<programlisting language="java">QPerson person = new QPerson("person");
List&lt;Person&gt; result = repository.findAll(person.address.zipCode.eq("C0123"));
Page&lt;Person&gt; page = repository.findAll(person.lastname.contains("a"),
@ -361,7 +360,7 @@ Page&lt;Person&gt; page = repository.findAll(person.lastname.contains("a"), @@ -361,7 +360,7 @@ Page&lt;Person&gt; page = repository.findAll(person.lastname.contains("a"),
<interfacename>QueryDslPredicateExecutor</interfacename> which is shown
below</para>
<programlisting>public interface QueryDslPredicateExecutor&lt;T&gt; {
<programlisting language="java">public interface QueryDslPredicateExecutor&lt;T&gt; {
T findOne(Predicate predicate);
@ -379,7 +378,7 @@ Page&lt;Person&gt; page = repository.findAll(person.lastname.contains("a"), @@ -379,7 +378,7 @@ Page&lt;Person&gt; page = repository.findAll(person.lastname.contains("a"),
it in additiion to other repository interfaces. This is shown
below</para>
<programlisting>public interface PersonRepository extends MongoRepository&lt;Person, String&gt;, QueryDslPredicateExecutor&lt;Person&gt; {
<programlisting lang="" language="java">public interface PersonRepository extends MongoRepository&lt;Person, String&gt;, QueryDslPredicateExecutor&lt;Person&gt; {
// additional finder methods go here

41
src/docbkx/reference/mongodb.xml

@ -117,7 +117,7 @@ @@ -117,7 +117,7 @@
configuration style. Also change the version of Spring in the pom.xml to
be</para>
<programlisting lang="xml">&lt;spring.framework.version&gt;3.0.5.RELEASE&lt;/spring.framework.version&gt;</programlisting>
<programlisting lang="" language="xml">&lt;spring.framework.version&gt;3.0.5.RELEASE&lt;/spring.framework.version&gt;</programlisting>
<para>You may also want to set the logging level to DEBUG to see some
additional information, edit the log4j.properties file and add</para>
@ -127,7 +127,7 @@ @@ -127,7 +127,7 @@
<para>Next, in the org.spring.mongodb package in the sr/ctest/java
directory create a class as shown below.</para>
<programlisting lang="java">package org.spring.mongodb;
<programlisting lang="" language="java">package org.spring.mongodb;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.document.mongodb.MongoTemplate;
@ -525,7 +525,7 @@ public class AppConfig { @@ -525,7 +525,7 @@ public class AppConfig {
<para>You can also configure a MongoTemplate using Spring's XML
&lt;beans/&gt; schema.</para>
<programlisting> &lt;mongo:mongo host="localhost" port="27017"/&gt;
<programlisting language="java"> &lt;mongo:mongo host="localhost" port="27017"/&gt;
&lt;bean id="mongoTemplate" class="org.springframework.data.document.mongodb.MongoTemplate"&gt;
&lt;constructor-arg ref="mongo"/&gt;
@ -595,7 +595,7 @@ public class AppConfig { @@ -595,7 +595,7 @@ public class AppConfig {
<para>Given a simple class such as Person</para>
<programlisting>public class Person {
<programlisting language="java">public class Person {
private String id;
private String firstName;
@ -790,7 +790,7 @@ import static org.springframework.data.document.mongodb.query.Criteria.query; @@ -790,7 +790,7 @@ import static org.springframework.data.document.mongodb.query.Criteria.query;
over the mapping of an object into a DBObject. The MongoWriter
interface is </para>
<programlisting>/**
<programlisting language="java">/**
* A MongoWriter is responsible for converting an object of type T to the native MongoDB representation DBObject.
*
* @param &lt;T&gt; the type of the object to convert to a DBObject
@ -873,8 +873,8 @@ import static org.springframework.data.document.mongodb.query.Update @@ -873,8 +873,8 @@ import static org.springframework.data.document.mongodb.query.Update
...
WriteResult wr = mongoTemplate.updateMulti(query(where("accounts.accountType").is(Account.Type.SAVINGS)),
update.inc("accounts.$.balance", 50.00));
WriteResult wr = mongoTemplate.updateMulti(query(where("accounts.accountType").is(Account.Type.SAVINGS)),
update.inc("accounts.$.balance", 50.00));
</programlisting>
</example>
@ -1456,7 +1456,7 @@ import static org.springframework.data.document.mongodb.query.Query.query; @@ -1456,7 +1456,7 @@ import static org.springframework.data.document.mongodb.query.Query.query;
the role of RowMapper in JdbcTemplate. The MongoReader interface
is</para>
<programlisting>/**
<programlisting language="java">/**
* A MongoWriter is responsible for converting a native MongoDB DBObject to an object of type T.
*
* @param &lt;T&gt; the type of the object to convert from a DBObject
@ -1535,30 +1535,30 @@ public class Venue { @@ -1535,30 +1535,30 @@ public class Venue {
<para>To find locations within a circle, the following query can be
used.</para>
<programlisting lang="java">Circle circle = new Circle(-73.99171, 40.738868, 0.01);
<programlisting lang="" language="java">Circle circle = new Circle(-73.99171, 40.738868, 0.01);
List&lt;Venue&gt; venues = template.find(new Query(Criteria.where("location").withinCenter(circle)), Venue.class);</programlisting>
<para>To find venues within a circle using Spherical coordinates the
following query can be used</para>
<programlisting lang="java">Circle circle = new Circle(-73.99171, 40.738868, 0.003712240453784);
<programlisting lang="" language="java">Circle circle = new Circle(-73.99171, 40.738868, 0.003712240453784);
List&lt;Venue&gt; venues = template.find(new Query(Criteria.where("location").withinCenterSphere(circle)), Venue.class);</programlisting>
<para>To find venues within a Box the following query can be used</para>
<programlisting>Box box = new Box(new Point(-73.99756, 40.73083), new Point(-73.988135, 40.741404)); //lower-left then upper-right
<programlisting language="java">Box box = new Box(new Point(-73.99756, 40.73083), new Point(-73.988135, 40.741404)); //lower-left then upper-right
List&lt;Venue&gt; venues = template.find(new Query(Criteria.where("location").withinBox(box)), Venue.class);</programlisting>
<para>To find venues near a Point, the following query can be
used</para>
<programlisting>Point point = new Point(-73.99171, 40.738868);
<programlisting language="java">Point point = new Point(-73.99171, 40.738868);
List&lt;Venue&gt; venues = template.find(new Query(Criteria.where("location").near(point).maxDistance(0.01)), Venue.class);</programlisting>
<para>To find venues near a Point using Spherical coordines the
following query can be used</para>
<programlisting>Point point = new Point(-73.99171, 40.738868);
<programlisting language="java">Point point = new Point(-73.99171, 40.738868);
List&lt;Venue&gt; venues = template.find(new Query(Criteria.where("location").nearSphere(point).maxDistance(0.003712240453784)), Venue.class);
</programlisting>
@ -1584,9 +1584,7 @@ List&lt;Venue&gt; venues = template.find(new Query(Criteria.where("location").ne @@ -1584,9 +1584,7 @@ List&lt;Venue&gt; venues = template.find(new Query(Criteria.where("location").ne
<example>
<title>Creating an index using the MongoTemplate</title>
<programlisting language="java">mongoTemplate.ensureIndex("MyCollection", new Index().on("name",
Order.ASCENDING));
</programlisting>
<programlisting language="java">mongoTemplate.ensureIndex("MyCollection", new Index().on("name",Order.ASCENDING)); </programlisting>
</example>
<para><itemizedlist>
@ -1611,7 +1609,7 @@ List&lt;Venue&gt; venues = template.find(new Query(Criteria.where("location").ne @@ -1611,7 +1609,7 @@ List&lt;Venue&gt; venues = template.find(new Query(Criteria.where("location").ne
the Venue class defined in a previous section, you would declare a
geospatial query as shown below</para>
<programlisting>mongoTemplate.ensureIndex(new GeospatialIndex("location"));</programlisting>
<programlisting language="java">mongoTemplate.ensureIndex(new GeospatialIndex("location"));</programlisting>
</section>
<section>
@ -1625,12 +1623,11 @@ List&lt;Venue&gt; venues = template.find(new Query(Criteria.where("location").ne @@ -1625,12 +1623,11 @@ List&lt;Venue&gt; venues = template.find(new Query(Criteria.where("location").ne
<title>Working with collections using the MongoTemplate</title>
<programlisting language="java">DBCollection collection = null;
if (!mongoTemplate.getCollectionNames().contains("MyNewCollection")) {
collection = mongoTemplate.createCollection("MyNewCollection");
}
if (!mongoTemplate.getCollectionNames().contains("MyNewCollection")) {
collection = mongoTemplate.createCollection("MyNewCollection");
}
mongoTemplate.dropCollection("MyNewCollection");
</programlisting>
mongoTemplate.dropCollection("MyNewCollection"); </programlisting>
</example>
<para><itemizedlist>

Loading…
Cancel
Save