forked from msgpack/msgpack-scala
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
takeshita
committed
Oct 12, 2011
0 parents
commit bacba7b
Showing
21 changed files
with
1,770 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# use glob syntax. | ||
syntax: glob | ||
*.ser | ||
*.class | ||
*~ | ||
*.bak | ||
#*.off | ||
*.old | ||
|
||
# eclipse conf file | ||
.settings | ||
.classpath | ||
.project | ||
.manager | ||
.scala_dependencies | ||
|
||
# idea | ||
.idea | ||
*.iml | ||
|
||
# building | ||
target | ||
build | ||
null | ||
tmp* | ||
dist | ||
test-output | ||
build.log | ||
|
||
# other scm | ||
.svn | ||
.CVS | ||
.hg* | ||
|
||
# switch to regexp syntax. | ||
# syntax: regexp | ||
# ^\.pc/ | ||
|
||
#SHITTY output not in target directory | ||
build.log | ||
|
||
#working dir | ||
target/* | ||
|
||
#intelliJ project | ||
*.iml | ||
*.ipr | ||
*.iws |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,199 @@ | ||
<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> | ||
<groupId>org.msgpack</groupId> | ||
<artifactId>scala-msgpack_${scala.version}</artifactId> | ||
<version>0.6.1-SNAPSHOT</version> | ||
<name>${project.artifactId}</name> | ||
<description>My wonderfull scala app</description> | ||
<inceptionYear>2010</inceptionYear> | ||
<licenses> | ||
<license> | ||
<name>My License</name> | ||
<url>http://....</url> | ||
<distribution>repo</distribution> | ||
</license> | ||
</licenses> | ||
|
||
<properties> | ||
<maven.compiler.source>1.5</maven.compiler.source> | ||
<maven.compiler.target>1.5</maven.compiler.target> | ||
<encoding>UTF-8</encoding> | ||
<!--<scala.version>2.8.1</scala.version> --> | ||
</properties> | ||
<repositories> | ||
<repository> | ||
<id>msgpack.org</id> | ||
<name>MessagePack Repository for Maven</name> | ||
<url>http://msgpack.org/maven2/</url> | ||
</repository> | ||
</repositories> | ||
|
||
|
||
<profiles> | ||
<profile> | ||
<id>scala-2.8.1</id> | ||
<properties> | ||
<scala.version>2.8.1</scala.version> | ||
</properties> | ||
</profile> | ||
<profile> | ||
<id>scala-2.9.0</id> | ||
<activation> | ||
<activeByDefault>true</activeByDefault> | ||
</activation> | ||
<properties> | ||
<scala.version>2.9.0</scala.version> | ||
</properties> | ||
</profile> | ||
</profiles> | ||
|
||
<!-- | ||
<repositories> | ||
<repository> | ||
<id>scala-tools.org</id> | ||
<name>Scala-Tools Maven2 Repository</name> | ||
<url>http://scala-tools.org/repo-releases</url> | ||
</repository> | ||
</repositories> | ||
<pluginRepositories> | ||
<pluginRepository> | ||
<id>scala-tools.org</id> | ||
<name>Scala-Tools Maven2 Repository</name> | ||
<url>http://scala-tools.org/repo-releases</url> | ||
</pluginRepository> | ||
</pluginRepositories> | ||
--> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.scala-lang</groupId> | ||
<artifactId>scala-library</artifactId> | ||
<version>${scala.version}</version> | ||
</dependency> | ||
|
||
<!-- Test --> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.8.1</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.scala-tools.testing</groupId> | ||
<artifactId>specs_${scala.version}</artifactId> | ||
<version>1.6.8</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.msgpack</groupId> | ||
<artifactId>msgpack</artifactId> | ||
<version>0.6.1-SNAPSHOT</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<distributionManagement> | ||
<!--<repository> | ||
<uniqueVersion>false</uniqueVersion> | ||
<id>msgpack.org</id> | ||
<name>Repository at msgpack.org</name> | ||
<url>file://${project.build.directory}/website/maven2/</url> | ||
</repository> | ||
<snapshotRepository> | ||
<uniqueVersion>true</uniqueVersion> | ||
<id>msgpack.org</id> | ||
<name>Repository at msgpack.org</name> | ||
<url>file://${project.build.directory}/website/maven2/</url> | ||
</snapshotRepository>--> | ||
<repository> | ||
<uniqueVersion>false</uniqueVersion> | ||
<id>deploy.release</id> | ||
<name>Repository for release</name> | ||
<url>${deploy-release-url}</url> | ||
</repository> | ||
<snapshotRepository> | ||
<uniqueVersion>true</uniqueVersion> | ||
<id>deploy.snapshot</id> | ||
<name>Repository for snapshot</name> | ||
<url>${deploy-snapshot-url}</url> | ||
</snapshotRepository> | ||
</distributionManagement> | ||
|
||
<build> | ||
<sourceDirectory>src/main/scala</sourceDirectory> | ||
<testSourceDirectory>src/test/scala</testSourceDirectory> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.scala-tools</groupId> | ||
<artifactId>maven-scala-plugin</artifactId> | ||
<version>2.15.0</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>compile</goal> | ||
<goal>testCompile</goal> | ||
</goals> | ||
<configuration> | ||
<args> | ||
<arg>-make:transitive</arg> | ||
<arg>-dependencyfile</arg> | ||
<arg>${project.build.directory}/.scala_dependencies</arg> | ||
</args> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>2.6</version> | ||
<configuration> | ||
<useFile>false</useFile> | ||
<disableXmlReport>true</disableXmlReport> | ||
<!-- If you have classpath issue like NoDefClassError,... --> | ||
<!-- useManifestOnlyJar>false</useManifestOnlyJar --> | ||
<includes> | ||
<include>**/*Test.*</include> | ||
<include>**/*Suite.*</include> | ||
</includes> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-report-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<configuration> | ||
<descriptorRefs> | ||
<!-- ここはこのままでOK --> | ||
<descriptorRef>jar-with-dependencies</descriptorRef> | ||
</descriptorRefs> | ||
|
||
</configuration> | ||
<executions> | ||
<!-- ここでpackageのPhaseで実行されるように設定している--> | ||
<execution> | ||
<id>make-assembly</id> <!-- this is used for inheritance merges --> | ||
<phase>package</phase> <!-- append to the packaging phase. --> | ||
<goals> | ||
<goal>single</goal> <!-- goals == mojos --> | ||
</goals> | ||
</execution> | ||
</executions> | ||
|
||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-source-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>attach-sources</id> | ||
<goals> | ||
<goal>jar</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package org.msgpack | ||
|
||
import `type`.Value | ||
import template._ | ||
import collection.mutable.{MutableList, LinkedList} | ||
import collection.mutable.{Map => MMap, HashMap => MHashMap} | ||
import java.io.InputStream | ||
; | ||
/* | ||
* Created by IntelliJ IDEA. | ||
* User: takeshita | ||
* Date: 11/03/10 | ||
* Time: 1:34 | ||
*/ | ||
|
||
object ScalaMessagePack { | ||
|
||
val messagePack = new ScalaMessagePack() | ||
|
||
def write( obj : Any) : Array[Byte] = { | ||
messagePack.write(obj) | ||
} | ||
def writeT[T](obj : T)(implicit template : Template[T]) : Array[Byte] = { | ||
messagePack.write(obj,template) | ||
} | ||
|
||
def read[T]( data : Array[Byte])(implicit manifest : Manifest[T]) : T = { | ||
messagePack.read(data, manifest.erasure.asInstanceOf[Class[T]]) | ||
} | ||
|
||
def read[T](data : InputStream)(implicit manifest : Manifest[T]) : T = { | ||
messagePack.read(data, manifest.erasure.asInstanceOf[Class[T]]) | ||
} | ||
|
||
def readTo[T](data : Array[Byte], obj : T) : T = { | ||
messagePack.read(data,obj) | ||
} | ||
|
||
def readAsValue( data : Array[Byte]) : Value = { | ||
messagePack.read(data) | ||
} | ||
|
||
|
||
|
||
|
||
} | ||
|
||
class ScalaMessagePack extends MessagePack(new ScalaTemplateRegistry()){ | ||
|
||
|
||
|
||
} |
Oops, something went wrong.