diff --git a/src/main/java/org/springframework/data/aerospike/config/AerospikeClientBeanDefinitionParser.java b/src/main/java/org/springframework/data/aerospike/config/AerospikeClientBeanDefinitionParser.java deleted file mode 100644 index a7332f74..00000000 --- a/src/main/java/org/springframework/data/aerospike/config/AerospikeClientBeanDefinitionParser.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2015 the original author or authors. - * - * 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 - * - * https://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.springframework.data.aerospike.config; - -import com.aerospike.client.AerospikeClient; -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.beans.factory.support.BeanDefinitionBuilder; -import org.springframework.beans.factory.xml.BeanDefinitionParser; -import org.springframework.beans.factory.xml.ParserContext; -import org.springframework.data.config.ParsingUtils; -import org.springframework.util.xml.DomUtils; -import org.w3c.dom.Element; - -/** - * @author Oliver Gierke - */ -public class AerospikeClientBeanDefinitionParser implements BeanDefinitionParser { - - private final ClientPolicyBeanDefinitionParser clientPolicyParser = new ClientPolicyBeanDefinitionParser(); - - @Override - public BeanDefinition parse(Element element, ParserContext parserContext) { - BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(AerospikeClient.class); - builder.addConstructorArgValue(element.getAttribute("host")); - builder.addConstructorArgValue(element.getAttribute("port")); - builder.setDestroyMethodName("close"); - - parserContext.getRegistry().registerBeanDefinition("aerospikeClient", - ParsingUtils.getSourceBeanDefinition(builder, parserContext, element)); - - parseNestedClientPolicy(element, parserContext, builder); - - return null; - } - - /** - * Looks up a nested {@code client-policy} element within the given one and passes a {@link BeanDefinition} from - * it. - * - * @param element the current {@code client} element, must not be {@literal null}. - * @param parserContext must not be {@literal null}. - * @param builder must not be {@literal null}. - */ - private void parseNestedClientPolicy(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { - Element clientPolicyElement = DomUtils.getChildElementByTagName(element, "client-policy"); - - if (clientPolicyElement != null) { - BeanDefinition policyDefinition = clientPolicyParser.parse(clientPolicyElement, parserContext); - builder.addConstructorArgValue(policyDefinition); - } - } -} diff --git a/src/main/java/org/springframework/data/aerospike/config/BatchPolicyBeanDefinitionParser.java b/src/main/java/org/springframework/data/aerospike/config/BatchPolicyBeanDefinitionParser.java deleted file mode 100644 index 497714a1..00000000 --- a/src/main/java/org/springframework/data/aerospike/config/BatchPolicyBeanDefinitionParser.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2015 the original author or authors. - * - * 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 - * - * https://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.springframework.data.aerospike.config; - -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.beans.factory.support.BeanDefinitionBuilder; -import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser; -import org.springframework.beans.factory.xml.BeanDefinitionParser; -import org.springframework.data.config.ParsingUtils; -import org.w3c.dom.Element; - -/** - * {@link BeanDefinitionParser} to create a {@link BeanDefinition} for a {@link BatchPolicyFactoryBean}. - * - * @author Peter Milne - */ -public class BatchPolicyBeanDefinitionParser extends AbstractSingleBeanDefinitionParser { - - @Override - protected Class getBeanClass(Element element) { - return BatchPolicyFactoryBean.class; - } - - @Override - protected void doParse(Element element, BeanDefinitionBuilder builder) { - ParsingUtils.setPropertyValue(builder, element, "max-concurrent-threads"); - } -} diff --git a/src/main/java/org/springframework/data/aerospike/config/BatchPolicyFactoryBean.java b/src/main/java/org/springframework/data/aerospike/config/BatchPolicyFactoryBean.java deleted file mode 100644 index 32f95d93..00000000 --- a/src/main/java/org/springframework/data/aerospike/config/BatchPolicyFactoryBean.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2015 the original author or authors. - * - * 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 - * - * https://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.springframework.data.aerospike.config; - -import com.aerospike.client.policy.BatchPolicy; -import org.springframework.beans.factory.FactoryBean; - -/** - * A {@link FactoryBean} implementation that exposes the setters necessary to configure a {@link BatchPolicy} via XML. - * - * @author Peter Milne - */ -public class BatchPolicyFactoryBean extends ReadPolicyFactoryBean { - - private final BatchPolicy policy; - - /** - * Creates a new {@link BatchPolicyFactoryBean}. - */ - public BatchPolicyFactoryBean() { - this.policy = new BatchPolicy(); - } - - /** - * Configures the maximum number of concurrent batch request threads to server nodes at any point in time - * - * @param maxConcurrentThreads The maxConcurrentThreads configuration value. - */ - public void setMaxConcurrentThreads(int maxConcurrentThreads) { - this.policy.maxConcurrentThreads = maxConcurrentThreads; - } - - @Override - public BatchPolicy getObject() throws Exception { - return policy; - } - - @Override - public boolean isSingleton() { - return false; - } - - @Override - public Class getObjectType() { - return BatchPolicy.class; - } -} diff --git a/src/main/java/org/springframework/data/aerospike/config/ClientPolicyBeanDefinitionParser.java b/src/main/java/org/springframework/data/aerospike/config/ClientPolicyBeanDefinitionParser.java deleted file mode 100644 index b7b5f48d..00000000 --- a/src/main/java/org/springframework/data/aerospike/config/ClientPolicyBeanDefinitionParser.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2015 the original author or authors. - * - * 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 - * - * https://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.springframework.data.aerospike.config; - -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.beans.factory.support.BeanDefinitionBuilder; -import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser; -import org.springframework.beans.factory.xml.BeanDefinitionParser; -import org.springframework.data.config.ParsingUtils; -import org.w3c.dom.Element; - -/** - * {@link BeanDefinitionParser} to create a {@link BeanDefinition} for a {@link ClientPolicyFactoryBean}. - * - * @author Oliver Gierke - * @author Peter Milne - */ -public class ClientPolicyBeanDefinitionParser extends AbstractSingleBeanDefinitionParser { - - @Override - protected Class getBeanClass(Element element) { - return ClientPolicyFactoryBean.class; - } - - @Override - protected void doParse(Element element, BeanDefinitionBuilder builder) { - ParsingUtils.setPropertyValue(builder, element, "maxThreads"); - ParsingUtils.setPropertyValue(builder, element, "timeOut"); - } -} diff --git a/src/main/java/org/springframework/data/aerospike/config/ClientPolicyFactoryBean.java b/src/main/java/org/springframework/data/aerospike/config/ClientPolicyFactoryBean.java deleted file mode 100644 index 16521c20..00000000 --- a/src/main/java/org/springframework/data/aerospike/config/ClientPolicyFactoryBean.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright 2015 the original author or authors. - * - * 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 - * - * https://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.springframework.data.aerospike.config; - -import com.aerospike.client.policy.BatchPolicy; -import com.aerospike.client.policy.ClientPolicy; -import com.aerospike.client.policy.Policy; -import com.aerospike.client.policy.QueryPolicy; -import com.aerospike.client.policy.ScanPolicy; -import com.aerospike.client.policy.WritePolicy; -import org.springframework.beans.factory.FactoryBean; - -/** - * A {@link FactoryBean} implementation that exposes the setters necessary to configure a {@link ClientPolicy} via XML. - * - * @author Peter Milne - */ -public class ClientPolicyFactoryBean implements FactoryBean { - - private final ClientPolicy policy; - - /** - * Creates a new {@link ClientPolicyFactoryBean}. - */ - public ClientPolicyFactoryBean() { - this.policy = new ClientPolicy(); - } - - /** - * Configures the maximum number of connections for operation processing. This value is used to size the synchronous - * connection pool for each server node. - * - * @param maxConnsPerNode The maxConnsPerNode configuration value. - */ - public void setMaxConnsPerNode(int maxConnsPerNode) { - this.policy.maxConnsPerNode = maxConnsPerNode; - } - - /** - * Configures the timeout for a client connection when opening a connection to the server host for the first time. - * - * @param timeout The timeout configuration value. - */ - public void setTimeout(int timeout) { - this.policy.timeout = timeout; - } - - /** - * Configures the maximum socket idle time for the client. Socket connection pools will discard sockets that have - * been idle longer than the maximum - * - * @param maxSocketIdle The maxSocketIdle configuration value. - */ - public void setMaxSocketIdle(int maxSocketIdle) { - this.policy.maxSocketIdle = maxSocketIdle; - } - - /** - * Configures the action if the client cannot connect to a host. If true the client will throw exception if host - * connection fails during connection. - * - * @param failIfNotConnected The failIfNotConnected configuration value. - */ - public void failIfNotConnected(boolean failIfNotConnected) { - this.policy.failIfNotConnected = failIfNotConnected; - } - - /** - * Configures the tendInterval, in milliseconds, between cluster tends, by maintenance thread. - * - * @param tendInterval The tendInterval configuration value. - */ - public void setTendInterval(int tendInterval) { - this.policy.tendInterval = tendInterval; - } - - /** - * Configures the default read policy - * - * @param readPolicy The readPolicy configuration value. - */ - public void setReadPolicyDefault(Policy readPolicy) { - this.policy.readPolicyDefault = readPolicy; - } - - /** - * Configures the default write policy - * - * @param writePolicy The writePolicy configuration value. - */ - public void setWritePolicyDefault(WritePolicy writePolicy) { - this.policy.writePolicyDefault = writePolicy; - } - - /** - * Configures the default scan policy - * - * @param scanPolicy The scanPolicy configuration value. - */ - public void setScanPolicyDefault(ScanPolicy scanPolicy) { - this.policy.scanPolicyDefault = scanPolicy; - } - - /** - * Configures the default batch policy - * - * @param batchPolicy The batchPolicy configuration value. - */ - public void setBatchPolicyDefault(BatchPolicy batchPolicy) { - this.policy.batchPolicyDefault = batchPolicy; - } - - /** - * Configures the default query policy - * - * @param queryPolicy The queryPolicy configuration value. - */ - public void setQueryPolicyDefault(QueryPolicy queryPolicy) { - this.policy.queryPolicyDefault = queryPolicy; - } - - /** - * Configures the username for authentication to cluster. Only used for clusters running with security enabled. - * - * @param user The user configuration value. - */ - public void setUser(String user) { - this.policy.user = user; - } - - /** - * Configures the User password for authentication to cluster. Only used for clusters running with security - * enabled. - * - * @param password The password configuration value. - */ - public void setPassword(String password) { - this.policy.password = password; - } - - @Override - public ClientPolicy getObject() throws Exception { - return policy; - } - - @Override - public boolean isSingleton() { - return false; - } - - @Override - public Class getObjectType() { - return ClientPolicy.class; - } -} diff --git a/src/main/java/org/springframework/data/aerospike/config/QueryPolicyBeanDefinitionParser.java b/src/main/java/org/springframework/data/aerospike/config/QueryPolicyBeanDefinitionParser.java deleted file mode 100644 index 19d00015..00000000 --- a/src/main/java/org/springframework/data/aerospike/config/QueryPolicyBeanDefinitionParser.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2015 the original author or authors. - * - * 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 - * - * https://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.springframework.data.aerospike.config; - -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.beans.factory.support.BeanDefinitionBuilder; -import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser; -import org.springframework.beans.factory.xml.BeanDefinitionParser; -import org.springframework.data.config.ParsingUtils; -import org.w3c.dom.Element; - -/** - * {@link BeanDefinitionParser} to create a {@link BeanDefinition} for a {@link QueryPolicyFactoryBean}. - * - * @author Peter Milne - */ -public class QueryPolicyBeanDefinitionParser extends AbstractSingleBeanDefinitionParser { - - @Override - protected Class getBeanClass(Element element) { - return QueryPolicyFactoryBean.class; - } - - @Override - protected void doParse(Element element, BeanDefinitionBuilder builder) { - ParsingUtils.setPropertyValue(builder, element, "max-concurrent-threads"); - } -} diff --git a/src/main/java/org/springframework/data/aerospike/config/QueryPolicyFactoryBean.java b/src/main/java/org/springframework/data/aerospike/config/QueryPolicyFactoryBean.java deleted file mode 100644 index 22ff90da..00000000 --- a/src/main/java/org/springframework/data/aerospike/config/QueryPolicyFactoryBean.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2015 the original author or authors. - * - * 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 - * - * https://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.springframework.data.aerospike.config; - -import com.aerospike.client.policy.QueryPolicy; -import org.springframework.beans.factory.FactoryBean; - -/** - * A {@link FactoryBean} implementation that exposes the setters necessary to configure a {@link QueryPolicy} via XML. - * - * @author Peter Milne - */ -public class QueryPolicyFactoryBean extends ReadPolicyFactoryBean { - - private final QueryPolicy policy; - - /** - * Creates a new {@link QueryPolicyFactoryBean}. - */ - public QueryPolicyFactoryBean() { - this.policy = new QueryPolicy(); - } - - /** - * Configures the maximum number of concurrent requests to server nodes at any point in time. If there are 16 nodes - * in the cluster and maxConcurrentNodes is 8, then queries will be made to 8 nodes in parallel. When a query - * completes, a new query will be issued until all 16 nodes have been queried. Default (0) is to issue requests to - * all server nodes in parallel. - * - * @param maxConcurrentNodes The maxConcurrentNodes configuration value. - */ - public void setMaxConcurrentNodes(int maxConcurrentNodes) { - this.policy.maxConcurrentNodes = maxConcurrentNodes; - } - - /** - * Configure the number of records to place in queue before blocking. Records received from multiple server nodes - * will be placed in a queue. A separate thread consumes these records in parallel. If the queue is full, the - * producer threads will block until records are consumed. - * - * @param recordQueueSize The recordQueueSize configuration value. - */ - public void setRecordQueueSize(int recordQueueSize) { - this.policy.recordQueueSize = recordQueueSize; - } - - @Override - public QueryPolicy getObject() throws Exception { - return policy; - } - - @Override - public boolean isSingleton() { - return false; - } - - @Override - public Class getObjectType() { - return QueryPolicy.class; - } -} diff --git a/src/main/java/org/springframework/data/aerospike/config/ReadPolicyBeanDefinitionParser.java b/src/main/java/org/springframework/data/aerospike/config/ReadPolicyBeanDefinitionParser.java deleted file mode 100644 index fd0d072c..00000000 --- a/src/main/java/org/springframework/data/aerospike/config/ReadPolicyBeanDefinitionParser.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2015 the original author or authors. - * - * 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 - * - * https://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.springframework.data.aerospike.config; - -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.beans.factory.support.BeanDefinitionBuilder; -import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser; -import org.springframework.beans.factory.xml.BeanDefinitionParser; -import org.springframework.data.config.ParsingUtils; -import org.w3c.dom.Element; - -/** - * {@link BeanDefinitionParser} to create a {@link BeanDefinition} for a {@link ReadPolicyFactoryBean}. - * - * @author Peter Milne - */ -public class ReadPolicyBeanDefinitionParser extends AbstractSingleBeanDefinitionParser { - - @Override - protected Class getBeanClass(Element element) { - return ReadPolicyFactoryBean.class; - } - - @Override - protected void doParse(Element element, BeanDefinitionBuilder builder) { - ParsingUtils.setPropertyValue(builder, element, "max-concurrent-threads"); - } -} diff --git a/src/main/java/org/springframework/data/aerospike/config/ReadPolicyFactoryBean.java b/src/main/java/org/springframework/data/aerospike/config/ReadPolicyFactoryBean.java deleted file mode 100644 index 4bb6eee9..00000000 --- a/src/main/java/org/springframework/data/aerospike/config/ReadPolicyFactoryBean.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2015 the original author or authors. - * - * 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 - * - * https://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.springframework.data.aerospike.config; - -import com.aerospike.client.policy.Policy; -import org.springframework.beans.factory.FactoryBean; - -/** - * A {@link FactoryBean} implementation that exposes the setters necessary to configure a read policy via XML. - * - * @author Peter Milne - */ -public class ReadPolicyFactoryBean implements FactoryBean { - - private final Policy policy; - - /** - * Creates a new {@link ReadPolicyFactoryBean}. - */ - public ReadPolicyFactoryBean() { - this.policy = new Policy(); - } - - /** - * Configures the timeout for each transaction attempt of an operation. - * - * @param socketTimeout The socketTimeout configuration value. - */ - public void setSocketTimeout(int socketTimeout) { - this.policy.socketTimeout = socketTimeout; - } - - /** - * Configures the timeout for an operation. - * - * @param totalTimeout The totalTimeout configuration value. - */ - public void setTotalTimeout(int totalTimeout) { - this.policy.totalTimeout = totalTimeout; - } - - /** - * Configures the maximum number of retries before aborting the current transaction. A retry is attempted when there - * is a network error other than timeout. If maxRetries is exceeded, the abort will occur even if the timeout has - * not yet been exceeded. The default number of retries is 1. - * - * @param maxRetries The maxRetries configuration value. - */ - public void setMaxRetries(int maxRetries) { - this.policy.maxRetries = maxRetries; - } - - /** - * Configures the sleep between retries if a transaction fails and the timeout was not exceeded. Enter zero to skip - * sleep. The default sleep between retries is 500 ms. - * - * @param sleepBetweenRetries The sleepBetweenRetries configuration value. - */ - public void setSleepBetweenRetries(int sleepBetweenRetries) { - this.policy.sleepBetweenRetries = sleepBetweenRetries; - } - - @Override - public Policy getObject() throws Exception { - return policy; - } - - @Override - public boolean isSingleton() { - return false; - } - - @Override - public Class getObjectType() { - return Policy.class; - } -} diff --git a/src/main/java/org/springframework/data/aerospike/config/ScanPolicyBeanDefinitionParser.java b/src/main/java/org/springframework/data/aerospike/config/ScanPolicyBeanDefinitionParser.java deleted file mode 100644 index e12d976a..00000000 --- a/src/main/java/org/springframework/data/aerospike/config/ScanPolicyBeanDefinitionParser.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2015 the original author or authors. - * - * 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 - * - * https://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.springframework.data.aerospike.config; - -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.beans.factory.support.BeanDefinitionBuilder; -import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser; -import org.springframework.beans.factory.xml.BeanDefinitionParser; -import org.springframework.data.config.ParsingUtils; -import org.w3c.dom.Element; - -/** - * {@link BeanDefinitionParser} to create a {@link BeanDefinition} for a {@link QueryPolicyFactoryBean}. - * - * @author Peter Milne - */ -public class ScanPolicyBeanDefinitionParser extends AbstractSingleBeanDefinitionParser { - - @Override - protected Class getBeanClass(Element element) { - return QueryPolicyFactoryBean.class; - } - - @Override - protected void doParse(Element element, BeanDefinitionBuilder builder) { - ParsingUtils.setPropertyValue(builder, element, "max-concurrent-threads"); - } -} diff --git a/src/main/java/org/springframework/data/aerospike/config/ScanPolicyFactoryBean.java b/src/main/java/org/springframework/data/aerospike/config/ScanPolicyFactoryBean.java deleted file mode 100644 index ffae3ec8..00000000 --- a/src/main/java/org/springframework/data/aerospike/config/ScanPolicyFactoryBean.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2015 the original author or authors. - * - * 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 - * - * https://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.springframework.data.aerospike.config; - -import com.aerospike.client.policy.ScanPolicy; -import org.springframework.beans.factory.FactoryBean; - -/** - * A {@link FactoryBean} implementation that exposes the setters necessary to configure a {@link ScanPolicy} via XML. - * - * @author Peter Milne - */ -public class ScanPolicyFactoryBean extends ReadPolicyFactoryBean { - - private final ScanPolicy policy; - - /** - * Creates a new {@link ScanPolicyFactoryBean}. - */ - public ScanPolicyFactoryBean() { - this.policy = new ScanPolicy(); - } - - /** - * Configures scan requests to be issued in parallel or serially. - * - * @param concurrentNodes The concurrentNodes configuration value. - */ - public void setConcurrentNodes(boolean concurrentNodes) { - this.policy.concurrentNodes = concurrentNodes; - } - - /** - * Indicates if bin data is retrieved. If false, only record digests are retrieved. - * - * @param includeBinData The includeBinData configuration value. - */ - public void setIncludeBinData(boolean includeBinData) { - this.policy.includeBinData = includeBinData; - } - - /** - * Configures the maximum number of concurrent requests to server nodes at any point in time. If there are 16 nodes - * in the cluster and maxConcurrentNodes is 8, then scan requests will be made to 8 nodes in parallel. When a scan - * completes, a new scan request will be issued until all 16 nodes have been scanned. - *

