Memory EntityStore: assembly and documentation
Project: http://git-wip-us.apache.org/repos/asf/zest-qi4j/repo Commit: http://git-wip-us.apache.org/repos/asf/zest-qi4j/commit/f2b9c3e6 Tree: http://git-wip-us.apache.org/repos/asf/zest-qi4j/tree/f2b9c3e6 Diff: http://git-wip-us.apache.org/repos/asf/zest-qi4j/diff/f2b9c3e6 Branch: refs/heads/master Commit: f2b9c3e620e5eaf1043b64580cc0564302b28f72 Parents: f1483cd Author: Paul Merlin <[email protected]> Authored: Wed Feb 13 12:44:05 2013 +0100 Committer: Paul Merlin <[email protected]> Committed: Wed Feb 13 12:44:05 2013 +0100 ---------------------------------------------------------------------- extensions/entitystore-memory/build.gradle | 13 ++++++ extensions/entitystore-memory/dev-status.xml | 17 +++++++ .../entitystore-memory/src/docs/es-memory.txt | 23 +++++++++ .../memory/MemoryEntityStoreAssembler.java | 49 ++++++++++++++++++++ .../org/qi4j/entitystore/memory/package.html | 5 ++ .../memory/MemoryEntityStoreTest.java | 41 ++++++++++++++++ manual/src/docs/userguide/extensions.txt | 4 ++ settings.gradle | 1 + 8 files changed, 153 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/f2b9c3e6/extensions/entitystore-memory/build.gradle ---------------------------------------------------------------------- diff --git a/extensions/entitystore-memory/build.gradle b/extensions/entitystore-memory/build.gradle new file mode 100644 index 0000000..23abd29 --- /dev/null +++ b/extensions/entitystore-memory/build.gradle @@ -0,0 +1,13 @@ +jar { manifest { name = "Qi4j Extension - EntityStore - Memory" }} + +dependencies { + + compile(project(":org.qi4j.core:org.qi4j.core.bootstrap")) + + testCompile(project(":org.qi4j.core:org.qi4j.core.testsupport")) + testCompile(project(":org.qi4j.extensions:org.qi4j.extension.valueserialization-orgjson")) + + testRuntime(project(":org.qi4j.core:org.qi4j.core.runtime")) + testRuntime(libraries.logback) + +} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/f2b9c3e6/extensions/entitystore-memory/dev-status.xml ---------------------------------------------------------------------- diff --git a/extensions/entitystore-memory/dev-status.xml b/extensions/entitystore-memory/dev-status.xml new file mode 100644 index 0000000..9af9b6b --- /dev/null +++ b/extensions/entitystore-memory/dev-status.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<module xmlns="http://www.qi4j.org/schemas/2008/dev-status/1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.qi4j.org/schemas/2008/dev-status/1 + http://www.qi4j.org/schemas/2008/dev-status/1/dev-status.xsd"> + <status> + <codebase>stable</codebase> + <!--none,early,beta,stable,mature--> + <documentation>good</documentation> + <!-- none, brief, good, complete --> + <unittests>good</unittests> + <!-- none, some, good, complete --> + </status> + <licenses> + <license>ALv2</license> + </licenses> +</module> http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/f2b9c3e6/extensions/entitystore-memory/src/docs/es-memory.txt ---------------------------------------------------------------------- diff --git a/extensions/entitystore-memory/src/docs/es-memory.txt b/extensions/entitystore-memory/src/docs/es-memory.txt new file mode 100644 index 0000000..bf88ed5 --- /dev/null +++ b/extensions/entitystore-memory/src/docs/es-memory.txt @@ -0,0 +1,23 @@ +[[extension-es-memoryl, Memory EntityStore]] += Memory EntityStore = + +[devstatus] +-------------- +source=extensions/entitystore-memory/dev-status.xml +-------------- + +EntityStore service backed by an in-memory +Map+. + +include::../../build/docs/buildinfo/artifact.txt[] + +== Assembly == + +Assembly is done as follows: + +[snippet,java] +---- +source=extensions/entitystore-memory/src/test/java/org/qi4j/entitystore/memory/MemoryEntityStoreTest.java +tag=assembly +---- + +This EntityStore has no configuration. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/f2b9c3e6/extensions/entitystore-memory/src/main/java/org/qi4j/entitystore/memory/MemoryEntityStoreAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-memory/src/main/java/org/qi4j/entitystore/memory/MemoryEntityStoreAssembler.java b/extensions/entitystore-memory/src/main/java/org/qi4j/entitystore/memory/MemoryEntityStoreAssembler.java new file mode 100644 index 0000000..918224a --- /dev/null +++ b/extensions/entitystore-memory/src/main/java/org/qi4j/entitystore/memory/MemoryEntityStoreAssembler.java @@ -0,0 +1,49 @@ +/* + * Copyright 2013 Paul Merlin. + * + * Licensed 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. + */ +package org.qi4j.entitystore.memory; + +import org.qi4j.api.common.Visibility; +import org.qi4j.bootstrap.Assembler; +import org.qi4j.bootstrap.AssemblyException; +import org.qi4j.bootstrap.ModuleAssembly; +import org.qi4j.spi.uuid.UuidIdentityGeneratorService; + +/** + * Assemble an in-memory EntityStore. + */ +public class MemoryEntityStoreAssembler + implements Assembler +{ + + private Visibility visibility = Visibility.module; + + public MemoryEntityStoreAssembler visibleIn( Visibility visibility ) + { + this.visibility = visibility; + return this; + } + + @Override + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + module.services( MemoryEntityStoreService.class, + UuidIdentityGeneratorService.class ). + visibleIn( visibility ); + } +} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/f2b9c3e6/extensions/entitystore-memory/src/main/java/org/qi4j/entitystore/memory/package.html ---------------------------------------------------------------------- diff --git a/extensions/entitystore-memory/src/main/java/org/qi4j/entitystore/memory/package.html b/extensions/entitystore-memory/src/main/java/org/qi4j/entitystore/memory/package.html new file mode 100644 index 0000000..ab810ef --- /dev/null +++ b/extensions/entitystore-memory/src/main/java/org/qi4j/entitystore/memory/package.html @@ -0,0 +1,5 @@ +<html> + <body> + <h2>In-Memory EntityStore.</h2> + </body> +</html> http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/f2b9c3e6/extensions/entitystore-memory/src/test/java/org/qi4j/entitystore/memory/MemoryEntityStoreTest.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-memory/src/test/java/org/qi4j/entitystore/memory/MemoryEntityStoreTest.java b/extensions/entitystore-memory/src/test/java/org/qi4j/entitystore/memory/MemoryEntityStoreTest.java new file mode 100644 index 0000000..9f99595 --- /dev/null +++ b/extensions/entitystore-memory/src/test/java/org/qi4j/entitystore/memory/MemoryEntityStoreTest.java @@ -0,0 +1,41 @@ +/* + * Copyright 2013 Paul Merlin. + * + * Licensed 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. + */ +package org.qi4j.entitystore.memory; + +import org.qi4j.bootstrap.AssemblyException; +import org.qi4j.bootstrap.ModuleAssembly; +import org.qi4j.test.entity.AbstractEntityStoreTest; +import org.qi4j.valueserialization.orgjson.OrgJsonValueSerializationAssembler; + +public class MemoryEntityStoreTest + extends AbstractEntityStoreTest +{ + + // START SNIPPET: assembly + @Override + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + new MemoryEntityStoreAssembler().assemble( module ); + // END SNIPPET: assembly + new OrgJsonValueSerializationAssembler().assemble( module ); + super.assemble( module ); + // START SNIPPET: assembly + } + // END SNIPPET: assembly +} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/f2b9c3e6/manual/src/docs/userguide/extensions.txt ---------------------------------------------------------------------- diff --git a/manual/src/docs/userguide/extensions.txt b/manual/src/docs/userguide/extensions.txt index e2de272..5112fe2 100644 --- a/manual/src/docs/userguide/extensions.txt +++ b/manual/src/docs/userguide/extensions.txt @@ -42,6 +42,10 @@ include::../../../../extensions/cache-ehcache/src/docs/ehcache.txt[] :leveloffset: 2 +include::../../../../extensions/entitystore-memory/src/docs/es-memory.txt[] + +:leveloffset: 2 + include::../../../../extensions/entitystore-file/src/docs/es-file.txt[] :leveloffset: 2 http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/f2b9c3e6/settings.gradle ---------------------------------------------------------------------- diff --git a/settings.gradle b/settings.gradle index e960445..0d613cb 100644 --- a/settings.gradle +++ b/settings.gradle @@ -49,6 +49,7 @@ include "core:functional", 'libraries:uid', 'libraries:uowfile', 'extensions:cache-ehcache', + 'extensions:entitystore-memory', 'extensions:entitystore-file', 'extensions:entitystore-gae', 'extensions:entitystore-hazelcast',
