You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by er...@apache.org on 2013/04/26 15:01:47 UTC

svn commit: r1476176 - in /james/mailbox/trunk: ./ caching/ caching/src/ caching/src/main/ caching/src/main/java/ caching/src/main/java/org/ caching/src/main/java/org/apache/ caching/src/main/java/org/apache/mailbox/ caching/src/main/java/org/apache/ma...

Author: eric
Date: Fri Apr 26 13:01:43 2013
New Revision: 1476176

URL: http://svn.apache.org/r1476176
Log:
Basic work for a cache for Mailbox/Message Mappers, patch from Andrzej, updated by Eric (IMAP-373)

Added:
    james/mailbox/trunk/caching/
    james/mailbox/trunk/caching/pom.xml
    james/mailbox/trunk/caching/src/
    james/mailbox/trunk/caching/src/main/
    james/mailbox/trunk/caching/src/main/java/
    james/mailbox/trunk/caching/src/main/java/org/
    james/mailbox/trunk/caching/src/main/java/org/apache/
    james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/
    james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/
    james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/CacheInvalidatingMailboxListener.java
    james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/CacheLoaderFromUnderlying.java
    james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/CachingMailboxMapper.java
    james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/CachingMailboxSessionMapperFactory.java
    james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/CachingMessageMapper.java
    james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/MailboxByPathCache.java
    james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/MailboxMetadataCache.java
    james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/guava/
    james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/guava/AbstractGuavaCache.java
    james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/guava/GuavaCacheWrapper.java
    james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/guava/GuavaMailboxByPathCache.java
    james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache.java
    james/mailbox/trunk/caching/target/
    james/mailbox/trunk/caching/target/classes/
    james/mailbox/trunk/caching/target/classes/META-INF/
    james/mailbox/trunk/caching/target/classes/META-INF/MANIFEST.MF
    james/mailbox/trunk/caching/target/classes/META-INF/maven/
    james/mailbox/trunk/caching/target/classes/META-INF/maven/org.apache.james/
    james/mailbox/trunk/caching/target/classes/META-INF/maven/org.apache.james/apache-james-mailbox-caching/
    james/mailbox/trunk/caching/target/classes/META-INF/maven/org.apache.james/apache-james-mailbox-caching/pom.properties
    james/mailbox/trunk/caching/target/classes/META-INF/maven/org.apache.james/apache-james-mailbox-caching/pom.xml
    james/mailbox/trunk/caching/target/classes/org/
    james/mailbox/trunk/caching/target/classes/org/apache/
    james/mailbox/trunk/caching/target/classes/org/apache/mailbox/
    james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/
    james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/CacheInvalidatingMailboxListener.class   (with props)
    james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/CacheLoaderFromUnderlying.class   (with props)
    james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/CachingMailboxMapper.class   (with props)
    james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/CachingMailboxSessionMapperFactory.class   (with props)
    james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/CachingMessageMapper.class   (with props)
    james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/MailboxByPathCache.class   (with props)
    james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/MailboxMetadataCache.class   (with props)
    james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/
    james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/AbstractGuavaCache.class   (with props)
    james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaCacheWrapper.class   (with props)
    james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxByPathCache$MailboxByPathCacheWrapper.class   (with props)
    james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxByPathCache.class   (with props)
    james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache$CountMessagesInMailboxWrapper.class   (with props)
    james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache$CountUnseenMessagesInMailboxWrapper.class   (with props)
    james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache$FindFirstUnseenMessageUidWrapper.class   (with props)
    james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache$HighestModseqCacheWrapper.class   (with props)
    james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache$LastUidCacheWrapper.class   (with props)
    james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache$MetadataCacheWrapper.class   (with props)
    james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache.class   (with props)
    james/mailbox/trunk/caching/target/test-classes/
Modified:
    james/mailbox/trunk/hbase/src/main/java/org/apache/james/mailbox/hbase/HBaseMailboxSessionMapperFactory.java
    james/mailbox/trunk/maildir/src/main/java/org/apache/james/mailbox/maildir/MaildirMailboxSessionMapperFactory.java
    james/mailbox/trunk/pom.xml
    james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/MailboxSessionMapperFactory.java

Added: james/mailbox/trunk/caching/pom.xml
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/pom.xml?rev=1476176&view=auto
==============================================================================
--- james/mailbox/trunk/caching/pom.xml (added)
+++ james/mailbox/trunk/caching/pom.xml Fri Apr 26 13:01:43 2013
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements. See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership. The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License. You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied. See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <artifactId>apache-james-mailbox</artifactId>
+        <groupId>org.apache.james</groupId>
+        <version>0.6-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>apache-james-mailbox-caching</artifactId>
+    <name>Apache James :: Mailbox :: Caching</name>
+    <packaging>bundle</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.james</groupId>
+            <artifactId>apache-james-mailbox-store</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jmock</groupId>
+            <artifactId>jmock</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jmock</groupId>
+            <artifactId>jmock-junit4</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>

