From d9c15eaa71f215d8193bbebb7c94b2e0aa952dc4 Mon Sep 17 00:00:00 2001 From: Bruno Sinou Date: Mon, 27 Sep 2010 15:39:14 +0000 Subject: [PATCH] solving the hibernate transaction problem git-svn-id: https://svn.argeo.org/slc/trunk@3805 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- .../META-INF/MANIFEST.MF | 10 +- .../client/aspects/ContentProviderAspect.java | 57 +++ .../client/core/ProcessListTableContent.java | 40 +- .../argeo/slc/client/core/TableContent.java | 2 - .../META-INF/MANIFEST.MF | 2 + .../META-INF/spring/core.xml | 12 +- .../META-INF/spring/transaction-osgi.xml | 2 + .../META-INF/spring/commands.xml | 9 +- .../org.argeo.slc.client.ui/plugin.xml | 5 + ...ava => ProcessListViewRefreshHandler.java} | 7 +- .../ResultListViewRefreshHandler.java | 19 + .../listeners/TestManagerServiceAdapter.java | 15 +- .../slc/client/ui/views/ProcessListView.java | 346 +----------------- 13 files changed, 135 insertions(+), 391 deletions(-) create mode 100644 eclipse/plugins/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/aspects/ContentProviderAspect.java rename eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/{RefreshHandler.java => ProcessListViewRefreshHandler.java} (67%) create mode 100644 eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/ResultListViewRefreshHandler.java diff --git a/eclipse/plugins/org.argeo.slc.client.core/META-INF/MANIFEST.MF b/eclipse/plugins/org.argeo.slc.client.core/META-INF/MANIFEST.MF index 90fb8d092..4203255fa 100644 --- a/eclipse/plugins/org.argeo.slc.client.core/META-INF/MANIFEST.MF +++ b/eclipse/plugins/org.argeo.slc.client.core/META-INF/MANIFEST.MF @@ -4,8 +4,14 @@ Bundle-Name: Core Bundle-SymbolicName: org.argeo.slc.client.core Bundle-Version: 1.0.0.qualifier Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Export-Package: org.argeo.slc.client.core +Export-Package: org.argeo.slc.client.aspects, + org.argeo.slc.client.core Import-Package: org.apache.commons.io;version="1.4.0", org.apache.commons.logging;version="1.1.1", org.argeo.slc.dao.process, - org.argeo.slc.process + org.argeo.slc.process, + org.aspectj.lang, + org.aspectj.lang.annotation, + org.springframework.beans.factory;version="2.5.6.SEC01", + org.springframework.transaction;version="2.5.6.SEC01" +Require-Bundle: org.springframework.orm;bundle-version="2.5.6" diff --git a/eclipse/plugins/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/aspects/ContentProviderAspect.java b/eclipse/plugins/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/aspects/ContentProviderAspect.java new file mode 100644 index 000000000..82290aff6 --- /dev/null +++ b/eclipse/plugins/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/aspects/ContentProviderAspect.java @@ -0,0 +1,57 @@ +package org.argeo.slc.client.aspects; + +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; + +@Aspect +public class ContentProviderAspect { + + // private final static Log log = LogFactory + // .getLog(ContentProviderAspect.class); + + // Advices + @Around("execution (* getLabel(..))") + public Object aroundGetVariable(ProceedingJoinPoint thisJoinPoint) + throws Throwable { + //log.debug("***************** IN THE ASPECT. Before proceed"); + // log.debug("We have an open session : " + // + sessionFactory.getCurrentSession().isOpen()); + // log.debug("Current transaction is active : " + // + sessionFactory.getCurrentSession().getTransaction() + // .isActive()); + + Object o = thisJoinPoint.proceed(); + //log.debug("**************** IN THE ASPECT. After proceed"); + return o; + } + + // @Before("methodeTrace()") + // public void log(JoinPoint joinPoint) { + // log.info("Before calling " + joinPoint.getSignature().getName()); + // log.debug("SessionFactory " + sessionFactory.toString()); + // } + + // @Around("methodeTrace()") + // public void proxyCalling(JoinPoint joinPoint) { + // log.info("*********** We Call the method " + // + joinPoint.getSignature().getName()); + // } + // + // // Pointcuts + // @Pointcut("execution(* org.argeo.slc.client.core.ProcessListTableContent.set*(..))") + // public void methodeTrace() { + // } + + // IoC + // public void setSessionFactory(SessionFactory sessionFactory) { + // this.sessionFactory = sessionFactory; + // } + // + // public void setTransactionManager( + // PlatformTransactionManager transactionManager) { + // if (transactionManager instanceof HibernateTransactionManager) + // this.transactionManager = (HibernateTransactionManager) + // transactionManager; + // } +} 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 index 79e2efe6f..e02f1e074 100644 --- 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 @@ -1,7 +1,5 @@ package org.argeo.slc.client.core; -import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import org.apache.commons.logging.Log; @@ -13,23 +11,27 @@ public class ProcessListTableContent implements TableContent { private static final Log log = LogFactory .getLog(ProcessListTableContent.class); - private List slcExecutions = new ArrayList(); - // IoC private SlcExecutionDao slcExecutionDao; @Override public SlcExecution getLine(int index) { - return slcExecutions.get(index); + return slcExecutionDao.listSlcExecutions().get(index); + // return slcExecutions.get(index); } @Override - public synchronized String getLabel(Object o, int i) { + // public synchronized String getLabel(Object o, int i) { + public String getLabel(Object o, int i) { SlcExecution se = (SlcExecution) o; + switch (i) { case 0: - return se.getStartDate().toString(); + // return se.getStartDate().toString(); + // Workaround to insure that we have no Lazy Init PB + return slcExecutionDao.getSlcExecution(se.getUuid()).getStartDate() + .toString(); case 1: return se.getHost(); case 2: @@ -37,30 +39,12 @@ public class ProcessListTableContent implements TableContent { case 3: return se.getStatus(); } - return "test"; + return null; } public synchronized List getContent() { - return this.slcExecutions; - } - - public synchronized void setContent() { - // Thread.currentThread().setContextClassLoader(null); - List lst = slcExecutionDao.listSlcExecutions(); - if (lst.get(0) != null) { - log.debug("======================== set CONTENT ====================="); - log.debug("Lst Size : " + lst.size()); - log.debug("Date : " + lst.get(0).getStartDate()); - log.debug("Host : " + lst.get(0).getHost()); - log.debug("Status : " + lst.get(0).getStatus()); - log.debug("UUID : " + lst.get(0).getUuid()); - } - - slcExecutions.clear(); - Iterator it = lst.iterator(); - while (it.hasNext()) { - slcExecutions.add(it.next()); - } + return slcExecutionDao.listSlcExecutions(); + // return this.slcExecutions; } // IoC 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 index df480c325..bc85e83e8 100644 --- 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 @@ -10,7 +10,5 @@ public interface TableContent { public String getLabel(Object o, int index); - public void setContent(); - public List getContent(); } diff --git a/eclipse/plugins/org.argeo.slc.client.hibernate/META-INF/MANIFEST.MF b/eclipse/plugins/org.argeo.slc.client.hibernate/META-INF/MANIFEST.MF index 91c937807..4e6e16868 100644 --- a/eclipse/plugins/org.argeo.slc.client.hibernate/META-INF/MANIFEST.MF +++ b/eclipse/plugins/org.argeo.slc.client.hibernate/META-INF/MANIFEST.MF @@ -4,8 +4,10 @@ Bundle-Name: Hibernate Interface for RCP Client Bundle-SymbolicName: org.argeo.slc.client.hibernate Bundle-Version: 1.0.0.qualifier Import-Package: org.aopalliance.aop;version="1.0.0", + org.argeo.slc.client.aspects, org.argeo.slc.client.core, org.argeo.slc.dao.process;version="0.13.0.SNAPSHOT-r3777", org.springframework.aop;version="2.5.6.SEC01", + org.springframework.aop.aspectj.annotation;version="2.5.6.SEC01", org.springframework.aop.framework;version="2.5.6.SEC01", org.springframework.transaction;version="2.5.6.SEC01" diff --git a/eclipse/plugins/org.argeo.slc.client.hibernate/META-INF/spring/core.xml b/eclipse/plugins/org.argeo.slc.client.hibernate/META-INF/spring/core.xml index 29dfe3b2b..7250277e0 100644 --- a/eclipse/plugins/org.argeo.slc.client.hibernate/META-INF/spring/core.xml +++ b/eclipse/plugins/org.argeo.slc.client.hibernate/META-INF/spring/core.xml @@ -1,11 +1,19 @@ + xmlns:aop="http://www.springframework.org/schema/aop" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd + "> + + + + + diff --git a/eclipse/plugins/org.argeo.slc.client.hibernate/META-INF/spring/transaction-osgi.xml b/eclipse/plugins/org.argeo.slc.client.hibernate/META-INF/spring/transaction-osgi.xml index 3cd4bac8d..dd8484c8b 100644 --- a/eclipse/plugins/org.argeo.slc.client.hibernate/META-INF/spring/transaction-osgi.xml +++ b/eclipse/plugins/org.argeo.slc.client.hibernate/META-INF/spring/transaction-osgi.xml @@ -9,4 +9,6 @@ + \ No newline at end of file diff --git a/eclipse/plugins/org.argeo.slc.client.ui/META-INF/spring/commands.xml b/eclipse/plugins/org.argeo.slc.client.ui/META-INF/spring/commands.xml index 34a365353..2abb6ed67 100644 --- a/eclipse/plugins/org.argeo.slc.client.ui/META-INF/spring/commands.xml +++ b/eclipse/plugins/org.argeo.slc.client.ui/META-INF/spring/commands.xml @@ -4,9 +4,12 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - + + - - diff --git a/eclipse/plugins/org.argeo.slc.client.ui/plugin.xml b/eclipse/plugins/org.argeo.slc.client.ui/plugin.xml index 591e9fecd..3ca7dafa8 100644 --- a/eclipse/plugins/org.argeo.slc.client.ui/plugin.xml +++ b/eclipse/plugins/org.argeo.slc.client.ui/plugin.xml @@ -39,6 +39,11 @@ id="org.argeo.slc.client.ui.RefreshResultList" name="RefreshResultList "> + + diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/RefreshHandler.java b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/ProcessListViewRefreshHandler.java similarity index 67% rename from eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/RefreshHandler.java rename to eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/ProcessListViewRefreshHandler.java index fb424a4dc..47f9d0041 100644 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/RefreshHandler.java +++ b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/ProcessListViewRefreshHandler.java @@ -1,19 +1,14 @@ package org.argeo.slc.client.ui.commands; import org.argeo.slc.client.ui.views.ProcessListView; -import org.argeo.slc.client.ui.views.ResultListView; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.ui.handlers.HandlerUtil; -public class RefreshHandler extends AbstractHandler { +public class ProcessListViewRefreshHandler extends AbstractHandler { public Object execute(ExecutionEvent event) throws ExecutionException { - ResultListView view = (ResultListView) HandlerUtil - .getActiveWorkbenchWindow(event).getActivePage().findView( - ResultListView.ID); - view.retrieveResults(); ProcessListView pView = (ProcessListView) HandlerUtil .getActiveWorkbenchWindow(event).getActivePage() .findView(ProcessListView.ID); diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/ResultListViewRefreshHandler.java b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/ResultListViewRefreshHandler.java new file mode 100644 index 000000000..23fa87916 --- /dev/null +++ b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/ResultListViewRefreshHandler.java @@ -0,0 +1,19 @@ +package org.argeo.slc.client.ui.commands; + +import org.argeo.slc.client.ui.views.ResultListView; +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.handlers.HandlerUtil; + +public class ResultListViewRefreshHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + ResultListView view = (ResultListView) HandlerUtil + .getActiveWorkbenchWindow(event).getActivePage() + .findView(ResultListView.ID); + view.retrieveResults(); + return null; + } + +} diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/listeners/TestManagerServiceAdapter.java b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/listeners/TestManagerServiceAdapter.java index 6189591cb..094a9b910 100644 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/listeners/TestManagerServiceAdapter.java +++ b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/listeners/TestManagerServiceAdapter.java @@ -54,17 +54,22 @@ public class TestManagerServiceAdapter implements TreeTestResultListener { // TODO : clean this -> pb of thread && commandID hardCoded. // We force the refresh of the list view. - ClientUiPlugin.getDefault().getWorkbench().getDisplay().syncExec( - new Runnable() { + ClientUiPlugin.getDefault().getWorkbench().getDisplay() + .syncExec(new Runnable() { public void run() { IHandlerService handlerService = (IHandlerService) ClientUiPlugin - .getDefault().getWorkbench().getService( - IHandlerService.class); + .getDefault().getWorkbench() + .getService(IHandlerService.class); try { handlerService .executeCommand( "org.argeo.slc.client.ui.RefreshResultList", null); + handlerService + .executeCommand( + "org.argeo.slc.client.ui.RefreshProcessList", + null); + } catch (Exception e) { e.printStackTrace(); throw new SlcException( @@ -74,7 +79,7 @@ public class TestManagerServiceAdapter implements TreeTestResultListener { } } - ); + ); } diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessListView.java b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessListView.java index b0b1d2067..de8519281 100644 --- a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessListView.java +++ b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessListView.java @@ -2,8 +2,6 @@ package org.argeo.slc.client.ui.views; 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.process.SlcExecution; import org.eclipse.jface.viewers.IStructuredContentProvider; @@ -20,7 +18,7 @@ import org.eclipse.swt.widgets.TableColumn; import org.eclipse.ui.part.ViewPart; public class ProcessListView extends ViewPart { - private final static Log log = LogFactory.getLog(ProcessListView.class); + // private final static Log log = LogFactory.getLog(ProcessListView.class); public static final String ID = "org.argeo.slc.client.ui.processListView"; @@ -29,9 +27,6 @@ public class ProcessListView extends ViewPart { // IoC private TableContent tableContent; - // tests - private List slcExecutions; - public void createPartControl(Composite parent) { Table table = createTable(parent); viewer = new TableViewer(table); @@ -111,14 +106,7 @@ public class ProcessListView extends ViewPart { } public void retrieveResults() { - try { - tableContent.setContent(); - viewer.setInput(tableContent.getContent()); - // viewer.refresh(); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + viewer.setInput(tableContent.getContent()); } // IoC @@ -126,332 +114,4 @@ public class ProcessListView extends ViewPart { this.tableContent = tableContent; } -} -// package org.argeo.slc.client.ui.views; -// -// import java.util.List; -// -// import org.apache.commons.logging.Log; -// import org.apache.commons.logging.LogFactory; -// import org.argeo.slc.core.test.tree.ResultAttributes; -// import org.argeo.slc.dao.process.SlcExecutionDao; -// import org.argeo.slc.process.SlcExecution; -// import org.eclipse.jface.viewers.IContentProvider; -// import org.eclipse.jface.viewers.IStructuredContentProvider; -// import org.eclipse.jface.viewers.ITableLabelProvider; -// import org.eclipse.jface.viewers.LabelProvider; -// import org.eclipse.jface.viewers.TableViewer; -// import org.eclipse.jface.viewers.Viewer; -// import org.eclipse.swt.SWT; -// import org.eclipse.swt.graphics.Image; -// import org.eclipse.swt.layout.GridData; -// import org.eclipse.swt.widgets.Composite; -// import org.eclipse.swt.widgets.Table; -// import org.eclipse.swt.widgets.TableColumn; -// import org.eclipse.ui.part.ViewPart; -// -// public class ProcessListView extends ViewPart { -// private final static Log log = LogFactory.getLog(ProcessListView.class); -// -// public static final String ID = "org.argeo.slc.client.ui.processListView"; -// -// private TableViewer viewer; -// -// // IoC -// // We use external content & label provider to encapsulate them in an AOP -// // proxy; -// // In order to solve hibernate transaction issue. -// private IContentProvider contentProvider; -// private ITableLabelProvider tableLabelProvider; -// -// // private SessionFactory sessionFactory; -// -// private SlcExecutionDao slcExecutionDao; -// -// public void createPartControl(Composite parent) { -// Table table = createTable(parent); -// viewer = new TableViewer(table); -// viewer.setContentProvider(this.contentProvider); -// viewer.setLabelProvider(this.tableLabelProvider); -// viewer.setInput(getViewSite()); -// } -// -// protected Table createTable(Composite parent) { -// int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL -// | SWT.FULL_SELECTION | SWT.HIDE_SELECTION; -// -// Table table = new Table(parent, style); -// -// GridData gridData = new GridData(GridData.FILL_BOTH); -// gridData.grabExcessVerticalSpace = true; -// gridData.grabExcessHorizontalSpace = true; -// gridData.horizontalSpan = 3; -// table.setLayoutData(gridData); -// -// table.setLinesVisible(true); -// table.setHeaderVisible(true); -// -// TableColumn column = new TableColumn(table, SWT.LEFT, 0); -// column.setText("Date"); -// column.setWidth(200); -// -// column = new TableColumn(table, SWT.LEFT, 1); -// column.setText("Host"); -// column.setWidth(100); -// -// column = new TableColumn(table, SWT.LEFT, 2); -// column.setText("Id"); -// column.setWidth(300); -// -// column = new TableColumn(table, SWT.LEFT, 3); -// column.setText("Status"); -// column.setWidth(100// package org.argeo.slc.client.ui.views; -// -// import java.util.List; -// -// import org.apache.commons.logging.Log; -// import org.apache.commons.logging.LogFactory; -// import org.argeo.slc.core.test.tree.ResultAttributes; -// import org.argeo.slc.dao.process.SlcExecutionDao; -// import org.argeo.slc.process.SlcExecution; -// import org.eclipse.jface.viewers.IContentProvider; -// import org.eclipse.jface.viewers.IStructuredContentProvider; -// import org.eclipse.jface.viewers.ITableLabelProvider; -// import org.eclipse.jface.viewers.LabelProvider; -// import org.eclipse.jface.viewers.TableViewer; -// import org.eclipse.jface.viewers.Viewer; -// import org.eclipse.swt.SWT; -// import org.eclipse.swt.graphics.Image; -// import org.eclipse.swt.layout.GridData; -// import org.eclipse.swt.widgets.Composite; -// import org.eclipse.swt.widgets.Table; -// import org.eclipse.swt.widgets.TableColumn; -// import org.eclipse.ui.part.ViewPart; -// -// public class ProcessListView extends ViewPart { -// private final static Log log = LogFactory.getLog(ProcessListView.class); -// -// public static final String ID = "org.argeo.slc.client.ui.processListView"; -// -// private TableViewer viewer; -// -// // IoC -// // We use external content & label provider to encapsulate them in an AOP -// // proxy; -// // In order to solve hibernate transaction issue. -// private IContentProvider contentProvider; -// private ITableLabelProvider tableLabelProvider; -// -// // private SessionFactory sessionFactory; -// -// private SlcExecutionDao slcExecutionDao; -// -// public void createPartControl(Composite parent) { -// Table table = createTable(parent); -// viewer = new TableViewer(table); -// viewer.setContentProvider(this.contentProvider); -// viewer.setLabelProvider(this.tableLabelProvider); -// viewer.setInput(getViewSite()); -// } -// -// protected Table createTable(Composite parent) { -// int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL -// | SWT.FULL_SELECTION | SWT.HIDE_SELECTION; -// -// Table table = new Table(parent, style); -// -// GridData gridData = new GridData(GridData.FILL_BOTH); -// gridData.grabExcessVerticalSpace = true; -// gridData.grabExcessHorizontalSpace = true; -// gridData.horizontalSpan = 3; -// table.setLayoutData(gridData); -// -// table.setLinesVisible(true); -// table.setHeaderVisible(true); -// -// TableColumn column = new TableColumn(table, SWT.LEFT, 0); -// column.setText("Date"); -// column.setWidth(200); -// -// column = new TableColumn(table, SWT.LEFT, 1); -// column.setText("Host"); -// column.setWidth(100); -// -// column = new TableColumn(table, SWT.LEFT, 2); -// column.setText("Id"); -// column.setWidth(300); -// -// column = new TableColumn(table, SWT.LEFT, 3); -// column.setText("Status"); -// column.setWidth(100); -// -// return table; -// } -// -// protected static class ViewContentProvider implements -// IStructuredContentProvider { -// -// public void inputChanged(Viewer arg0, Object arg1, Object arg2) { -// } -// -// public void dispose() { -// } -// -// @SuppressWarnings("unchecked") -// public Object[] getElements(Object obj) { -// if (obj instanceof List) { -// return ((List) obj).toArray(); -// } else { -// return new Object[0]; -// } -// } -// } -// -// protected class ViewLabelProvider extends LabelProvider implements -// ITableLabelProvider { -// public String getColumnText(Object obj, int index) { -// // log.debug(sessionFactory.getClass().toString()); -// -// 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); -// } -// -// public Image getColumnImage(Object obj, int index) { -// return null; -// } -// -// } -// -// public void setFocus() { -// viewer.getControl().setFocus(); -// } -// -// public void retrieveResults() { -// try { -// List lst = slcExecutionDao.listSlcExecutions(); -// -// if (log.isDebugEnabled()) -// log.debug("Result attributes count: " + lst.size()); -// viewer.setInput(lst); -// // viewer.refresh(); -// } catch (Exception e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } -// } -// -// // IoC -// public void setSlcExecutionDao(SlcExecutionDao slcExecutionDao) { -// this.slcExecutionDao = slcExecutionDao; -// } -// -// public void setContentProvider(IContentProvider contentProvider) { -// this.contentProvider = contentProvider; -// } -// -// public void setTableLabelProvider(ITableLabelProvider tableLabelProvider) { -// this.tableLabelProvider = tableLabelProvider; -// } -// -// // public void setSessionFactory(SessionFactory sessionFactory) { -// // this.sessionFactory = sessionFactory; -// // } -// -// } -// ); -// -// return table; -// } -// -// protected static class ViewContentProvider implements -// IStructuredContentProvider { -// -// public void inputChanged(Viewer arg0, Object arg1, Object arg2) { -// } -// -// public void dispose() { -// } -// -// @SuppressWarnings("unchecked") -// public Object[] getElements(Object obj) { -// if (obj instanceof List) { -// return ((List) obj).toArray(); -// } else { -// return new Object[0]; -// } -// } -// } -// -// protected class ViewLabelProvider extends LabelProvider implements -// ITableLabelProvider { -// public String getColumnText(Object obj, int index) { -// // log.debug(sessionFactory.getClass().toString()); -// -// 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); -// } -// -// public Image getColumnImage(Object obj, int index) { -// return null; -// } -// -// } -// -// public void setFocus() { -// viewer.getControl().setFocus(); -// } -// -// public void retrieveResults() { -// try { -// List lst = slcExecutionDao.listSlcExecutions(); -// -// if (log.isDebugEnabled()) -// log.debug("Result attributes count: " + lst.size()); -// viewer.setInput(lst); -// // viewer.refresh(); -// } catch (Exception e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } -// } -// -// // IoC -// public void setSlcExecutionDao(SlcExecutionDao slcExecutionDao) { -// this.slcExecutionDao = slcExecutionDao; -// } -// -// public void setContentProvider(IContentProvider contentProvider) { -// this.contentProvider = contentProvider; -// } -// -// public void setTableLabelProvider(ITableLabelProvider tableLabelProvider) { -// this.tableLabelProvider = tableLabelProvider; -// } -// -// // public void setSessionFactory(SessionFactory sessionFactory) { -// // this.sessionFactory = sessionFactory; -// // } -// -// } +} \ No newline at end of file -- 2.39.2