plone two adapters providing ISchemaExtender - schema

I am trying to use two plone addon products both using archetypes.schemaextender.
Since both products have to be explicit in which interface the adapters provide, they have
provides="archetypes.schemaextender.interfaces.ISchemaExtender"
in their zcml, which gives the following conflict:
raise ConfigurationConflictError(conflicts)
zope.configuration.config.ConfigurationConflictError: Conflicting configuration actions
For: ('adapter', (<InterfaceClass Products.ATContentTypes.interfaces.document.IATDocument>,), <InterfaceClass archetypes.schemaextender.interfaces.ISchemaExtender>, '')
File "/usr/local/Plone4/zeocluster/src/collective.guestbookcomments/collective/guestbookcomments/configure.zcml", line 14.2-15.69
<adapter factory=".guestbookcomments.PageExtender"
provides="archetypes.schemaextender.interfaces.ISchemaExtender"/>
File "/usr/local/Plone4/zeocluster/src/kuehnel.naturfreundeskreis/kuehnel/naturfreundeskreis/configure.zcml", line 54.2-55.69
<adapter factory=".topimagefield.PageExtender"
provides="archetypes.schemaextender.interfaces.ISchemaExtender"/>
Is it possible for two products to extend a document by archetypes.schemaextender?
This is on Plone 4.3.2 via unified installer

Yes it is, you have to register named adapters.
Example:
<include package="archetypes.schemaextender" />
<adapter factory=".factory.Factory"
provides="archetypes.schemaextender.interfaces.ISchemaExtender"
name="my.extender.name" />

Related

Freemarker reference theme.properties in template

I am very new to this and have to migrate an existing web app (that I do not know much about) to Weblogic (12.2.1.4). I had to upgrade the version of struts (2.0.11.2 --> 2.3.1) which also came with a newer version of Freemarker (2.3.8 --> 2.3.18).
The template directory has subdirectories for the different themes.
Under ajax for example I have a file theme.properties containing this line:
parent=xhtml
A head.ftl then contains this include:
<#include "/${parameters.templateDir}/${themeProperties.parent}/head.ftl" />
However this throws the following error in the browser:
The following has evaluated to null or missing:
==> themeProperties.parent [in template "template/ajax/head.ftl" at line 2, column 41]
I believe this was working on the old server.
Is there some new way or syntax to reference the content of that properties file?
It seems like replacing
${themeProperties.parent}
with
${parameters.expandTheme}
seems to work

Allow more than 2 gb file upload in struts2

I am using Struts 2.1 in my project.
In struts.xml maxsize element in my project is as follows :
<constant name="struts.multipart.maxSize" value="2147483648" />
For the file upload process,
is it possible to supersede the normal 2 Gb file limit of Struts2 ?
You should migrate to the latest version of Struts2.
From 2.3.20 and above, a new MulitpartRequest implementation can be used to upload large files:
Alternate Libraries
The struts.multipart.parser used by the fileUpload interceptor to
handle HTTP POST requests, encoded using the MIME-type
multipart/form-data, can be changed out. Currently there are two
choices, jakarta and pell. The jakarta parser is a standard part of
the Struts 2 framework needing only its required libraries added to a
project. The pell parser uses Jason Pell's multipart parser instead of
the Commons-FileUpload library. The pell parser is a Struts 2 plugin,
for more details see:
http://cwiki.apache.org/S2PLUGINS/pell-multipart-plugin.html. There
was a third alternative, cos, but it was removed due to licensing
incompatibilities.
As from Struts version 2.3.18 a new implementation of MultiPartRequest
was added - JakartaStreamMultiPartRequest. It can be used to handle
large files, see WW-3025 for more details, but you can simple set
<constant name="struts.multipart.parser" value="jakarta-stream" />
> in struts.xml to start using it.

How do I change the default location for mule application log files?