- * This property is only relevant when concurrentNodes is true. Default (0) is to issue requests to all server nodes - * in parallel. - * - * @param maxConcurrentNodes The maxConcurrentNodes configuration value. - */ - public void setMaxConcurrentNodes(int maxConcurrentNodes) { - this.policy.maxConcurrentNodes = maxConcurrentNodes; - } - - @Override - public ScanPolicy getObject() throws Exception { - return policy; - } - - @Override - public boolean isSingleton() { - return false; - } - - @Override - public Class getObjectType() { - return ScanPolicy.class; - } -} diff --git a/src/main/java/org/springframework/data/aerospike/config/WritePolicyBeanDefinitionParser.java b/src/main/java/org/springframework/data/aerospike/config/WritePolicyBeanDefinitionParser.java deleted file mode 100644 index 15908686..00000000 --- a/src/main/java/org/springframework/data/aerospike/config/WritePolicyBeanDefinitionParser.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2015 the original author or authors. - * - * 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 - * - * https://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.springframework.data.aerospike.config; - -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.beans.factory.support.BeanDefinitionBuilder; -import org.springframework.beans.factory.xml.BeanDefinitionParser; -import org.springframework.data.config.ParsingUtils; -import org.w3c.dom.Element; - -/** - * {@link BeanDefinitionParser} to create a {@link BeanDefinition} for a {@link WritePolicyFactoryBean}. - * - * @author Peter Milne - */ -public class WritePolicyBeanDefinitionParser extends ReadPolicyBeanDefinitionParser { - - @Override - protected Class getBeanClass(Element element) { - return WritePolicyFactoryBean.class; - } - - @Override - protected void doParse(Element element, BeanDefinitionBuilder builder) { - ParsingUtils.setPropertyValue(builder, element, "max-concurrent-threads"); - } -} diff --git a/src/main/java/org/springframework/data/aerospike/config/WritePolicyFactoryBean.java b/src/main/java/org/springframework/data/aerospike/config/WritePolicyFactoryBean.java deleted file mode 100644 index ee156a3a..00000000 --- a/src/main/java/org/springframework/data/aerospike/config/WritePolicyFactoryBean.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2015 the original author or authors. - * - * 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 - * - * https://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.springframework.data.aerospike.config; - -import com.aerospike.client.policy.CommitLevel; -import com.aerospike.client.policy.GenerationPolicy; -import com.aerospike.client.policy.RecordExistsAction; -import com.aerospike.client.policy.WritePolicy; -import org.springframework.beans.factory.FactoryBean; - -/** - * A {@link FactoryBean} implementation that exposes the setters necessary to configure a read policy via XML. - * - * @author Peter Milne - */ -public class WritePolicyFactoryBean extends ReadPolicyFactoryBean { - - private final WritePolicy policy; - - /** - * Creates a new {@link WritePolicyFactoryBean}. - */ - public WritePolicyFactoryBean() { - this.policy = new WritePolicy(); - } - - /** - * Configures consistency guarantee when committing a transaction on the server. The default (COMMIT_ALL) indicates - * that the server should wait for master and all replica commits to be successful before returning success to the - * client. - * - * @param commitLevel The commitLevel configuration value. - */ - public void setCommitLevel(CommitLevel commitLevel) { - this.policy.commitLevel = commitLevel; - } - - /** - * Configures Record expiration. Also known as ttl (time to live). Seconds record will live before being removed by - * the server. - * - * @param expiration The expiration configuration value. - */ - public void setExpiration(int expiration) { - this.policy.expiration = expiration; - } - - /** - * Configures the expected generation. Generation is the number of times a record has been modified (including - * creation) on the server. If a write operation is creating a record, the expected generation would be - * 0. - * - * @param generation The generation configuration value. - */ - public void setGeneration(int generation) { - this.policy.generation = generation; - } - - /** - * Configure how to handle record writes based on record generation. The default (NONE) indicates that the - * generation is not used to restrict writes. - * - * @param generationPolicy The generationPolicy configuration value. - */ - public void setGenerationPolicy(GenerationPolicy generationPolicy) { - this.policy.generationPolicy = generationPolicy; - } - - /** - * QConfigure how to handle writes where the record already exists. - * - * @param recordExistsAction The recordExistsAction configuration value. - */ - public void setRecordExistsAction(RecordExistsAction recordExistsAction) { - this.policy.recordExistsAction = recordExistsAction; - } - - /** - * Configure sending the user defined key in addition to hash digest on a record put. The default is to not send the - * user defined key. - * - * @param sendKey The sendKey configuration value. - */ - public void setSendKey(boolean sendKey) { - this.policy.sendKey = sendKey; - } - - @Override - public WritePolicy getObject() throws Exception { - return policy; - } - - @Override - public boolean isSingleton() { - return false; - } - - @Override - public Class getObjectType() { - return WritePolicy.class; - } -}