Deploy custom workflow developed in jbpm into alfresco - deployment

I am using alfresco 3.0 .. I followed the link below to install jbpm and start creating jbpm workflow ..
http://wiki.alfresco.com/wiki/WorkflowAdministration
In the link It says there are 2 ways of deploying .. first one through designer deploy tab and the other is manually..
I could make it work trough deploy tab.
can anyone tell how can deploy manually .. as the info in the link is insufficient..
I want to know how does it work.. like where i need to place the deployer bean .. ect
Thanks

There are two links that tell you where to put things:
first and foremost, Packaging And Deploying Extensions describe how and where to create your custom Spring configuration files, among other things
then Workflow Administration describe workflow specific configuration tasks
An old but mostly still valid article from Jeff Potts might also come in handy for you.

The first way about I know is to write bean in context file (it will be deployed while alfresco starts)- can looks like that (in \tomcat\shared\classes\alfresco\extension)
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<!-- custom Workflow bean -->
<bean id="WorkflowID" parent="workflowDeployer">
<property name="workflowDefinitions">
<list>
<props>
<prop key="engineId">activiti</prop>
<prop key="location">alfresco/extension/nameOfTheFile.bpmn</prop>
<prop key="mimetype">text/xml</prop>
<prop key="redeploy">true</prop>
</props>
</list>
</property>
</bean>
<!-- custom model BEAN -->
<bean id="SomeID2.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
<property name="models">
<list>
<value>alfresco/extension/Somename-model.xml</value>
</list>
</property>
</bean>
</beans>
And the second way how to deploy is workflow console
URLs, eg.:
Alf 4.2.f /alfresco/faces/jsp/admin/workflow-console.jsp
Alf 5.0.d /alfresco/s/admin/admin-workflowconsole
(write help for the help)
For deploy:
activiti - eg. deploy activiti alfresco/extension/wfFileName.bpmn
jbpm - eg. deploy jbpm alfresco/extension/wfFileName.bpmn
gl
EDIT:
That's for activiti, not sure if it could be the same :)
Btw there should be also way how to deploy through "data dictionary" :)

Related

Arquillian: Do I need domain.xml and arquillian.xml for minimal Glassfish Embedded tests with Derby DB?

in the internet I often find recent but contrary information on this topic..., thus I would like to ask a question on minimum requirements.
My goal is to do a very simple integration test of simple EJB 3.1 application:
Simple JPA 2.0 functionality with EclipseLink
Arquillian with JUnit for testing
Maven
Derby DB (in memory or file in ./target), JTA persistence context.
Embedded Glassfish in Arquillian
So I just want to do a simple JPA test. I get my Glassfish running in Arquillian, but when doing my JPA stuff, my app always fails to handle the Derby DB (tells me there are no tables etc.), but DDL files look sane.
I played around with providing schema name, user etc. in my persistence.xml, but nothing helps. Sometimes a come accross posts telling me about making changes in a minimal domain.xml for the embedded Glassfish to match my persistence.xml or to adapt the arquillian.xml.
My question is: for this minimal approach - do I really require that src/test/glassfish/domains/domain1/domain.xml or arquillian.xml?
I am quite sure that some time ago I managed to do so with Embedded Glassfish but using Hibernate 4 as JPA provider. I have no access to the project anylonger and thus cannot tell the difference except that I definetely did not add a domain.xml etc.
Posts like (other question here) really do confuse me.
Important is that I am not using a managed server, but an embedded one.
Thanks and cheers,
Timo
Here is one of my versions, please see my following comment.
<persistence-unit name="localiser-core" transaction-type="JTA">
<jta-data-source>jdbc/__default</jta-data-source>
<properties>
<property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver" />
<property name="javax.persistence.jdbc.url"
value="jdbc:derby:memory:test;create=true" />
<property name="javax.persistence.jdbc.user" value="" />
<property name="javax.persistence.jdbc.password" value="" />
<property name="eclipselink.target-database" value="Derby"/>
<property name="eclipselink.ddl-generation.output-mode"
value="database" />
<property name="eclipselink.ddl-generation" value="create-tables" />
<property name="eclipselink.application-location" value="target" />
<property name="eclipselink.create-ddl-jdbc-file-name" value="create.sql"/>
<property name="eclipselink.drop-ddl-jdbc-file-name" value="drop.sql"/>
<property name="eclipselink.debug" value="ALL"/>
<property name="eclipselink.weaving" value="static"/>
<property name="eclipselink.logging.level" value="FINEST"/>
<property name="eclipselink.logging.level.sql" value="FINEST"/>
<property name="eclipselink.logging.level.cache" value="FINEST"/>
</properties>
</persistence-unit>
Since your connection URL is: jdbc:derby:memory:test;create=true, what you have told Derby is: connect to a database in the folder 'test', relative to the current working directory of wherever Derby is started, and if that database 'test' is not present in the current working directory, create it from scratch.
So one possibility is that your application has a different current working directory each time, or perhaps that something else in your application is clearing out your current working directory each time you run the application.
Thus Derby doesn't find the previous database in that location, and so it creates a fresh new one.
One way around this is to specify a more explicit location for your database, by using a connection URL such as: jdbc:derby:memory:/users/timo/testdb
Then create the database once, up front, and subsequent to that your application will find the database in the specified location and use it.

