[EJB 3.0] - Re: Missing comprehension in EJB3 and JBoss in Elcipse
by hispeedsurfer
Hello,
her is my solution tot he problem above, solved with JBoss Seam and Facelets
1.) First I follow the discription http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossSeamGettingStartedGuide and installed JBoss IDE and SEAM as described.
2.) Now the steps in Eclipse for an new ?Enterprise Application Project?
Project Name: statelessSb
J2EE Modules -> New Module: statelessSbEJB, statelessSbWeb
The Workspace is defined as V:\seam-workspace
Under Win CMD type as follow: (the same like 1.)
V:\seam-workspace\jboss-seam-1.0.1.GA\seam-gen>seam new-wtp-project statelessSb
V:\seam-workspace\jboss-seam-1.0.1.GA\seam-gen>seam new-stateless-action statelessSb StatelessCalculator
V:\seam-workspace\jboss-seam-1.0.1.GA\seam-gen>seam new-action-page statelessSb home StatelessCalculator
Now Refresh statelssSb, statelessSbEJB and statelessWeb in Eclipse and set ?Configure Buildpath? from statelessSbEJB (also see in 1.)
Code for home.xhtml:
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
| <html xmlns="http://www.w3.org/1999/xhtml"
| xmlns:s="http://jboss.com/products/seam/taglib"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:f="http://java.sun.com/jsf"
| xmlns:h="http://java.sun.com/jsf/html">
| <body>
| <ui:composition template="/WEB-INF/layout/template.xhtml">
|
| <ui:define name="body">
| <h1>Seam Generated Page named: "Calculator"</h1>
| <h:form>
| <div>
| <fieldset>
| <div>
| <div><h:outputLabel for="start">Start age: </h:outputLabel></div>
| <div><h:inputText value="#{StatelessCalculator.start}"/><br /></div>
| </div>
| <div>
| <div><h:outputLabel>End age: </h:outputLabel></div>
| <div><h:inputText value="#{StatelessCalculator.end}"/><br /></div>
| </div>
| <div>
| <div><h:outputLabel>Growth Rate: </h:outputLabel></div>
| <div><h:inputText value="#{StatelessCalculator.growthrate}"/><br /></div>
| </div>
| <div>
| <div><h:outputLabel>saving: </h:outputLabel></div>
| <div><h:inputText value="#{StatelessCalculator.saving}"/><br /></div>
| </div>
| <div>
| <div><h:commandButton type="submit" value="Calculate" action="#{StatelessCalculator.calculate}"/></div>
| </div>
| <div>
| <div><h:outputText>Result: "#{StatelessCalculator.resultString}"</h:outputText></div>
| </div>
|
| </fieldset>
| </div>
| </h:form>
| </ui:define>
|
| </ui:composition>
| </body>
| </html>
|
Code for StatelessCalculator.java:
| package org.jboss.business;
|
| import javax.ejb.Local;
|
| @Local
| public interface StatelessCalculator {
|
| //seam-gen method
| public String doAction();
|
| //add additional interface methods here
| public String calculate ();
|
| public double calculate(int start, int end, double growth, double saving);
|
| public int getEnd();
|
| public void setEnd(int end);
|
| public double getGrowthrate();
|
| public void setGrowthrate(double growthrate);
|
| public double getSaving();
|
| public void setSaving(double saving);
|
| public int getStart();
|
| public void setStart(int start);
|
| public double getResult();
|
| public void setResult(double result);
|
| public String getResultString();
|
| public void setResultString(String resultString);
| }
|
Code for StatelessCalculatorAction.java:
| package org.jboss.business;
|
| import static org.jboss.seam.ScopeType.SESSION;
|
| import java.io.Serializable;
| import java.text.NumberFormat;
|
| import javax.ejb.Stateless;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.Scope;
|
| @Stateless
| @Name("StatelessCalculator")
| @Scope(SESSION)
| public class StatelessCalculatorAction implements StatelessCalculator,
| Serializable {
|
| private int start = 25;
| private int end = 65;
| private double growthrate = 0.08;
| private double saving = 300.0;
| private double result = 0;
| private String resultString = null;
| /**
| *
| */
| private static final long serialVersionUID = 1L;
|
| // seam-gen method
| public String doAction() {
| return "success";
| }
|
| // add additional action methods
| public double calculate(int start, int end, double growth, double saving){
| double tmp = Math.pow(1. + growthrate / 12., 12. * (end - start) + 1);
| return saving * 12. * (tmp - 1) / growth;
| }
|
| public String calculate() {
| NumberFormat nf = NumberFormat.getInstance();
| nf.setMaximumFractionDigits(2);
| result = calculate(start, end, growthrate, saving);
| resultString = nf.format(result);
| return "success";
| }
|
|
|
| public int getEnd() {
| return end;
| }
|
| public void setEnd(int end) {
| this.end = end;
| }
|
| public double getGrowthrate() {
| return growthrate;
| }
|
| public void setGrowthrate(double growthrate) {
| this.growthrate = growthrate;
| }
|
| public double getSaving() {
| return saving;
| }
|
| public void setSaving(double saving) {
| this.saving = saving;
| }
|
| public int getStart() {
| return start;
| }
|
| public void setStart(int start) {
| this.start = start;
| }
|
| public double getResult() {
| return result;
| }
|
| public void setResult(double result) {
| this.result = result;
| }
|
| public String getResultString() {
| return resultString;
| }
|
| public void setResultString(String resultString) {
| this.resultString = resultString;
| }
|
| }
|
Finally ADD the Project to JBoss Server, start and see the result by typing http://localhost:8080/statelessSb in browser
Have fun
Andreas
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3970928#3970928
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3970928
19 years, 7 months
[JBoss Seam] - Re: Task assignment via pooled actor
by appendix
Here's a follow-up to my previous post....
I've started the debugger to look into PooledTaskInstanceList.getPooledTaskInstanceList() to see why the task is never assigned if the actorId is used instead of a group of the actor.
| public List<TaskInstance> getPooledTaskInstanceList()
| {
| List<TaskInstance> pooledTaskInstanceList = new ArrayList<TaskInstance>();
| Set<String> actorIds = Actor.instance().getGroupActorIds();
| for (String actorId: actorIds )
| {
| pooledTaskInstanceList.addAll( ManagedJbpmContext.instance().getTaskMgmtSession().findPooledTaskInstances(actorId) );
| }
| return pooledTaskInstanceList;
| }
|
Please correct me if I'm wrong, but with this code there seems to be no assignment via the actorId itself. Just the groupIds of the actor are used, despite the userguide documentation (Chapter 16.4.26 assignment) states a different fact.
Is the userguide outdated or do I miss something here? I'm using Seam 1.0.1.GA
Thanks for any help.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3970927#3970927
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3970927
19 years, 7 months
[JBoss jBPM] - Re: Disabling DBLoggingService
by jbaton
A way is to replace the DBLoggingFactory by some own 'do nothing' implementation.
1/ Create a service
public class NothingLoggingService implements LoggingService {
| public static Logger LOG = Logger.getLogger(NothingLoggingService.class);
|
| public void log(ProcessLog processLog) {
| LOG.debug( processLog.toString() );
| }
|
| public void close() {
| }
| }
|
2/ Create a service
| public class NothingLoggingServiceFactory implements ServiceFactory {
| public Service openService() {
| return new NothingLoggingService();
| }
|
| public void close() {
| }
|
| }
|
3/ Cut and paste default xml config (from jar) into jbpm.cfg.xml
4/ Link the "logging" service, to your own implementation
| <service name="logging" factory="........."/>
|
JBaton
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3970920#3970920
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3970920
19 years, 7 months