From b2267419cd7d0323a9e26e104e2893d92bffce76 Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Sun, 29 Apr 2012 13:12:32 +0200 Subject: [PATCH] DATAGRAPH-229 - Upgraded to Spring Data Commons 1.3.0.BUILD-SNAPSHOT. Added removed deprecated types from Spring Data Commons that are necessary until the dependency to these types are removed from the Spring Data Neo4J codebase. --- spring-data-neo4j-parent/pom.xml | 2 +- .../data/persistence/StateBackedCreator.java | 31 +++++++++++++ .../data/persistence/StateProvider.java | 44 +++++++++++++++++++ .../data/persistence/package-info.java | 21 +++++++++ 4 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 spring-data-neo4j/src/main/java/org/springframework/data/persistence/StateBackedCreator.java create mode 100644 spring-data-neo4j/src/main/java/org/springframework/data/persistence/StateProvider.java create mode 100644 spring-data-neo4j/src/main/java/org/springframework/data/persistence/package-info.java diff --git a/spring-data-neo4j-parent/pom.xml b/spring-data-neo4j-parent/pom.xml index 8c788b7338..c02186b612 100644 --- a/spring-data-neo4j-parent/pom.xml +++ b/spring-data-neo4j-parent/pom.xml @@ -126,7 +126,7 @@ 3.0.7.RELEASE 4.0.0.RELEASE [${org.springframework.version.30}, ${org.springframework.version.40}) - 1.3.0.RC1 + 1.3.0.BUILD-SNAPSHOT 1.7 0.8-SNAPSHOT 1.6.12 diff --git a/spring-data-neo4j/src/main/java/org/springframework/data/persistence/StateBackedCreator.java b/spring-data-neo4j/src/main/java/org/springframework/data/persistence/StateBackedCreator.java new file mode 100644 index 0000000000..b906a8f8aa --- /dev/null +++ b/spring-data-neo4j/src/main/java/org/springframework/data/persistence/StateBackedCreator.java @@ -0,0 +1,31 @@ +/** + * Copyright 2011 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 + * + * 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.springframework.data.persistence; + +import org.springframework.data.convert.EntityInstantiator; + +/** + * encapsulates the instantiator of state-backed classes and populating them with the provided state. + *

+ * Can be implemented and registered with the concrete AbstractConstructorEntityInstantiator to provide non reflection + * bases instantiaton for domain classes + * + * @deprecated use {@link EntityInstantiator} abstraction instead. + */ +@Deprecated +public interface StateBackedCreator { + T create(STATE n, Class c) throws Exception; +} diff --git a/spring-data-neo4j/src/main/java/org/springframework/data/persistence/StateProvider.java b/spring-data-neo4j/src/main/java/org/springframework/data/persistence/StateProvider.java new file mode 100644 index 0000000000..832b8e4e40 --- /dev/null +++ b/spring-data-neo4j/src/main/java/org/springframework/data/persistence/StateProvider.java @@ -0,0 +1,44 @@ +/** + * Copyright 2011 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 + * + * 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.springframework.data.persistence; + +import org.springframework.data.convert.EntityInstantiator; + +/** + * @author Michael Hunger + * @since 24.09.2010 + * @deprecated use {@link EntityInstantiator} abstraction instead + */ +@Deprecated +public abstract class StateProvider { + private final static ThreadLocal stateHolder = new ThreadLocal(); + + private StateProvider() { + } + + public static void setUnderlyingState(STATE state) { + if (stateHolder.get() != null) + throw new IllegalStateException("StateHolder already contains state " + stateHolder.get() + " in thread " + + Thread.currentThread()); + stateHolder.set(state); + } + + public static STATE retrieveState() { + STATE result = (STATE) stateHolder.get(); + stateHolder.remove(); + return result; + } +} diff --git a/spring-data-neo4j/src/main/java/org/springframework/data/persistence/package-info.java b/spring-data-neo4j/src/main/java/org/springframework/data/persistence/package-info.java new file mode 100644 index 0000000000..9f1427b1a8 --- /dev/null +++ b/spring-data-neo4j/src/main/java/org/springframework/data/persistence/package-info.java @@ -0,0 +1,21 @@ +/** + * Copyright 2011 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 + * + * 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. + */ +/** + * Deprecated entity instantiation API. + * + * @deprecated Use entity instantation API around {@link org.springframework.data.convert.EntityInstantiator} instead. + */ +package org.springframework.data.persistence; \ No newline at end of file