bDerek, Chris,
thank you for your answers :) I'm little late with the response, but I've
played with the Cocoon :D
I've Mavenized the application which now have couple of JAR modules and two
WAR modules. I still didn't get to the web applications, I stuck at one of
the jar modules. It is some kind of framework which utilizes Cocoon 2.1.
My current mission is to fix all compile-time errors for that module. There
is seven types of errors. All the others I solved by defining proper
dependencies in POM.
Here it goes:
--------------------------
ERR-0001
setupDefinition(widgetElement, definition); line is the problem:
public class XmlOutputDefinitionBuilder extends OutputDefinitionBuilder {
public WidgetDefinition buildWidgetDefinition(Element widgetElement)
throws Exception {
XmlOutputDefinition definition = new XmlOutputDefinition();
setupDefinition(widgetElement, definition); // COMPILE TIME ERROR
// SNIP
return definition;
}
}
Now setupDefinition requires third argument of type
WidgetDefinitionBuilderContext. What is the proper way to get to the
instance of that type?
--------------------------
ERR-0002
getMandatory() method of WidgetDescription now returns boolean insted of
int. I have two uses of this:
#1
int manadtory = widgetDescription.getMandatory();
if (manadtory == 1 || manadtory == 10) {
attributes.addAttribute(
"",
"required",
"required",
"required",
"true");
}
I'm not sure is it safe to replace the if statement with this one:
if (widgetDescription.getMandatory()) ?
#2
int mandatory = widgetDescription.getMandatory();
if (mandatory != FALSE_CONTEXT) {
if (mandatory != TRUE_CONTEXT && mandatory !=
ALWAYS_TRUE_CONTEXT) {
ci.addMandatoryCondition(pageNumber,
widgetDescription.getName(), String.valueOf(mandatory));
}
}
where:
private static final int ALWAYS_TRUE_CONTEXT = 10;
private static final int TRUE_CONTEXT = 1;
private static final int FALSE_CONTEXT = 0;
This one is little confusing - now it's boolean and can't be true and false
at the same time. What to do here?
--------------------------
ERR-0003
Lots of logger problems. For example:
DatabaseSearchObject databaseSO =
PersistenceManager.getPersistenceSearchObject();
if (databaseSO instanceof LogEnabled) {
((LogEnabled) databaseSO).enableLogging(getLogger()); // ERROR
}
enableLogging expect the org.apache.avalon.framework.logger.Logger, but
getLogger() method of org.apache.cocoon.util.AbstractLogEnabled returns the
org.apache.commons.logging.Log
How to fix this?
--------------------------
ERR-0004
Cocoon Session VS Http Session.
Session mySession = req.getSession(); is now not OK because getSession now
returns HttpSession.
I can solve this either with using req.getCocoonSession() (which is
deprecated, btw) or with replacing Cocoon's session with the HttpSession.
What to choose?
--------------------------
ERR-0005
In many places import org.apache.cocoon.components.sax.XMLDeserializer is
used, but it not exists any more.
What to do here?
--------------------------
ERR-0006
FlowHelper.setContextObject(objectModel, botX.getFlowData());
Both passed arguments are maps. The error is:
"setContextObject(java.util.Map map,
org.apache.cocoon.el.objectmodel.ObjectModel objectModel, java.lang.Object
o) in FlowHelper cannot be applied to (Map, JAVA.UTIL.MAP)"
So, I need to change the type of 2nd argument and to pass the third
argument?
HELP, please :D
--------------------------
ERR-0007
Constants.DESCRIPTOR_RELOADABLE_DEFAULT in org.apache.cocoon doesn't exist
any more!?
--------------------------
++++++++++++++++++++++++++++++++++++++++++
This post could be the nice howto for Cocoon 2.1 to Cocoon 2.2 migration ;o)
Thank you very much,
Vanja