Added: james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/CacheInvalidatingMailboxListener.java
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/CacheInvalidatingMailboxListener.java?rev=1476176&view=auto
==============================================================================
--- james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/CacheInvalidatingMailboxListener.java (added)
+++ james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/CacheInvalidatingMailboxListener.java Fri Apr 26 13:01:43 2013
@@ -0,0 +1,47 @@
+package org.apache.mailbox.caching;
+
+import org.apache.james.mailbox.MailboxListener;
+import org.apache.james.mailbox.MailboxListenerSupport;
+import org.apache.james.mailbox.exception.MailboxException;
+
+public class CacheInvalidatingMailboxListener<Id> implements MailboxListener {
+
+	private MailboxByPathCache<Id> mailboxCacheByPath;
+	private MailboxMetadataCache<Id> mailboxMetadataCache;
+
+	public CacheInvalidatingMailboxListener(MailboxByPathCache<Id> mailboxCacheByPath, MailboxMetadataCache<Id> mailboxMetadataCache) {
+		this.mailboxCacheByPath = mailboxCacheByPath;
+		this.mailboxMetadataCache = mailboxMetadataCache;
+	}
+	
+	public void register(MailboxListenerSupport listener) throws MailboxException {
+		listener.addGlobalListener(this, null);
+	}
+	
+	@Override
+	public void event(Event event) {
+		// TODO this needs for sure to be smarter
+		try {
+			if (event instanceof MessageEvent) {
+				// invalidate the metadata caches
+					invalidateMetadata(event);
+			}
+			invalidateMailbox(event);
+		} catch (MailboxException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+
+	}
+
+	private void invalidateMetadata(Event event) throws MailboxException {
+		//HMM, race conditions welcome?
+		mailboxMetadataCache.invalidate(mailboxCacheByPath.findMailboxByPath(event.getMailboxPath(), null));
+		
+	}
+
+	private void invalidateMailbox(Event event) {
+		mailboxCacheByPath.invalidate(event.getMailboxPath());		
+	}
+
+}

Added: james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/CacheLoaderFromUnderlying.java
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/CacheLoaderFromUnderlying.java?rev=1476176&view=auto
==============================================================================
--- james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/CacheLoaderFromUnderlying.java (added)
+++ james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/CacheLoaderFromUnderlying.java Fri Apr 26 13:01:43 2013
@@ -0,0 +1,5 @@
+package org.apache.mailbox.caching;
+
+public interface CacheLoaderFromUnderlying<Key, Value, Underlying, Except extends Throwable> {
+	Value load(Key key, Underlying underlying) throws Except;
+}

Added: james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/CachingMailboxMapper.java
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/CachingMailboxMapper.java?rev=1476176&view=auto
==============================================================================
--- james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/CachingMailboxMapper.java (added)
+++ james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/CachingMailboxMapper.java Fri Apr 26 13:01:43 2013
@@ -0,0 +1,79 @@
+package org.apache.mailbox.caching;
+import java.util.List;
+
+import org.apache.james.mailbox.exception.MailboxException;
+import org.apache.james.mailbox.exception.MailboxNotFoundException;
+import org.apache.james.mailbox.model.MailboxPath;
+import org.apache.james.mailbox.store.mail.MailboxMapper;
+import org.apache.james.mailbox.store.mail.model.Mailbox;
+
+
+public class CachingMailboxMapper<Id> implements MailboxMapper<Id> {
+
+	private MailboxMapper<Id> underlying;
+	private MailboxByPathCache<Id> cache;
+
+	public CachingMailboxMapper(MailboxMapper<Id> underlying, MailboxByPathCache<Id> cache) {
+		this.underlying = underlying;
+		this.cache = cache;
+	}
+	
+	@Override
+	public void endRequest() {
+		underlying.endRequest();		
+	}
+
+	@Override
+	public <T> T execute(Transaction<T> transaction) throws MailboxException {
+		return underlying.execute(transaction);
+	}
+
+	@Override
+	public void save(Mailbox<Id> mailbox) throws MailboxException {
+		invalidate(mailbox);
+		underlying.save(mailbox);
+	}
+
+	@Override
+	public void delete(Mailbox<Id> mailbox) throws MailboxException {
+		cache.invalidate(mailbox);
+		underlying.delete(mailbox);
+	}
+
+	@Override
+	public Mailbox<Id> findMailboxByPath(MailboxPath mailboxName)
+			throws MailboxException, MailboxNotFoundException {
+		try {
+			return cache.findMailboxByPath(mailboxName, underlying);
+		} catch (MailboxNotFoundException e) {
+			cache.invalidate(mailboxName);
+			throw e;
+		}
+	}
+
+	@Override
+	public List<Mailbox<Id>> findMailboxWithPathLike(MailboxPath mailboxPath)
+			throws MailboxException {
+		// TODO possible to meaningfully cache it?
+		return underlying.findMailboxWithPathLike(mailboxPath);
+	}
+
+	@Override
+	public boolean hasChildren(Mailbox<Id> mailbox, char delimiter)
+			throws MailboxException, MailboxNotFoundException {
+		// TODO possible to meaningfully cache it?
+		return hasChildren(mailbox, delimiter);
+	}
+
+	@Override
+	public List<Mailbox<Id>> list() throws MailboxException {
+		// TODO possible to meaningfully cache it? is it used at all?
+		return underlying.list();
+	}
+
+	private void invalidate(Mailbox<Id> mailbox) {
+		cache.invalidate(mailbox);
+	}
+
+
+}

Added: james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/CachingMailboxSessionMapperFactory.java
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/CachingMailboxSessionMapperFactory.java?rev=1476176&view=auto
==============================================================================
--- james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/CachingMailboxSessionMapperFactory.java (added)
+++ james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/CachingMailboxSessionMapperFactory.java Fri Apr 26 13:01:43 2013
@@ -0,0 +1,43 @@
+package org.apache.mailbox.caching;
+
+import org.apache.james.mailbox.MailboxSession;
+import org.apache.james.mailbox.exception.MailboxException;
+import org.apache.james.mailbox.exception.SubscriptionException;
+import org.apache.james.mailbox.store.MailboxSessionMapperFactory;
+import org.apache.james.mailbox.store.mail.MailboxMapper;
+import org.apache.james.mailbox.store.mail.MessageMapper;
+import org.apache.james.mailbox.store.user.SubscriptionMapper;
+
+public class CachingMailboxSessionMapperFactory<Id> extends
+		MailboxSessionMapperFactory<Id> {
+
+	private MailboxSessionMapperFactory<Id> underlying;
+	private MailboxByPathCache<Id> mailboxByPathCache;
+	private MailboxMetadataCache<Id> mailboxMetadataCache;
+
+	public CachingMailboxSessionMapperFactory(MailboxSessionMapperFactory<Id> underlying, MailboxByPathCache<Id> mailboxByPathCache, MailboxMetadataCache<Id> mailboxMetadataCache) {
+		this.underlying = underlying;
+		this.mailboxByPathCache = mailboxByPathCache;
+		this.mailboxMetadataCache = mailboxMetadataCache;
+	}
+	
+	@Override
+	public MessageMapper<Id> createMessageMapper(MailboxSession session)
+			throws MailboxException {
+		return new CachingMessageMapper<Id>(underlying.createMessageMapper(session), mailboxByPathCache);
+	}
+
+	@Override
+	public MailboxMapper<Id> createMailboxMapper(MailboxSession session)
+			throws MailboxException {
+	    //TODO(eric) this cast will not work!!! Temporary adding it to compile the project...
+		return (MailboxMapper<Id>) new CachingMessageMapper<Id>(underlying.createMailboxMapper(session), mailboxMetadataCache);
+	}
+
+	@Override
+	public SubscriptionMapper createSubscriptionMapper(MailboxSession session)
+			throws SubscriptionException {
+		return underlying.createSubscriptionMapper(session);
+	}
+
+}

Added: james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/CachingMessageMapper.java
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/CachingMessageMapper.java?rev=1476176&view=auto
==============================================================================
--- james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/CachingMessageMapper.java (added)
+++ james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/CachingMessageMapper.java Fri Apr 26 13:01:43 2013
@@ -0,0 +1,138 @@
+package org.apache.mailbox.caching;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.mail.Flags;
+
+import org.apache.james.mailbox.exception.MailboxException;
+import org.apache.james.mailbox.model.MessageMetaData;
+import org.apache.james.mailbox.model.MessageRange;
+import org.apache.james.mailbox.model.UpdatedFlags;
+import org.apache.james.mailbox.store.mail.MailboxMapper;
+import org.apache.james.mailbox.store.mail.MessageMapper;
+import org.apache.james.mailbox.store.mail.model.Mailbox;
+import org.apache.james.mailbox.store.mail.model.Message;
+
+public class CachingMessageMapper<Id> implements MessageMapper<Id> {
+	
+	private MessageMapper<Id> underlying;
+	private MailboxMetadataCache<Id> cache;
+
+	public CachingMessageMapper(MessageMapper<Id> underlying, MailboxMetadataCache<Id> cache) {
+		this.underlying = underlying;
+		this.cache = cache;
+	}
+	
+    public CachingMessageMapper(MessageMapper<Id> createMessageMapper, MailboxByPathCache<Id> mailboxByPathCache) {
+        // TODO(eric) Auto-generated constructor stub
+    }
+
+    public CachingMessageMapper(MailboxMapper<Id> mailboxMapper, MailboxMetadataCache<Id> mailboxMetadataCache) {
+        // TODO(eric) Auto-generated constructor stub
+    }
+
+    @Override
+	public void endRequest() {
+		underlying.endRequest();
+	}
+
+	@Override
+	public <T> T execute(Transaction<T> transaction) throws MailboxException {
+		return underlying.execute(transaction);
+	}
+
+	@Override
+	public Iterator<Message<Id>> findInMailbox(Mailbox<Id> mailbox,
+			MessageRange set,
+			org.apache.james.mailbox.store.mail.MessageMapper.FetchType type,
+			int limit) throws MailboxException {
+		return underlying.findInMailbox(mailbox, set, type, limit);
+	}
+
+	@Override
+	public Map<Long, MessageMetaData> expungeMarkedForDeletionInMailbox(
+			Mailbox<Id> mailbox, MessageRange set) throws MailboxException {
+		invalidateMetadata(mailbox);
+		return underlying.expungeMarkedForDeletionInMailbox(mailbox, set);
+	}
+
+	@Override
+	public long countMessagesInMailbox(Mailbox<Id> mailbox)
+			throws MailboxException {
+		return cache.countMessagesInMailbox(mailbox, underlying);
+	}
+
+	@Override
+	public long countUnseenMessagesInMailbox(Mailbox<Id> mailbox)
+			throws MailboxException {
+		return cache.countUnseenMessagesInMailbox(mailbox, underlying);
+	}
+
+	@Override
+	public void delete(Mailbox<Id> mailbox, Message<Id> message)
+			throws MailboxException {
+		invalidateMetadata(mailbox);
+		underlying.delete(mailbox, message);
+		
+	}
+
+	@Override
+	public Long findFirstUnseenMessageUid(Mailbox<Id> mailbox)
+			throws MailboxException {
+		return cache.findFirstUnseenMessageUid(mailbox, underlying);
+	}
+
+	@Override
+	public List<Long> findRecentMessageUidsInMailbox(Mailbox<Id> mailbox)
+			throws MailboxException {
+		// TODO can be meaningfully cached?
+		return underlying.findRecentMessageUidsInMailbox(mailbox);
+	}
+
+	@Override
+	public MessageMetaData add(Mailbox<Id> mailbox, Message<Id> message)
+			throws MailboxException {
+		invalidateMetadata(mailbox);
+		return underlying.add(mailbox, message);
+	}
+
+	@Override
+	public Iterator<UpdatedFlags> updateFlags(Mailbox<Id> mailbox, Flags flags,
+			boolean value, boolean replace, MessageRange set)
+			throws MailboxException {
+		//check if there are in fact any updates
+		if (set.iterator().hasNext())
+			invalidateMetadata(mailbox);
+		return underlying.updateFlags(mailbox, flags, value, replace, set);
+	}
+
+
+	@Override
+	public MessageMetaData copy(Mailbox<Id> mailbox, Message<Id> original)
+			throws MailboxException {
+		invalidateMetadata(mailbox);
+		return underlying.copy(mailbox, original);
+	}
+
+	@Override
+	public long getLastUid(Mailbox<Id> mailbox) throws MailboxException {
+		return cache.getLastUid(mailbox, underlying);
+	}
+
+	@Override
+	public long getHighestModSeq(Mailbox<Id> mailbox) throws MailboxException {
+		return cache.getHighestModSeq(mailbox, underlying);
+	}
+
+	private void invalidateMetadata(Mailbox<Id> mailbox) {
+		cache.invalidate(mailbox);
+		
+	}
+
+    @Override
+    public MessageMetaData move(Mailbox<Id> mailbox, Message<Id> original) throws MailboxException {
+        throw new UnsupportedOperationException("Move is not yet supported");
+    }
+
+}

Added: james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/MailboxByPathCache.java
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/MailboxByPathCache.java?rev=1476176&view=auto
==============================================================================
--- james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/MailboxByPathCache.java (added)
+++ james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/MailboxByPathCache.java Fri Apr 26 13:01:43 2013
@@ -0,0 +1,22 @@
+package org.apache.mailbox.caching;
+
+import org.apache.james.mailbox.exception.MailboxException;
+import org.apache.james.mailbox.exception.MailboxNotFoundException;
+import org.apache.james.mailbox.model.MailboxPath;
+import org.apache.james.mailbox.store.mail.MailboxMapper;
+import org.apache.james.mailbox.store.mail.model.Mailbox;
+
+public interface MailboxByPathCache<Id> {
+
+	public abstract Mailbox<Id> findMailboxByPath(MailboxPath mailboxName,
+			MailboxMapper<Id> underlying) throws MailboxNotFoundException,
+			MailboxException;
+
+	public abstract void invalidate(Mailbox<Id> mailbox);
+	
+	public abstract void invalidate(MailboxPath mailboxPath);
+
+	// for the purpose of cascading the invalidations; does it make sense? 
+	//public void connectTo(MailboxMetadataCache<Id> mailboxMetadataCache);
+
+}

Added: james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/MailboxMetadataCache.java
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/MailboxMetadataCache.java?rev=1476176&view=auto
==============================================================================
--- james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/MailboxMetadataCache.java (added)
+++ james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/MailboxMetadataCache.java Fri Apr 26 13:01:43 2013
@@ -0,0 +1,28 @@
+package org.apache.mailbox.caching;
+
+import org.apache.james.mailbox.exception.MailboxException;
+import org.apache.james.mailbox.store.mail.MessageMapper;
+import org.apache.james.mailbox.store.mail.model.Mailbox;
+
+public interface MailboxMetadataCache<Id> {
+
+	public abstract long countMessagesInMailbox(Mailbox<Id> mailbox,
+			MessageMapper<Id> underlying) throws MailboxException;
+
+	public abstract long countUnseenMessagesInMailbox(Mailbox<Id> mailbox,
+			MessageMapper<Id> underlying) throws MailboxException;
+
+	public abstract Long findFirstUnseenMessageUid(Mailbox<Id> mailbox,
+			MessageMapper<Id> underlying) throws MailboxException;
+
+	public abstract long getLastUid(Mailbox<Id> mailbox,
+			MessageMapper<Id> underlying) throws MailboxException;
+
+	public abstract long getHighestModSeq(Mailbox<Id> mailbox,
+			MessageMapper<Id> underlying) throws MailboxException;
+
+	public abstract void invalidate(Mailbox<Id> mailbox);
+
+//	public abstract void invalidate(MailboxPath mailboxPath);
+
+}
\ No newline at end of file

Added: james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/guava/AbstractGuavaCache.java
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/guava/AbstractGuavaCache.java?rev=1476176&view=auto
==============================================================================
--- james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/guava/AbstractGuavaCache.java (added)
+++ james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/guava/AbstractGuavaCache.java Fri Apr 26 13:01:43 2013
@@ -0,0 +1,15 @@
+package org.apache.mailbox.caching.guava;
+
+import java.util.concurrent.TimeUnit;
+
+import com.google.common.cache.CacheBuilder;
+
+public class AbstractGuavaCache {
+
+	// TODO this can probably be instantiated more elegant way
+	protected static final CacheBuilder<Object, Object> BUILDER = 
+			CacheBuilder.newBuilder()			
+			.maximumSize(100000)
+			.expireAfterWrite(15, TimeUnit.MINUTES);
+
+}

Added: james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/guava/GuavaCacheWrapper.java
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/guava/GuavaCacheWrapper.java?rev=1476176&view=auto
==============================================================================
--- james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/guava/GuavaCacheWrapper.java (added)
+++ james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/guava/GuavaCacheWrapper.java Fri Apr 26 13:01:43 2013
@@ -0,0 +1,37 @@
+package org.apache.mailbox.caching.guava;
+
+import org.apache.mailbox.caching.CacheLoaderFromUnderlying;
+
+import com.google.common.cache.Cache;
+
+public abstract class GuavaCacheWrapper<Key, Value, Underlying, KeyRepresentation, Except extends Throwable>
+	implements CacheLoaderFromUnderlying<Key, Value, Underlying, Except> {
+
+	private final Cache<KeyRepresentation, Value> cache;
+//	private final CacheLoaderFromUnderlying<Key, Value, Underlying, Except> loader;
+
+	public GuavaCacheWrapper(Cache<KeyRepresentation, Value> cache/*, CacheLoaderFromUnderlying<Key, Value, Underlying, Except> loader*/) {
+		this.cache = cache;
+//		this.loader = loader;
+	}
+	
+	public Value get(Key key, Underlying underlying) throws Except {
+		Value value = cache.getIfPresent(getKeyRepresentation(key));
+		if (value != null)
+			return value;
+		else {
+			value = load(key, underlying);
+			cache.put(getKeyRepresentation(key), value);
+			return value;
+		}
+
+	}
+	
+	public void invalidate(Key key) {
+		if (key != null) //needed?
+			cache.invalidate(getKeyRepresentation(key));
+	}
+
+	public abstract KeyRepresentation getKeyRepresentation(Key key);
+
+}

Added: james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/guava/GuavaMailboxByPathCache.java
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/guava/GuavaMailboxByPathCache.java?rev=1476176&view=auto
==============================================================================
--- james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/guava/GuavaMailboxByPathCache.java (added)
+++ james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/guava/GuavaMailboxByPathCache.java Fri Apr 26 13:01:43 2013
@@ -0,0 +1,80 @@
+package org.apache.mailbox.caching.guava;
+
+import org.apache.james.mailbox.exception.MailboxException;
+import org.apache.james.mailbox.exception.MailboxNotFoundException;
+import org.apache.james.mailbox.model.MailboxPath;
+import org.apache.james.mailbox.store.mail.MailboxMapper;
+import org.apache.james.mailbox.store.mail.model.Mailbox;
+import org.apache.mailbox.caching.MailboxByPathCache;
+
+import com.google.common.cache.Cache;
+
+public class GuavaMailboxByPathCache<Id> extends AbstractGuavaCache implements MailboxByPathCache<Id> {
+	
+	private final Cache<String, Mailbox<Id>> findMailboxByPathCache = BUILDER.build();
+
+	private final MailboxByPathCacheWrapper wrapper;
+
+	public GuavaMailboxByPathCache() {
+		this.wrapper = new MailboxByPathCacheWrapper(findMailboxByPathCache);
+	}
+	
+	@Override
+	public Mailbox<Id> findMailboxByPath(MailboxPath mailboxName, MailboxMapper<Id> underlying) throws MailboxNotFoundException, MailboxException {
+		
+		return wrapper.get(mailboxName, underlying);
+	}
+	
+//	alternative plain implementation - review and choose the better
+//	public Mailbox<Id> findMailboxByPath(MailboxPath mailboxName, MailboxMapper<Id> underlying) throws MailboxNotFoundException, MailboxException {
+//		Mailbox<Id> mailbox = findMailboxByPathCache.getIfPresent(mailboxName.toString());
+//		if (mailbox != null)
+//			return mailbox;
+//		else {
+//			mailbox = new MailboxByPathCacheLoaderFromUnderlying().load(mailboxName, underlying);
+//			findMailboxByPathCache.put(mailboxName.toString(), mailbox);
+//			return mailbox;
+//		}
+//	}
+
+	
+
+	@Override
+	public void invalidate(Mailbox<Id> mailbox) {
+		invalidate(new MailboxPath(mailbox.getNamespace(), mailbox.getUser(), mailbox.getName()));
+	}
+	
+	@Override
+	public void invalidate(MailboxPath mailboxPath) {
+		wrapper.invalidate(mailboxPath);
+	}
+
+
+	//Does it make sense to define such loaders as separate classes for reuse?
+//	class MailboxByPathCacheLoaderFromUnderlying implements CacheLoaderFromUnderlying<MailboxPath, Mailbox<Id>, MailboxMapper<Id>, MailboxException> {
+//		@Override
+//		public Mailbox<Id> load(MailboxPath mailboxName, MailboxMapper<Id> underlying) throws MailboxException {
+//			return underlying.findMailboxByPath(mailboxName);
+//		}
+//	}
+
+	class MailboxByPathCacheWrapper extends GuavaCacheWrapper<MailboxPath, Mailbox<Id>, MailboxMapper<Id>, String, MailboxException> {
+
+		public MailboxByPathCacheWrapper(
+				Cache<String, Mailbox<Id>> cache/*,
+				MailboxByPathCacheLoaderFromUnderlying loader*/) {
+			super(cache);
+		}
+
+		@Override
+		public Mailbox<Id> load(MailboxPath mailboxName, MailboxMapper<Id> underlying) throws MailboxException {
+			return underlying.findMailboxByPath(mailboxName);
+		}
+
+		@Override
+		public String getKeyRepresentation(MailboxPath key) {
+			return key.toString();
+		}
+		
+	}
+}

Added: james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache.java
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache.java?rev=1476176&view=auto
==============================================================================
--- james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache.java (added)
+++ james/mailbox/trunk/caching/src/main/java/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache.java Fri Apr 26 13:01:43 2013
@@ -0,0 +1,135 @@
+package org.apache.mailbox.caching.guava;
+
+import org.apache.james.mailbox.exception.MailboxException;
+import org.apache.james.mailbox.store.mail.MessageMapper;
+import org.apache.james.mailbox.store.mail.model.Mailbox;
+import org.apache.mailbox.caching.MailboxMetadataCache;
+
+import com.google.common.cache.Cache;
+
+public class GuavaMailboxMetadataCache<Id> extends AbstractGuavaCache implements MailboxMetadataCache<Id> {
+
+	// TODO these can probably be instantiated more elegant way
+	private final Cache<Id, Long> cacheCountMessagesInMailbox = BUILDER.build();
+	private final Cache<Id, Long> cacheCountUnseenMessagesInMailbox = BUILDER.build();
+	private final Cache<Id, Long> cacheFindFirstUnseenMessageUid = BUILDER.build();
+	private final Cache<Id, Long> cacheGetLastUid = BUILDER.build();
+	private final Cache<Id, Long> cacheGetHighestModSeq = BUILDER.build();
+
+	private final MetadataCacheWrapper countMessagesInMailboxWrapper = new CountMessagesInMailboxWrapper(cacheCountMessagesInMailbox);
+	private final MetadataCacheWrapper countUnseenMessagesInMailboxWrapper = new CountUnseenMessagesInMailboxWrapper(cacheCountUnseenMessagesInMailbox);
+	private final MetadataCacheWrapper findFirstUnseenMessageUid = new FindFirstUnseenMessageUidWrapper(cacheFindFirstUnseenMessageUid);
+	private final MetadataCacheWrapper highestModSeqWrapper = new HighestModseqCacheWrapper(cacheGetHighestModSeq);
+	private final MetadataCacheWrapper lastUidWrapper = new LastUidCacheWrapper(cacheGetLastUid);
+	
+	@Override
+	public long countMessagesInMailbox(Mailbox<Id> mailbox, MessageMapper<Id> underlying) throws MailboxException {
+		return countMessagesInMailboxWrapper.get(mailbox, underlying);
+	}
+	
+	@Override
+	public long countUnseenMessagesInMailbox(Mailbox<Id> mailbox, MessageMapper<Id> underlying)
+			throws MailboxException {
+		return countUnseenMessagesInMailboxWrapper.get(mailbox, underlying);
+	}
+	
+	@Override
+	public Long findFirstUnseenMessageUid(Mailbox<Id> mailbox, MessageMapper<Id> underlying)
+			throws MailboxException {
+		return findFirstUnseenMessageUid.get(mailbox, underlying);
+	}
+	
+	@Override
+	public long getLastUid(Mailbox<Id> mailbox, MessageMapper<Id> underlying) throws MailboxException {
+		return lastUidWrapper.get(mailbox, underlying);
+
+	}
+	
+	@Override
+	public long getHighestModSeq(Mailbox<Id> mailbox, MessageMapper<Id> underlying) throws MailboxException {
+		return highestModSeqWrapper.get(mailbox, underlying);
+	}
+	
+	@Override
+	public void invalidate(Mailbox<Id> mailbox) {
+		cacheCountMessagesInMailbox.invalidate(mailbox);
+		cacheCountUnseenMessagesInMailbox.invalidate(mailbox);
+		cacheFindFirstUnseenMessageUid.invalidate(mailbox);
+		lastUidWrapper.invalidate(mailbox);
+		highestModSeqWrapper.invalidate(mailbox);
+	}
+
+	
+	abstract class MetadataCacheWrapper extends GuavaCacheWrapper<Mailbox<Id>, Long, MessageMapper<Id>, Id, MailboxException> {
+
+		public MetadataCacheWrapper(Cache<Id, Long> cache) {
+			super(cache);
+		}
+
+		@Override
+		public Id getKeyRepresentation(Mailbox<Id> key) {
+			return key.getMailboxId();
+		}		
+		
+	}
+
+	class CountMessagesInMailboxWrapper extends MetadataCacheWrapper {
+
+		public CountMessagesInMailboxWrapper(Cache<Id, Long> cache) {
+			super(cache);
+		}
+		@Override
+		public Long load(Mailbox<Id> mailbox, MessageMapper<Id> underlying)
+				throws MailboxException {
+			return underlying.countMessagesInMailbox(mailbox);
+		}
+
+	}
+	
+	class CountUnseenMessagesInMailboxWrapper extends MetadataCacheWrapper {
+
+		public CountUnseenMessagesInMailboxWrapper(Cache<Id, Long> cache) {
+			super(cache);
+		}
+		@Override
+		public Long load(Mailbox<Id> mailbox, MessageMapper<Id> underlying)
+				throws MailboxException {
+			return underlying.countUnseenMessagesInMailbox(mailbox);
+		}
+
+	}
+
+	class FindFirstUnseenMessageUidWrapper extends MetadataCacheWrapper {
+
+		public FindFirstUnseenMessageUidWrapper(Cache<Id, Long> cache) {
+			super(cache);
+		}
+		@Override
+		public Long load(Mailbox<Id> mailbox, MessageMapper<Id> underlying)
+				throws MailboxException {
+			return underlying.findFirstUnseenMessageUid(mailbox);
+		}
+
+	}
+
+	class LastUidCacheWrapper extends MetadataCacheWrapper {
+		public LastUidCacheWrapper(Cache<Id, Long> cache) {
+			super(cache);
+		}
+		@Override
+		public Long load(Mailbox<Id> mailbox, MessageMapper<Id> underlying) throws MailboxException {
+			return underlying.getLastUid(mailbox);
+		}
+	}
+
+	class HighestModseqCacheWrapper extends MetadataCacheWrapper {
+		public HighestModseqCacheWrapper(Cache<Id, Long> cache) {
+			super(cache);
+		}
+		@Override
+		public Long load(Mailbox<Id> mailbox, MessageMapper<Id> underlying) throws MailboxException {
+			return underlying.getHighestModSeq(mailbox);
+		}
+	}
+
+}

Added: james/mailbox/trunk/caching/target/classes/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/target/classes/META-INF/MANIFEST.MF?rev=1476176&view=auto
==============================================================================
--- james/mailbox/trunk/caching/target/classes/META-INF/MANIFEST.MF (added)
+++ james/mailbox/trunk/caching/target/classes/META-INF/MANIFEST.MF Fri Apr 26 13:01:43 2013
@@ -0,0 +1,37 @@
+Manifest-Version: 1.0
+Bnd-LastModified: 1366981115083
+Build-Jdk: 1.6.0_33
+Built-By: eric
+Bundle-Description: Apache James Mailbox
+Bundle-DocURL: http://www.apache.org/
+Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
+Bundle-ManifestVersion: 2
+Bundle-Name: Apache James :: Mailbox :: Caching
+Bundle-SymbolicName: org.apache.james.apache-james-mailbox-caching
+Bundle-Vendor: The Apache Software Foundation
+Bundle-Version: 0.6.0.SNAPSHOT
+Created-By: Apache Maven Bundle Plugin
+Export-Package: org.apache.mailbox.caching;uses:="org.apache.james.mailb
+ ox.store.mail.model,org.apache.james.mailbox,org.apache.james.mailbox.e
+ xception,org.apache.james.mailbox.store.mail,org.apache.james.mailbox.m
+ odel,org.apache.james.mailbox.store.transaction,org.apache.james.mailbo
+ x.store.user,org.apache.james.mailbox.store,javax.mail";version="0.6.0.
+ SNAPSHOT",org.apache.mailbox.caching.guava;uses:="com.google.common.cac
+ he,org.apache.mailbox.caching,org.apache.james.mailbox.store.mail.model
+ ,org.apache.james.mailbox.exception,org.apache.james.mailbox.store.mail
+ ,org.apache.james.mailbox.model";version="0.6.0.SNAPSHOT"
+Implementation-Title: Apache James :: Mailbox :: Caching
+Implementation-Vendor: The Apache Software Foundation
+Implementation-Vendor-Id: org.apache.james
+Implementation-Version: 0.6-SNAPSHOT
+Import-Package: com.google.common.cache;version="[13.0,14)",javax.mail,o
+ rg.apache.james.mailbox,org.apache.james.mailbox.exception,org.apache.j
+ ames.mailbox.model,org.apache.james.mailbox.store;version="[0.6,1)",org
+ .apache.james.mailbox.store.mail;version="[0.6,1)",org.apache.james.mai
+ lbox.store.mail.model;version="[0.6,1)",org.apache.james.mailbox.store.
+ transaction;version="[0.6,1)",org.apache.james.mailbox.store.user;versi
+ on="[0.6,1)"
+Specification-Title: Apache James :: Mailbox :: Caching
+Specification-Vendor: The Apache Software Foundation
+Specification-Version: 0.6-SNAPSHOT
+Tool: Bnd-1.50.0

Added: james/mailbox/trunk/caching/target/classes/META-INF/maven/org.apache.james/apache-james-mailbox-caching/pom.properties
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/target/classes/META-INF/maven/org.apache.james/apache-james-mailbox-caching/pom.properties?rev=1476176&view=auto
==============================================================================
--- james/mailbox/trunk/caching/target/classes/META-INF/maven/org.apache.james/apache-james-mailbox-caching/pom.properties (added)
+++ james/mailbox/trunk/caching/target/classes/META-INF/maven/org.apache.james/apache-james-mailbox-caching/pom.properties Fri Apr 26 13:01:43 2013
@@ -0,0 +1,7 @@
+#Generated by Maven Integration for Eclipse
+#Fri Apr 26 13:58:35 BST 2013
+version=0.6-SNAPSHOT
+groupId=org.apache.james
+m2e.projectName=apache-james-mailbox-caching
+m2e.projectLocation=/Users/eric/wrk/osa/james.svn/mailbox/caching
+artifactId=apache-james-mailbox-caching

Added: james/mailbox/trunk/caching/target/classes/META-INF/maven/org.apache.james/apache-james-mailbox-caching/pom.xml
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/target/classes/META-INF/maven/org.apache.james/apache-james-mailbox-caching/pom.xml?rev=1476176&view=auto
==============================================================================
--- james/mailbox/trunk/caching/target/classes/META-INF/maven/org.apache.james/apache-james-mailbox-caching/pom.xml (added)
+++ james/mailbox/trunk/caching/target/classes/META-INF/maven/org.apache.james/apache-james-mailbox-caching/pom.xml Fri Apr 26 13:01:43 2013
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements. See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership. The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License. You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied. See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <artifactId>apache-james-mailbox</artifactId>
+        <groupId>org.apache.james</groupId>
+        <version>0.6-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>apache-james-mailbox-caching</artifactId>
+    <name>Apache James :: Mailbox :: Caching</name>
+    <packaging>bundle</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.james</groupId>
+            <artifactId>apache-james-mailbox-store</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jmock</groupId>
+            <artifactId>jmock</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.jmock</groupId>
+            <artifactId>jmock-junit4</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>

Added: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/CacheInvalidatingMailboxListener.class
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/CacheInvalidatingMailboxListener.class?rev=1476176&view=auto
==============================================================================
Binary file - no diff available.

Propchange: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/CacheInvalidatingMailboxListener.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/CacheLoaderFromUnderlying.class
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/CacheLoaderFromUnderlying.class?rev=1476176&view=auto
==============================================================================
Binary file - no diff available.

Propchange: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/CacheLoaderFromUnderlying.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/CachingMailboxMapper.class
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/CachingMailboxMapper.class?rev=1476176&view=auto
==============================================================================
Binary file - no diff available.

Propchange: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/CachingMailboxMapper.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/CachingMailboxSessionMapperFactory.class
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/CachingMailboxSessionMapperFactory.class?rev=1476176&view=auto
==============================================================================
Binary file - no diff available.

Propchange: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/CachingMailboxSessionMapperFactory.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/CachingMessageMapper.class
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/CachingMessageMapper.class?rev=1476176&view=auto
==============================================================================
Binary file - no diff available.

Propchange: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/CachingMessageMapper.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/MailboxByPathCache.class
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/MailboxByPathCache.class?rev=1476176&view=auto
==============================================================================
Binary file - no diff available.

Propchange: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/MailboxByPathCache.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/MailboxMetadataCache.class
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/MailboxMetadataCache.class?rev=1476176&view=auto
==============================================================================
Binary file - no diff available.

Propchange: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/MailboxMetadataCache.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/AbstractGuavaCache.class
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/AbstractGuavaCache.class?rev=1476176&view=auto
==============================================================================
Binary file - no diff available.

Propchange: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/AbstractGuavaCache.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaCacheWrapper.class
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaCacheWrapper.class?rev=1476176&view=auto
==============================================================================
Binary file - no diff available.

Propchange: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaCacheWrapper.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxByPathCache$MailboxByPathCacheWrapper.class
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxByPathCache%24MailboxByPathCacheWrapper.class?rev=1476176&view=auto
==============================================================================
Binary file - no diff available.

Propchange: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxByPathCache$MailboxByPathCacheWrapper.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxByPathCache.class
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxByPathCache.class?rev=1476176&view=auto
==============================================================================
Binary file - no diff available.

Propchange: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxByPathCache.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache$CountMessagesInMailboxWrapper.class
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache%24CountMessagesInMailboxWrapper.class?rev=1476176&view=auto
==============================================================================
Binary file - no diff available.

Propchange: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache$CountMessagesInMailboxWrapper.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache$CountUnseenMessagesInMailboxWrapper.class
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache%24CountUnseenMessagesInMailboxWrapper.class?rev=1476176&view=auto
==============================================================================
Binary file - no diff available.

Propchange: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache$CountUnseenMessagesInMailboxWrapper.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache$FindFirstUnseenMessageUidWrapper.class
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache%24FindFirstUnseenMessageUidWrapper.class?rev=1476176&view=auto
==============================================================================
Binary file - no diff available.

Propchange: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache$FindFirstUnseenMessageUidWrapper.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache$HighestModseqCacheWrapper.class
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache%24HighestModseqCacheWrapper.class?rev=1476176&view=auto
==============================================================================
Binary file - no diff available.

Propchange: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache$HighestModseqCacheWrapper.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache$LastUidCacheWrapper.class
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache%24LastUidCacheWrapper.class?rev=1476176&view=auto
==============================================================================
Binary file - no diff available.

Propchange: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache$LastUidCacheWrapper.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache$MetadataCacheWrapper.class
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache%24MetadataCacheWrapper.class?rev=1476176&view=auto
==============================================================================
Binary file - no diff available.

Propchange: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache$MetadataCacheWrapper.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache.class
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache.class?rev=1476176&view=auto
==============================================================================
Binary file - no diff available.

Propchange: james/mailbox/trunk/caching/target/classes/org/apache/mailbox/caching/guava/GuavaMailboxMetadataCache.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: james/mailbox/trunk/hbase/src/main/java/org/apache/james/mailbox/hbase/HBaseMailboxSessionMapperFactory.java
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/hbase/src/main/java/org/apache/james/mailbox/hbase/HBaseMailboxSessionMapperFactory.java?rev=1476176&r1=1476175&r2=1476176&view=diff
==============================================================================
--- james/mailbox/trunk/hbase/src/main/java/org/apache/james/mailbox/hbase/HBaseMailboxSessionMapperFactory.java (original)
+++ james/mailbox/trunk/hbase/src/main/java/org/apache/james/mailbox/hbase/HBaseMailboxSessionMapperFactory.java Fri Apr 26 13:01:43 2013
@@ -114,17 +114,17 @@ public class HBaseMailboxSessionMapperFa
     }
 
     @Override