persistence-unit, different hibernate.transaction.manager_lookup_class property

I have Java EE application, and my EJB module have persistence.xml.
I deploy my app on 3 app servers: JBoss, GlassFish and WebLogic, and every server needs own hibernate.transaction.manager_lookup_class property.
WL needs
<property name="transaction.manager_lookup_class" value="org.hibernate.transaction.WeblogicTransactionManagerLookup" />
JBoss needs
<property name="transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />
Glass fish
<property name="transaction.manager_lookup_class"
value="org.hibernate.transaction.SunONETransactionManagerLookup" />
What is the best way to do this?
Solution is use
<property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.JTATransactionFactory"/>
instead of
<property name="transaction.manager_lookup_class"

Eclipse - JBoss (Hibernate) tools not showing any tables

I want to use JBoss tools in Eclipse to generate java code from DDL.
I am using the following:
Oracle XE
Eclipse Helios (SpringSource version)
JBoss Tools
I've configured the hibernate.cfg.xml (as below) and created a sample application to insert and update records in XE and it works fine.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:#localhost:1521:xe</property>
<property name="hibernate.connection.username">admin</property>
<property name="hibernate.connection.password">admin</property>
<property name="hibernate.default_schema">users</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<mapping resource="users.hbm.xml"/>
</session-factory>
</hibernate-configuration>
But when I select (in hibernate perspective) File->New->Hibernate console configuration, I get the following in the "Hibernate Configurations" window:
-Console
+Configuration
+Session Factory
+Database
Expanding the "Database" above shows "pending" for few seconds and then shows nothing. I expecting it to show the table names. I am struggling to find out the reason. There are no exceptions\errors in any of the log files, nothing on console, all XE services are running, hibernate configuration is correct because my sample app works.
While creating the "console configuration" I created a new database connection and have done the "Test connection" and it shows "Ping successfully" message. I've used the following in the configuration:
hibernate.connection.url jdbc:oracle:thin:#localhost:1521:xe
hibernate.dialect org.hibernate.dialect.Oracle10gDialect
hibernate.connection.driver_class oracle.jdbc.OracleDriver
Any help is appreciated. Thanks.
Fixed it..
had to change the following
<property name="hibernate.default_schema">users</property>
to
<property name="hibernate.default_schema">USERS</property>
I had this same problem, then found out my database had no tables in it and felt embarrassed. After creating a quick table, it worked. Will never get that time back..

Add new workflow into Alfresco share

I'm new to Alfresco/Activiti.
Our company is using Skelta BPM.NET (in integration with our self developed RMS) and now we would like to take a look into other BPM software.
I last days I found our how to create new workflow using Eclipse and Import them into standalone installation of Activiti.
Now I would like to publish this workflow into Alfresco share. Is there any easy way to do that? I was searching whole day on Google but didn't find anything useful.
And another question about installation:
Is it possible to install Activiti with all it's webapps on the same tomcat, that alfresco is running on? That Apache Ant can build only standalone installation. So can this two application be merged?
Thanks for your info, Anze
If you place your BPMN 2.0 process definition XML somewhere in the Alfresco classpath, you can use Alfresco's workflow console to deploy the definition.
For example, I always place my workflows under WEB-INF/classes/alfresco/extension/workflows/someFolder where someFolder is a unique folder for each process definition I am using.
The workflow console is in http://localhost:8080/alfresco/faces/jsp/admin/workflow-console.jsp. Assuming you are using 3.4.e, which is a preview release showing Activiti integration, you can deploy a process through the workflow console with this command:
deploy activiti /alfresco/extension/workflows/activiti/activitiHelloWorld.activiti
You can see other helpful workflow console commands by typing help.
Alternatively, as Gagravarr suggests, you can use Spring to deploy your workflow when Alfresco starts up. The Spring config file must have a name ending with "-context.xml". I usually place mine in WEB-INF/classes/alfresco/extension.
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<bean id="someco.workflowBootstrap" parent="workflowDeployer">
<property name="workflowDefinitions">
<list>
<props>
<prop key="engineId">activiti</prop>
<prop key="location">alfresco/extension/workflows/activiti/activitiHelloWorld.bpmn20.xml</prop>
<prop key="mimetype">text/xml</prop>
<prop key="redeploy">false</prop>
</props>
</list>
</property>
<property name="models">
<list>
<value>alfresco/extension/model/scWorkflowModel.xml</value>
</list>
</property>
<property name="labels">
<list>
<value>alfresco.extension.messages.scWorkflow</value>
</list>
</property>
</bean>
</beans>
If you'd like working examples of some simple workflows, with the same workflows implemented for both jBPM and Activiti for easy comparison, take a look at this blog post: http://ecmarchitect.com/archives/2011/04/27/1357
Jeff
For the second part of your question:
If you want to use Alfresco with Activiti, then you should try the 3.4.e release (or a recently nightly build). 3.4.e has Activiti build in, so you don't need to do any merging of webapps. It's all already there for you.
For the first part, as long as you're using 3.4.e (or a later nightly build), then you ought to be able to deploy to Activiti in much the same way that you would previously deploy to JBMP. The Workflow With Activiti wiki page ought to help you with this too, as might this wiki too.

