You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by mr...@apache.org on 2005/09/21 21:42:44 UTC
svn commit: r290802 [8/10] - in /struts/sandbox/trunk/ti: ./
jars/core/src/java/org/apache/ti/compiler/internal/
jars/core/src/java/org/apache/ti/compiler/internal/genmodel/
jars/core/src/java/org/apache/ti/compiler/internal/grammar/
jars/core/src/java...
Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/JspTagConfig.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/JspTagConfig.java?rev=290802&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/JspTagConfig.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/JspTagConfig.java Wed Sep 21 12:42:20 2005
@@ -0,0 +1,61 @@
+/**
+ Copyright 2004 The Apache Software Foundation.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Header:$
+ */
+package org.apache.ti.util.config.bean;
+
+
+/**
+ *
+ */
+public class JspTagConfig {
+ private static final DocType DEFAULT_DOC_TYPE = DocType.HTML4_LOOSE_QUIRKS;
+ private static final IdJavascript DEFAULT_ID_JAVASCRIPT = IdJavascript.DEFAULT;
+ private DocType _docType;
+ private IdJavascript _idJavascript;
+ private String _treeImageLocation;
+
+ public JspTagConfig() {
+ _docType = DEFAULT_DOC_TYPE;
+ _idJavascript = DEFAULT_ID_JAVASCRIPT;
+ }
+
+ public JspTagConfig(DocType docType, IdJavascript idJavascript, String treeImageLocation) {
+ this();
+
+ if (docType != null) {
+ _docType = docType;
+ }
+
+ if (idJavascript != null) {
+ _idJavascript = idJavascript;
+ }
+
+ _treeImageLocation = treeImageLocation;
+ }
+
+ public DocType getDocType() {
+ return _docType;
+ }
+
+ public IdJavascript getIdJavascript() {
+ return _idJavascript;
+ }
+
+ public String getTreeImageLocation() {
+ return _treeImageLocation;
+ }
+}
Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/ModuleConfigLocatorConfig.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/ModuleConfigLocatorConfig.java?rev=290802&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/ModuleConfigLocatorConfig.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/ModuleConfigLocatorConfig.java Wed Sep 21 12:42:20 2005
@@ -0,0 +1,40 @@
+/**
+ Copyright 2004 The Apache Software Foundation.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Header:$
+ */
+package org.apache.ti.util.config.bean;
+
+
+/**
+ *
+ */
+public class ModuleConfigLocatorConfig {
+ private String _locatorClass;
+ private String _description;
+
+ public ModuleConfigLocatorConfig(String locatorClass, String description) {
+ _locatorClass = locatorClass;
+ _description = description;
+ }
+
+ public String getLocatorClass() {
+ return _locatorClass;
+ }
+
+ public String getDescription() {
+ return _description;
+ }
+}
Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/MultipartHandler.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/MultipartHandler.java?rev=290802&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/MultipartHandler.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/MultipartHandler.java Wed Sep 21 12:42:20 2005
@@ -0,0 +1,101 @@
+/**
+ Copyright 2004 The Apache Software Foundation.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Header:$
+ */
+package org.apache.ti.util.config.bean;
+
+
+/**
+ *
+ */
+public final class MultipartHandler
+ implements java.io.Serializable {
+ public static final int INT_DISABLED = 0;
+ public static final int INT_MEMORY = 1;
+ public static final int INT_DISK = 2;
+
+ /**
+ */
+ public static final MultipartHandler DISABLED = new MultipartHandler(INT_DISABLED);
+
+ /**
+ */
+ public static final MultipartHandler MEMORY = new MultipartHandler(INT_MEMORY);
+
+ /**
+ */
+ public static final MultipartHandler DISK = new MultipartHandler(INT_DISK);
+ private int _val;
+
+ private MultipartHandler(int val) {
+ _val = val;
+ }
+
+ /**
+ * Convert this multipart handler to a readable String.
+ * @return the readable multipart handler name
+ */
+ public String toString() {
+ switch (_val) {
+ case INT_DISABLED:
+ return "disabled";
+
+ case INT_MEMORY:
+ return "memory";
+
+ case INT_DISK:
+ return "disk";
+ }
+
+ String message = "Encountered an unknown multipart handler with value \"" + _val + "\"";
+ assert false : message;
+ throw new IllegalStateException(message);
+ }
+
+ /**
+ * Equals method.
+ * @param value value to check
+ * @return <code>true</code> if this multipart handler matches the <code>value</code>; <code>false</code> otherwise.
+ */
+ public boolean equals(Object value) {
+ if (value == this) {
+ return true;
+ }
+
+ if ((value == null) || !(value instanceof MultipartHandler)) {
+ return false;
+ }
+
+ return ((MultipartHandler) value)._val == _val;
+ }
+
+ /**
+ * Hash code.
+ * @return the hash code
+ */
+ public int hashCode() {
+ return _val;
+ }
+
+ /**
+ * The multipart handler's int value.
+ *
+ * @return the multipart handler's value
+ */
+ public int getValue() {
+ return _val;
+ }
+}
Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/NetUIConfig.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/NetUIConfig.java?rev=290802&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/NetUIConfig.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/NetUIConfig.java Wed Sep 21 12:42:20 2005
@@ -0,0 +1,105 @@
+/**
+ Copyright 2004 The Apache Software Foundation.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Header:$
+ */
+package org.apache.ti.util.config.bean;
+
+
+/**
+ *
+ */
+public class NetUIConfig {
+ private PageFlowActionInterceptorsConfig _pageFlowActionInterceptors;
+ private PageFlowHandlersConfig _pageFlowHandlers;
+ private PageFlowConfig _pageFlowConfig;
+ private PageFlowFactoriesConfig _pageFlowFactories;
+ private SharedFlowRefConfig[] _sharedFlowRef;
+ private RequestInterceptorsConfig _requestInterceptors;
+ private JspTagConfig _jspTagConfig;
+ private PrefixHandlerConfig[] _prefixHandlers;
+ private ExpressionLanguagesConfig _expressionLanguages;
+ private IteratorFactoryConfig[] _iteratorFactories;
+ private TypeConverterConfig[] _typeConverters;
+ private UrlConfig _urlConfig;
+
+ public NetUIConfig(PageFlowActionInterceptorsConfig pageFlowActionInterceptors, PageFlowHandlersConfig pageFlowHandlers,
+ PageFlowConfig pageFlowConfig, PageFlowFactoriesConfig pageFlowFactories,
+ SharedFlowRefConfig[] sharedFlowRef, RequestInterceptorsConfig requestInterceptors,
+ JspTagConfig jspTagConfig, PrefixHandlerConfig[] prefixHandlers,
+ ExpressionLanguagesConfig expressionLanguages, IteratorFactoryConfig[] iteratorFactories,
+ TypeConverterConfig[] typeConverters, UrlConfig urlConfig) {
+ _pageFlowActionInterceptors = pageFlowActionInterceptors;
+ _pageFlowHandlers = pageFlowHandlers;
+ _pageFlowConfig = pageFlowConfig;
+ _pageFlowFactories = pageFlowFactories;
+ _sharedFlowRef = sharedFlowRef;
+ _requestInterceptors = requestInterceptors;
+ _jspTagConfig = jspTagConfig;
+ _prefixHandlers = prefixHandlers;
+ _expressionLanguages = expressionLanguages;
+ _iteratorFactories = iteratorFactories;
+ _typeConverters = typeConverters;
+ _urlConfig = urlConfig;
+ }
+
+ public PageFlowActionInterceptorsConfig getPageFlowActionInterceptors() {
+ return _pageFlowActionInterceptors;
+ }
+
+ public PageFlowHandlersConfig getPageFlowHandlers() {
+ return _pageFlowHandlers;
+ }
+
+ public PageFlowConfig getPageFlowConfig() {
+ return _pageFlowConfig;
+ }
+
+ public PageFlowFactoriesConfig getPageFlowFactories() {
+ return _pageFlowFactories;
+ }
+
+ public SharedFlowRefConfig[] getSharedFlowRefs() {
+ return _sharedFlowRef;
+ }
+
+ public RequestInterceptorsConfig getRequestInterceptors() {
+ return _requestInterceptors;
+ }
+
+ public JspTagConfig getJspTagConfig() {
+ return _jspTagConfig;
+ }
+
+ public PrefixHandlerConfig[] getPrefixHandlers() {
+ return _prefixHandlers;
+ }
+
+ public ExpressionLanguagesConfig getExpressionLanguages() {
+ return _expressionLanguages;
+ }
+
+ public IteratorFactoryConfig[] getIteratorFactories() {
+ return _iteratorFactories;
+ }
+
+ public TypeConverterConfig[] getTypeConverters() {
+ return _typeConverters;
+ }
+
+ public UrlConfig getUrlConfig() {
+ return _urlConfig;
+ }
+}
Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PageFlowActionInterceptorsConfig.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PageFlowActionInterceptorsConfig.java?rev=290802&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PageFlowActionInterceptorsConfig.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PageFlowActionInterceptorsConfig.java Wed Sep 21 12:42:20 2005
@@ -0,0 +1,41 @@
+/**
+ Copyright 2004 The Apache Software Foundation.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Header:$
+ */
+package org.apache.ti.util.config.bean;
+
+
+/**
+ *
+ */
+public class PageFlowActionInterceptorsConfig {
+ private GlobalPageFlowActionInterceptorConfig _globalPageFlowActionInterceptors;
+ private PerPageFlowActionInterceptorConfig[] _perPageFlowActionInterceptors;
+
+ public PageFlowActionInterceptorsConfig(GlobalPageFlowActionInterceptorConfig globalPageFlowActionInterceptors,
+ PerPageFlowActionInterceptorConfig[] perPageFlowActionInterceptors) {
+ _globalPageFlowActionInterceptors = globalPageFlowActionInterceptors;
+ _perPageFlowActionInterceptors = perPageFlowActionInterceptors;
+ }
+
+ public GlobalPageFlowActionInterceptorConfig getGlobalPageFlowActionInterceptors() {
+ return _globalPageFlowActionInterceptors;
+ }
+
+ public PerPageFlowActionInterceptorConfig[] getPerPageFlowActionInterceptors() {
+ return _perPageFlowActionInterceptors;
+ }
+}
Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PageFlowConfig.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PageFlowConfig.java?rev=290802&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PageFlowConfig.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PageFlowConfig.java Wed Sep 21 12:42:20 2005
@@ -0,0 +1,119 @@
+/**
+ Copyright 2004 The Apache Software Foundation.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Header:$
+ */
+package org.apache.ti.util.config.bean;
+
+
+/**
+ *
+ */
+public class PageFlowConfig {
+ private static final boolean DEFAULT_ENABLE_SELF_NESTING = false;
+ private static final int DEFAULT_MAX_FORWARDS_PER_REQUEST = 25;
+ private static final int DEFAULT_MAX_NESTING_STACK_DEPTH = 10;
+ private static final boolean DEFAULT_ENSURE_SECURE_FORWARDS = false;
+ private static final boolean DEFAULT_THROW_SESSION_EXPIRED_EXCEPTION = true;
+ private static final MultipartHandler DEFAULT_MULTIPART_HANDLER = MultipartHandler.DISABLED;
+ private static final PreventCache DEFAULT_PREVENT_CACHE = PreventCache.DEFAULT;
+ private boolean _enableSelfNesting;
+ private boolean _ensureSecureForwards;
+ private boolean _throwSessionExpiredException;
+ private int _maxForwardsPerRequest;
+ private int _maxNestingStackDepth;
+ private MultipartHandler _multipartHandler;
+ private PreventCache _preventCache;
+ private ModuleConfigLocatorConfig[] _moduleConfigLocators;
+
+ public PageFlowConfig() {
+ _enableSelfNesting = DEFAULT_ENABLE_SELF_NESTING;
+ _ensureSecureForwards = DEFAULT_ENSURE_SECURE_FORWARDS;
+ _throwSessionExpiredException = DEFAULT_THROW_SESSION_EXPIRED_EXCEPTION;
+ _maxForwardsPerRequest = DEFAULT_MAX_FORWARDS_PER_REQUEST;
+ _maxNestingStackDepth = DEFAULT_MAX_NESTING_STACK_DEPTH;
+ _multipartHandler = DEFAULT_MULTIPART_HANDLER;
+ _preventCache = DEFAULT_PREVENT_CACHE;
+ }
+
+ public PageFlowConfig(Boolean enableSelfNesting, Boolean ensureSecureForwards, Boolean throwSessionExpiredException,
+ Integer maxForwardsPerRequest, Integer maxNestingStackDepth, MultipartHandler multipartHandler,
+ PreventCache preventCache, ModuleConfigLocatorConfig[] moduleConfigLocators) {
+ /* initialize the defaults */
+ this();
+
+ if (enableSelfNesting != null) {
+ _enableSelfNesting = enableSelfNesting.booleanValue();
+ }
+
+ if (ensureSecureForwards != null) {
+ _ensureSecureForwards = ensureSecureForwards.booleanValue();
+ }
+
+ if (throwSessionExpiredException != null) {
+ _throwSessionExpiredException = throwSessionExpiredException.booleanValue();
+ }
+
+ if (maxForwardsPerRequest != null) {
+ _maxForwardsPerRequest = maxForwardsPerRequest.intValue();
+ }
+
+ if (maxNestingStackDepth != null) {
+ _maxNestingStackDepth = maxNestingStackDepth.intValue();
+ }
+
+ if (multipartHandler != null) {
+ _multipartHandler = multipartHandler;
+ }
+
+ if (preventCache != null) {
+ _preventCache = preventCache;
+ }
+
+ _moduleConfigLocators = moduleConfigLocators;
+ }
+
+ public boolean isEnableSelfNesting() {
+ return _enableSelfNesting;
+ }
+
+ public boolean isEnsureSecureForwards() {
+ return _ensureSecureForwards;
+ }
+
+ public boolean isThrowSessionExpiredException() {
+ return _throwSessionExpiredException;
+ }
+
+ public int getMaxForwardsPerRequest() {
+ return _maxForwardsPerRequest;
+ }
+
+ public int getMaxNestingStackDepth() {
+ return _maxNestingStackDepth;
+ }
+
+ public MultipartHandler getMultipartHandler() {
+ return _multipartHandler;
+ }
+
+ public PreventCache getPreventCache() {
+ return _preventCache;
+ }
+
+ public ModuleConfigLocatorConfig[] getModuleConfigLocators() {
+ return _moduleConfigLocators;
+ }
+}
Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PageFlowFactoriesConfig.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PageFlowFactoriesConfig.java?rev=290802&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PageFlowFactoriesConfig.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PageFlowFactoriesConfig.java Wed Sep 21 12:42:20 2005
@@ -0,0 +1,40 @@
+/**
+ Copyright 2004 The Apache Software Foundation.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Header:$
+ */
+package org.apache.ti.util.config.bean;
+
+
+/**
+ *
+ */
+public class PageFlowFactoriesConfig {
+ private PageFlowFactoryConfig _pageFlowFactory;
+ private PageFlowFactoryConfig _facesBackingBeanFactory;
+
+ public PageFlowFactoriesConfig(PageFlowFactoryConfig pageFlowFactory, PageFlowFactoryConfig facesBackingBeanFactory) {
+ _pageFlowFactory = pageFlowFactory;
+ _facesBackingBeanFactory = facesBackingBeanFactory;
+ }
+
+ public PageFlowFactoryConfig getPageFlowFactory() {
+ return _pageFlowFactory;
+ }
+
+ public PageFlowFactoryConfig getFacesBackingBeanFactory() {
+ return _facesBackingBeanFactory;
+ }
+}
Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PageFlowFactoryConfig.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PageFlowFactoryConfig.java?rev=290802&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PageFlowFactoryConfig.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PageFlowFactoryConfig.java Wed Sep 21 12:42:20 2005
@@ -0,0 +1,40 @@
+/**
+ Copyright 2004 The Apache Software Foundation.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Header:$
+ */
+package org.apache.ti.util.config.bean;
+
+
+/**
+ *
+ */
+public class PageFlowFactoryConfig {
+ private String _factoryClass;
+ private CustomPropertyConfig[] _customProperties;
+
+ public PageFlowFactoryConfig(String factoryClass, CustomPropertyConfig[] customProperties) {
+ _factoryClass = factoryClass;
+ _customProperties = customProperties;
+ }
+
+ public String getFactoryClass() {
+ return _factoryClass;
+ }
+
+ public CustomPropertyConfig[] getCustomProperties() {
+ return _customProperties;
+ }
+}
Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PageFlowHandlersConfig.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PageFlowHandlersConfig.java?rev=290802&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PageFlowHandlersConfig.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PageFlowHandlersConfig.java Wed Sep 21 12:42:20 2005
@@ -0,0 +1,79 @@
+/**
+ Copyright 2004 The Apache Software Foundation.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Header:$
+ */
+package org.apache.ti.util.config.bean;
+
+
+/**
+ *
+ */
+public class PageFlowHandlersConfig {
+ private HandlerConfig[] _actionForwardHandlers;
+ private HandlerConfig[] _exceptionsHandler;
+ private HandlerConfig[] _forwardRedirectHandler;
+ private HandlerConfig[] _loginHandler;
+ private HandlerConfig[] _storageHandler;
+ private HandlerConfig[] _reloadableClassHandler;
+ private HandlerConfig[] _moduleRegistrationHandler;
+ private HandlerConfig[] _annotationHandler;
+
+ public PageFlowHandlersConfig(HandlerConfig[] actionForwardHandlers, HandlerConfig[] exceptionsHandler,
+ HandlerConfig[] forwardRedirectHandler, HandlerConfig[] loginHandler,
+ HandlerConfig[] storageHandler, HandlerConfig[] reloadableClassHandler,
+ HandlerConfig[] moduleRegistrationHandler, HandlerConfig[] annotationHandler) {
+ _actionForwardHandlers = actionForwardHandlers;
+ _exceptionsHandler = exceptionsHandler;
+ _forwardRedirectHandler = forwardRedirectHandler;
+ _loginHandler = loginHandler;
+ _storageHandler = storageHandler;
+ _reloadableClassHandler = reloadableClassHandler;
+ _moduleRegistrationHandler = moduleRegistrationHandler;
+ _annotationHandler = annotationHandler;
+ }
+
+ public HandlerConfig[] getActionForwardHandlers() {
+ return _actionForwardHandlers;
+ }
+
+ public HandlerConfig[] getExceptionsHandlers() {
+ return _exceptionsHandler;
+ }
+
+ public HandlerConfig[] getForwardRedirectHandlers() {
+ return _forwardRedirectHandler;
+ }
+
+ public HandlerConfig[] getLoginHandlers() {
+ return _loginHandler;
+ }
+
+ public HandlerConfig[] getStorageHandlers() {
+ return _storageHandler;
+ }
+
+ public HandlerConfig[] getReloadableClassHandlers() {
+ return _reloadableClassHandler;
+ }
+
+ public HandlerConfig[] getModuleRegistrationHandlers() {
+ return _moduleRegistrationHandler;
+ }
+
+ public HandlerConfig[] getAnnotationHandlers() {
+ return _annotationHandler;
+ }
+}
Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PerActionInterceptorConfig.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PerActionInterceptorConfig.java?rev=290802&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PerActionInterceptorConfig.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PerActionInterceptorConfig.java Wed Sep 21 12:42:20 2005
@@ -0,0 +1,47 @@
+/**
+ Copyright 2004 The Apache Software Foundation.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Header:$
+ */
+package org.apache.ti.util.config.bean;
+
+
+/**
+ *
+ */
+public class PerActionInterceptorConfig {
+ private String _actionName;
+ private SimpleActionInterceptorConfig[] _simpleActionInterceptor;
+ private InterceptorConfig[] _actionInterceptor;
+
+ public PerActionInterceptorConfig(String actionName, SimpleActionInterceptorConfig[] simpleActionInterceptor,
+ InterceptorConfig[] actionInterceptor) {
+ _actionName = actionName;
+ _simpleActionInterceptor = simpleActionInterceptor;
+ _actionInterceptor = actionInterceptor;
+ }
+
+ public String getActionName() {
+ return _actionName;
+ }
+
+ public SimpleActionInterceptorConfig[] getSimpleActionInterceptors() {
+ return _simpleActionInterceptor;
+ }
+
+ public InterceptorConfig[] getActionInterceptors() {
+ return _actionInterceptor;
+ }
+}
Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PerPageFlowActionInterceptorConfig.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PerPageFlowActionInterceptorConfig.java?rev=290802&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PerPageFlowActionInterceptorConfig.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PerPageFlowActionInterceptorConfig.java Wed Sep 21 12:42:20 2005
@@ -0,0 +1,54 @@
+/**
+ Copyright 2004 The Apache Software Foundation.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Header:$
+ */
+package org.apache.ti.util.config.bean;
+
+
+/**
+ *
+ */
+public class PerPageFlowActionInterceptorConfig {
+ private String _pageflowUri;
+ private SimpleActionInterceptorConfig[] _simpleActionInterceptors;
+ private InterceptorConfig[] _actionInterceptors;
+ private PerActionInterceptorConfig[] _perActionInterceptors;
+
+ public PerPageFlowActionInterceptorConfig(String pageflowUri, SimpleActionInterceptorConfig[] simpleActionInterceptors,
+ InterceptorConfig[] actionInterceptors,
+ PerActionInterceptorConfig[] perActionInterceptors) {
+ _pageflowUri = pageflowUri;
+ _simpleActionInterceptors = simpleActionInterceptors;
+ _actionInterceptors = actionInterceptors;
+ _perActionInterceptors = perActionInterceptors;
+ }
+
+ public String getPageFlowUri() {
+ return _pageflowUri;
+ }
+
+ public SimpleActionInterceptorConfig[] getSimpleActionInterceptors() {
+ return _simpleActionInterceptors;
+ }
+
+ public InterceptorConfig[] getActionInterceptors() {
+ return _actionInterceptors;
+ }
+
+ public PerActionInterceptorConfig[] getPerActionInterceptors() {
+ return _perActionInterceptors;
+ }
+}
Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PrefixHandlerConfig.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PrefixHandlerConfig.java?rev=290802&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PrefixHandlerConfig.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PrefixHandlerConfig.java Wed Sep 21 12:42:20 2005
@@ -0,0 +1,40 @@
+/**
+ Copyright 2004 The Apache Software Foundation.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Header:$
+ */
+package org.apache.ti.util.config.bean;
+
+
+/**
+ *
+ */
+public class PrefixHandlerConfig {
+ private String _name;
+ private String _handlerClass;
+
+ public PrefixHandlerConfig(String name, String handlerClass) {
+ _name = name;
+ _handlerClass = handlerClass;
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public String getHandlerClass() {
+ return _handlerClass;
+ }
+}
Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PreventCache.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PreventCache.java?rev=290802&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PreventCache.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/PreventCache.java Wed Sep 21 12:42:20 2005
@@ -0,0 +1,101 @@
+/**
+ Copyright 2004 The Apache Software Foundation.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Header:$
+ */
+package org.apache.ti.util.config.bean;
+
+
+/**
+ *
+ */
+public final class PreventCache
+ implements java.io.Serializable {
+ public static final int INT_DEFAULT = 0;
+ public static final int INT_ALWAYS = 1;
+ public static final int INT_IN_DEV_MODE = 2;
+
+ /**
+ */
+ public static final PreventCache DEFAULT = new PreventCache(INT_DEFAULT);
+
+ /**
+ */
+ public static final PreventCache ALWAYS = new PreventCache(INT_ALWAYS);
+
+ /**
+ */
+ public static final PreventCache IN_DEV_MODE = new PreventCache(INT_IN_DEV_MODE);
+ private int _val;
+
+ private PreventCache(int val) {
+ _val = val;
+ }
+
+ /**
+ * Convert this prevent cache to a readable String.
+ * @return the readable multipart handler name
+ */
+ public String toString() {
+ switch (_val) {
+ case INT_DEFAULT:
+ return "default";
+
+ case INT_ALWAYS:
+ return "always";
+
+ case INT_IN_DEV_MODE:
+ return "inDevMode";
+ }
+
+ String message = "Encountered an unknown prevent cache with value \"" + _val + "\"";
+ assert false : message;
+ throw new IllegalStateException(message);
+ }
+
+ /**
+ * Equals method.
+ * @param value value to check
+ * @return <code>true</code> if this prevent cache matches the <code>value</code>; <code>false</code> otherwise.
+ */
+ public boolean equals(Object value) {
+ if (value == this) {
+ return true;
+ }
+
+ if ((value == null) || !(value instanceof PreventCache)) {
+ return false;
+ }
+
+ return ((PreventCache) value)._val == _val;
+ }
+
+ /**
+ * Hash code.
+ * @return the hash code
+ */
+ public int hashCode() {
+ return _val;
+ }
+
+ /**
+ * The multipart handler's int value.
+ *
+ * @return the multipart handler's value
+ */
+ public int getValue() {
+ return _val;
+ }
+}
Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/RequestInterceptorsConfig.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/RequestInterceptorsConfig.java?rev=290802&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/RequestInterceptorsConfig.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/RequestInterceptorsConfig.java Wed Sep 21 12:42:20 2005
@@ -0,0 +1,34 @@
+/**
+ Copyright 2004 The Apache Software Foundation.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Header:$
+ */
+package org.apache.ti.util.config.bean;
+
+
+/**
+ *
+ */
+public class RequestInterceptorsConfig {
+ private InterceptorConfig[] _globalRequestInterceptors;
+
+ public RequestInterceptorsConfig(InterceptorConfig[] globalRequestInterceptors) {
+ _globalRequestInterceptors = globalRequestInterceptors;
+ }
+
+ public InterceptorConfig[] getGlobalRequestInterceptors() {
+ return _globalRequestInterceptors;
+ }
+}
Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/SharedFlowRefConfig.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/SharedFlowRefConfig.java?rev=290802&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/SharedFlowRefConfig.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/SharedFlowRefConfig.java Wed Sep 21 12:42:20 2005
@@ -0,0 +1,23 @@
+package org.apache.ti.util.config.bean;
+
+
+/**
+ *
+ */
+public class SharedFlowRefConfig {
+ private String _name;
+ private String _type;
+
+ public SharedFlowRefConfig(String name, String type) {
+ _name = name;
+ _type = type;
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public String getType() {
+ return _type;
+ }
+}
Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/SimpleActionInterceptorConfig.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/SimpleActionInterceptorConfig.java?rev=290802&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/SimpleActionInterceptorConfig.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/SimpleActionInterceptorConfig.java Wed Sep 21 12:42:20 2005
@@ -0,0 +1,49 @@
+/**
+ Copyright 2004 The Apache Software Foundation.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Header:$
+ */
+package org.apache.ti.util.config.bean;
+
+
+/**
+ */
+public class SimpleActionInterceptorConfig {
+ private static final boolean DEFAULT_AFTER_ACTION = false;
+ private boolean _afterAction;
+ private String _interceptPath;
+
+ public SimpleActionInterceptorConfig() {
+ _afterAction = DEFAULT_AFTER_ACTION;
+ }
+
+ public SimpleActionInterceptorConfig(Boolean afterAction, String interceptPath) {
+ this();
+
+ if (afterAction != null) {
+ _afterAction = afterAction.booleanValue();
+ }
+
+ _interceptPath = interceptPath;
+ }
+
+ public boolean getAfterAction() {
+ return _afterAction;
+ }
+
+ public String getInterceptPath() {
+ return _interceptPath;
+ }
+}
Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/TypeConverterConfig.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/TypeConverterConfig.java?rev=290802&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/TypeConverterConfig.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/TypeConverterConfig.java Wed Sep 21 12:42:20 2005
@@ -0,0 +1,40 @@
+/**
+ Copyright 2004 The Apache Software Foundation.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Header:$
+ */
+package org.apache.ti.util.config.bean;
+
+
+/**
+ *
+ */
+public class TypeConverterConfig {
+ private String _type;
+ private String _converterClass;
+
+ public TypeConverterConfig(String type, String converterClass) {
+ _type = type;
+ _converterClass = converterClass;
+ }
+
+ public String getType() {
+ return _type;
+ }
+
+ public String getConverterClass() {
+ return _converterClass;
+ }
+}
Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/UrlConfig.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/UrlConfig.java?rev=290802&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/UrlConfig.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/bean/UrlConfig.java Wed Sep 21 12:42:20 2005
@@ -0,0 +1,65 @@
+/**
+ Copyright 2004 The Apache Software Foundation.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Header:$
+ */
+package org.apache.ti.util.config.bean;
+
+
+/**
+ *
+ */
+public class UrlConfig {
+ private static final boolean DEFAULT_URL_ENCODE_URLS = true;
+ private static final boolean DEFAULT_HTML_AMP_ENTITY = true;
+ private static final String DEFAULT_TEMPLATED_URL_FORMATTER_CLASS = "org.apache.ti.pageflow.internal.DefaultTemplatedURLFormatter";
+ private boolean _urlEncodeUrls;
+ private boolean _htmlAmpEntity = DEFAULT_HTML_AMP_ENTITY;
+ private String _templatedUrlFormatterClass;
+
+ public UrlConfig() {
+ _urlEncodeUrls = DEFAULT_URL_ENCODE_URLS;
+ _htmlAmpEntity = DEFAULT_HTML_AMP_ENTITY;
+ _templatedUrlFormatterClass = DEFAULT_TEMPLATED_URL_FORMATTER_CLASS;
+ }
+
+ public UrlConfig(Boolean urlEncodeUrls, Boolean htmlAmpEntity, String templatedUrlFormatterClass) {
+ this();
+
+ if (urlEncodeUrls != null) {
+ _urlEncodeUrls = urlEncodeUrls.booleanValue();
+ }
+
+ if (htmlAmpEntity != null) {
+ _htmlAmpEntity = htmlAmpEntity.booleanValue();
+ }
+
+ if (templatedUrlFormatterClass != null) {
+ _templatedUrlFormatterClass = templatedUrlFormatterClass;
+ }
+ }
+
+ public boolean isUrlEncodeUrls() {
+ return _urlEncodeUrls;
+ }
+
+ public boolean isHtmlAmpEntity() {
+ return _htmlAmpEntity;
+ }
+
+ public String getTemplatedUrlFormatterClass() {
+ return _templatedUrlFormatterClass;
+ }
+}
Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/internal/struts-ti-config-default.xml
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/internal/struts-ti-config-default.xml?rev=290802&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/internal/struts-ti-config-default.xml (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/internal/struts-ti-config-default.xml Wed Sep 21 12:42:20 2005
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<ti-config xmlns="http://struts.apache.org/ti/2005/server/config">
+
+ <expression-languages>
+ <default-language>netuiel</default-language>
+ <expression-language>
+ <name>netuiel</name>
+ <factory-class>org.apache.ti.script.el.ExpressionEvaluatorImpl$NetUIELEngineFactory</factory-class>
+ </expression-language>
+ </expression-languages>
+
+</ti-config>
+
Added: struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/parser/NetUIConfigParser.java
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/parser/NetUIConfigParser.java?rev=290802&view=auto
==============================================================================
--- struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/parser/NetUIConfigParser.java (added)
+++ struts/sandbox/trunk/ti/jars/core/src/java/org/apache/ti/util/config/parser/NetUIConfigParser.java Wed Sep 21 12:42:20 2005
@@ -0,0 +1,747 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.ti.util.config.parser;
+
+import org.apache.ti.util.config.ConfigInitializationException;
+import org.apache.ti.util.config.bean.BindingContextConfig;
+import org.apache.ti.util.config.bean.CustomPropertyConfig;
+import org.apache.ti.util.config.bean.DocType;
+import org.apache.ti.util.config.bean.ExpressionLanguageConfig;
+import org.apache.ti.util.config.bean.ExpressionLanguagesConfig;
+import org.apache.ti.util.config.bean.GlobalPageFlowActionInterceptorConfig;
+import org.apache.ti.util.config.bean.HandlerConfig;
+import org.apache.ti.util.config.bean.IdJavascript;
+import org.apache.ti.util.config.bean.InterceptorConfig;
+import org.apache.ti.util.config.bean.IteratorFactoryConfig;
+import org.apache.ti.util.config.bean.JspTagConfig;
+import org.apache.ti.util.config.bean.ModuleConfigLocatorConfig;
+import org.apache.ti.util.config.bean.MultipartHandler;
+import org.apache.ti.util.config.bean.NetUIConfig;
+import org.apache.ti.util.config.bean.PageFlowActionInterceptorsConfig;
+import org.apache.ti.util.config.bean.PageFlowConfig;
+import org.apache.ti.util.config.bean.PageFlowFactoriesConfig;
+import org.apache.ti.util.config.bean.PageFlowFactoryConfig;
+import org.apache.ti.util.config.bean.PageFlowHandlersConfig;
+import org.apache.ti.util.config.bean.PerActionInterceptorConfig;
+import org.apache.ti.util.config.bean.PerPageFlowActionInterceptorConfig;
+import org.apache.ti.util.config.bean.PrefixHandlerConfig;
+import org.apache.ti.util.config.bean.PreventCache;
+import org.apache.ti.util.config.bean.RequestInterceptorsConfig;
+import org.apache.ti.util.config.bean.SharedFlowRefConfig;
+import org.apache.ti.util.config.bean.SimpleActionInterceptorConfig;
+import org.apache.ti.util.config.bean.TypeConverterConfig;
+import org.apache.ti.util.config.bean.UrlConfig;
+import org.apache.ti.util.logging.Logger;
+import org.apache.ti.util.xml.DomUtils;
+import org.apache.ti.util.xml.XmlInputStreamResolver;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import org.xml.sax.EntityResolver;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+public final class NetUIConfigParser {
+ private static final Logger LOGGER = Logger.getInstance(NetUIConfigParser.class);
+ private static final String DEFAULT_CONFIG = "org/apache/ti/util/config/internal/struts-ti-config-default.xml";
+ private static final String CONFIG_SCHEMA = "org/apache/ti/util/config/schema/struts-ti-config.xsd";
+ private static final XmlInputStreamResolver SCHEMA_RESOLVER = new XmlInputStreamResolver() {
+ public String getResourcePath() {
+ return CONFIG_SCHEMA;
+ }
+
+ public InputStream getInputStream() {
+ return NetUIConfigParser.class.getClassLoader().getResourceAsStream(getResourcePath());
+ }
+ };
+
+ private static final XmlInputStreamResolver DEFAULT_CONFIG_RESOLVER = new XmlInputStreamResolver() {
+ public String getResourcePath() {
+ return DEFAULT_CONFIG;
+ }
+
+ public InputStream getInputStream() {
+ return NetUIConfigParser.class.getClassLoader().getResourceAsStream(getResourcePath());
+ }
+ };
+
+ public NetUIConfig parse(final XmlInputStreamResolver xmlResolver) {
+ NetUIConfig configBean = null;
+ InputStream xmlInputStream = null;
+ XmlInputStreamResolver theXmlResolver = xmlResolver;
+
+ try {
+ /* use the default XmlInputStream */
+ if (theXmlResolver == null) {
+ theXmlResolver = DEFAULT_CONFIG_RESOLVER;
+ }
+
+ xmlInputStream = theXmlResolver.getInputStream();
+
+ /* the default XmlInputStream could not provide a valid InputStream; try the default */
+ if (xmlInputStream == null) {
+ theXmlResolver = DEFAULT_CONFIG_RESOLVER;
+ xmlInputStream = theXmlResolver.getInputStream();
+
+ if (LOGGER.isInfoEnabled()) {
+ LOGGER.info("Loading the default NetUI config file. The runtime will be configured " +
+ "with a set of minimum parameters.");
+ }
+
+ /* todo: should this throw an exception? */
+ if (xmlInputStream == null) {
+ throw new ConfigInitializationException("The NetUI runtime could not find the default config file. " +
+ "The webapp may not function properly.");
+ }
+ }
+
+ if (LOGGER.isInfoEnabled()) {
+ LOGGER.info("NetUIConfigParser -- load config: " + theXmlResolver.getResourcePath());
+ }
+
+ configBean = parse(theXmlResolver.getResourcePath(), xmlInputStream);
+ } catch (IOException e) {
+ LOGGER.error("Could not open stream for " + theXmlResolver.getResourcePath(), e);
+ } finally {
+ try {
+ if (xmlInputStream != null) {
+ xmlInputStream.close();
+ }
+ } catch (IOException ignore) {
+ }
+ }
+
+ return configBean;
+ }
+
+ private NetUIConfig parse(final String resourcePath, final InputStream is) {
+ assert is != null;
+
+ NetUIConfig netuiConfig = null;
+ InputStream xsdInputStream = null;
+
+ try {
+ /* parse the config document */
+ xsdInputStream = SCHEMA_RESOLVER.getInputStream();
+
+ final String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema";
+ final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+ final String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setValidating(true);
+ dbf.setNamespaceAware(true);
+ dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
+ dbf.setAttribute(JAXP_SCHEMA_SOURCE, xsdInputStream);
+
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ db.setErrorHandler(new ErrorHandler() {
+ public void warning(SAXParseException exception) {
+ if (LOGGER.isInfoEnabled()) {
+ LOGGER.info("Validation warning validating config file \"" + resourcePath +
+ "\" against XML Schema \"" + SCHEMA_RESOLVER.getResourcePath());
+ }
+ }
+
+ public void error(SAXParseException exception) {
+ throw new ConfigInitializationException("Validation errors occurred parsing the config file \"" +
+ resourcePath + "\". Cause: " + exception, exception);
+ }
+
+ public void fatalError(SAXParseException exception) {
+ throw new ConfigInitializationException("Validation errors occurred parsing the config file \"" +
+ resourcePath + "\". Cause: " + exception, exception);
+ }
+ });
+
+ db.setEntityResolver(new EntityResolver() {
+ public InputSource resolveEntity(String publicId, String systemId) {
+ if (systemId.endsWith("/struts-ti-config.xsd")) {
+ InputStream inputStream = NetUIConfigParser.class.getClassLoader().getResourceAsStream(CONFIG_SCHEMA);
+
+ return new InputSource(inputStream);
+ } else {
+ return null;
+ }
+ }
+ });
+
+ Document document = db.parse(is);
+
+ PageFlowActionInterceptorsConfig pfActionInterceptorsConfig = parsePfActionInterceptorsConfig(document);
+ PageFlowHandlersConfig pfHandlersConfig = parsePfHandlersConfig(document);
+ PageFlowConfig pfConfig = parsePfConfig(document);
+ PageFlowFactoriesConfig pfFactoriesConfig = parsePfFactoriesConfig(document);
+ SharedFlowRefConfig[] sharedFlowRefConfigs = parseSharedFlowRefConfigs(document);
+ RequestInterceptorsConfig requestInterceptorsConfig = parseRequestInterceptorsConfig(document);
+
+ JspTagConfig jspTagConfig = parseJspTagConfig(document);
+ ExpressionLanguagesConfig elConfig = parseExpressionLanguageConfig(document);
+ TypeConverterConfig[] typeConvertersConfig = parseTypeConvertersConfig(document);
+ UrlConfig urlConfig = parseUrlConfig(document);
+ IteratorFactoryConfig[] iteratorFactories = parseIteratorFactoryConfig(document);
+ PrefixHandlerConfig[] prefixHandlers = parsePrefixHandlerConfig(document);
+
+ netuiConfig = new NetUIConfig(pfActionInterceptorsConfig, pfHandlersConfig, pfConfig, pfFactoriesConfig,
+ sharedFlowRefConfigs, requestInterceptorsConfig, jspTagConfig, prefixHandlers,
+ elConfig, iteratorFactories, typeConvertersConfig, urlConfig);
+ } catch (ParserConfigurationException e) {
+ throw new ConfigInitializationException("Error occurred parsing the config file \"" + resourcePath + "\"", e);
+ } catch (IOException e) {
+ throw new ConfigInitializationException("Error occurred parsing the config file \"" + resourcePath + "\"", e);
+ } catch (SAXException e) {
+ throw new ConfigInitializationException("Error occurred parsing the config file \"" + resourcePath + "\"", e);
+ } finally {
+ try {
+ if (xsdInputStream != null) {
+ xsdInputStream.close();
+ }
+ } catch (IOException e) {
+ }
+ }
+
+ return netuiConfig;
+ }
+
+ private static final PageFlowActionInterceptorsConfig parsePfActionInterceptorsConfig(Document document) {
+ final Element elem = DomUtils.getChildElementByName(document.getDocumentElement(), "pageflow-action-interceptors");
+
+ if (elem == null) {
+ return null;
+ }
+
+ /* global */
+ Element globalElem = DomUtils.getChildElementByName(elem, "global");
+ GlobalPageFlowActionInterceptorConfig global = null;
+ InterceptorConfig[] globalInterceptorConfigs = null;
+ SimpleActionInterceptorConfig[] globalSimpleActionInterceptorConfig = null;
+
+ if (globalElem != null) {
+ globalSimpleActionInterceptorConfig = parseSimpleActionInterceptorConfigs(DomUtils.getChildElementsByName(globalElem,
+ "simple-action-interceptor"));
+ globalInterceptorConfigs = parseInterceptorConfigs(DomUtils.getChildElementsByName(globalElem, "action-interceptor"));
+ }
+
+ global = new GlobalPageFlowActionInterceptorConfig(globalSimpleActionInterceptorConfig, globalInterceptorConfigs);
+
+ /* per page flow */
+ PerPageFlowActionInterceptorConfig[] perPageFlow = null;
+ NodeList perJpfList = elem.getElementsByTagName("per-pageflow");
+
+ if ((perJpfList != null) && (perJpfList.getLength() > 0)) {
+ perPageFlow = new PerPageFlowActionInterceptorConfig[perJpfList.getLength()];
+
+ for (int i = 0; i < perJpfList.getLength(); i++) {
+ Element perJpfElem = (Element) perJpfList.item(i);
+
+ PerActionInterceptorConfig[] perActionInterceptorConfigs = null;
+ NodeList perAction = perJpfElem.getElementsByTagName("per-action");
+
+ if ((perAction != null) && (perAction.getLength() > 0)) {
+ perActionInterceptorConfigs = new PerActionInterceptorConfig[perAction.getLength()];
+
+ for (int j = 0; j < perAction.getLength(); j++) {
+ perActionInterceptorConfigs[j] = new PerActionInterceptorConfig(DomUtils.getChildElementText((Element) perAction.item(j),
+ "action-name"),
+ parseSimpleActionInterceptorConfigs(DomUtils.getChildElementsByName((Element) perAction.item(j),
+ "simple-action-interceptor")),
+ parseInterceptorConfigs(DomUtils.getChildElementsByName((Element) perAction.item(j),
+ "action-interceptor")));
+ }
+ }
+
+ perPageFlow[i] = new PerPageFlowActionInterceptorConfig(DomUtils.getChildElementText(perJpfElem, "pageflow-uri"),
+ parseSimpleActionInterceptorConfigs(DomUtils.getChildElementsByName(perJpfElem,
+ "simple-action-interceptor")),
+ parseInterceptorConfigs(DomUtils.getChildElementsByName(perJpfElem,
+ "action-interceptor")),
+ perActionInterceptorConfigs);
+ }
+ }
+
+ return new PageFlowActionInterceptorsConfig(global, perPageFlow);
+ }
+
+ private static final SimpleActionInterceptorConfig[] parseSimpleActionInterceptorConfigs(List list) {
+ if ((list == null) || (list.size() == 0)) {
+ return null;
+ }
+
+ SimpleActionInterceptorConfig[] simpleActionInterceptorConfigs = new SimpleActionInterceptorConfig[list.size()];
+
+ for (int i = 0; i < list.size(); i++) {
+ Boolean afterAction = null;
+
+ String tmp = DomUtils.getChildElementText((Element) list.get(i), "after-action");
+
+ if (tmp != null) {
+ afterAction = new Boolean(tmp);
+ }
+
+ simpleActionInterceptorConfigs[i] = new SimpleActionInterceptorConfig(afterAction,
+ DomUtils.getChildElementText((Element) list.get(i),
+ "intercept-path"));
+ }
+
+ return simpleActionInterceptorConfigs;
+ }
+
+ private static final PageFlowHandlersConfig parsePfHandlersConfig(Document document) {
+ Element elem = DomUtils.getChildElementByName(document.getDocumentElement(), "pageflow-handlers");
+
+ if (elem == null) {
+ return null;
+ }
+
+ return new PageFlowHandlersConfig(parseHandlerConfig(elem.getElementsByTagName("action-forward-handler")),
+ parseHandlerConfig(elem.getElementsByTagName("exceptions-handler")),
+ parseHandlerConfig(elem.getElementsByTagName("forward-redirect-handler")),
+ parseHandlerConfig(elem.getElementsByTagName("login-handler")),
+ parseHandlerConfig(elem.getElementsByTagName("storage-handler")),
+ parseHandlerConfig(elem.getElementsByTagName("reloadable-class-handler")),
+ parseHandlerConfig(elem.getElementsByTagName("module-registration-handler")),
+ parseHandlerConfig(elem.getElementsByTagName("annotation-handler")));
+ }
+
+ private static final PageFlowConfig parsePfConfig(Document document) {
+ Element elem = DomUtils.getChildElementByName(document.getDocumentElement(), "pageflow-config");
+
+ if (elem == null) {
+ return new PageFlowConfig();
+ }
+
+ PageFlowConfig pfConfig = null;
+
+ Boolean enableSelfNesting = null;
+ Boolean ensureSecureForwards = null;
+ Boolean throwSessionExpiredException = null;
+ Integer maxForwardsPerRequest = null;
+ Integer maxNestingStackDepth = null;
+ MultipartHandler mpHandler = null;
+ PreventCache preventCache = null;
+ ModuleConfigLocatorConfig[] moduleConfigLocators = null;
+
+ String tmp = null;
+
+ tmp = DomUtils.getChildElementText(elem, "enable-self-nesting");
+
+ if (tmp != null) {
+ enableSelfNesting = new Boolean(tmp);
+ }
+
+ tmp = DomUtils.getChildElementText(elem, "ensure-secure-forwards");
+
+ if (tmp != null) {
+ ensureSecureForwards = new Boolean(tmp);
+ }
+
+ tmp = DomUtils.getChildElementText(elem, "throw-session-expired-exception");
+
+ if (tmp != null) {
+ throwSessionExpiredException = new Boolean(tmp);
+ }
+
+ tmp = DomUtils.getChildElementText(elem, "max-forwards-per-request");
+
+ if (tmp != null) {
+ maxForwardsPerRequest = new Integer(Integer.parseInt(tmp));
+ }
+
+ tmp = DomUtils.getChildElementText(elem, "max-nesting-stack-depth");
+
+ if (tmp != null) {
+ maxNestingStackDepth = new Integer(Integer.parseInt(tmp));
+ }
+
+ tmp = DomUtils.getChildElementText(elem, "multipart-handler");
+
+ if (tmp != null) {
+ if (tmp.equals("disabled")) {
+ mpHandler = MultipartHandler.DISABLED;
+ } else if (tmp.equals("disk")) {
+ mpHandler = MultipartHandler.DISK;
+ } else if (tmp.equals("memory")) {
+ mpHandler = MultipartHandler.MEMORY;
+ }
+ }
+
+ tmp = DomUtils.getChildElementText(elem, "prevent-cache");
+
+ if (tmp != null) {
+ if (tmp.equals("always")) {
+ preventCache = PreventCache.ALWAYS;
+ } else if (tmp.equals("default")) {
+ preventCache = PreventCache.DEFAULT;
+ } else if (tmp.equals("inDevMode")) {
+ preventCache = PreventCache.IN_DEV_MODE;
+ }
+ }
+
+ moduleConfigLocators = parseModuleConfigLocators(DomUtils.getChildElementByName(elem, "module-config-locators"));
+
+ pfConfig = new PageFlowConfig(enableSelfNesting, ensureSecureForwards, throwSessionExpiredException,
+ maxForwardsPerRequest, maxNestingStackDepth, mpHandler, preventCache, moduleConfigLocators);
+
+ return pfConfig;
+ }
+
+ private static final ModuleConfigLocatorConfig[] parseModuleConfigLocators(Element element) {
+ if (element == null) {
+ return null;
+ }
+
+ NodeList list = element.getElementsByTagName("module-config-locator");
+
+ if ((list == null) || (list.getLength() == 0)) {
+ return null;
+ }
+
+ ModuleConfigLocatorConfig[] mclConfig = new ModuleConfigLocatorConfig[list.getLength()];
+
+ for (int i = 0; i < list.getLength(); i++) {
+ mclConfig[i] = new ModuleConfigLocatorConfig(DomUtils.getChildElementText((Element) list.item(i), "locator-class"),
+ DomUtils.getChildElementText((Element) list.item(i), "description"));
+ }
+
+ return mclConfig;
+ }
+
+ private static final PageFlowFactoriesConfig parsePfFactoriesConfig(Document document) {
+ Element elem = DomUtils.getChildElementByName(document.getDocumentElement(), "pageflow-factories");
+
+ if (elem == null) {
+ return null;
+ }
+
+ PageFlowFactoryConfig pfFactory = parsePageFlowFactoryConfig(DomUtils.getChildElementByName(elem, "flowcontroller-factory"));
+ PageFlowFactoryConfig fbbFactoyr = parsePageFlowFactoryConfig(DomUtils.getChildElementByName(elem,
+ "faces-backing-bean-factory"));
+
+ return new PageFlowFactoriesConfig(pfFactory, fbbFactoyr);
+ }
+
+ private static final SharedFlowRefConfig[] parseSharedFlowRefConfigs(Document document) {
+ Element elem = DomUtils.getChildElementByName(document.getDocumentElement(), "default-shared-flow-refs");
+
+ if (elem == null) {
+ return null;
+ }
+
+ NodeList list = elem.getElementsByTagName("shared-flow-ref");
+
+ if ((list == null) || (list.getLength() == 0)) {
+ return null;
+ }
+
+ SharedFlowRefConfig[] sharedFlowRefConfigs = new SharedFlowRefConfig[list.getLength()];
+
+ for (int i = 0; i < list.getLength(); i++) {
+ Node node = list.item(i);
+ sharedFlowRefConfigs[i] = new SharedFlowRefConfig(DomUtils.getChildElementText((Element) node, "name"),
+ DomUtils.getChildElementText((Element) node, "type"));
+ }
+
+ return sharedFlowRefConfigs;
+ }
+
+ private static final RequestInterceptorsConfig parseRequestInterceptorsConfig(Document document) {
+ Element elem = DomUtils.getChildElementByName(document.getDocumentElement(), "request-interceptors");
+
+ if (elem == null) {
+ return null;
+ }
+
+ RequestInterceptorsConfig requestInterceptorsConfig = null;
+ Element global = DomUtils.getChildElementByName(elem, "global");
+
+ if (global == null) {
+ return null;
+ }
+
+ InterceptorConfig[] interceptorConfigs = parseInterceptorConfigs(DomUtils.getChildElementsByName(global,
+ "request-interceptor"));
+
+ if (interceptorConfigs != null) {
+ requestInterceptorsConfig = new RequestInterceptorsConfig(interceptorConfigs);
+ }
+
+ return requestInterceptorsConfig;
+ }
+
+ private static final JspTagConfig parseJspTagConfig(Document document) {
+ DocType docType = null;
+ IdJavascript idJavascript = null;
+ String treeImageLocation = null;
+
+ String tmp = null;
+ Element elem = DomUtils.getChildElementByName(document.getDocumentElement(), "jsp-tag-config");
+
+ if (elem == null) {
+ return new JspTagConfig();
+ }
+
+ tmp = DomUtils.getChildElementText(elem, "doctype");
+
+ if (tmp != null) {
+ if (tmp.equals("html4-loose")) {
+ docType = DocType.HTML4_LOOSE;
+ } else if (tmp.equals("html4-loose-quirks")) {
+ docType = DocType.HTML4_LOOSE_QUIRKS;
+ } else if (tmp.equals("xhtml1-transitional")) {
+ docType = DocType.XHTML1_TRANSITIONAL;
+ }
+ }
+
+ tmp = DomUtils.getChildElementText(elem, "id-javascript");
+
+ if (tmp != null) {
+ if (tmp.equals("default")) {
+ idJavascript = IdJavascript.DEFAULT;
+ } else if (tmp.equals("legacy")) {
+ idJavascript = IdJavascript.LEGACY;
+ } else if (tmp.equals("legacyOnly")) {
+ idJavascript = IdJavascript.LEGACY_ONLY;
+ }
+ }
+
+ treeImageLocation = DomUtils.getChildElementText(elem, "tree-image-location");
+
+ return new JspTagConfig(docType, idJavascript, treeImageLocation);
+ }
+
+ private static final PrefixHandlerConfig[] parsePrefixHandlerConfig(Document document) {
+ Element elem = DomUtils.getChildElementByName(document.getDocumentElement(), "prefix-handlers");
+
+ if (elem == null) {
+ return null;
+ }
+
+ NodeList list = elem.getElementsByTagName("prefix-handler");
+
+ if ((list == null) || (list.getLength() == 0)) {
+ return null;
+ }
+
+ PrefixHandlerConfig[] prefixHandlers = new PrefixHandlerConfig[list.getLength()];
+
+ for (int i = 0; i < list.getLength(); i++) {
+ Node node = list.item(i);
+ prefixHandlers[i] = new PrefixHandlerConfig(DomUtils.getChildElementText((Element) node, "name"),
+ DomUtils.getChildElementText((Element) node, "handler-class"));
+ }
+
+ return prefixHandlers;
+ }
+
+ private static final ExpressionLanguagesConfig parseExpressionLanguageConfig(Document document) {
+ Element elem = DomUtils.getChildElementByName(document.getDocumentElement(), "expression-languages");
+
+ if (elem == null) {
+ return null;
+ }
+
+ String defaultLanguage = DomUtils.getChildElementText(elem, "default-language");
+ ExpressionLanguageConfig[] elConfigs = null;
+
+ NodeList list = elem.getElementsByTagName("expression-language");
+
+ if ((list != null) && (list.getLength() > 0)) {
+ elConfigs = new ExpressionLanguageConfig[list.getLength()];
+
+ for (int i = 0; i < list.getLength(); i++) {
+ Node node = list.item(i);
+
+ BindingContextConfig[] bindingContextConfig = null;
+ Node bindingContexts = DomUtils.getChildElementByName((Element) node, "binding-contexts");
+
+ if (bindingContexts != null) {
+ NodeList bcList = ((Element) bindingContexts).getElementsByTagName("binding-context");
+
+ if ((bcList != null) && (bcList.getLength() > 0)) {
+ bindingContextConfig = new BindingContextConfig[bcList.getLength()];
+
+ for (int j = 0; j < bcList.getLength(); j++) {
+ bindingContextConfig[j] = new BindingContextConfig(DomUtils.getChildElementText((Element) bcList.item(j),
+ "name"),
+ DomUtils.getChildElementText((Element) bcList.item(j),
+ "factory-class"));
+ }
+ }
+ }
+
+ elConfigs[i] = new ExpressionLanguageConfig(DomUtils.getChildElementText((Element) node, "name"),
+ DomUtils.getChildElementText((Element) node, "factory-class"),
+ bindingContextConfig);
+ }
+ }
+
+ return new ExpressionLanguagesConfig(defaultLanguage, elConfigs);
+ }
+
+ private static final TypeConverterConfig[] parseTypeConvertersConfig(Document document) {
+ Element elem = DomUtils.getChildElementByName(document.getDocumentElement(), "type-converters");
+
+ if (elem == null) {
+ return null;
+ }
+
+ NodeList list = elem.getElementsByTagName("type-converter");
+
+ if ((list == null) || (list.getLength() == 0)) {
+ return null;
+ }
+
+ TypeConverterConfig[] typeConverterConfig = new TypeConverterConfig[list.getLength()];
+
+ for (int i = 0; i < list.getLength(); i++) {
+ Node node = list.item(i);
+ typeConverterConfig[i] = new TypeConverterConfig(DomUtils.getChildElementText((Element) node, "type"),
+ DomUtils.getChildElementText((Element) node, "converter-class"));
+ }
+
+ return typeConverterConfig;
+ }
+
+ private static final IteratorFactoryConfig[] parseIteratorFactoryConfig(Document document) {
+ Element elem = DomUtils.getChildElementByName(document.getDocumentElement(), "iterator-factories");
+
+ if (elem == null) {
+ return null;
+ }
+
+ NodeList list = elem.getElementsByTagName("iterator-factory");
+
+ if ((list == null) || (list.getLength() == 0)) {
+ return null;
+ }
+
+ IteratorFactoryConfig[] iteratorFactoryConfig = new IteratorFactoryConfig[list.getLength()];
+
+ for (int i = 0; i < list.getLength(); i++) {
+ Node node = list.item(i);
+ iteratorFactoryConfig[i] = new IteratorFactoryConfig(DomUtils.getChildElementText((Element) node, "name"),
+ DomUtils.getChildElementText((Element) node, "factory-class"));
+ }
+
+ return iteratorFactoryConfig;
+ }
+
+ private static final UrlConfig parseUrlConfig(Document document) {
+ Element elem = DomUtils.getChildElementByName(document.getDocumentElement(), "url-config");
+
+ if (elem == null) {
+ return new UrlConfig();
+ }
+
+ Boolean urlEncodeUrls = null;
+ Boolean htmlAmpEntity = null;
+ String templatedUrlFormatterClass = null;
+
+ String tmp = null;
+
+ tmp = DomUtils.getChildElementText(elem, "url-encode-urls");
+
+ if (tmp != null) {
+ urlEncodeUrls = new Boolean(tmp);
+ }
+
+ tmp = DomUtils.getChildElementText(elem, "html-amp-entity");
+
+ if (tmp != null) {
+ htmlAmpEntity = new Boolean(tmp);
+ }
+
+ templatedUrlFormatterClass = DomUtils.getChildElementText(elem, "templated-url-formatter-class");
+
+ return new UrlConfig(urlEncodeUrls, htmlAmpEntity, templatedUrlFormatterClass);
+ }
+
+ /* -----------------------------------------------------------------------------------
+
+ Utilities used to parse reused NetUI config types
+
+ ----------------------------------------------------------------------------------
+ */
+ private static final HandlerConfig[] parseHandlerConfig(NodeList list) {
+ if ((list == null) || (list.getLength() == 0)) {
+ return null;
+ }
+
+ HandlerConfig[] handlerConfigs = new HandlerConfig[list.getLength()];
+
+ for (int i = 0; i < handlerConfigs.length; i++) {
+ handlerConfigs[i] = new HandlerConfig(DomUtils.getChildElementText((Element) list.item(i), "handler-class"),
+ parseCustomProperties(((Element) list.item(i)).getElementsByTagName("custom-property")));
+ }
+
+ return handlerConfigs;
+ }
+
+ private static final InterceptorConfig[] parseInterceptorConfigs(List list) {
+ if ((list == null) || (list.size() == 0)) {
+ return null;
+ }
+
+ InterceptorConfig[] interceptorConfigs = new InterceptorConfig[list.size()];
+
+ for (int i = 0; i < list.size(); i++) {
+ interceptorConfigs[i] = new InterceptorConfig(DomUtils.getChildElementText((Element) list.get(i), "interceptor-class"),
+ parseCustomProperties(((Element) list.get(i)).getElementsByTagName("custom-property")));
+ }
+
+ return interceptorConfigs;
+ }
+
+ private static final CustomPropertyConfig[] parseCustomProperties(NodeList customProperties) {
+ if ((customProperties == null) || (customProperties.getLength() == 0)) {
+ return null;
+ }
+
+ CustomPropertyConfig[] cpConfig = new CustomPropertyConfig[customProperties.getLength()];
+
+ for (int i = 0; i < cpConfig.length; i++) {
+ cpConfig[i] = new CustomPropertyConfig(DomUtils.getChildElementText((Element) customProperties.item(i), "name"),
+ DomUtils.getChildElementText((Element) customProperties.item(i), "value"));
+ }
+
+ return cpConfig;
+ }
+
+ private static final PageFlowFactoryConfig parsePageFlowFactoryConfig(Node node) {
+ if (node != null) {
+ return new PageFlowFactoryConfig(DomUtils.getChildElementText((Element) node, "factory-class"),
+ parseCustomProperties((((Element) node).getElementsByTagName("custom-property"))));
+ } else {
+ return null;
+ }
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org