tests for solving the hibernate transaction problem
authorBruno Sinou <bsinou@argeo.org>
Wed, 22 Sep 2010 14:41:19 +0000 (14:41 +0000)
committerBruno Sinou <bsinou@argeo.org>
Wed, 22 Sep 2010 14:41:19 +0000 (14:41 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@3793 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

eclipse/plugins/org.argeo.slc.client.core/META-INF/MANIFEST.MF
eclipse/plugins/org.argeo.slc.client.core/META-INF/spring/core-osgi.xml [new file with mode: 0644]
eclipse/plugins/org.argeo.slc.client.core/META-INF/spring/core.xml [new file with mode: 0644]
eclipse/plugins/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/core/ProcessListTableContent.java [new file with mode: 0644]
eclipse/plugins/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/core/TableContent.java [new file with mode: 0644]
eclipse/plugins/org.argeo.slc.client.ui/META-INF/MANIFEST.MF
eclipse/plugins/org.argeo.slc.client.ui/META-INF/spring/osgi.xml
eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessListView.java

index b854bf480f160026d2c44f9317113dbb32fbc0cd..8088b5f1c8ab25597c8508de3b8f4dfaeb719909 100644 (file)
@@ -4,4 +4,7 @@ Bundle-Name: Core
 Bundle-SymbolicName: org.argeo.slc.client.core
 Bundle-Version: 1.0.0.qualifier
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Import-Package: org.osgi.framework;version="1.3.0"
+Export-Package: org.argeo.slc.client.core
+Import-Package: org.argeo.slc.dao.process,
+ org.argeo.slc.process,
+ org.osgi.framework;version="1.3.0"
diff --git a/eclipse/plugins/org.argeo.slc.client.core/META-INF/spring/core-osgi.xml b/eclipse/plugins/org.argeo.slc.client.core/META-INF/spring/core-osgi.xml
new file mode 100644 (file)
index 0000000..d1172f9
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<beans:beans xmlns="http://www.springframework.org/schema/osgi"\r
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"\r
+       xsi:schemaLocation="http://www.springframework.org/schema/osgi  \r
+       http://www.springframework.org/schema/osgi/spring-osgi-1.1.xsd\r
+       http://www.springframework.org/schema/beans   \r
+       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">\r
+\r
+       <!-- DAO <reference id="slcExecutionDao" interface="org.argeo.slc.dao.process.SlcExecutionDao" \r
+               /> -->\r
+       <service id="processListTableContent" interface="org.argeo.slc.client.core.TableContent" />\r
+</beans:beans>
\ No newline at end of file
diff --git a/eclipse/plugins/org.argeo.slc.client.core/META-INF/spring/core.xml b/eclipse/plugins/org.argeo.slc.client.core/META-INF/spring/core.xml
new file mode 100644 (file)
index 0000000..0545a4c
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+        http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+       <bean id="processListTableContent" class="org.argeo.slc.client.core.ProcessListTableContent" />
+
+</beans>
diff --git a/eclipse/plugins/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/core/ProcessListTableContent.java b/eclipse/plugins/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/core/ProcessListTableContent.java
new file mode 100644 (file)
index 0000000..78af963
--- /dev/null
@@ -0,0 +1,19 @@
+package org.argeo.slc.client.core;
+
+import org.argeo.slc.process.SlcExecution;
+
+public class ProcessListTableContent implements TableContent {
+
+       @Override
+       public SlcExecution getLine(int i) {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public String getLabel(Object o, int i) {
+               // TODO Auto-generated method stub
+               return "test";
+       }
+
+}
diff --git a/eclipse/plugins/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/core/TableContent.java b/eclipse/plugins/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/core/TableContent.java
new file mode 100644 (file)
index 0000000..02e750c
--- /dev/null
@@ -0,0 +1,8 @@
+package org.argeo.slc.client.core;
+
+public interface TableContent {
+
+       public Object getLine(int i);
+       
+       public String getLabel(Object o, int i);
+}
index 066b63a554b364462f202467df2289c47d949cc2..52cb4d9f73af713191b3c169bc5df1185569f793 100644 (file)
@@ -18,6 +18,7 @@ Import-Package: org.apache.commons.io;version="1.4.0",
  org.argeo.eclipse.spring,
  org.argeo.eclipse.ui,
  org.argeo.slc.build;version="0.13.0.SNAPSHOT-r3685",
+ org.argeo.slc.client.core,
  org.argeo.slc.core.attachment,
  org.argeo.slc.core.runtime;version="0.13.0.SNAPSHOT-r3701",
  org.argeo.slc.core.test.tree;version="0.13.0.SNAPSHOT-r3768",
index 2e131cf7ee9804e5a4aa60e3d66b0dc9566f7a35..f39cf1d96819a7336d3dd35c85f14a5bf88f2ecb 100644 (file)
        <reference id="slcExecutionService" interface="org.argeo.slc.services.SlcExecutionService" />\r
 \r
        <!-- Session (to insure transactional management) -->\r
-       <!--  <reference id="sessionFactory" interface="org.hibernate.SessionFactory" /> -->\r
+       <!-- <reference id="sessionFactory" interface="org.hibernate.SessionFactory" \r
+               /> -->\r
 \r
        <!-- TODO : what is it for ? -->\r
        <list id="slcAgents" interface="org.argeo.slc.runtime.SlcAgent" />\r
 \r
+       <!-- Proxy object to try solving transaction & session problem caused by \r
+               using hibernate -->\r
+       <reference id="processListTableContent" interface="org.argeo.slc.client.core.TableContent" />\r
 \r
 </beans:beans>
\ No newline at end of file
index 8ef1d292540b09e7db29f3eb8bac937bfb4b4b51..12a450057aaafa4bee5072e5dd2b098d9f92bd5a 100644 (file)
@@ -4,6 +4,7 @@ import java.util.List;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.argeo.slc.client.core.TableContent;
 import org.argeo.slc.dao.process.SlcExecutionDao;
 import org.argeo.slc.process.SlcExecution;
 import org.eclipse.jface.viewers.IStructuredContentProvider;
@@ -26,7 +27,9 @@ public class ProcessListView extends ViewPart {
 
        private TableViewer viewer;
 
+       // IoC
        private SlcExecutionDao slcExecutionDao;
+       private TableContent tableContent;
 
        public void createPartControl(Composite parent) {
                Table table = createTable(parent);
@@ -94,18 +97,19 @@ public class ProcessListView extends ViewPart {
                        ITableLabelProvider {
                public String getColumnText(Object obj, int index) {
                        SlcExecution se = (SlcExecution) obj;
-                       switch (index) {
-
-                       case 0:
-                               return getText(se.getStartDate());
-                       case 1:
-                               return se.getHost();
-                       case 2:
-                               return se.getUuid();
-                       case 3:
-                               return se.currentStep().getType();
-                       }
-                       return getText(obj);
+                       // switch (index) {
+                       //
+                       // case 0:
+                       // return getText(se.getStartDate());
+                       // case 1:
+                       // return se.getHost();
+                       // case 2:
+                       // return se.getUuid();
+                       // case 3:
+                       // return se.currentStep().getType();
+                       // }
+                       // return getText(obj);
+                       return tableContent.getLabel(null, 0);
                }
 
                public Image getColumnImage(Object obj, int index) {