JPA Entity (in multiple persistence-unit) in OSGi (Spring DM) Environnement is confusing me

I'm a bit confused about a strange behavior of my JPA's related objects.
I have three bundle :
The User bundle does contain some user-related objects, but mainly the User object.
The Energy bundle does contain some energy-related objects, and particularly a ConsumptionTerminal which contains a List of User.
The Index bundle does contain an Index object that has no dependency at all.
My OSGi environment is the following :
A DataSource bundle that provide 2 services : dataSource and jpaVendorAdapter.
The three bundles. They consume dataSource and jpaVendorAdapter.
Their module-context.xml file look like :
And they all have a persistence.xml file :
User
<?xml version="1.0" encoding="UTF-8"?>
<persistence>
<persistence-unit name="securityPU" transaction-type="JTA">
<jta-data-source>java:/securityDataSourceService</jta-data-source>
<class>net.nextep.amundsen.security.domain.User</class>
<!-- [...] -->
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="eclipselink.logging.level" value="INFO" />
<property name="eclipselink.ddl-generation" value="create-tables" />
<property name="eclipselink.ddl-generation.output-mode" value="database" />
<property name="eclipselink.orm.throw.exceptions" value="true" />
</properties>
</persistence-unit>
</persistence>
Energy
<?xml version="1.0" encoding="UTF-8"?>
<persistence>
<persistence-unit name="energyPU" transaction-type="JTA">
<jta-data-source>java:/securityDataSourceService</jta-data-source>
<class>net.nextep.amundsen.security.domain.User</class>
<class>net.nextep.amundsen.energy.domain.User</class>
<!-- [...] -->
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="eclipselink.logging.level" value="INFO" />
<property name="eclipselink.ddl-generation" value="create-tables" />
<property name="eclipselink.ddl-generation.output-mode" value="database" />
<property name="eclipselink.orm.throw.exceptions" value="true" />
</properties>
</persistence-unit>
</persistence>
Index : This one has the most simple persistence.xml with just the Index class (no shared Class).
I'm using named #PersistenceUnit annotation like #PersitenceUnit(name = 'securityPU') (for the User bundle).
And finally, I'm using EclipseLink as Jpa provider and Spring DM (+ Spring DM Server in the development process)
The problem is the following :
When the User bundle is deployed, I'm able to persist User objects.
When the User bundle and Energy bundles are both deployed, I'm not able to persist User objects (neither the Energy object). But I don't have any exception at all !
There is no problem at all with the Index bundle.
The bug is dataSource independent (I tried with PostgreSQL and MySQL so far).
My first conclusion was that the <class>net.nextep.amundsen.security.domain.User</class> in both persistence unit was causing the trouble. I tried without it (and hiding the User dependent object in the Energy bundle) but it failed too.
I'm a bit confused about that bug. I'm also not quite sure about the transaction management in this context.
I wasn't the one who designed this architecture (but I tell my intern OK without testing it.. shame on me) but if I could understand this bug and maybe fix it without rewrite the bundle (and break my intern work), I would appreciate. Am I doing something wrong ? (it's obvious, but what..) Did I miss something while reading documentation ?
By the way, I'm also looking for some best practices or advices when it comes to JPA, EclipseLink (or whatever JPA Provider) and Spring DM (and OSGi in general). I found interesting slides from Mike Keith about this topic (by browsing Stackoverflow).
Ok, it seems stupid to answer my own question (because it's actually not an answer but a step to the understanding of the bug).
emphasized text
It might be related to load-time weaving. I'm not quite alright with this concept yet, so I'm going to learn about it..