You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directmemory.apache.org by si...@apache.org on 2012/02/15 21:54:44 UTC

svn commit: r1244715 - in /incubator/directmemory/trunk/serializers: ./ msgpack/ msgpack/src/ msgpack/src/main/ msgpack/src/main/java/ msgpack/src/main/java/org/ msgpack/src/main/java/org/apache/ msgpack/src/main/java/org/apache/directmemory/ msgpack/s...

Author: simonetripodi
Date: Wed Feb 15 20:54:43 2012
New Revision: 1244715

URL: http://svn.apache.org/viewvc?rev=1244715&view=rev
Log:
initial (basic) version of MsgPack serializer adapter - not complete, but at least a starting point

Added:
    incubator/directmemory/trunk/serializers/msgpack/   (with props)
    incubator/directmemory/trunk/serializers/msgpack/pom.xml   (with props)
    incubator/directmemory/trunk/serializers/msgpack/src/
    incubator/directmemory/trunk/serializers/msgpack/src/main/
    incubator/directmemory/trunk/serializers/msgpack/src/main/java/
    incubator/directmemory/trunk/serializers/msgpack/src/main/java/org/
    incubator/directmemory/trunk/serializers/msgpack/src/main/java/org/apache/
    incubator/directmemory/trunk/serializers/msgpack/src/main/java/org/apache/directmemory/
    incubator/directmemory/trunk/serializers/msgpack/src/main/java/org/apache/directmemory/serialization/
    incubator/directmemory/trunk/serializers/msgpack/src/main/java/org/apache/directmemory/serialization/msgpack/
    incubator/directmemory/trunk/serializers/msgpack/src/main/java/org/apache/directmemory/serialization/msgpack/MessagePackSerializer.java   (with props)
    incubator/directmemory/trunk/serializers/msgpack/src/main/java/org/apache/directmemory/serialization/msgpack/package-info.java   (with props)
    incubator/directmemory/trunk/serializers/msgpack/src/test/
    incubator/directmemory/trunk/serializers/msgpack/src/test/java/
Modified:
    incubator/directmemory/trunk/serializers/pom.xml

Propchange: incubator/directmemory/trunk/serializers/msgpack/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Feb 15 20:54:43 2012
@@ -0,0 +1,2 @@
+target
+bin

