cziegeler 2003/07/04 10:47:41
Modified: src/blocks/woody/java/org/apache/cocoon/woody
FormContext.java DefaultFormManager.java
Log:
Make classes subclassable
Revision Changes Path
1.3 +5 -4
cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/FormContext.java
Index: FormContext.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/FormContext.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FormContext.java 30 Jun 2003 13:25:28 -0000 1.2
+++ FormContext.java 4 Jul 2003 17:47:41 -0000 1.3
@@ -59,10 +59,11 @@
* Holds data needed during the processing of a form submit.
*/
public class FormContext {
- private Request request;
- private Locale locale;
- private ActionEvent actionEvent;
- private boolean doValidation;
+
+ protected Request request;
+ protected Locale locale;
+ protected ActionEvent actionEvent;
+ protected boolean doValidation;
public FormContext(Request request, Locale locale) {
this.request = request;
1.7 +29 -12
cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/DefaultFormManager.java
Index: DefaultFormManager.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/DefaultFormManager.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DefaultFormManager.java 14 May 2003 13:19:43 -0000 1.6
+++ DefaultFormManager.java 4 Jul 2003 17:47:41 -0000 1.7
@@ -62,6 +62,7 @@
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.component.Component;
import org.apache.avalon.framework.component.Composable;
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.component.ComponentException;
@@ -78,18 +79,27 @@
/**
* Component implementing the [EMAIL PROTECTED] FormManager} role.
*/
-public class DefaultFormManager extends AbstractLogEnabled implements
FormManager, ThreadSafe, Composable, Disposable, Configurable {
- private ComponentManager componentManager;
- private Map widgetDefinitionBuilders = new HashMap();
- private FormDefinitionBuilder formDefinitionBuilder;
- private boolean initialized = false;
- private Store store;
-
+public class DefaultFormManager
+ extends AbstractLogEnabled
+ implements FormManager, ThreadSafe, Composable, Disposable, Configurable,
Component {
+
+ protected ComponentManager manager;
+ protected Map widgetDefinitionBuilders = new HashMap();
+ protected FormDefinitionBuilder formDefinitionBuilder;
+ protected boolean initialized = false;
+ protected Store store;
+
+ /**
+ * Composable
+ */
public void compose(ComponentManager componentManager) throws
ComponentException {
- this.componentManager = componentManager;
+ this.manager = componentManager;
this.store = (Store)componentManager.lookup(Store.TRANSIENT_STORE);
}
+ /**
+ * Configurable
+ */
public void configure(Configuration configuration) throws
ConfigurationException {
// get available widgets from configuration
Configuration[] widgetConfs =
configuration.getChild("widgets").getChildren("widget");
@@ -124,7 +134,7 @@
if (initialized)
return;
- LifecycleHelper lifecycleHelper = new LifecycleHelper(null, null,
componentManager, null, null, null);
+ LifecycleHelper lifecycleHelper = new LifecycleHelper(null, null,
manager, null, null, null);
Iterator widgetDefinitionBuilderIt =
widgetDefinitionBuilders.values().iterator();
while (widgetDefinitionBuilderIt.hasNext()) {
@@ -171,7 +181,7 @@
return formDefinition;
}
- private FormDefinition getStoredFormDefinition(Source source) {
+ protected FormDefinition getStoredFormDefinition(Source source) {
String key = "WoodyForm:" + source.getURI();
SourceValidity newValidity = source.getValidity();
@@ -202,7 +212,7 @@
return (FormDefinition)formDefinitionAndValidity[0];
}
- private void storeFormDefinition(FormDefinition formDefinition, Source
source) throws IOException {
+ protected void storeFormDefinition(FormDefinition formDefinition, Source
source) throws IOException {
String key = "WoodyForm:" + source.getURI();
SourceValidity validity = source.getValidity();
if (validity != null) {
@@ -221,7 +231,14 @@
return builder.buildWidgetDefinition(widgetDefinition);
}
+ /**
+ * Disposable
+ */
public void dispose() {
- componentManager.release(store);
+ if ( this.manager != null ) {
+ this.manager.release(this.store);
+ this.manager = null;
+ this.store = null;
+ }
}
}