-    protected MessageMapper<UUID> createMessageMapper(MailboxSession session) throws MailboxException {
+    public MessageMapper<UUID> createMessageMapper(MailboxSession session) throws MailboxException {
         return new HBaseMessageMapper(session, uidProvider, modSeqProvider, this.conf);
     }
 
     @Override
-    protected MailboxMapper<UUID> createMailboxMapper(MailboxSession session) throws MailboxException {
+    public MailboxMapper<UUID> createMailboxMapper(MailboxSession session) throws MailboxException {
         return new HBaseMailboxMapper(this.conf);
     }
 
     @Override
-    protected SubscriptionMapper createSubscriptionMapper(MailboxSession session) throws SubscriptionException {
+    public SubscriptionMapper createSubscriptionMapper(MailboxSession session) throws SubscriptionException {
         return new HBaseSubscriptionMapper(this.conf);
     }
 

Modified: james/mailbox/trunk/maildir/src/main/java/org/apache/james/mailbox/maildir/MaildirMailboxSessionMapperFactory.java
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/maildir/src/main/java/org/apache/james/mailbox/maildir/MaildirMailboxSessionMapperFactory.java?rev=1476176&r1=1476175&r2=1476176&view=diff
==============================================================================
--- james/mailbox/trunk/maildir/src/main/java/org/apache/james/mailbox/maildir/MaildirMailboxSessionMapperFactory.java (original)
+++ james/mailbox/trunk/maildir/src/main/java/org/apache/james/mailbox/maildir/MaildirMailboxSessionMapperFactory.java Fri Apr 26 13:01:43 2013
@@ -41,19 +41,19 @@ public class MaildirMailboxSessionMapper
     
     
     @Override
-    protected MailboxMapper<Integer> createMailboxMapper(MailboxSession session)
+    public MailboxMapper<Integer> createMailboxMapper(MailboxSession session)
             throws MailboxException {
         return new MaildirMailboxMapper(store, session);
     }
 
     @Override
-    protected MessageMapper<Integer> createMessageMapper(MailboxSession session)
+    public MessageMapper<Integer> createMessageMapper(MailboxSession session)
             throws MailboxException {
         return new MaildirMessageMapper(session, store);
     }
 
     @Override
-    protected SubscriptionMapper createSubscriptionMapper(MailboxSession session)
+    public SubscriptionMapper createSubscriptionMapper(MailboxSession session)
             throws SubscriptionException {
         return new MaildirSubscriptionMapper(store);
     }

Modified: james/mailbox/trunk/pom.xml
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/pom.xml?rev=1476176&r1=1476175&r2=1476176&view=diff
==============================================================================
--- james/mailbox/trunk/pom.xml (original)
+++ james/mailbox/trunk/pom.xml Fri Apr 26 13:01:43 2013
@@ -50,13 +50,14 @@
 
     <modules>
         <module>api</module>
-        <module>store</module>
-        <module>lucene</module>
-        <module>memory</module>
-        <module>jpa</module>
+        <module>caching</module>
+        <module>hbase</module>
         <module>jcr</module>
+        <module>jpa</module>
+        <module>lucene</module>
         <module>maildir</module>
-        <module>hbase</module>
+        <module>memory</module>
+        <module>store</module>
         <module>spring</module>
         <module>tool</module>
         <module>zoo-seq-provider</module>

Modified: james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/MailboxSessionMapperFactory.java
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/MailboxSessionMapperFactory.java?rev=1476176&r1=1476175&r2=1476176&view=diff
==============================================================================
--- james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/MailboxSessionMapperFactory.java (original)
+++ james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/MailboxSessionMapperFactory.java Fri Apr 26 13:01:43 2013
@@ -62,7 +62,7 @@ public abstract class MailboxSessionMapp
      * @return messageMapper
      * @throws MailboxException
      */
-    protected abstract MessageMapper<Id> createMessageMapper(MailboxSession session) throws MailboxException;
+    public abstract MessageMapper<Id> createMessageMapper(MailboxSession session) throws MailboxException;
 
 
     /**
@@ -85,7 +85,7 @@ public abstract class MailboxSessionMapp
      * @return mailboxMapper
      * @throws MailboxException
      */
-    protected abstract MailboxMapper<Id> createMailboxMapper(MailboxSession session) throws MailboxException;
+    public abstract MailboxMapper<Id> createMailboxMapper(MailboxSession session) throws MailboxException;
 
     /**
      * Create a {@link SubscriptionMapper} instance or return the one which exists for the {@link MailboxSession} already
@@ -108,7 +108,7 @@ public abstract class MailboxSessionMapp
      * @return subscriptionMapper
      * @throws SubscriptionException
      */
-    protected abstract SubscriptionMapper createSubscriptionMapper(MailboxSession session) throws SubscriptionException;
+    public abstract SubscriptionMapper createSubscriptionMapper(MailboxSession session) throws SubscriptionException;
 
     /**
      * Call endRequest on {@link Mapper} instances



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org