You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by am...@apache.org on 2007/12/14 06:17:24 UTC
svn commit: r604105 - in
/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2:
deployment/ deployment/util/ description/ description/java2wsdl/ receivers/
util/
Author: amilas
Date: Thu Dec 13 21:17:23 2007
New Revision: 604105
URL: http://svn.apache.org/viewvc?rev=604105&view=rev
Log:
improve the exclude bean properties method to enable users to use the
regulare expressions to specify the class names, exclude and include properties.
Added:
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/BeanExcludeInfo.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/ExcludeInfo.java
Modified:
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DocLitBareSchemaGenerator.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/receivers/AbstractRobustInMessageReceiver.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/JavaUtils.java
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java?rev=604105&r1=604104&r2=604105&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/DeploymentConstants.java Thu Dec 13 21:17:23 2007
@@ -92,6 +92,7 @@
String TAG_DESCRIPTION = "Description";
String TAG_CLASS_NAME = "class";
String TAG_EXCLUDE_PROPERTIES= "excludeProperties";
+ String TAG_INCLUDE_PROPERTIES= "includeProperties";
String TAG_AFTER = "after";
String TAG_BEFORE = "before";
String TAG_SUPPORTED_POLICY_NAMESPACES = "supported-policy-namespaces";
Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/BeanExcludeInfo.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/BeanExcludeInfo.java?rev=604105&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/BeanExcludeInfo.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/BeanExcludeInfo.java Thu Dec 13 21:17:23 2007
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ */
+package org.apache.axis2.deployment.util;
+
+import java.util.Locale;
+
+/**
+ * this class is used to keep the excludeProperties and includePropertes
+ * of the given bean when generating the wsdl, and serializing.
+ */
+public class BeanExcludeInfo {
+
+ // exclude property list given as a regualar expression
+ // but we exclude this property only if it is not available
+ // in the include properties list
+ private String excludeProperties;
+ private String includeProperties;
+
+ public BeanExcludeInfo(String excludeProperties, String includeProperties) {
+ this.excludeProperties = excludeProperties;
+ this.includeProperties = includeProperties;
+ }
+
+ public String getExcludeProperties() {
+ return excludeProperties;
+ }
+
+ public void setExcludeProperties(String excludeProperties) {
+ this.excludeProperties = excludeProperties;
+ }
+
+ public String getIncludeProperties() {
+ return includeProperties;
+ }
+
+ public void setIncludeProperties(String includeProperties) {
+ this.includeProperties = includeProperties;
+ }
+
+ /**
+ * a property is excluded if it ths given in the exclude list
+ * but not in include list
+ * @param property
+ * @return is exclude the property or not
+ */
+ public boolean isExcluedProperty(String property){
+ boolean isExclude = false;
+ if ((excludeProperties != null) && (excludeProperties.trim().length() > 0)){
+ if (property.matches(excludeProperties)){
+ isExclude = true;
+ if ((includeProperties != null) && (includeProperties.trim().length() > 0)){
+ if (property.matches(includeProperties)){
+ isExclude = false;
+ }
+ }
+ }
+ }
+ return isExclude;
+ }
+
+
+}
Added: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/ExcludeInfo.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/ExcludeInfo.java?rev=604105&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/ExcludeInfo.java (added)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/ExcludeInfo.java Thu Dec 13 21:17:23 2007
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ */
+package org.apache.axis2.deployment.util;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+
+/**
+ * this class is used to keep the exclude property details of all the classes.
+ * A map object is used to map the class name to an beanInfo object. here the class name is
+ * acctually a regular expression
+ *
+ */
+public class ExcludeInfo {
+
+ private Map classNameToBeanInfoMap;
+
+ public ExcludeInfo() {
+ this.classNameToBeanInfoMap = new HashMap();
+ }
+
+ public void putBeanInfo(String classNameRegx,BeanExcludeInfo beanExcludeInfo){
+ this.classNameToBeanInfoMap.put(classNameRegx,beanExcludeInfo);
+ }
+
+ public BeanExcludeInfo getBeanExcludeInfoForClass(String className){
+ // here map keys represents the regualr expressions for class names
+ // so we have to iterate through the keys and find the beanInfo object
+ String classNameRegx = null;
+ BeanExcludeInfo beanExcludeInfo = null;
+ for (Iterator iter = this.classNameToBeanInfoMap.keySet().iterator(); iter.hasNext();){
+ classNameRegx = (String) iter.next();
+ if (className.matches(classNameRegx)){
+ beanExcludeInfo = (BeanExcludeInfo) this.classNameToBeanInfoMap.get(classNameRegx);
+ // this means we have find the required object
+ break;
+ }
+ }
+ return beanExcludeInfo;
+ }
+
+}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java?rev=604105&r1=604104&r2=604105&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java Thu Dec 13 21:17:23 2007
@@ -679,18 +679,18 @@
if (excludeBeanProperty != null) {
OMElement parameterElement = excludeBeanProperty.getParameterElement();
Iterator bneasItr =parameterElement.getChildrenWithName(new QName("bean"));
- HashMap beanMap = new HashMap();
+ ExcludeInfo excludeInfo = new ExcludeInfo();
while (bneasItr.hasNext()) {
OMElement bean = (OMElement) bneasItr.next();
String clazz = bean.getAttributeValue(
new QName(DeploymentConstants.TAG_CLASS_NAME));
- String value = bean.getAttributeValue(
+ String excludePropertees = bean.getAttributeValue(
new QName(DeploymentConstants.TAG_EXCLUDE_PROPERTIES));
- if (clazz != null && value != null) {
- beanMap.put(clazz,getArrayFromString(value));
- }
+ String includeProperties = bean.getAttributeValue(
+ new QName(DeploymentConstants.TAG_INCLUDE_PROPERTIES));
+ excludeInfo.putBeanInfo(clazz, new BeanExcludeInfo(excludePropertees,includeProperties));
}
- service.setBeanExludeMap(beanMap);
+ service.setExcludeInfo(excludeInfo);
}
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java?rev=604105&r1=604104&r2=604105&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java Thu Dec 13 21:17:23 2007
@@ -39,6 +39,7 @@
import org.apache.axis2.dataretrieval.WSDLSupplier;
import org.apache.axis2.deployment.util.PhasesInfo;
import org.apache.axis2.deployment.util.Utils;
+import org.apache.axis2.deployment.util.ExcludeInfo;
import org.apache.axis2.deployment.DeploymentConstants;
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.engine.DefaultObjectSupplier;
@@ -240,8 +241,8 @@
// package to namespace mapping
private Map p2nMap;
- //To keep the bean property exclude map
- private Map beanExludeMap;
+ // to keep the exclude property details
+ private ExcludeInfo excludeInfo;
private TypeTable typeTable;
@@ -2565,12 +2566,11 @@
return getName();
}
-
- public Map getBeanExludeMap() {
- return beanExludeMap;
+ public ExcludeInfo getExcludeInfo() {
+ return excludeInfo;
}
- public void setBeanExludeMap(Map beanExludeMap) {
- this.beanExludeMap = beanExludeMap;
+ public void setExcludeInfo(ExcludeInfo excludeInfo) {
+ this.excludeInfo = excludeInfo;
}
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java?rev=604105&r1=604104&r2=604105&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DefaultSchemaGenerator.java Thu Dec 13 21:17:23 2007
@@ -20,6 +20,7 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.deployment.util.Utils;
+import org.apache.axis2.deployment.util.BeanExcludeInfo;
import org.apache.axis2.description.AxisMessage;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisService;
@@ -502,21 +503,17 @@
Set propertiesNames = new HashSet();
JProperty[] tempProperties = javaType.getDeclaredProperties();
- ArrayList excludes = null;
- if (service.getBeanExludeMap() !=null) {
- excludes = (ArrayList) service.getBeanExludeMap().get(
+ BeanExcludeInfo beanExcludeInfo = null;
+ if (service.getExcludeInfo() !=null) {
+ beanExcludeInfo = service.getExcludeInfo().getBeanExcludeInfoForClass(
javaType.getQualifiedName());
}
for (int i = 0; i < tempProperties.length; i++) {
JProperty tempProperty = tempProperties[i];
- if (excludes !=null && excludes.contains("*")){
- continue;
+ String propertyName = getCorrectName(tempProperty.getSimpleName());
+ if ((beanExcludeInfo == null) || !beanExcludeInfo.isExcluedProperty(propertyName)){
+ propertiesSet.add(tempProperty);
}
- if (excludes != null && excludes.contains(
- getCorrectName(tempProperty.getSimpleName()))) {
- continue;
- }
- propertiesSet.add(tempProperties[i]);
}
JProperty[] properties = (JProperty[]) propertiesSet.toArray(new JProperty[0]);
@@ -546,18 +543,15 @@
// We do not need to expose static fields
continue;
}
- if (excludes != null && excludes.contains("*")) {
- continue;
- }
- if (excludes !=null &&
- excludes.contains(tempFields[i].getSimpleName())) {
- continue;
- }
- // skip field with same name as a property
- if (!propertiesNames.contains(tempFields[i].getSimpleName())) {
+ String propertyName = getCorrectName(tempFields[i].getSimpleName());
+ if ((beanExcludeInfo == null) || !beanExcludeInfo.isExcluedProperty(propertyName)) {
+ // skip field with same name as a property
+ if (!propertiesNames.contains(tempFields[i].getSimpleName())) {
- FieldMap.put(tempFields[i].getSimpleName(), tempFields[i]);
+ FieldMap.put(tempFields[i].getSimpleName(), tempFields[i]);
+ }
}
+
}
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DocLitBareSchemaGenerator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DocLitBareSchemaGenerator.java?rev=604105&r1=604104&r2=604105&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DocLitBareSchemaGenerator.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/java2wsdl/DocLitBareSchemaGenerator.java Thu Dec 13 21:17:23 2007
@@ -20,6 +20,7 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.deployment.util.Utils;
+import org.apache.axis2.deployment.util.BeanExcludeInfo;
import org.apache.axis2.description.AxisMessage;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisService;
@@ -404,22 +405,18 @@
Set propertiesSet = new HashSet();
Set propertiesNames = new HashSet();
- ArrayList excludes = null;
- if (service.getBeanExludeMap() !=null) {
- excludes = (ArrayList) service.getBeanExludeMap().get(
+ BeanExcludeInfo beanExcludeInfo = null;
+ if (service.getExcludeInfo() !=null) {
+ beanExcludeInfo = service.getExcludeInfo().getBeanExcludeInfoForClass(
javaType.getQualifiedName());
}
JProperty[] tempProperties = javaType.getDeclaredProperties();
for (int i = 0; i < tempProperties.length; i++) {
JProperty tempProperty = tempProperties[i];
- if (excludes !=null && excludes.contains("*")){
- continue;
+ String propertyName = getCorrectName(tempProperty.getSimpleName());
+ if ((beanExcludeInfo == null) || !beanExcludeInfo.isExcluedProperty(propertyName)){
+ propertiesSet.add(tempProperty);
}
- if (excludes != null && excludes.contains(
- getCorrectName(tempProperty.getSimpleName()))) {
- continue;
- }
- propertiesSet.add(tempProperties[i]);
}
JProperty[] properties = (JProperty[]) propertiesSet.toArray(new JProperty[0]);
@@ -450,18 +447,13 @@
// We do not need to expose static fields
continue;
}
- if (excludes != null && excludes.contains("*")) {
- continue;
- }
- if (excludes != null &&
- excludes.contains(tempFields[i].getSimpleName())) {
- continue;
- }
+ String propertyName = getCorrectName(tempFields[i].getSimpleName());
+ if ((beanExcludeInfo == null) || !beanExcludeInfo.isExcluedProperty(propertyName)) {
+ // skip field with same name as a property
+ if (!propertiesNames.contains(tempFields[i].getSimpleName())) {
- // skip field with same name as a property
- if (!propertiesNames.contains(tempFields[i].getSimpleName())) {
-
- FieldMap.put(tempFields[i].getSimpleName(), tempFields[i]);
+ FieldMap.put(tempFields[i].getSimpleName(), tempFields[i]);
+ }
}
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/receivers/AbstractRobustInMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/receivers/AbstractRobustInMessageReceiver.java?rev=604105&r1=604104&r2=604105&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/receivers/AbstractRobustInMessageReceiver.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/receivers/AbstractRobustInMessageReceiver.java Thu Dec 13 21:17:23 2007
@@ -28,5 +28,5 @@
*
* @deprecated not needed, since in-only MessageReceivers can throw faults
*/
-public abstract class AbstractRobustInMessageReceiver extends AbstractMessageReceiver {
+public abstract class AbstractRobustInMessageReceiver extends AbstractMessageReceiver{
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/JavaUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/JavaUtils.java?rev=604105&r1=604104&r2=604105&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/JavaUtils.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/JavaUtils.java Thu Dec 13 21:17:23 2007
@@ -69,6 +69,7 @@
|| ':' == c
|| '\u00B7' == c
|| '\u0387' == c
+ || '-' == c
|| '\u06DD' == c
|| '\u06DE' == c;
} // isPunctuation
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org