Skip to content

Commit 9cd414c

Browse files
Implemented TransactionManager
1 parent f08fa62 commit 9cd414c

3 files changed

Lines changed: 88 additions & 0 deletions

File tree

spring-data-eclipse-store/src/main/java/software/xdev/spring/data/eclipse/store/repository/support/EclipseStoreRepositoryFactoryBean.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
@ComponentScan({
3232
"software.xdev.spring.data.eclipse.store.repository",
33+
"software.xdev.spring.data.eclipse.store.transactions",
3334
"org.eclipse.store.integrations.spring.boot.types"})
3435
@Component
3536
public class EclipseStoreRepositoryFactoryBean<T extends Repository<S, ID>, S, ID extends Serializable>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
* Copyright © 2024 XDEV Software (https://xdev.software)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package software.xdev.spring.data.eclipse.store.transactions;
17+
18+
import org.springframework.beans.factory.InitializingBean;
19+
import org.springframework.stereotype.Component;
20+
import org.springframework.transaction.TransactionDefinition;
21+
import org.springframework.transaction.TransactionException;
22+
import org.springframework.transaction.support.AbstractPlatformTransactionManager;
23+
import org.springframework.transaction.support.DefaultTransactionStatus;
24+
import org.springframework.transaction.support.ResourceTransactionManager;
25+
26+
27+
@Component
28+
public class EclipseStoreTransactionManager extends AbstractPlatformTransactionManager
29+
implements ResourceTransactionManager, InitializingBean
30+
{
31+
32+
@Override
33+
public void afterPropertiesSet() throws Exception
34+
{
35+
System.out.println("trest");
36+
}
37+
38+
@Override
39+
protected Object doGetTransaction() throws TransactionException
40+
{
41+
return new EclipseStoreTransactionObject();
42+
}
43+
44+
@Override
45+
protected void doBegin(final Object transaction, final TransactionDefinition definition) throws TransactionException
46+
{
47+
System.out.println(transaction);
48+
}
49+
50+
@Override
51+
protected void doCommit(final DefaultTransactionStatus status) throws TransactionException
52+
{
53+
System.out.println(status);
54+
}
55+
56+
@Override
57+
protected void doRollback(final DefaultTransactionStatus status) throws TransactionException
58+
{
59+
System.out.println(status);
60+
}
61+
62+
@Override
63+
public Object getResourceFactory()
64+
{
65+
return null;
66+
}
67+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright © 2024 XDEV Software (https://xdev.software)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package software.xdev.spring.data.eclipse.store.transactions;
17+
18+
public class EclipseStoreTransactionObject
19+
{
20+
}

0 commit comments

Comments
 (0)