Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Stardust/Knowledge Base/Integration/Application/EJB/EJB Remote Client"
< Stardust | Knowledge Base | Integration | Application/EJB
(→Introduction) |
(→Introduction) |
||
Line 5: | Line 5: | ||
The EJB client project is a Simple java Project with following artifacts and settings: | The EJB client project is a Simple java Project with following artifacts and settings: | ||
− | a) | + | == Libraries == |
+ | |||
+ | Make sure you have following libraries in the project classpath: | ||
+ | |||
+ | * log4j-*.jar | ||
+ | * jboss-client*.jar | ||
+ | * carnot-base-*.jar | ||
+ | * carnot-ejb3-*.jar | ||
+ | * carnot-engine-*.jar | ||
+ | |||
+ | == Properties == | ||
+ | |||
+ | Attached here are sample properties. | ||
+ | |||
+ | Create a jboss-ejb-client.properties in the project classpath and have following entries | ||
+ | |||
+ | * remote.connection.default.host = localhost | ||
+ | * remote.connection.default.port = 4447 | ||
+ | * remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false | ||
+ | |||
+ | Edit the carnot.properties from the project class path and make sure it has following entries | ||
+ | |||
+ | * Client.ServiceFactory = org.eclipse.stardust.engine.api.ejb3.RemoteServiceFactory | ||
+ | * WorkflowService.JndiName = ejb:carnot/carnot-ejb3/WorkflowServiceImpl!org.eclipse.stardust.engine.api.ejb3.beans.RemoteWorkflowService | ||
+ | * AdministrationService.JndiName = ejb:carnot/carnot-ejb3/AdministrationServiceImpl!org.eclipse.stardust.engine.api.ejb3.beans.RemoteAdministrationService | ||
+ | * UserService.JndiName = ejb:carnot/carnot-ejb3/UserServiceImpl!org.eclipse.stardust.engine.api.ejb3.beans.RemoteUserService | ||
+ | * QueryService.JndiName = ejb:carnot/carnot-ejb3/QueryServiceImpl!org.eclipse.stardust.engine.api.ejb3.beans.RemoteQueryService | ||
+ | * DocumentManagementService.JndiName = ejb:carnot/carnot-ejb3/DocumentManagementServiceImpl!org.eclipse.stardust.engine.api.ejb3.beans.RemoteDocumentManagementService | ||
+ | |||
+ | * JNDI.InitialContextFactory = org.jboss.naming.remote.client.InitialContextFactory | ||
+ | * JNDI.URL = remote://localhost:4447 (JBOSS port) | ||
+ | * JNDI.PackagePrefixes = org.jboss.ejb.client.naming | ||
+ | |||
+ | == Sample Java Code== | ||
+ | |||
+ | <source lang="java> | ||
+ | ServiceFactory sf = getTestService("default",null,null,"motu","motu"); | ||
+ | System.out.println("Service Factory****************" + sf); | ||
+ | QueryService qs = sf.getQueryService(); | ||
+ | |||
+ | WorkflowService ws = sf.getWorkflowService(); | ||
+ | AdministrationService as = sf.getAdministrationService(); | ||
+ | UserService us = sf.getUserService(); | ||
+ | //us.modifyLoginUser(arg0, arg1, arg2, arg3, arg4) | ||
+ | |||
+ | DocumentManagementService dms = sf.getDocumentManagementService(); | ||
+ | ProcessInstanceQuery piQuery = ProcessInstanceQuery.findAlive(); | ||
+ | ProcessInstances pis = qs.getAllProcessInstances(piQuery); | ||
+ | |||
+ | for (Iterator iterator = pis.iterator(); iterator.hasNext();) { | ||
+ | ProcessInstance pi = (ProcessInstance) iterator.next(); | ||
+ | //log.info("PI: " + pi.getOID()); | ||
+ | System.out.println("Number of Process Definitions" + qs.getAllProcessDefinitions()); | ||
+ | } | ||
+ | </source> |
Revision as of 02:40, 22 July 2014
Introduction
This article provides information on settings required for an EJB client (Remote) for invoking the Stardust Services (WorkflowService, AdministrationService,UserService, etc). Example below is based on the JBoss environment.
The EJB client project is a Simple java Project with following artifacts and settings:
Libraries
Make sure you have following libraries in the project classpath:
- log4j-*.jar
- jboss-client*.jar
- carnot-base-*.jar
- carnot-ejb3-*.jar
- carnot-engine-*.jar
Properties
Attached here are sample properties.
Create a jboss-ejb-client.properties in the project classpath and have following entries
- remote.connection.default.host = localhost
- remote.connection.default.port = 4447
- remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
Edit the carnot.properties from the project class path and make sure it has following entries
- Client.ServiceFactory = org.eclipse.stardust.engine.api.ejb3.RemoteServiceFactory
- WorkflowService.JndiName = ejb:carnot/carnot-ejb3/WorkflowServiceImpl!org.eclipse.stardust.engine.api.ejb3.beans.RemoteWorkflowService
- AdministrationService.JndiName = ejb:carnot/carnot-ejb3/AdministrationServiceImpl!org.eclipse.stardust.engine.api.ejb3.beans.RemoteAdministrationService
- UserService.JndiName = ejb:carnot/carnot-ejb3/UserServiceImpl!org.eclipse.stardust.engine.api.ejb3.beans.RemoteUserService
- QueryService.JndiName = ejb:carnot/carnot-ejb3/QueryServiceImpl!org.eclipse.stardust.engine.api.ejb3.beans.RemoteQueryService
- DocumentManagementService.JndiName = ejb:carnot/carnot-ejb3/DocumentManagementServiceImpl!org.eclipse.stardust.engine.api.ejb3.beans.RemoteDocumentManagementService
- JNDI.InitialContextFactory = org.jboss.naming.remote.client.InitialContextFactory
- JNDI.URL = remote://localhost:4447 (JBOSS port)
- JNDI.PackagePrefixes = org.jboss.ejb.client.naming
Sample Java Code
ServiceFactory sf = getTestService("default",null,null,"motu","motu"); System.out.println("Service Factory****************" + sf); QueryService qs = sf.getQueryService(); WorkflowService ws = sf.getWorkflowService(); AdministrationService as = sf.getAdministrationService(); UserService us = sf.getUserService(); //us.modifyLoginUser(arg0, arg1, arg2, arg3, arg4) DocumentManagementService dms = sf.getDocumentManagementService(); ProcessInstanceQuery piQuery = ProcessInstanceQuery.findAlive(); ProcessInstances pis = qs.getAllProcessInstances(piQuery); for (Iterator iterator = pis.iterator(); iterator.hasNext();) { ProcessInstance pi = (ProcessInstance) iterator.next(); //log.info("PI: " + pi.getOID()); System.out.println("Number of Process Definitions" + qs.getAllProcessDefinitions()); }