I would like to change the log directory from MULE_HOME/logs to MULE_HOME/logs/apps. The only place I have found that refers to a file path is in MULE_HOME/conf/wrapper.conf. Editing the wrapper.logfile does allow me to relocate the mule_ee.log file, which seems to be the Mule application log, but I'd like to include Mule application logs there, too. If I create an application called FOO and deploy it to the runtime environment, it will create a file called MULE_HOME/logs/mule-app-FOO.log, but changing the location seems to be difficult short of completely messing things up writing custom log4j2 XML files.
If you have Mule version 3.6+, then it is recommended to use log4j2.xml instead of log4j.xml.... Using log4j2 you can change the path and get your application log ... a simple example would be :-
<RollingFile name="RollingFile" fileName="${env:MULE_HOME}/logs/${sys:CustomapplicationName}.log"
filePattern="${env:MULE_HOME}/logs/${sys:CustomapplicationName}-%d{yyyy-MM-dd}-%i.log"> <!-- CustomapplicationName is set at mule-app.properties or in VM argument in Run As Configure as -DCustomapplicationName=Log4j -->
<PatternLayout>
<pattern>%d{dd/MMM/yyyy HH:mm:ss,SSS}- %c{1}: %m%n</pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="120 KB" />
</Policies>
<DefaultRolloverStrategy max="1" />
</RollingFile>
Just put this above code in your log4j2.xml in src/main/resource folder
Here in above you can see that, you have configured your path of your log files by mentioning here:-
<RollingFile name="RollingFile" fileName="${env:MULE_HOME}/logs/apps/${sys:CustomapplicationName}.log"
filePattern="${env:MULE_HOME}/logs/apps/${sys:CustomapplicationName}-%d{yyyy-MM-dd}-%i.log">
where ${sys:CustomapplicationName} is the System variable set in mule-app.properties as following :-
CustomapplicationName=yourApplicationName
Right way is to have log4j properties / xml file for FOO application and have that define the desired path for FOO application log. This way will ensure mule_ee.log is not messed up and at the same time other applications too will have their own log files which will be easy to manage and easy to introspect specific application log in case of errors / exceptions
Define location in log4j.properties file.

How to disable the OrientDb in Moqui

I am trying to run Moqui by dropping the war file into tomcat6, but it complains about OrientDb, which I don't need, so I would like to disable it.
I commented out the datasource reference in MoquiDefaultConf.xml but it still complains (SEVERE: Exception sending context initialized event to listener instance of class org.moqui.impl.webapp.MoquiContextListener
java.io.FileNotFoundException: /var/lib/tomcat6/webapps/offernanny/runtime/db/orientdb/config/orientdb-server-config.xml (No such file or directory)).
To disable OrientDB you'll need to tell the Entity Facade to use a different datasource for the "nosql" entity group. Here is an example snippet for the runtime Moqui Conf XML file (i.e. MoquiDevConf.xml, MoquiProductionConf.xml, etc):
<entity-facade crypt-pass="MoquiDefaultPassword:CHANGEME">
<!-- add datasource elements here to configure databases -->
<datasource group-name="nosql" database-conf-name="derby" schema-name="MOQUI" object-factory="">
<inline-jdbc pool-minsize="2" pool-maxsize="20">
<xa-properties databaseName="${moqui.runtime}/db/derby/MoquiTransactional" createDatabase="create"/>
</inline-jdbc>
</datasource>
</entity-facade>
This changes it to use the MoquiTransactional database, the same db as the "transactional" entity group.
Additional information for the other part of your question: the reason the runtime/db/orientdb/config/orientdb-server-config.xml file was not found was because it was not there. The gradle addRuntime task and ant add-runtime target were not copying the runtime/db directory. This is changed in commit #d3eebaa on the master branch, and OrientDB runs under Tomcat now with an embedded runtime directory.

VelocityTools error - "java.util.MissingResourceException: Can't find bundle for base name WEB-INF.conf.resources.ss_messages, locale en_US"

I'm trying to integrate VelocityTools.ResourceTool to localize velocity template but whatever I use as the 'bundles' parameter I keep getting the following error:
java.util.MissingResourceException: Can't find bundle for base name
WEB-INF.conf.resources.ss_messages, locale en_US
I'm using VelocityTools v1.4. Here are my configurations:
Tool config /WEB-INF/conf/misc/velocity/toolbox.xml
<tool>
<key>test</key>
<scope>request</scope>
<class>org.apache.velocity.tools.generic.ResourceTool</class>
<parameter name="bundles" value="WEB-INF.conf.resources.ss_messages"/>
<parameter name="locale" value="en_US"/>
</tool>
Bundles:
\WEB-INF\conf\resources\ss_messages_bg_BG.properties
\WEB-INF\conf\resources\ss_messages_en_US.properties
The two files have simple content:
full.name=\u0421\u0442\ (for bg_BG.properties)
full.name=Joe Blow (for en_US.properties)
My Velocity template has this code:
HELLO $test.full.name
I tried different values for the name="bundles" above i.e., /WEB-INF/conf/resources/ss_messages and ./conf/resources/ss_messages (going to the root dir and then referencing the ss_messages bundle).
Also, I tried putting my ss_messages.properties bundle files in a resources folder in the root and use the value="resources" instead, but nothing seems to be working...still getting the same error message.
What am I doing wrong?! Is it that the toolbox.xml file is not in the root? I've been using successfully the toolbox.xml throughout my application up until now.
The resources should be on the classpath, and configured as such.
See the ResourceTool API docs.