01-13-2017 12:07 AM
Hey Everybody! I Use Activit in Karaf, an OSGI Container. To make the E-Mail Configuration Editable during runtime i put the valuses into an *.cfg folder. In the Blueprint i load the config from the cfg file.
<cm:property-placeholder persistent-id="com.example.bpmn" update-strategy="reload" placeholder-prefix="$["
placeholder-suffix="]">
<cm:default-properties>
<cm:property name="cfg.mailServerHost" value="localhost" />
<cm:property name="cfg.mailServerUsername" value="admin" />
<cm:property name="cfg.mailServerPassword" value="admin" />
<cm:property name="cfg.mailServerPort" value="25" />
<cm:property name="cfg.useSSL" value="true" />
<cm:property name="cfg.useTLS" value="true" />
<cm:property name="cfg.mailServerDefaultFrom" value="johndoe@localhost" />
</cm:default-properties>
</cm:property-placeholder>
<bean id="dataSource" class="org.h2.jdbcx.JdbcDataSource">
<property name="URL" value="jdbc:h2:~/activiti"/>
<property name="user" value="sa"/>
<property name="password" value=""/>
</bean>
<reference id="transactionManager" interface="javax.transaction.TransactionManager"/>
<bean id="configuration" class="org.activiti.engine.impl.cfg.JtaProcessEngineConfiguration"
ext:field-injection="true">
<property name="databaseType" value="h2"/>
<property name="dataSource" ref="dataSource"/>
<property name="transactionManager" ref="transactionManager"/>
<property name="databaseSchemaUpdate" value="true"/>
<property name="transactionsExternallyManaged" value="true"/>
<property name="defaultCamelContext" value="defaultContext"/>
<property name="mailServerHost" value="$[cfg.mailServerHost]"/>
<property name="mailServerUsername" value="$[cfg.mailServerUsername]"/>
<property name="mailServerPassword" value="$[cfg.mailServerPassword]"/>
<property name="mailServerPort" value="$[cfg.mailServerPort]"/>
<property name="useSSL" value="$[cfg.useSSL]" />
<property name="useTLS" value="$[cfg.useTLS]" />
<property name="mailServerDefaultFrom" value="$[cfg.mailServerDefaultFrom]"/>
</bean>
This works fine for me but if i have a Email Server without Authentication i earn an Error if i pass only empty values into the mailServerUsername and the mailServerPassword. Only Surrounding in the blueprint with a comment, so nothing pass into the process engine helps for this. is it possible to make this Optional in the config?
01-13-2017 01:29 AM
I have the same problem in working with college essay writing service.
Thank you!
01-16-2017 03:10 PM
01-17-2017 12:05 AM
Well, this works. The Problem is if you want to use both, depending on the installation then you have to rebuild the complete project for this change. if i leave the fields empty, they will also send a empty username and password to the server, but this is not the same like having no auth parameters. i want to set them optional... is there any chance?
01-17-2017 04:26 AM
Yeah, this is what I expected. If you look at the configuration impl class, the userid and password are null unless declared.
By declaring a "" it is no longer null and is being passed in.
Short of building a custom configuration impl class (which isn't hard, just extend the class you are using) you can't have it both ways.
Greg
01-18-2017 12:17 AM
Can you provide an example for overwriting this? i am not really deep in spring.
01-18-2017 09:29 AM
02-14-2017 01:52 AM
The only way I figured out to handle this to comment it out. it is not the best option but it works for me. Thank you!
Explore our Alfresco products with the links below. Use labels to filter content by product module.