Author: simonetripodi
Date: Thu Mar  8 16:45:02 2012
New Revision: 1298466

URL: http://svn.apache.org/viewvc?rev=1298466&view=rev
Log:
first checkin of CacheServiceProvider class

Added:
    
incubator/directmemory/trunk/integrations/guice/src/main/java/org/apache/directmemory/guice/CacheServiceProvider.java
   (with props)

Added: 
incubator/directmemory/trunk/integrations/guice/src/main/java/org/apache/directmemory/guice/CacheServiceProvider.java
URL: 
http://svn.apache.org/viewvc/incubator/directmemory/trunk/integrations/guice/src/main/java/org/apache/directmemory/guice/CacheServiceProvider.java?rev=1298466&view=auto
==============================================================================
--- 
incubator/directmemory/trunk/integrations/guice/src/main/java/org/apache/directmemory/guice/CacheServiceProvider.java
 (added)
+++ 
incubator/directmemory/trunk/integrations/guice/src/main/java/org/apache/directmemory/guice/CacheServiceProvider.java
 Thu Mar  8 16:45:02 2012
@@ -0,0 +1,59 @@
+package org.apache.directmemory.guice;
+
+/*
+ * 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.
+ */
+
+import java.util.concurrent.ConcurrentMap;
+
+import org.apache.directmemory.cache.CacheService;
+import org.apache.directmemory.cache.CacheServiceImpl;
+import org.apache.directmemory.memory.MemoryManagerService;
+import org.apache.directmemory.memory.Pointer;
+import org.apache.directmemory.serialization.Serializer;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public final class CacheServiceProvider<K, V>
+    implements Provider<CacheService<K, V>>
+{
+
+    private final ConcurrentMap<K, Pointer<V>> map;
+
+    private final MemoryManagerService<V> memoryManager;
+
+    private final Serializer serializer;
+
+    @Inject
+    public CacheServiceProvider( ConcurrentMap<K, Pointer<V>> map,
+                                 MemoryManagerService<V> memoryManager,
+                                 Serializer serializer )
+    {
+        this.map = map;
+        this.memoryManager = memoryManager;
+        this.serializer = serializer;
+    }
+
+    @Override
+    public CacheService<K, V> get()
+    {
+        return new CacheServiceImpl<K, V>( map, memoryManager, serializer );
+    }
+
+}

Propchange: 
incubator/directmemory/trunk/integrations/guice/src/main/java/org/apache/directmemory/guice/CacheServiceProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/directmemory/trunk/integrations/guice/src/main/java/org/apache/directmemory/guice/CacheServiceProvider.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: 
incubator/directmemory/trunk/integrations/guice/src/main/java/org/apache/directmemory/guice/CacheServiceProvider.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain


Reply via email to