From: <pka...@us...> - 2009-07-28 22:20:02
|
Revision: 394 http://cse-ip.svn.sourceforge.net/cse-ip/?rev=394&view=rev Author: pkasprzak Date: 2009-07-28 22:19:54 +0000 (Tue, 28 Jul 2009) Log Message: ----------- * Correlation Stuff :) Modified Paths: -------------- trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/DependencyManagerImpl.java Modified: trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/DependencyManagerImpl.java =================================================================== --- trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/DependencyManagerImpl.java 2009-07-28 22:18:45 UTC (rev 393) +++ trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/DependencyManagerImpl.java 2009-07-28 22:19:54 UTC (rev 394) @@ -7,6 +7,7 @@ import de.campussource.cse.core.pdm.Relation; import de.campussource.cse.core.pdm.RelationType; import de.campussource.cse.core.pdm.WaitingProcess; +import de.campussource.cse.ejb.dependencymanager.DependencyManagerNotificationService; import java.util.HashSet; import java.util.List; import java.util.logging.Logger; @@ -14,7 +15,6 @@ import javax.ejb.Stateless; import javax.persistence.PersistenceContext; import javax.xml.ws.WebServiceRef; -import org.netbeans.j2ee.wsdl.common.dependencymanagernotification.DependencyManagerNotificationService; /** * @@ -22,7 +22,8 @@ */ @Stateless(mappedName = "cse/DependencyManager") public class DependencyManagerImpl implements DependencyManagerRemote, DependencyManager { - @WebServiceRef(wsdlLocation = "META-INF/wsdl/client/DependencyManagerNotification/DependencyManagerNotification.wsdl") + + @WebServiceRef(wsdlLocation = "META-INF/wsdl/client/DependencyManager/DependencyManager.wsdl") private DependencyManagerNotificationService service; @PersistenceContext @@ -154,17 +155,19 @@ // ---------------------------------------------------------------------------------------------------------------- protected void wakeUpWaitingProcess(WaitingProcess process) { + + /* Call process */ try { - org.netbeans.j2ee.wsdl.common.dependencymanagernotification.DependencyManagerNotificationPortType port = service.getDependencyManagerNotificationPort(); - + de.campussource.cse.ejb.dependencymanager.DependencyManagerNotification port = service.getDependencyManagerNotificationPort(); + int entityId = process.getEntityId(); String system = process.getSystem(); - + port.notify(entityId, system); } catch (Exception ex) { - logger.info("Exception while trying to notify process: " + ex.getMessage()); + logger.severe("Exception while notifying process: " + ex.getMessage()); } /* Remove dependencies */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pka...@us...> - 2009-07-29 21:50:26
|
Revision: 400 http://cse-ip.svn.sourceforge.net/cse-ip/?rev=400&view=rev Author: pkasprzak Date: 2009-07-29 21:50:19 +0000 (Wed, 29 Jul 2009) Log Message: ----------- * Fix query Modified Paths: -------------- trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/DependencyManagerImpl.java Modified: trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/DependencyManagerImpl.java =================================================================== --- trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/DependencyManagerImpl.java 2009-07-29 20:59:13 UTC (rev 399) +++ trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/DependencyManagerImpl.java 2009-07-29 21:50:19 UTC (rev 400) @@ -82,18 +82,19 @@ // ---------------------------------------------------------------------------------------------------------------- protected WaitingProcess getWaitingProcess(int entityId, String system) { - WaitingProcess process = (WaitingProcess) em.createNamedQuery(WaitingProcess.QUERY_getByEntityIdAndSystem). setParameter("system", system). - setParameter("entityId", entityId). - getSingleResult(); - if (process == null) { + List<WaitingProcess> processes = em.createNamedQuery(WaitingProcess.QUERY_getByEntityIdAndSystem). setParameter("system", system). + setParameter("entityId", entityId). + getResultList(); + if (processes.isEmpty()) { /* No existing process found => create a new one */ - process = new WaitingProcess(); + WaitingProcess process = new WaitingProcess(); process.setEntityId(entityId); process.setSystem(system); em.persist(process); + return process; } - return process; + return processes.get(0); } // ---------------------------------------------------------------------------------------------------------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pka...@us...> - 2009-07-31 21:58:09
|
Revision: 415 http://cse-ip.svn.sourceforge.net/cse-ip/?rev=415&view=rev Author: pkasprzak Date: 2009-07-31 21:57:59 +0000 (Fri, 31 Jul 2009) Log Message: ----------- * Added test code Modified Paths: -------------- trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/DependencyManagerImpl.java Modified: trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/DependencyManagerImpl.java =================================================================== --- trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/DependencyManagerImpl.java 2009-07-31 21:53:30 UTC (rev 414) +++ trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/DependencyManagerImpl.java 2009-07-31 21:57:59 UTC (rev 415) @@ -11,8 +11,14 @@ import java.util.HashSet; import java.util.List; import java.util.logging.Logger; +import javax.annotation.PostConstruct; +import javax.annotation.Resource; import javax.ejb.EJB; +import javax.ejb.EJBContext; +import javax.ejb.SessionContext; import javax.ejb.Stateless; +import javax.ejb.Timeout; +import javax.ejb.Timer; import javax.persistence.PersistenceContext; import javax.xml.ws.WebServiceRef; @@ -26,6 +32,9 @@ @WebServiceRef(wsdlLocation = "META-INF/wsdl/client/DependencyManager/DependencyManager.wsdl") private DependencyManagerNotificationService service; + @Resource + private EJBContext ctx; + @PersistenceContext private javax.persistence.EntityManager em; @@ -44,6 +53,34 @@ private final static Logger logger = Logger.getLogger("de.campussource.cse.core.DependencyManager"); // ---------------------------------------------------------------------------------------------------------------- +// @PostConstruct + protected void init() { + ctx.getTimerService().createTimer(10000, null); + logger.info("*** Timer created!"); + } + + // ---------------------------------------------------------------------------------------------------------------- + @Timeout + public void handleTimeout(Timer timer) { + logger.info("*** Timer called => waking up process!"); + List<WaitingProcess> processes = getBySystem("Ilias"); + if (!processes.isEmpty()) { + wakeUpWaitingProcess(processes.get(0)); + } else { + logger.info("*** No processes waiting => doing nothing!"); + } + } + + // ---------------------------------------------------------------------------------------------------------------- + protected List<WaitingProcess> getBySystem(String System) { + + List<WaitingProcess> processes = em.createNamedQuery(WaitingProcess.QUERY_getBySystem). setParameter("system", System). + getResultList(); + + return processes; + } + + // ---------------------------------------------------------------------------------------------------------------- protected boolean updateDependencies(WaitingProcess process) { boolean satisfied = true; @@ -100,6 +137,8 @@ // ---------------------------------------------------------------------------------------------------------------- public void waitForDependencies(int cseId) { + init(); + Entity entity = em.find(Entity.class, cseId); for (String system : systemManager.getOutboundSystems()) { @@ -156,8 +195,6 @@ // ---------------------------------------------------------------------------------------------------------------- protected void wakeUpWaitingProcess(WaitingProcess process) { - - /* Call process */ try { de.campussource.cse.ejb.dependencymanager.DependencyManagerNotification port = service.getDependencyManagerNotificationPort(); @@ -165,10 +202,12 @@ int entityId = process.getEntityId(); String system = process.getSystem(); + logger.info("*** Waking up process (" + system + ": " + entityId + ")"); + port.notify(entityId, system); } catch (Exception ex) { - logger.severe("Exception while notifying process: " + ex.getMessage()); + logger.severe("*** Exception while notifying process: " + ex.getMessage()); } /* Remove dependencies */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pka...@us...> - 2009-08-02 18:02:50
|
Revision: 425 http://cse-ip.svn.sourceforge.net/cse-ip/?rev=425&view=rev Author: pkasprzak Date: 2009-08-02 18:02:13 +0000 (Sun, 02 Aug 2009) Log Message: ----------- * DependencyManager wsdl adaptations Modified Paths: -------------- trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/DependencyManagerImpl.java Modified: trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/DependencyManagerImpl.java =================================================================== --- trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/DependencyManagerImpl.java 2009-08-02 17:59:32 UTC (rev 424) +++ trunk/sandbox/lsf-adapter-demo/CSECore-ejb/src/java/de/campussource/cse/core/DependencyManagerImpl.java 2009-08-02 18:02:13 UTC (rev 425) @@ -7,15 +7,17 @@ import de.campussource.cse.core.pdm.Relation; import de.campussource.cse.core.pdm.RelationType; import de.campussource.cse.core.pdm.WaitingProcess; -import de.campussource.cse.ejb.dependencymanager.DependencyManagerNotificationService; + +import de.campussource.cse.ejb.dependencymanager.DependencyManagerAccountNotificationService; +import de.campussource.cse.ejb.dependencymanager.DependencyManagerCategoryNotificationService; +import de.campussource.cse.ejb.dependencymanager.DependencyManagerCourseNotificationService; + import java.util.HashSet; import java.util.List; import java.util.logging.Logger; -import javax.annotation.PostConstruct; import javax.annotation.Resource; import javax.ejb.EJB; import javax.ejb.EJBContext; -import javax.ejb.SessionContext; import javax.ejb.Stateless; import javax.ejb.Timeout; import javax.ejb.Timer; @@ -30,8 +32,14 @@ public class DependencyManagerImpl implements DependencyManagerRemote, DependencyManager { @WebServiceRef(wsdlLocation = "META-INF/wsdl/client/DependencyManager/DependencyManager.wsdl") - private DependencyManagerNotificationService service; + private DependencyManagerAccountNotificationService accountService; + @WebServiceRef(wsdlLocation = "META-INF/wsdl/client/DependencyManager/DependencyManager.wsdl") + private DependencyManagerCategoryNotificationService categoryService; + + @WebServiceRef(wsdlLocation = "META-INF/wsdl/client/DependencyManager/DependencyManager.wsdl") + private DependencyManagerCourseNotificationService courseService; + @Resource private EJBContext ctx; @@ -195,19 +203,30 @@ // ---------------------------------------------------------------------------------------------------------------- protected void wakeUpWaitingProcess(WaitingProcess process) { - /* Call process */ + + Entity entity = em.find(Entity.class, process.getEntityId()); + + int entityId = process.getEntityId(); + String system = process.getSystem(); + try { - de.campussource.cse.ejb.dependencymanager.DependencyManagerNotification port = service.getDependencyManagerNotificationPort(); - - int entityId = process.getEntityId(); - String system = process.getSystem(); + if (entity.getType().equals(EntityType.COURSE.toString())) { + de.campussource.cse.ejb.dependencymanager.DependencyManagerCourseNotification port = courseService.getDependencyManagerCourseNotificationPort(); + port.notify(entityId, system); + } - logger.info("*** Waking up process (" + system + ": " + entityId + ")"); + if (entity.getType().equals(EntityType.CATEGORY.toString())) { + de.campussource.cse.ejb.dependencymanager.DependencyManagerCategoryNotification port = categoryService.getDependencyManagerCategoryNotificationPort(); + port.notify(entityId, system); - port.notify(entityId, system); + } + if (entity.getType().equals(EntityType.ACCOUNT.toString())) { + de.campussource.cse.ejb.dependencymanager.DependencyManagerAccountNotification port = accountService.getDependencyManagerAccountNotificationPort(); + port.notify(entityId, system); + } } catch (Exception ex) { - logger.severe("*** Exception while notifying process: " + ex.getMessage()); + logger.severe("*** Exception while notifying process [" + entity.getType() + ": " + entity.getId() + "]: " + ex.getMessage()); } /* Remove dependencies */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |