// Path: src/main/java/nl/uva/larissa/json/IRIDeserializer.java
// public final class IRIDeserializer extends JsonDeserializer<IRI> {
// 	@Override
// 	public IRI deserialize(JsonParser jsonparser,
// 			DeserializationContext deserializationcontext)
// 			throws IOException, JsonProcessingException {
// 		String value = jsonparser.readValueAs(String.class);
// 		return new IRI(value);
// 	}
// }
// 
// Path: src/main/java/nl/uva/larissa/json/IRISerializer.java
// public final class IRISerializer extends JsonSerializer<IRI> {
// 	@Override
// 	public void serialize(IRI iri, JsonGenerator generator,
// 			SerializerProvider serializerProvider) throws IOException,
// 			JsonProcessingException {
// 		generator.writeString(iri.toString());
// 	}
// }
// 
// Path: src/main/java/nl/uva/larissa/json/ISO8601VerboseDateFormat.java
// public class ISO8601VerboseDateFormat extends ISO8601DateFormat {
// 
// 	/**
// 	 * 
// 	 */
// 	private static final long serialVersionUID = 1L;
// 
// 	@Override
// 	public StringBuffer format(Date date, StringBuffer stringbuffer,
// 			FieldPosition fieldposition) {
// 		String s = ISO8601Utils.format(date, true);
// 		stringbuffer.append(s);
// 		return stringbuffer;
// 	}
// }


import java.net.MalformedURLException;
import nl.uva.larissa.json.IRIDeserializer;
import nl.uva.larissa.json.IRISerializer;
import nl.uva.larissa.json.ISO8601VerboseDateFormat;
import org.apache.abdera.i18n.iri.IRI;
import org.ektorp.CouchDbConnector;
import org.ektorp.CouchDbInstance;
import org.ektorp.http.HttpClient;
import org.ektorp.http.StdHttpClient;
import org.ektorp.impl.StdCouchDbConnector;
import org.ektorp.impl.StdCouchDbInstance;
import org.ektorp.impl.StreamingJsonSerializer;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
package nl.uva.larissa;





public class CouchDbConnectorFactory {

	private static void applyMapperConfiguration(ObjectMapper mapper) {
		// working around broken NON_NULL stuff in Ektorp/Jackson
		// TODO report and/or check for update
		mapper.setSerializationInclusion(Include.NON_NULL);

		mapper.setDateFormat(new ISO8601VerboseDateFormat());

		SimpleModule module = new SimpleModule();
// Path: src/main/java/nl/uva/larissa/json/IRIDeserializer.java
// public final class IRIDeserializer extends JsonDeserializer<IRI> {
// 	@Override
// 	public IRI deserialize(JsonParser jsonparser,
// 			DeserializationContext deserializationcontext)
// 			throws IOException, JsonProcessingException {
// 		String value = jsonparser.readValueAs(String.class);
// 		return new IRI(value);
// 	}
// }
// 
// Path: src/main/java/nl/uva/larissa/json/IRISerializer.java
// public final class IRISerializer extends JsonSerializer<IRI> {
// 	@Override
// 	public void serialize(IRI iri, JsonGenerator generator,
// 			SerializerProvider serializerProvider) throws IOException,
// 			JsonProcessingException {
// 		generator.writeString(iri.toString());
// 	}
// }
// 
// Path: src/main/java/nl/uva/larissa/json/ISO8601VerboseDateFormat.java
// public class ISO8601VerboseDateFormat extends ISO8601DateFormat {
// 
// 	/**
// 	 * 
// 	 */
// 	private static final long serialVersionUID = 1L;
// 
// 	@Override
// 	public StringBuffer format(Date date, StringBuffer stringbuffer,
// 			FieldPosition fieldposition) {
// 		String s = ISO8601Utils.format(date, true);
// 		stringbuffer.append(s);
// 		return stringbuffer;
// 	}
// }


// Path: src/main/java/nl/uva/larissa/CouchDbConnectorFactory.java
import java.net.MalformedURLException;
import nl.uva.larissa.json.IRIDeserializer;
import nl.uva.larissa.json.IRISerializer;
import nl.uva.larissa.json.ISO8601VerboseDateFormat;
import org.apache.abdera.i18n.iri.IRI;
import org.ektorp.CouchDbConnector;
import org.ektorp.CouchDbInstance;
import org.ektorp.http.HttpClient;
import org.ektorp.http.StdHttpClient;
import org.ektorp.impl.StdCouchDbConnector;
import org.ektorp.impl.StdCouchDbInstance;
import org.ektorp.impl.StreamingJsonSerializer;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;

package nl.uva.larissa;





public class CouchDbConnectorFactory {

	private static void applyMapperConfiguration(ObjectMapper mapper) {
		// working around broken NON_NULL stuff in Ektorp/Jackson
		// TODO report and/or check for update
		mapper.setSerializationInclusion(Include.NON_NULL);

		mapper.setDateFormat(new ISO8601VerboseDateFormat());

		SimpleModule module = new SimpleModule();
		module.addSerializer(IRI.class, new IRISerializer());