EMMA Coverage Report (generated Thu May 22 12:08:10 CDT 2014)
[all classes][org.springframework.batch.item.data]

COVERAGE SUMMARY FOR SOURCE FILE [GemfireItemWriter.java]

nameclass, %method, %block, %line, %
GemfireItemWriter.java100% (1/1)100% (4/4)100% (28/28)100% (9/9)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class GemfireItemWriter100% (1/1)100% (4/4)100% (28/28)100% (9/9)
GemfireItemWriter (): void 100% (1/1)100% (3/3)100% (1/1)
init (): void 100% (1/1)100% (5/5)100% (2/2)
setTemplate (GemfireTemplate): void 100% (1/1)100% (4/4)100% (2/2)
writeKeyValue (Object, Object): void 100% (1/1)100% (16/16)100% (4/4)

1/*
2 * Copyright 2002-2013 the original author or authors.
3 * 
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5 * the License. You may obtain a copy of the License at
6 * 
7 * http://www.apache.org/licenses/LICENSE-2.0
8 * 
9 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11 * specific language governing permissions and limitations under the License.
12 */
13package org.springframework.batch.item.data;
14 
15import org.springframework.batch.item.ItemWriter;
16import org.springframework.batch.item.KeyValueItemWriter;
17import org.springframework.data.gemfire.GemfireOperations;
18import org.springframework.data.gemfire.GemfireTemplate;
19import org.springframework.util.Assert;
20 
21/**
22 * An {@link ItemWriter} that stores items in GemFire
23 * 
24 * @author David Turanski
25 * @since 2.2
26 *
27 */
28public class GemfireItemWriter<K,V> extends KeyValueItemWriter<K,V> {
29        private GemfireOperations gemfireTemplate;
30        /**
31         * @param gemfireTemplate the {@link GemfireTemplate} to set
32         */
33        public void setTemplate(GemfireTemplate gemfireTemplate) {
34                this.gemfireTemplate = gemfireTemplate;
35        }
36 
37        /* (non-Javadoc)
38         * @see org.springframework.batch.item.KeyValueItemWriter#writeKeyValue(java.lang.Object, java.lang.Object)
39         */
40        @Override
41        protected void writeKeyValue(K key, V value) {
42                if (delete) {
43                        gemfireTemplate.remove(key);
44                } else {
45                        gemfireTemplate.put(key, value);
46                }
47        }
48 
49        /* (non-Javadoc)
50         * @see org.springframework.batch.item.KeyValueItemWriter#init()
51         */
52        @Override
53        protected void init() {
54                Assert.notNull(gemfireTemplate, "A GemfireTemplate is required.");
55        }
56 
57}

[all classes][org.springframework.batch.item.data]
EMMA 2.0.5312 (C) Vladimir Roubtsov