Added: incubator/directmemory/trunk/serializers/msgpack/pom.xml
URL: http://svn.apache.org/viewvc/incubator/directmemory/trunk/serializers/msgpack/pom.xml?rev=1244715&view=auto
==============================================================================
--- incubator/directmemory/trunk/serializers/msgpack/pom.xml (added)
+++ incubator/directmemory/trunk/serializers/msgpack/pom.xml Wed Feb 15 20:54:43 2012
@@ -0,0 +1,89 @@
+<?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/xsd/maven-4.0.0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.directmemory</groupId>
+    <artifactId>directmemory-serializers</artifactId>
+    <version>0.5.5-SNAPSHOT</version>
+    <relativePath>../</relativePath>
+  </parent>
+
+  <artifactId>directmemory-msgpack</artifactId>
+  <name>Apache DirectMemory :: Serializers :: MessagePack</name>
+  <packaging>bundle</packaging>
+  <description>MessagePack serializer adapter for DirectMemory Cache</description>
+
+  <!-- TODO need the help of some OSGi expert here -->
+  <properties>
+    <osgi.import>
+      !org.apache.directmemory*,
+      com.dyuproject.protostuff*;version="[1,2)",
+      com.google.common.collect;version="[9.0,11)",
+      org.aspectj*;version="[1.6,2)",
+      org.josql*;version="[1.5,2)",
+      org.slf4j*,
+      *
+    </osgi.import>
+    <osgi.export>org.apache.directmemory*;version="${project.version}</osgi.export>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>${project.parent.groupId}</groupId>
+      <artifactId>directmemory-cache</artifactId>
+      <version>${project.parent.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.msgpack</groupId>
+      <artifactId>msgpack</artifactId>
+      <version>0.6.5</version>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <resources>
+      <resource>
+        <directory>${basedir}/src/main/resources</directory>
+      </resource>
+    </resources>
+
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>2.9</version>
+        <configuration>
+          <argLine>-Xmx512m -Xms512m -XX:MaxDirectMemorySize=512m</argLine>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

Propchange: incubator/directmemory/trunk/serializers/msgpack/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/directmemory/trunk/serializers/msgpack/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: incubator/directmemory/trunk/serializers/msgpack/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/directmemory/trunk/serializers/msgpack/src/main/java/org/apache/directmemory/serialization/msgpack/MessagePackSerializer.java
URL: http://svn.apache.org/viewvc/incubator/directmemory/trunk/serializers/msgpack/src/main/java/org/apache/directmemory/serialization/msgpack/MessagePackSerializer.java?rev=1244715&view=auto
==============================================================================
--- incubator/directmemory/trunk/serializers/msgpack/src/main/java/org/apache/directmemory/serialization/msgpack/MessagePackSerializer.java (added)
+++ incubator/directmemory/trunk/serializers/msgpack/src/main/java/org/apache/directmemory/serialization/msgpack/MessagePackSerializer.java Wed Feb 15 20:54:43 2012
@@ -0,0 +1,55 @@
+package org.apache.directmemory.serialization.msgpack;
+
+import java.io.IOException;
+
+import org.apache.directmemory.serialization.Serializer;
+import org.kohsuke.MetaInfServices;
+import org.msgpack.MessagePack;
+
+/*
+ * 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.
+ */
+
+@MetaInfServices
+public final class MessagePackSerializer
+    implements Serializer
+{
+
+    private final MessagePack msgpack = new MessagePack();
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public <T> byte[] serialize( T obj )
+        throws IOException
+    {
+        return msgpack.write( obj );
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public <T> T deserialize( byte[] source, Class<T> clazz )
+        throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException
+    {
+        return msgpack.read( source, clazz );
+    }
+
+}

Propchange: incubator/directmemory/trunk/serializers/msgpack/src/main/java/org/apache/directmemory/serialization/msgpack/MessagePackSerializer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/directmemory/trunk/serializers/msgpack/src/main/java/org/apache/directmemory/serialization/msgpack/MessagePackSerializer.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/directmemory/trunk/serializers/msgpack/src/main/java/org/apache/directmemory/serialization/msgpack/MessagePackSerializer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/directmemory/trunk/serializers/msgpack/src/main/java/org/apache/directmemory/serialization/msgpack/package-info.java
URL: http://svn.apache.org/viewvc/incubator/directmemory/trunk/serializers/msgpack/src/main/java/org/apache/directmemory/serialization/msgpack/package-info.java?rev=1244715&view=auto
==============================================================================
--- incubator/directmemory/trunk/serializers/msgpack/src/main/java/org/apache/directmemory/serialization/msgpack/package-info.java (added)
+++ incubator/directmemory/trunk/serializers/msgpack/src/main/java/org/apache/directmemory/serialization/msgpack/package-info.java Wed Feb 15 20:54:43 2012
@@ -0,0 +1,23 @@
+/**
+ * ≈ Serializer adapter.
+ */
+package org.apache.directmemory.serialization.msgpack;
+
+/*
+ * 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.
+ */

Propchange: incubator/directmemory/trunk/serializers/msgpack/src/main/java/org/apache/directmemory/serialization/msgpack/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/directmemory/trunk/serializers/msgpack/src/main/java/org/apache/directmemory/serialization/msgpack/package-info.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/directmemory/trunk/serializers/msgpack/src/main/java/org/apache/directmemory/serialization/msgpack/package-info.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/directmemory/trunk/serializers/pom.xml
URL: http://svn.apache.org/viewvc/incubator/directmemory/trunk/serializers/pom.xml?rev=1244715&r1=1244714&r2=1244715&view=diff
==============================================================================
--- incubator/directmemory/trunk/serializers/pom.xml (original)
+++ incubator/directmemory/trunk/serializers/pom.xml Wed Feb 15 20:54:43 2012
@@ -37,6 +37,7 @@
 
   <modules>
     <module>protostuff</module>
+    <module>msgpack</module>
   </modules>
 
   <dependencies>