Repository: gora Updated Branches: refs/heads/master fb4ad6a47 -> f4debf25a
GORA-409 JCache datastore initial project structure commit Project: http://git-wip-us.apache.org/repos/asf/gora/repo Commit: http://git-wip-us.apache.org/repos/asf/gora/commit/2b8b0610 Tree: http://git-wip-us.apache.org/repos/asf/gora/tree/2b8b0610 Diff: http://git-wip-us.apache.org/repos/asf/gora/diff/2b8b0610 Branch: refs/heads/master Commit: 2b8b0610767f4cc51f0a393a0627b721069f052c Parents: 7325085 Author: Kevin Ratnasekera <djkevi...@yahoo.com> Authored: Sun May 29 19:17:57 2016 +0530 Committer: Kevin Ratnasekera <djkevi...@yahoo.com> Committed: Sun May 29 19:17:57 2016 +0530 ---------------------------------------------------------------------- gora-jcache/pom.xml | 154 +++++++++++++++++++ .../apache/gora/jcache/query/JCacheQuery.java | 34 ++++ .../apache/gora/jcache/query/JCacheResult.java | 53 +++++++ .../apache/gora/jcache/store/JCacheStore.java | 105 +++++++++++++ gora-jcache/src/test/resources/gora.properties | 16 ++ pom.xml | 18 +++ 6 files changed, 380 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/gora/blob/2b8b0610/gora-jcache/pom.xml ---------------------------------------------------------------------- diff --git a/gora-jcache/pom.xml b/gora-jcache/pom.xml new file mode 100644 index 0000000..a6fdf39 --- /dev/null +++ b/gora-jcache/pom.xml @@ -0,0 +1,154 @@ +<?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.gora</groupId> + <artifactId>gora</artifactId> + <version>0.7-SNAPSHOT</version> + <relativePath>../</relativePath> + </parent> + <artifactId>gora-jcache</artifactId> + <packaging>bundle</packaging> + + <name>Apache Gora :: JCache</name> + <url>http://gora.apache.org</url> + <description>The Apache Gora open source framework provides an in-memory data model and + persistence for big data. Gora supports persisting to column stores, key value stores, + document stores and RDBMSs, and analyzing the data with extensive Apache Hadoop MapReduce + support.</description> + <inceptionYear>2010</inceptionYear> + <organization> + <name>The Apache Software Foundation</name> + <url>http://www.apache.org/</url> + </organization> + <issueManagement> + <system>JIRA</system> + <url>https://issues.apache.org/jira/browse/GORA</url> + </issueManagement> + <ciManagement> + <system>Jenkins</system> + <url>https://builds.apache.org/job/Gora-trunk/</url> + </ciManagement> + + <properties> + <osgi.import>*</osgi.import> + <osgi.export>org.apache.gora.jcache*;version="${project.version}";-noimport:=true</osgi.export> + </properties> + + <build> + <directory>target</directory> + <outputDirectory>target/classes</outputDirectory> + <finalName>${project.artifactId}-${project.version}</finalName> + <testOutputDirectory>target/test-classes</testOutputDirectory> + <testSourceDirectory>src/test/java</testSourceDirectory> + <sourceDirectory>src/main/java</sourceDirectory> + <testResources> + <testResource> + <directory>${project.basedir}/src/test/resources</directory> + <includes> + <include>**/*</include> + </includes> + <!--targetPath>${project.basedir}/target/classes/</targetPath --> + </testResource> + </testResources> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>${build-helper-maven-plugin.version}</version> + <executions> + <execution> + <phase>generate-sources</phase> + <goals> + <goal>add-source</goal> + </goals> + <configuration> + <sources> + <source>src/examples/java</source> + </sources> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + + <dependencies> + <!-- Gora Internal Dependencies --> + <dependency> + <groupId>org.apache.gora</groupId> + <artifactId>gora-core</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.gora</groupId> + <artifactId>gora-core</artifactId> + <type>test-jar</type> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.avro</groupId> + <artifactId>avro</artifactId> + </dependency> + + <!-- JCache Dependencies --> + <dependency> + <groupId>com.hazelcast</groupId> + <artifactId>hazelcast-all</artifactId> + </dependency> + + <dependency> + <groupId>javax.cache</groupId> + <artifactId>cache-api</artifactId> + </dependency> + + <!-- Logging Dependencies --> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + </dependency> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <exclusions> + <exclusion> + <groupId>javax.jms</groupId> + <artifactId>jms</artifactId> + </exclusion> + </exclusions> + </dependency> + + <!-- Testing Dependencies --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.hadoop</groupId> + <artifactId>hadoop-minicluster</artifactId> + </dependency> + + </dependencies> + +</project> http://git-wip-us.apache.org/repos/asf/gora/blob/2b8b0610/gora-jcache/src/main/java/org/apache/gora/jcache/query/JCacheQuery.java ---------------------------------------------------------------------- diff --git a/gora-jcache/src/main/java/org/apache/gora/jcache/query/JCacheQuery.java b/gora-jcache/src/main/java/org/apache/gora/jcache/query/JCacheQuery.java new file mode 100644 index 0000000..0316fb7 --- /dev/null +++ b/gora-jcache/src/main/java/org/apache/gora/jcache/query/JCacheQuery.java @@ -0,0 +1,34 @@ +/** + * 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. + */ + +package org.apache.gora.jcache.query; + +import org.apache.gora.persistency.impl.PersistentBase; +import org.apache.gora.query.impl.QueryBase; +import org.apache.gora.store.DataStore; + +public class JCacheQuery<K,T extends PersistentBase> extends QueryBase<K,T> { + + public JCacheQuery() { + super(null); + } + + public JCacheQuery(DataStore<K,T> dataStore) { + super(dataStore); + } + +} http://git-wip-us.apache.org/repos/asf/gora/blob/2b8b0610/gora-jcache/src/main/java/org/apache/gora/jcache/query/JCacheResult.java ---------------------------------------------------------------------- diff --git a/gora-jcache/src/main/java/org/apache/gora/jcache/query/JCacheResult.java b/gora-jcache/src/main/java/org/apache/gora/jcache/query/JCacheResult.java new file mode 100644 index 0000000..76ef7ba --- /dev/null +++ b/gora-jcache/src/main/java/org/apache/gora/jcache/query/JCacheResult.java @@ -0,0 +1,53 @@ +/** + * 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. + */ + +package org.apache.gora.jcache.query; + +import java.io.IOException; + +import org.apache.gora.jcache.store.JCacheStore; +import org.apache.gora.persistency.impl.PersistentBase; +import org.apache.gora.query.Query; +import org.apache.gora.query.impl.ResultBase; +import org.apache.gora.store.DataStore; + +public class JCacheResult<K,T extends PersistentBase> extends ResultBase<K,T> { + + public JCacheStore<K,T> getDataStore() { + return (JCacheStore<K,T>) super.getDataStore(); + } + + public JCacheResult(DataStore<K,T> dataStore, Query<K,T> query) { + super(dataStore, query); + } + + @Override + public float getProgress() throws IOException { + return 0; + } + + @Override + public void close() throws IOException { + + } + + @Override + protected boolean nextInner() throws IOException { + return true; + } + +} http://git-wip-us.apache.org/repos/asf/gora/blob/2b8b0610/gora-jcache/src/main/java/org/apache/gora/jcache/store/JCacheStore.java ---------------------------------------------------------------------- diff --git a/gora-jcache/src/main/java/org/apache/gora/jcache/store/JCacheStore.java b/gora-jcache/src/main/java/org/apache/gora/jcache/store/JCacheStore.java new file mode 100644 index 0000000..1c52fdd --- /dev/null +++ b/gora-jcache/src/main/java/org/apache/gora/jcache/store/JCacheStore.java @@ -0,0 +1,105 @@ +/** + * 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. + */ + +package org.apache.gora.jcache.store; + +import java.io.IOException; +import java.util.List; +import java.util.Properties; + +import org.apache.gora.jcache.query.JCacheQuery; +import org.apache.gora.persistency.impl.PersistentBase; +import org.apache.gora.query.PartitionQuery; +import org.apache.gora.query.Query; +import org.apache.gora.query.Result; +import org.apache.gora.store.impl.DataStoreBase; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class JCacheStore<K,T extends PersistentBase> extends DataStoreBase<K,T> { + + + public static final Logger LOG = LoggerFactory.getLogger(JCacheStore.class); + + + @Override + public void initialize(Class<K> keyClass, Class<T> persistentClass, Properties properties) { + super.initialize(keyClass, persistentClass, properties); + } + + @Override + public String getSchemaName() { + return null; + } + + @Override + public void createSchema() { + } + + @Override + public void deleteSchema() { + } + + @Override + public boolean schemaExists() { + return false; + } + + + @Override + public T get(K key, String[] fields) { + return null; + } + + @Override + public void put(K key, T val) { + } + + @Override + public boolean delete(K key) { + return false; + } + + @Override + public long deleteByQuery(Query<K,T> query) { + return 0; + } + + @Override + public Result<K,T> execute(Query<K,T> query) { + return null; + } + + @Override + public Query<K,T> newQuery() { + return new JCacheQuery<>(this); + } + + @Override + public List<PartitionQuery<K,T>> getPartitions(Query<K,T> query) throws IOException { + return null; + } + + @Override + public void flush() { + } + + @Override + public void close() { + } + +} http://git-wip-us.apache.org/repos/asf/gora/blob/2b8b0610/gora-jcache/src/test/resources/gora.properties ---------------------------------------------------------------------- diff --git a/gora-jcache/src/test/resources/gora.properties b/gora-jcache/src/test/resources/gora.properties new file mode 100644 index 0000000..83f920a --- /dev/null +++ b/gora-jcache/src/test/resources/gora.properties @@ -0,0 +1,16 @@ +# 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. + +gora.datastore.default=org.apache.gora.jcache.store.JCacheStore http://git-wip-us.apache.org/repos/asf/gora/blob/2b8b0610/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 565f3e6..dd5fc52 100644 --- a/pom.xml +++ b/pom.xml @@ -702,6 +702,7 @@ <module>gora-goraci</module> <module>gora-hbase</module> <module>gora-infinispan</module> + <module>gora-jcache</module> <!-- module>gora-lucene</module --> <module>gora-dynamodb</module> <!--module>gora-sql</module --> @@ -759,6 +760,10 @@ <log4j.version>1.2.16</log4j.version> <slf4j.version>1.6.6</slf4j.version> + <!-- JCache Dependencies --> + <jsr107.api.version>1.0.0</jsr107.api.version> + <hazelcast.version>3.6.3</hazelcast.version> + <!-- Testing Dependencies --> <junit.version>4.10</junit.version> @@ -1456,6 +1461,19 @@ </exclusions> </dependency> + <!-- JCache Dependencies --> + <dependency> + <groupId>com.hazelcast</groupId> + <artifactId>hazelcast-all</artifactId> + <version>${hazelcast.version}</version> + </dependency> + + <dependency> + <groupId>javax.cache</groupId> + <artifactId>cache-api</artifactId> + <version>${jsr107.api.version}</version> + </dependency> + <!-- Testing Dependencies --> <dependency> <groupId>org.apache.hadoop</groupId>