--- /dev/null
+package de.spring.example;
+
+import java.util.Map;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.generic.GenericBeanFactoryAccessor;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+
+
+public class AnnotationsHandler implements ApplicationContextAware, InitializingBean {
+ private ApplicationContext applicationContext;
+
+ @Override
+ public void afterPropertiesSet() {
+ GenericBeanFactoryAccessor genericBeanFactoryAccessor = new GenericBeanFactoryAccessor(applicationContext);
+
+ final Map<String, Object> transactionalClass = genericBeanFactoryAccessor.getBeansWithAnnotation(TransactionalN2A.class);
+
+ for (final Object myFoo : transactionalClass.values()) {
+ final Class<? extends Object> fooClass = myFoo.getClass();
+ final TransactionalN2A annotation = fooClass.getAnnotation(TransactionalN2A.class);
+ System.out.println("Found 1 foo class: " + fooClass + ", with tags: ");
+ }
+ }
+
+ @Override
+ public void setApplicationContext(final ApplicationContext applicationContext)
+ throws BeansException {
+ this.applicationContext = applicationContext;
+ }
+ }
+
--- /dev/null
+package de.spring.example;
+
+import es.dia.pos.n2a.aspectj.annotations.TransactionalN2A;
+
+
+public class Prueba {
+ public void bar(){
+ System.out.println("I am not a number, I am a free man!");
+ }
+
+ @TransactionalN2A
+ public class InnerService {
+ public void innerMethod() {
+ System.out.println("xxx: AopService$InnerClass.innerMethod()");
+ }
+ }
+
+}
+
--- /dev/null
+package de.spring.example;
+
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+
+/**
+ * Localizador de beans para de los dispositivos
+ *
+ * @author rvp001es
+ */
+public final class SpringContextLocator {
+
+
+ // Singleton Pattern
+ private static SpringContextLocator instance;
+
+ // Spring ApplicationContext
+ private static ApplicationContext context;
+
+ // Dispositivos logicos
+ private static final String SPRING_CONFIG_CONTEXT="spring-config.xml";
+ //private static final String DATABASE_CONFIG="database-config.xml";
+
+
+ /**
+ * Private constructor. Singleton pattern.
+ */
+ private SpringContextLocator() {
+ String[] factoryFiles = null;
+ System.out.println("Loading files context " +
+ SpringContextLocator.SPRING_CONFIG_CONTEXT);
+
+ factoryFiles = new String[] { SPRING_CONFIG_CONTEXT };
+
+ SpringContextLocator.context = new ClassPathXmlApplicationContext(factoryFiles);
+
+ System.out.println("The N2A devices context and test " +
+ "context has been loaded successfully!! ");
+ }
+
+ /**
+ * Singleton pattern. GetInstance()
+ */
+ public synchronized static SpringContextLocator getInstance() {
+ if (SpringContextLocator.instance == null) {
+ SpringContextLocator.instance = new SpringContextLocator();
+ }
+ return SpringContextLocator.instance;
+ }
+
+ /**
+ * Return a bean in application context.
+ */
+ public Object getBean(final String name) {
+ return SpringContextLocator.context.getBean(name);
+ }
+}
--- /dev/null
+package de.spring.example;
+
+
+public class SpringStart {
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ System.out.println("HOLA");
+ SpringContextLocator.getInstance();
+
+ }
+
+}
--- /dev/null
+package de.spring.example;
+
+import org.springframework.jdbc.datasource.DataSourceTransactionManager;
+import org.springframework.transaction.TransactionStatus;
+
+
+public class TransactionManagerN2A {
+ private static TransactionManagerN2A instance = new TransactionManagerN2A();
+ private DataSourceTransactionManager transactionManager;
+ private TransactionStatus transactionStatus;
+
+ //Why could you want to extend this class?
+ private TransactionManagerN2A() {}
+
+ public static TransactionManagerN2A getInstance() {
+ return instance;
+ }
+
+ public void initTransaction()
+ {
+ transactionStatus = this.transactionManager.getTransaction(null);
+ }
+
+ public void rollbackTransaction()
+ {
+ this.transactionManager.rollback(this.transactionStatus);
+ }
+
+ public void commitTransaction()
+ {
+ this.transactionManager.commit(this.transactionStatus);
+ }
+
+
+ /************************* Setters and getters *******************************************/
+ public void setTransactionManager(final DataSourceTransactionManager transactionManager)
+ {
+ this.transactionManager = transactionManager;
+ }
+}
+
--- /dev/null
+/**
+ *
+ */
+package de.spring.example;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import org.springframework.stereotype.Component;
+
+
+@Retention(RetentionPolicy.RUNTIME)
+@Component
+public @interface TransactionalN2A {
+}
+++ /dev/null
-package de.spring.example;
-
-import java.util.Map;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.beans.factory.generic.GenericBeanFactoryAccessor;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-
-
-public class AnnotationsHandler implements ApplicationContextAware, InitializingBean {
- private ApplicationContext applicationContext;
-
- @Override
- public void afterPropertiesSet() {
- GenericBeanFactoryAccessor genericBeanFactoryAccessor = new GenericBeanFactoryAccessor(applicationContext);
-
- final Map<String, Object> transactionalClass = genericBeanFactoryAccessor.getBeansWithAnnotation(TransactionalN2A.class);
-
- for (final Object myFoo : transactionalClass.values()) {
- final Class<? extends Object> fooClass = myFoo.getClass();
- final TransactionalN2A annotation = fooClass.getAnnotation(TransactionalN2A.class);
- System.out.println("Found 1 foo class: " + fooClass + ", with tags: ");
- }
- }
-
- @Override
- public void setApplicationContext(final ApplicationContext applicationContext)
- throws BeansException {
- this.applicationContext = applicationContext;
- }
- }
-
+++ /dev/null
-package de.spring.example;
-
-import java.util.Map;
-
-import org.aspectj.lang.annotation.Aspect;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.beans.factory.generic.GenericBeanFactoryAccessor;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-
-@Aspect
-public class AspectHandler {
-
-
-
-
- }
-
+++ /dev/null
-package de.spring.example;
-
-
-public class Prueba {
- public void bar(){
- System.out.println("I am not a number, I am a free man!");
- }
-
- @TransactionalN2A
- public class InnerService {
- public void innerMethod() {
- System.out.println("xxx: AopService$InnerClass.innerMethod()");
- }
- }
-
-}
-
+++ /dev/null
-package de.spring.example;
-
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-
-/**
- * Localizador de beans para de los dispositivos
- *
- * @author rvp001es
- */
-public final class SpringContextLocator {
-
-
- // Singleton Pattern
- private static SpringContextLocator instance;
-
- // Spring ApplicationContext
- private static ApplicationContext context;
-
- // Dispositivos logicos
- private static final String SPRING_CONFIG_CONTEXT="spring-config.xml";
- //private static final String DATABASE_CONFIG="database-config.xml";
-
-
- /**
- * Private constructor. Singleton pattern.
- */
- private SpringContextLocator() {
- String[] factoryFiles = null;
- System.out.println("Loading files context " +
- SpringContextLocator.SPRING_CONFIG_CONTEXT);
-
- factoryFiles = new String[] { SPRING_CONFIG_CONTEXT };
-
- SpringContextLocator.context = new ClassPathXmlApplicationContext(factoryFiles);
-
- System.out.println("The N2A devices context and test " +
- "context has been loaded successfully!! ");
- }
-
- /**
- * Singleton pattern. GetInstance()
- */
- public synchronized static SpringContextLocator getInstance() {
- if (SpringContextLocator.instance == null) {
- SpringContextLocator.instance = new SpringContextLocator();
- }
- return SpringContextLocator.instance;
- }
-
- /**
- * Return a bean in application context.
- */
- public Object getBean(final String name) {
- return SpringContextLocator.context.getBean(name);
- }
-}
+++ /dev/null
-package de.spring.example;
-
-public class SpringStart {
-
- /**
- * @param args
- */
- public static void main(String[] args) {
- System.out.println("HOLA");
- SpringContextLocator.getInstance();
-
- }
-
-}
+++ /dev/null
-package de.spring.example;
-
-import org.springframework.jdbc.datasource.DataSourceTransactionManager;
-import org.springframework.transaction.TransactionStatus;
-
-
-public class TransactionManagerN2A {
- private static TransactionManagerN2A instance = new TransactionManagerN2A();
- private DataSourceTransactionManager transactionManager;
- private TransactionStatus transactionStatus;
-
- //Why could you want to extend this class?
- private TransactionManagerN2A() {}
-
- public static TransactionManagerN2A getInstance() {
- return instance;
- }
-
- public void initTransaction()
- {
- transactionStatus = this.transactionManager.getTransaction(null);
- }
-
- public void rollbackTransaction()
- {
- this.transactionManager.rollback(this.transactionStatus);
- }
-
- public void commitTransaction()
- {
- this.transactionManager.commit(this.transactionStatus);
- }
-
-
- /************************* Setters and getters *******************************************/
- public void setTransactionManager(final DataSourceTransactionManager transactionManager)
- {
- this.transactionManager = transactionManager;
- }
-}
-
+++ /dev/null
-/**
- *
- */
-package de.spring.example;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import org.springframework.stereotype.Component;
-
-
-@Retention(RetentionPolicy.RUNTIME)
-@Component
-public @interface TransactionalN2A {
-}