Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

cleaned up dependencies

added dependencies list
added changelog
fixed a minor bug in view handling
  • Loading branch information...
commit c032e61ec240961e0a6c67910a6e4f9b636ab4dc 1 parent 9b4d4a3
@helun authored
View
3  .gitignore
@@ -16,4 +16,5 @@ local.properties
# CDT-specific
.cproject
-/org.ektorp.spring/target/
+/org.ektorp.spring/target/
+/target
View
158 changelog.md
@@ -0,0 +1,158 @@
+Changes in version 1.2.1
+========================
+1.2.1 is a minor bug fix release.
+
+Fixes
+-----
+* #18: nullpointer exception in ChangesCommand.Builder.merge
+
+Changes in version 1.2.0
+========================
+Besides bugfixes and increased stability, Ektorp 1.2.0 brings compatibility with CouchDB 1.1 and Jackson 1.8.
+New features are transparent caching of http responses from CouchDB through conditional GETs, a Spring XML configuration namespace and support for easily paging view results.
+
+Improvements
+------------
+* Transparent cache (requires no code changes besides configuring the cache).
+* Spring XML configuration namespace
+* Paging view results
+* Support for calling update handlers.
+* Support for stale=update_after query option in CouchDB 1.1.0
+* Added method ensureFullCommit() to CouchDbConnector
+* Added support for purging deleted docs.
+* Custom design document names for repositories
+* Map and reduce functions can now be loaded from separate source files in the classpath. (Write functions in pure javascript files).
+* New efficient checkIfDbExists() method in CouchDbInstance
+
+Fixes
+-----
+* GC#98: Blocking queue in ContinuousChangesFeed is not blocking and cause out of memory on huge changes
+* GC#103: Exception during bulk operation
+* GC#105: Viewresult creates inital array with the size of the whole view
+* GC#108: sourceLastSequence not integer when replicating from cloudant
+* GC#113: ChangesCommand does not manage "limit" parameter
+* GC#115 'Unrecognized field "digest"' when fetching docs w/ attachments in couchdb 1.1
+* GC#116: URI.toString() changes path value
+* GC#117: Map definition in external view file should be allowed to contain newlines (mac/unix/windows)
+* GC#118: Ektorp 1.1.1 does not work with Jackson 1.8.3
+
+Contributors
+------------
+Benoit Decherf
+Henrik Lundgren
+Ragnar Rova
+Sverre Kristian Valskrå
++ all defect reporters
+
+Changes in version 1.1.1
+========================
+1.1.1 is just a minor bug fix release.
+
+Fixes
+-----
+* #94: Ektorp 1.1.0 not working on Android with SSL & other SSL problem
+* #96: org.ektorp.spring.HttpClientFactoryBean? doesn't support SSL-related properties
+* #97: Ektorp gets Logger with runtime class as an argument.
+
+Changes in version 1.1.0
+========================
+Improvements
+------------
+* New ability to model a collection as external documents with transparent lazy loading
+* Added support for the changes API in CouchDB
+* Support for accessing design doc info
+* Added the ability to specify query parameters for list functions
+* SSL/TLS connections
+* Support for loading documents with conflict info attached
+* Better view generation through the new @TypeDiscriminator? annotation
+* Support for auto generation of the 'all' view
+
+Fixes
+-----
+* #72: Cannot write complex view in external view.json file
+* #76: Option to disable connection test at bean creation tim
+* #79: Timeout when iterating through multiple DBs
+* #81: HTTP request not always retried when idle HTTP connection is closed by server
+* #84: Socket timeout doesn't work
+* #86: Server error response masked by NullPointerException?
+* #89: ComplexKey? ObjectMapper? config differs from StdCouchDbConnector?
+* #90: Generated views return documents out of scope of the 'all' view.
+* #92: revision id in UpdateConflictException? of SdtCouchDbConnector?.update
+
+Breaking Changes
+----------------
+* A constructor in org.ektorp.impl.StdCouchDbConnector? has changed signature.
+* A constructor in org.ektorp.impl.StdCouchDbInstance? has changed signature.
+
+Contributors
+------------
+Henrik Lundgren
+Ragnar Rova (external document references)
+Pasi Eronen (http connection debugging)
+All defect reporters
+
+Changes in version 1.0.2
+========================
+Improvements
+------------
+* Added support for replication.
+* Removed the requirement for mapped Pojos to be annotated with @JsonSerialize?(include = Inclusion.NON_NULL)
+* Support for filter, lists and show functions through new annotations.
+* Accessor added for doc field in ViewResult?
+* Accessor added for total number of rows in ViewResult?
+* Added support for open content types through new class org.ektorp.support.OpenCouchDbDocument?
+* Added support for setting revision limit for a database
+
+Fixes
+-----
+* #54: StdCouchDbConnector?.create() doesn't work for ObjectNodes?
+* #59: StdHttpClient? attempts un-authenticated request every time despite of credentials being provided
+* #60: Non-existing document IDs break ViewQuery?.keys()
+* #69: local_id is not marked as ignorable in ResponseStatus? class exception.
+
+Changes in version 1.0.1
+========================
+* Fixed defect #50: View result cannot be loaded from all_docs views
+* Fixed defect #53: The 'language' field is missing from design documents created using CouchDbRepositorySupport?
+* Fixed defect #55: org.ektorp.util.DocumentAccessor? is not public
+* DesignDocument? is now properly serialized when SerializationConfig?.Feature.AUTO_DETECT_GETTERS is disabled
+
+Changes in version 1.0.0
+========================
+* Support for bulk operations
+* Support for complex keys
+* Support for multiple keys
+* Support for compacting operations
+* View definitions can be loaded from classpath
+* Support for multiple @View annotations on Types
+* Property access for id and rev fields in persitent classes.
+* Performance improvements when loading result from view queries
+* Support for accessing list functions
+* Upgraded to Jackson 1.6.0
+* Source is now JDK 5 compatible
+* Fixed defect #49: Connection leak when requesting non existing resources through getAsStream or getAttachment
+* Fixed defect #48: Using allDocs() in ViewQuery? can cause IllegalStateException?
+* Fixed defect #38: delete(Object o) at StdCouchDbConnector? produces DocumentNotFound?
+* Fixed defect #28: Better error reporting during attachments creation
+
+Changes in version 0.9.4
+========================
+* New @View annotation for embedding view definitions in repository classes.
+* New @GenerateView? annotation for automatically generate view definitions for finder methods in repository classes.
+* New Spring support module, with factory bean for HttpClient?, Retry advice and an InitialDataLoader?.
+* Document ids are now URL-encoded when needed.
+* Map can now be used as a document class
+* Fixed defect #10: serialization format for java.util.Date and org.joda.time.DateTime?
+* CouchDbConnector? and CouchDbInstance? can now be configured with an external Jackson ObjectMapper?
+
+Changes in version 0.9.2
+========================
+* persistent classes no longer have to extend CouchDbDocument?
+* upgraded to Http Components Client 4.0.1
+* upgraded to jackson 1.5.1
+* ViewQuery? now URL-encodes key, startKey and endKey parameters
+* added support for basic authentication
+* moved support classes to separate org.ektorp.support
+* operations in CouchDb? that return revision now returns it in Ektorp aswell
+* added getters for key, startKey and endKey equals and hashCode overrides all changes made to simply unit testing queries
+* getAll use getAllDocIds now filters design docs if no "all" view is defined
View
30 dependencies.md
@@ -0,0 +1,30 @@
+Runtime Dependencies for Ektorp 1.2.1
+-------------------------------------
+* org.codehaus.jackson
+ jackson-core-asl 1.8.4
+ jackson-mapper-asl 1.8.4
+* org.apache.httpcomponents
+* httpclient 4.1.1
+ httpcore 4.1
+ commons-codec 1.4
+* httpclient-cache 4.1.1
+* commons-io 2.0.1
+* org.slf4j
+* slf4j-api 1.6.1
+
+Runtime Dependencies for Ektorp Spring 1.2.1
+--------------------------------------------
+* org.ektorp 1.2.1
+* org.springframework 3.0.5
+ spring-context
+ spring-aop
+ aopalliance 1.0
+ spring-beans
+ spring-core
+ spring-expression
+ spring-asm
+* org.aspectj
+* aspectjweaver 1.6.9
+* commons-beanutils 1.8.3
+ commons-logging 1.1.1
+
View
115 doc/src/docbkx/reference_doc.xml
@@ -9,7 +9,7 @@
<info>
<title>Ektorp Reference Documentation</title>
- <releaseinfo>Version: 1.2.0</releaseinfo>
+ <releaseinfo>Version: 1.2.1</releaseinfo>
<author>
<personname><firstname>Henrik</firstname><surname>Lundgren</surname></personname>
@@ -92,7 +92,7 @@
<programlisting language="xml">&lt;dependency&gt;
&lt;groupId&gt;org.ektorp&lt;/groupId&gt;
&lt;artifactId&gt;org.ektorp&lt;/artifactId&gt;
- &lt;version&gt;1.2.0&lt;/version&gt;
+ &lt;version&gt;1.2.1&lt;/version&gt;
&lt;/dependency&gt;</programlisting>
<para>Spring support module:</para>
@@ -100,7 +100,7 @@
<programlisting language="xml">&lt;dependency&gt;
&lt;groupId&gt;org.ektorp&lt;/groupId&gt;
&lt;artifactId&gt;org.ektorp.spring&lt;/artifactId&gt;
- &lt;version&gt;1.2.0&lt;/version&gt;
+ &lt;version&gt;1.2.1&lt;/version&gt;
&lt;/dependency&gt;</programlisting>
</section>
@@ -112,14 +112,14 @@
<programlisting language="xml">&lt;dependency&gt;
&lt;groupId&gt;org.ektorp&lt;/groupId&gt;
&lt;artifactId&gt;org.ektorp&lt;/artifactId&gt;
- &lt;version&gt;1.2.1-SNAPSHOT&lt;/version&gt;
+ &lt;version&gt;1.2.2-SNAPSHOT&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.ektorp&lt;/groupId&gt;
&lt;artifactId&gt;org.ektorp.spring&lt;/artifactId&gt;
- &lt;version&gt;1.2.1-SNAPSHOT&lt;/version&gt;
+ &lt;version&gt;1.2.2-SNAPSHOT&lt;/version&gt;
&lt;/dependency&gt;</programlisting>
<para>You can find the snapshots at
@@ -144,7 +144,7 @@
<title>Download</title>
<para>Ektorp can be downloaded from <link
- xlink:href="http://code.google.com/p/ektorp/downloads/list">http://code.google.com/p/ektorp/downloads/list</link></para>
+ xlink:href="http://code.google.com/p/ektorp/downloads/list">https://github.com/helun/Ektorp/downloads</link></para>
</section>
<section>
@@ -290,11 +290,11 @@
<entry>true</entry>
</row>
- <row>
- <entry>cleanupIdleConnections</entry>
+ <row>
+ <entry>cleanupIdleConnections</entry>
- <entry>true</entry>
- </row>
+ <entry>true</entry>
+ </row>
</tbody>
</tgroup>
</table>
@@ -983,8 +983,6 @@ import org.codehaus.jackson.node.*;
<para>Basic CRUD (Create, Read, Update and Delete) operations are
straightforward in Ektorp.</para>
- <para></para>
-
<para>The easiest way to create a repository is to extend the class
CouchDbRepositorySupport. The class provides all CRUD methods out of the
box and has support methods for writing terse finder methods.</para>
@@ -1030,6 +1028,57 @@ Sofa sofa = db.get(Sofa.class, id, rev);</programlisting>
InputStream doc = db.getAsStream(id);
InputStream olderRev = db.getAsStream(id, rev);</programlisting>
+
+ <section>
+ <title>Special Cases</title>
+
+ <para>All get methods in CouchDbConnector has a variant that takes a
+ <emphasis>org.ektorp.Options</emphasis> argument. Options is used for
+ special cases when you need to load a document with a specific
+ revision, conflict markers etc.</para>
+
+ <section>
+ <title>Read a Specific Revision</title>
+
+ <para><parameter>Retrieve a specific revision of the
+ document.</parameter><programlisting language="java">String id = ...
+String rev = ...
+Options options = new Options().revision(rev);
+Sofa sofa = db.get(Sofa.class, id, options);</programlisting></para>
+ </section>
+
+ <section>
+ <title>Include Conflicts</title>
+
+ <para>The loaded doc will include the special field '_conflicts'
+ that contains all the conflicting revisions of the document.</para>
+
+ <programlisting language="java">String id = ...
+Options options = new Options().includeConflicts();
+Sofa sofa = db.get(Sofa.class, id, options);</programlisting>
+
+ <para></para>
+ </section>
+
+ <section>
+ <title>Include All Revisions</title>
+
+ <para>The loaded doc will include the special field '_revisions'
+ that describes all document revisions that exists in the
+ database.<programlisting language="java">String id = ...
+Options options = new Options().includeRevisions();
+Sofa sofa = db.get(Sofa.class, id, options);</programlisting></para>
+ </section>
+
+ <section>
+ <title>Add Arbitrary Parameters to the Request</title>
+
+ <para><parameter>It is possible to add arbitrary parameters to the
+ database request.</parameter><programlisting language="java">String id = ...
+Options options = new Options().param("paramName","paramValue");
+Sofa sofa = db.get(Sofa.class, id, options);</programlisting></para>
+ </section>
+ </section>
</section>
<section>
@@ -1067,6 +1116,19 @@ db.delete(id, revision):</programlisting>
<programlisting language="java">Sofa sofa = ...
db.delete(sofa)</programlisting>
+
+ <section>
+ <title>Purge Deleted Documents</title>
+
+ <para>Since the database retains references to deleted documents you
+ may need to permanently remove those references. This can be achieved
+ through a purge operation:<programlisting>// the map contains revisions by doc id to purge
+Map&lt;String,List&lt;String&gt;&gt; revisionsToPurge = ...
+PurgeResult result = db.purge(revisionsToPurge);
+</programlisting><parameter>Note that purging docs from the database is not
+ part of a normal use case and should only be considered if you need to
+ free up disk space.</parameter></para>
+ </section>
</section>
<section>
@@ -1293,22 +1355,21 @@ public class MyRepository {
<title>Loading the View Definition From the classpath</title>
<para>Non-trivial views are best stored in a separate files. By
- specifying the file parameter a view definition can be loaded from the
- classpath. The path is relative to the class annotated by this
- annotation. If the file complicated_view.json is in the same directory
- as the repository this parameter should be set to
- <emphasis>"complicated_view.json"</emphasis>. The file must be a valid
- json document:</para>
-
- <programlisting language="javascript">{
- "map": "function(doc) { much javascript here }",
- // the reduce function is optional
- "reduce": "function(keys, values) { ... }"
+ specifying the "classpath:" prefix in the map or reduce parameters,
+ followed by the path to a file in the classpath, the functions can be
+ loaded from the classpath. The path is relative to the class annotated
+ by this annotation. If the file myMapFunction.js is in the same
+ directory as the repository this parameter should be set to
+ <emphasis>"myMapFunction.js"</emphasis>:</para>
+
+ <programlisting language="javascript">function(doc)
+{
+ much javascript here
}</programlisting>
<para>The repository class:</para>
- <programlisting language="java">@View( name = "complicated_view", file = "complicated_view.json")
+ <programlisting language="java">@View( name = "complicated_view", map = "classpath:myMapFunction.js")
public int getAverageSofaSize() {
ViewResult r = db.queryView(createQuery("complicated_view.json"));
return r.getRows().get(0).getValueAsInt();
@@ -1663,8 +1724,8 @@ PageRequest prevPageRequest = nextPage.getPreviousPageRequest();</programlisting
string.</para>
<para>Given that the Page object is available in the model in the jsp
- page below, a link to the previous page can be constructed like this:
- </para>
+ page below, a link to the previous page can be constructed like
+ this:</para>
<programlisting language="html">&lt;c:if test="${page.hasPrevious}"&gt;
&lt;a href="/blog/posts/?p=${page.previousLink}"&gt;Previous page&lt;/a&gt;
@@ -1672,7 +1733,7 @@ PageRequest prevPageRequest = nextPage.getPreviousPageRequest();</programlisting
<para>When the request is handled in a controller the page request can
be recreated from the request parameter. Here is an example snippet
- from a controller created in Spring MVC </para>
+ from a controller created in Spring MVC</para>
<programlisting language="java">@RequestMapping( value = "/posts/", method = RequestMethod.GET)
public String viewAll(Model m, @RequestParam(value = "p", required = false) String pageLink) {
View
10 org.ektorp.spring/pom.xml
@@ -20,16 +20,6 @@
</dependency>
<dependency>
<groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-beans</artifactId>
- <version>${spring.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
View
2  org.ektorp/src/main/java/org/ektorp/support/SimpleViewGenerator.java
@@ -248,7 +248,7 @@ public boolean shouldLoadFunctionFromClassPath(String function) {
if (shouldLoadFunctionFromClassPath(reducePath)) {
reduce = loadResourceFromClasspath(repositoryClass, reducePath.substring(10));
} else {
- reduce = mapPath;
+ reduce = reducePath.length() > 0 ? reducePath : null;
}
return new DesignDocument.View(map, reduce);
}
View
14 org.ektorp/src/test/java/org/ektorp/support/SimpleViewGeneratorTest.java
@@ -37,7 +37,6 @@ public void testGenerateFindByView() {
@Test
public void views_should_be_generated_for_all_annotations() {
Map<String, DesignDocument.View> result = gen.generateViews(new TestRepo());
- assertEquals(11, result.size());
assertTrue(result.containsKey("view_1"));
assertTrue(result.containsKey("view_2"));
assertTrue(result.containsKey("view_3"));
@@ -53,12 +52,18 @@ public void views_should_be_generated_for_all_annotations() {
DesignDocument.View all = result.get("all");
assertEquals(ALL_VIEW_FUNCTION, all.getMap());
assertTrue(result.containsKey("by_special"));
+ assertNull("reduce function should not be defined", result.get("by_special").getReduce());
+
assertTrue(result.containsKey("by_special2"));
assertFalse("map function should be loaded from file in classpath", result.get("by_special2").getMap().startsWith("classpath:"));
- assertFalse("reduce function should be loaded from file in classpath", result.get("by_special2").getReduce().startsWith("classpath:"));
+ assertTrue("reduce function should be loaded from file in classpath", result.get("by_special2").getReduce().indexOf("keys") > -1);
assertTrue(result.containsKey("by_complicated"));
assertEquals(expectedComplicatedMapFunction, result.get("by_complicated").getMap());
assertEquals(expectedComplicatedReduceFunction, result.get("by_complicated").getReduce());
+
+ assertTrue(result.containsKey("by_special3"));
+ assertFalse("map function should be loaded from file in classpath", result.get("by_special3").getMap().startsWith("classpath:"));
+ assertNull("reduce function should not be defined", result.get("by_special3").getReduce());
}
@Test
@@ -199,6 +204,11 @@ public String findByComplicatedView(String input) {
return null;
}
+ @View(name = "by_special3", map = "classpath:map.js")
+ public List<String> findBySpecialView3() {
+ return null;
+ }
+
public List<String> findBySomethingElse() {
return null;
}
Please sign in to comment.
Something went wrong with that request. Please try again.