001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: *
017: * $Header:$
018: */
019: package org.apache.beehive.netui.compiler.model;
020:
021: import org.apache.beehive.netui.compiler.model.validation.ValidationModel;
022: import org.apache.beehive.netui.compiler.JpfLanguageConstants;
023: import org.apache.beehive.netui.compiler.FatalCompileTimeException;
024: import org.w3c.dom.Element;
025:
026: import java.io.File;
027: import java.io.IOException;
028: import java.io.PrintWriter;
029: import java.util.ArrayList;
030: import java.util.Map;
031: import java.util.HashMap;
032: import java.util.List;
033: import java.util.Iterator;
034: import java.util.Collections;
035: import java.util.Comparator;
036:
037: public class StrutsApp extends AbstractForwardContainer implements
038: ForwardContainer, ExceptionContainer, JpfLanguageConstants {
039: //protected boolean _isRootApp = false;
040: private HashMap _actionMappings = new HashMap();
041: private ArrayList _exceptionCatches = new ArrayList();
042: private ArrayList _messageResources = new ArrayList();
043: private HashMap _formBeans = new HashMap();
044: private ValidationModel _validationModel;
045: private List _additionalValidatorConfigs;
046:
047: private boolean _returnToPageDisabled = true;
048: private boolean _returnToActionDisabled = true;
049: private boolean _isNestedPageFlow = false;
050: private boolean _isLongLivedPageFlow = false;
051: private boolean _isSharedFlow = false;
052: private boolean _isAbstract = false;
053: /** Map of name to typename */
054: private Map _sharedFlows = null;
055: private String _controllerClassName = null;
056: private String _multipartHandlerClassName = null;
057: private String _memFileSize = null;
058: private List _tilesDefinitionsConfigs = null;
059:
060: protected static final String DUPLICATE_ACTION_COMMENT = "Note that there is more than one action with path \"{0}\"."
061: + " Use a form-qualified action path if this is not the "
062: + "one you want.";
063:
064: protected static final String PAGEFLOW_REQUESTPROCESSOR_CLASSNAME = PAGEFLOW_PACKAGE
065: + ".PageFlowRequestProcessor";
066:
067: protected static final String PAGEFLOW_CONTROLLER_CONFIG_CLASSNAME = PAGEFLOW_PACKAGE
068: + ".config.PageFlowControllerConfig";
069:
070: protected static final String STRUTS_CONFIG_PREFIX = "struts-config";
071: protected static final String STRUTS_CONFIG_EXTENSION = ".xml";
072: public static final char STRUTS_CONFIG_SEPARATOR = '-';
073: protected static final String WEBINF_DIR_NAME = "WEB-INF";
074: protected static final String STRUTSCONFIG_OUTPUT_DIR = "_pageflow";
075: protected static final String VALIDATOR_PLUG_IN_CLASSNAME = STRUTS_PACKAGE
076: + ".validator.ValidatorPlugIn";
077: protected static final String VALIDATOR_PATHNAMES_PROPERTY = "pathnames";
078: protected static final String TILES_PLUG_IN_CLASSNAME = STRUTS_PACKAGE
079: + ".tiles.TilesPlugin";
080: protected static final String TILES_DEFINITIONS_CONFIG_PROPERTY = "definitions-config";
081: protected static final String TILES_MODULE_AWARE_PROPERTY = "moduleAware";
082: protected static final String NETUI_VALIDATOR_RULES_URI = '/'
083: + WEBINF_DIR_NAME + "/beehive-netui-validator-rules.xml";
084: protected static final String STRUTS_VALIDATOR_RULES_URI = '/'
085: + WEBINF_DIR_NAME + "/validator-rules.xml";
086:
087: private static final String[] NODE_ORDER = { "data-sources",
088: "form-beans", "global-exceptions", "global-forwards",
089: "action-mappings", "controller", "message-resources",
090: "plug-in" };
091:
092: public StrutsApp(String controllerClassName) {
093: super (null);
094: setParentApp(this );
095: _controllerClassName = controllerClassName;
096:
097: //
098: // Add a reference for the default validation message resources (in beehive-netui-pageflow.jar).
099: //
100: MessageResourcesModel mrm = new MessageResourcesModel(this );
101: mrm.setParameter(DEFAULT_VALIDATION_MESSAGE_BUNDLE);
102: mrm.setKey(DEFAULT_VALIDATION_MESSAGE_BUNDLE_NAME);
103: mrm.setReturnNull(true);
104: addMessageResources(mrm);
105: }
106:
107: public void addMessageResources(MessageResourcesModel mr) {
108: _messageResources.add(mr);
109: }
110:
111: private void addDisambiguatedActionMapping(ActionModel mapping) {
112: if (mapping.getFormBeanName() != null) {
113: String qualifiedPath = getFormQualifiedActionPath(mapping);
114: String path = mapping.getPath();
115: mapping.setPath(qualifiedPath);
116: mapping.setUnqualifiedActionPath(path);
117: _actionMappings.put(qualifiedPath, mapping);
118: }
119: }
120:
121: /**
122: * Adds a new ActionMapping to this StrutsApp.
123: */
124: public void addActionMapping(ActionModel mapping) {
125: String mappingPath = mapping.getPath();
126: ActionModel conflictingActionMapping = (ActionModel) _actionMappings
127: .get(mappingPath);
128:
129: if (conflictingActionMapping != null) {
130: ActionModel defaultMappingForThisPath = conflictingActionMapping;
131:
132: //
133: // If the new action mapping takes no form, then it has the highest precedence, and replaces the existing
134: // "natural" mapping for the given path. Otherwise, replace the existing one if the existing one has a
135: // form bean and if the new mapping's form bean type comes alphabetically before the existing one's.
136: //
137: if (mapping.getFormBeanName() == null
138: || (conflictingActionMapping.getFormBeanName() != null && getBeanType(
139: mapping).compareTo(
140: getBeanType(conflictingActionMapping)) < 0)) {
141: _actionMappings.remove(mappingPath);
142: _actionMappings.put(mappingPath, mapping);
143: defaultMappingForThisPath = mapping;
144: conflictingActionMapping.setOverloaded(false);
145: addDisambiguatedActionMapping(conflictingActionMapping);
146: } else {
147: addDisambiguatedActionMapping(mapping);
148: }
149:
150: defaultMappingForThisPath.setOverloaded(true);
151: defaultMappingForThisPath
152: .setComment(DUPLICATE_ACTION_COMMENT.replaceAll(
153: "\\{0\\}", mappingPath)); // @TODO I18N
154: } else {
155: _actionMappings.put(mappingPath, mapping);
156: }
157: }
158:
159: //
160: // Returns either the "form class" (specified for non-ActionForm-derived bean types), or the type of the
161: // associated FormBeanModel.
162: //
163: public String getBeanType(ActionModel actionMapping) {
164: String beanType = actionMapping.getFormClass(); // will be non-null for non-ActionForm-derived types
165:
166: if (beanType == null) {
167: FormBeanModel bean = getFormBean(actionMapping
168: .getFormBeanName());
169: assert bean != null;
170: beanType = bean.getType();
171: }
172:
173: return beanType;
174: }
175:
176: protected String getFormQualifiedActionPath(ActionModel action) {
177: assert action.getFormBeanName() != null : "action "
178: + action.getPath() + " has no form bean";
179: String beanType = getBeanType(action);
180: return action.getPath() + '_'
181: + makeFullyQualifiedBeanName(beanType);
182: }
183:
184: /**
185: * Implemented for {@link ExceptionContainer}.
186: */
187: public void addException(ExceptionModel c) {
188: _exceptionCatches.add(c);
189: }
190:
191: /**
192: * Implemented for {@link ExceptionContainer}.
193: */
194: public String getActionPath() {
195: return null;
196: }
197:
198: /**
199: * Returns all of the form beans that are defined for this
200: * StrutsApp.
201: */
202: public FormBeanModel[] getFormBeans() {
203: return (FormBeanModel[]) getFormBeansAsList().toArray(
204: new FormBeanModel[0]);
205: }
206:
207: /**
208: * Returns a list of all the form beans that are defined for this StrutsApp.
209: */
210: public List getFormBeansAsList() {
211: ArrayList retList = new ArrayList();
212:
213: for (Iterator i = _formBeans.values().iterator(); i.hasNext();) {
214: FormBeanModel fb = (FormBeanModel) i.next();
215: if (fb != null)
216: retList.add(fb);
217: }
218:
219: return retList;
220: }
221:
222: public FormBeanModel getFormBean(String formBeanName) {
223: return (FormBeanModel) _formBeans.get(formBeanName);
224: }
225:
226: /**
227: * Returns a list of {@link FormBeanModel}.
228: */
229: public List getFormBeansByActualType(String actualTypeName,
230: Boolean usesPageFlowScopedBean) {
231: ArrayList beans = null;
232:
233: for (Iterator i = _formBeans.values().iterator(); i.hasNext();) {
234: FormBeanModel formBean = (FormBeanModel) i.next();
235:
236: if (formBean != null
237: && formBean.getActualType().equals(actualTypeName)
238: && (usesPageFlowScopedBean == null || usesPageFlowScopedBean
239: .booleanValue() == formBean
240: .isPageFlowScoped())) {
241: if (beans == null)
242: beans = new ArrayList();
243: beans.add(formBean);
244: }
245: }
246:
247: return beans;
248: }
249:
250: /**
251: * Adds a new form bean to this StrutsApp.
252: */
253: public void addFormBean(FormBeanModel newFormBean) {
254: _formBeans.put(newFormBean.getName(), newFormBean);
255: }
256:
257: /**
258: * Delete the given form-bean.
259: */
260: public void deleteFormBean(FormBeanModel formBean) {
261: _formBeans.remove(formBean.getName());
262: }
263:
264: public String getFormNameForType(String formType,
265: boolean isPageFlowScoped) {
266: //
267: // First try and create a form-bean name that is a camelcased version of the classname without all of its
268: // package/outer-class qualifiers. If one with that name already exists, munge the fully-qualified classname.
269: //
270: int lastQualifier = formType.lastIndexOf('$');
271: if (lastQualifier == -1)
272: lastQualifier = formType.lastIndexOf('.');
273:
274: String formBeanName = formType.substring(lastQualifier + 1);
275: formBeanName = Character.toLowerCase(formBeanName.charAt(0))
276: + formBeanName.substring(1);
277:
278: //
279: // If there's a name conflict, we need to disambiguate.
280: //
281: if (_formBeans.containsKey(formBeanName)) {
282: String conflictingName = formBeanName;
283: FormBeanModel conflictingBean = (FormBeanModel) _formBeans
284: .get(conflictingName);
285:
286: //
287: // If the conflicting form bean has a different value for isPageFlowScoped(), we can simply add a suffix
288: // to this bean name.
289: //
290: if (conflictingBean != null
291: && isPageFlowScoped != conflictingBean
292: .isPageFlowScoped()) {
293: formBeanName += isPageFlowScoped ? "_flowScoped"
294: : "_nonFlowScoped";
295: assert !_formBeans.containsKey(formBeanName); // we generate this name -- shouldn't conflict
296: return formBeanName;
297: }
298:
299: formBeanName = makeFullyQualifiedBeanName(formType);
300:
301: //
302: // Now look for the one we're conflicting with
303: //
304: if (conflictingBean != null) {
305: String nonConflictingName = makeFullyQualifiedBeanName(conflictingBean
306: .getType());
307: conflictingBean.setName(nonConflictingName);
308: _formBeans.put(nonConflictingName, conflictingBean);
309:
310: //
311: // Now look for any action mappings that are using the conflicting name...
312: //
313: for (Iterator i = _actionMappings.values().iterator(); i
314: .hasNext();) {
315: ActionModel mapping = (ActionModel) i.next();
316:
317: if (mapping.getFormBeanName() != null
318: && mapping.getFormBeanName().equals(
319: conflictingName)) {
320: mapping.setFormBeanName(nonConflictingName);
321: }
322: }
323: }
324:
325: _formBeans.put(conflictingName, null);
326: }
327:
328: return formBeanName;
329: }
330:
331: protected static String makeFullyQualifiedBeanName(String formType) {
332: return formType.replace('.', '_').replace('$', '_');
333: }
334:
335: protected static class ActionMappingComparator implements
336: Comparator {
337: public int compare(Object o1, Object o2) {
338: assert o1 instanceof ActionModel
339: && o2 instanceof ActionModel;
340:
341: ActionModel am1 = (ActionModel) o1;
342: ActionModel am2 = (ActionModel) o2;
343:
344: assert !am1.getPath().equals(am2.getPath()); // there should be no duplicate paths
345: return am1.getPath().compareTo(am2.getPath());
346: }
347: }
348:
349: protected Map getFormBeansMap() {
350: return _formBeans;
351: }
352:
353: protected List getExceptionCatchesList() {
354: return _exceptionCatches;
355: }
356:
357: protected List getSortedActionMappings() {
358: ArrayList sortedActionMappings = new ArrayList();
359: sortedActionMappings.addAll(_actionMappings.values());
360: Collections.sort(sortedActionMappings,
361: new ActionMappingComparator());
362: return sortedActionMappings;
363: }
364:
365: protected List getMessageResourcesList() {
366: return _messageResources;
367: }
368:
369: /**
370: * Get the MessageResourcesModel for which no "key" is set (the default one used at runtime).
371: */
372: public MessageResourcesModel getDefaultMessageResources() {
373: for (java.util.Iterator ii = _messageResources.iterator(); ii
374: .hasNext();) {
375: MessageResourcesModel i = (MessageResourcesModel) ii.next();
376: if (i.getKey() == null)
377: return i;
378: }
379:
380: return null;
381: }
382:
383: public boolean isReturnToPageDisabled() {
384: return _returnToPageDisabled;
385: }
386:
387: public boolean isReturnToActionDisabled() {
388: return _returnToActionDisabled;
389: }
390:
391: public void setReturnToPageDisabled(boolean disabled) {
392: _returnToPageDisabled = disabled;
393: }
394:
395: public void setReturnToActionDisabled(boolean disabled) {
396: _returnToActionDisabled = disabled;
397: }
398:
399: public void setAdditionalValidatorConfigs(
400: List additionalValidatorConfigs) {
401: if (additionalValidatorConfigs != null
402: && !additionalValidatorConfigs.isEmpty()) {
403: _additionalValidatorConfigs = additionalValidatorConfigs;
404: }
405: }
406:
407: public void setValidationModel(ValidationModel validationModel) {
408: if (!validationModel.isEmpty()) // if there's nothing in the validation model, we don't care about it.
409: {
410: _validationModel = validationModel;
411: }
412: }
413:
414: public void writeXml(PrintWriter writer, File mergeFile)
415: throws IOException, FatalCompileTimeException,
416: XmlModelWriterException {
417: XmlModelWriter xw = new XmlModelWriter(
418: mergeFile,
419: "struts-config",
420: "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN",
421: "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd",
422: getHeaderComment(mergeFile));
423: writeXML(xw, xw.getRootElement());
424: xw.simpleFastWrite(writer);
425: }
426:
427: protected void writeToElement(XmlModelWriter xw, Element element) {
428: // form-beans
429: writeFormBeans(xw, element);
430:
431: // global-exceptions
432: writeExceptions(xw, element);
433:
434: // global-forwards
435: Element globalForwardsElement = findChildElement(xw, element,
436: "global-forwards", true, NODE_ORDER);
437: writeForwards(xw, globalForwardsElement);
438:
439: // action-mappings
440: writeActionMappings(xw, element);
441:
442: // message-resources
443: writeMessageResources(xw, element);
444:
445: // controller (request-processor, etc.)
446: writeControllerElement(xw, element);
447:
448: // ValidatorPlugIn
449: writeValidatorInit(xw, element);
450:
451: // TilesPlugin
452: writeTilesInit(xw, element);
453: }
454:
455: private void writeMessageResources(XmlModelWriter xw,
456: Element element) {
457: for (Iterator i = getMessageResourcesList().iterator(); i
458: .hasNext();) {
459: MessageResourcesModel mr = (MessageResourcesModel) i.next();
460:
461: if (mr != null) {
462: Element mrToEdit = findChildElement(xw, element,
463: "message-resources", "key", mr.getKey(), true,
464: NODE_ORDER);
465: mr.writeXML(xw, mrToEdit);
466: }
467: }
468: }
469:
470: private void writeActionMappings(XmlModelWriter xw, Element element) {
471: Element actionMappingsElement = findChildElement(xw, element,
472: "action-mappings", true, NODE_ORDER);
473: List actionMappingsList = getSortedActionMappings();
474:
475: for (int i = 0; i < actionMappingsList.size(); ++i) {
476: ActionModel am = (ActionModel) actionMappingsList.get(i);
477: Element actionMappingtoEdit = findChildElement(xw,
478: actionMappingsElement, "action", "path", am
479: .getPath(), true, null);
480: am.writeXML(xw, actionMappingtoEdit);
481: }
482: }
483:
484: private void writeExceptions(XmlModelWriter xw, Element element) {
485: Element exceptionsElement = findChildElement(xw, element,
486: "global-exceptions", true, NODE_ORDER);
487: List exceptionCatches = getExceptionCatchesList();
488:
489: if (exceptionCatches != null && !exceptionCatches.isEmpty()) {
490: for (int i = 0; i < exceptionCatches.size(); ++i) {
491: ExceptionModel ec = (ExceptionModel) exceptionCatches
492: .get(i);
493: Element exceptionToEdit = findChildElement(xw,
494: exceptionsElement, "exception", "type", ec
495: .getType(), true, null);
496: ec.writeXML(xw, exceptionToEdit);
497: }
498: }
499: }
500:
501: private void writeFormBeans(XmlModelWriter xw, Element element) {
502: Element formBeansElement = findChildElement(xw, element,
503: "form-beans", true, NODE_ORDER);
504:
505: for (Iterator i = getFormBeansMap().values().iterator(); i
506: .hasNext();) {
507: FormBeanModel fb = (FormBeanModel) i.next();
508:
509: // fb may be null -- we do this to prevent a name from being used.
510: if (fb != null) {
511: Element formBean = findChildElement(xw,
512: formBeansElement, "form-bean", "name", fb
513: .getName(), true, null);
514: fb.writeXML(xw, formBean);
515: }
516: }
517: }
518:
519: protected void writeControllerElement(XmlModelWriter xw,
520: Element element) {
521: Element controllerElement = findChildElement(xw, element,
522: "controller", false, NODE_ORDER);
523:
524: // Insert it before the first <message-resources> element.
525: if (controllerElement == null) {
526: controllerElement = xw.getDocument().createElement(
527: "controller");
528: Element[] messageResourcesElements = getChildElements(
529: element, "message-resources");
530: if (messageResourcesElements.length > 0) {
531: element.insertBefore(controllerElement,
532: messageResourcesElements[0]);
533: } else {
534: element.appendChild(controllerElement);
535: }
536: }
537:
538: setElementAttribute(controllerElement, "processorClass",
539: PAGEFLOW_REQUESTPROCESSOR_CLASSNAME);
540: setElementAttribute(controllerElement, "inputForward", true);
541: setElementAttribute(controllerElement, "multipartClass",
542: _multipartHandlerClassName);
543: setElementAttribute(controllerElement, "memFileSize",
544: _memFileSize);
545:
546: if (_isNestedPageFlow)
547: addSetProperty(xw, controllerElement, "isNestedPageFlow",
548: "true");
549: if (_isLongLivedPageFlow)
550: addSetProperty(xw, controllerElement,
551: "isLongLivedPageFlow", "true");
552: if (_isSharedFlow)
553: addSetProperty(xw, controllerElement, "isSharedFlow",
554: "true");
555: if (_isAbstract)
556: addSetProperty(xw, controllerElement, "isAbstract", "true");
557: if (isReturnToPageDisabled())
558: addSetProperty(xw, controllerElement,
559: "isReturnToPageDisabled", "true");
560: if (isReturnToActionDisabled())
561: addSetProperty(xw, controllerElement,
562: "isReturnToActionDisabled", "true");
563:
564: if (_sharedFlows != null) {
565: StringBuffer str = new StringBuffer();
566: boolean first = true;
567:
568: for (java.util.Iterator ii = _sharedFlows.entrySet()
569: .iterator(); ii.hasNext();) {
570: Map.Entry entry = (Map.Entry) ii.next();
571: if (!first)
572: str.append(',');
573: first = false;
574: String name = (String) entry.getKey();
575: String type = (String) entry.getValue();
576: str.append(name).append('=').append(type);
577: }
578:
579: addSetProperty(xw, controllerElement, "sharedFlows", str
580: .toString());
581: }
582:
583: addSetProperty(xw, controllerElement, "controllerClass",
584: _controllerClassName);
585:
586: //
587: // If there is not a default MessageResources element in the generated XML, add a special set-property
588: // to communicate this to the runtime.
589: //
590: if (findChildElement(xw, element, "message-resources", "key",
591: null) == null) {
592: addSetProperty(xw, controllerElement,
593: "isMissingDefaultMessages", "true");
594: }
595: }
596:
597: protected void addSetProperty(XmlModelWriter xw, Element element,
598: String propName, String propValue) {
599: setCustomProperty(xw, element, propName, propValue,
600: PAGEFLOW_CONTROLLER_CONFIG_CLASSNAME);
601: }
602:
603: protected void writeValidatorInit(XmlModelWriter xw, Element element) {
604: if ((_validationModel != null && !_validationModel.isEmpty())
605: || _additionalValidatorConfigs != null) {
606: Element plugInElementToEdit = findChildElement(xw, element,
607: "plug-in", "className",
608: VALIDATOR_PLUG_IN_CLASSNAME, true, NODE_ORDER);
609:
610: Element pathnamesPropertyElement = findChildElement(xw,
611: plugInElementToEdit, "set-property", "property",
612: VALIDATOR_PATHNAMES_PROPERTY, true, null);
613:
614: pathnamesPropertyElement.setAttribute("property",
615: VALIDATOR_PATHNAMES_PROPERTY);
616: StringBuffer pathNames = new StringBuffer();
617: pathNames.append(NETUI_VALIDATOR_RULES_URI);
618: pathNames.append(',').append(STRUTS_VALIDATOR_RULES_URI);
619:
620: if (_validationModel != null && !_validationModel.isEmpty()) {
621: pathNames.append(",/").append(
622: _validationModel.getOutputFileURI());
623: }
624:
625: if (_additionalValidatorConfigs != null) {
626: for (java.util.Iterator ii = _additionalValidatorConfigs
627: .iterator(); ii.hasNext();) {
628: String configFile = (String) ii.next();
629: pathNames.append(',').append(configFile);
630: }
631: }
632:
633: setElementAttribute(pathnamesPropertyElement, "value",
634: pathNames.toString());
635: }
636: }
637:
638: protected void writeTilesInit(XmlModelWriter xw, Element element) {
639: if (_tilesDefinitionsConfigs == null
640: || _tilesDefinitionsConfigs.isEmpty()) {
641: return;
642: }
643:
644: Element plugInElementToEdit = findChildElement(xw, element,
645: "plug-in", "className", TILES_PLUG_IN_CLASSNAME, true,
646: NODE_ORDER);
647:
648: Element definitionsElement = findChildElement(xw,
649: plugInElementToEdit, "set-property", "property",
650: TILES_DEFINITIONS_CONFIG_PROPERTY, true, null);
651: StringBuffer pathNames = new StringBuffer();
652: boolean firstOne = true;
653:
654: for (java.util.Iterator ii = _tilesDefinitionsConfigs
655: .iterator(); ii.hasNext();) {
656: String definitionsConfig = (String) ii.next();
657: if (!firstOne)
658: pathNames.append(',');
659: firstOne = false;
660: pathNames.append(definitionsConfig);
661: }
662: setElementAttribute(definitionsElement, "value", pathNames
663: .toString());
664:
665: Element moduleAwareElement = findChildElement(xw,
666: plugInElementToEdit, "set-property", "property",
667: TILES_MODULE_AWARE_PROPERTY, true, null);
668: setElementAttribute(moduleAwareElement, "value", true);
669: }
670:
671: protected String getHeaderComment(File mergeFile)
672: throws FatalCompileTimeException {
673: return null;
674: }
675:
676: public void setNestedPageFlow(boolean nestedPageFlow) {
677: _isNestedPageFlow = nestedPageFlow;
678: }
679:
680: public void setLongLivedPageFlow(boolean longLivedPageFlow) {
681: _isLongLivedPageFlow = longLivedPageFlow;
682: }
683:
684: protected static String getStrutsConfigURI(
685: String containingPackage, boolean isSharedFlow) {
686: return getOutputFileURI(STRUTS_CONFIG_PREFIX,
687: containingPackage, isSharedFlow);
688: }
689:
690: public static String getOutputFileURI(String filePrefix,
691: String containingPackage, boolean isSharedFlow) {
692: StringBuffer fileName = new StringBuffer(
693: STRUTSCONFIG_OUTPUT_DIR);
694: fileName.append('/').append(filePrefix);
695: if (containingPackage != null && containingPackage.length() > 0)
696: fileName.append(STRUTS_CONFIG_SEPARATOR);
697: if (isSharedFlow) {
698: fileName.append(STRUTS_CONFIG_SEPARATOR);
699: if (containingPackage == null
700: || containingPackage.length() == 0) {
701: fileName.append(STRUTS_CONFIG_SEPARATOR);
702: }
703: }
704: if (containingPackage != null)
705: fileName.append(containingPackage.replace('.',
706: STRUTS_CONFIG_SEPARATOR));
707: fileName.append(STRUTS_CONFIG_EXTENSION);
708: return fileName.toString();
709: }
710:
711: protected void setSharedFlow(boolean sharedFlow) {
712: _isSharedFlow = sharedFlow;
713: }
714:
715: protected void setSharedFlows(Map sharedFlows) {
716: _sharedFlows = sharedFlows;
717: }
718:
719: public String getMultipartHandlerClassName() {
720: return _multipartHandlerClassName;
721: }
722:
723: protected void setMultipartHandlerClassName(
724: String multipartHandlerClassName) {
725: _multipartHandlerClassName = multipartHandlerClassName;
726: }
727:
728: public void setTilesDefinitionsConfigs(List tilesDefinitionsConfigs) {
729: _tilesDefinitionsConfigs = tilesDefinitionsConfigs;
730: }
731:
732: protected boolean isSharedFlow() {
733: return _isSharedFlow;
734: }
735:
736: public boolean isAbstract() {
737: return _isAbstract;
738: }
739:
740: public void setAbstract(boolean anAbstract) {
741: _isAbstract = anAbstract;
742: }
743:
744: /**
745: * Get the threshold for keeping a file in memory when processing a multipart request. An example is
746: * <code>256K</code>
747: */
748: protected String getMemFileSize() {
749: return _memFileSize;
750: }
751:
752: /**
753: * Set the threshold for keeping a file in memory when processing a multipart request. An example is
754: * <code>256K</code>
755: */
756: protected void setMemFileSize(String memFileSize) {
757: _memFileSize = memFileSize;
758: }
759: }
|