You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@etch.apache.org by sc...@apache.org on 2009/02/27 17:37:19 UTC

svn commit: r748580 [3/5] - in /incubator/etch/branches/router: ./ services/router/ services/router/scripts/ services/router/src/main/etch/ services/router/src/main/java/cisco/ services/router/src/main/java/org/ services/router/src/main/java/org/apache...

Added: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/plugin/RoundRobinPluginGroup.java
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/plugin/RoundRobinPluginGroup.java?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/plugin/RoundRobinPluginGroup.java (added)
+++ incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/plugin/RoundRobinPluginGroup.java Fri Feb 27 16:37:17 2009
@@ -0,0 +1,76 @@
+/* $Id$
+ *
+ * Copyright 2009-2010 Cisco Systems Inc.
+ *
+ * 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.etch.services.router.plugin;
+
+import java.util.List;
+
+import org.apache.etch.services.router.EtchRouterManager;
+import org.apache.etch.services.router.PluginInstallInfo;
+import org.apache.etch.services.router.EtchRouter.EtchRouterException;
+import org.apache.etch.services.router.utils.ApplicationAttributes;
+
+
+/**
+ * 
+ * @author Wei Wang (weiwa@cisco.com)
+ *
+ */
+public class RoundRobinPluginGroup extends PluginGroup
+{
+	
+	/**
+	 * 
+	 * @param name
+	 * @param routerMgr
+	 * @param installInfo
+	 */
+	public RoundRobinPluginGroup( String name, EtchRouterManager routerMgr, PluginInstallInfo installInfo)
+	{
+		super( name, routerMgr, installInfo);
+	}
+
+	@Override
+	public synchronized PluginMember getActiveMember( ApplicationAttributes appAttrs ) throws EtchRouterException
+	{
+		List<PluginMember> list = getActivePluginMembers( appAttrs );
+		PluginMember memberFound = null;
+		int sizeFound = -1;
+		// find the first instance that has the smallest size of instance connections:
+		for (PluginMember memberInfo : list)
+		{
+			if (memberFound==null)
+			{
+				memberFound = memberInfo;
+				sizeFound = memberFound.sizeOfMemberConnections();
+			}
+			else
+			{
+				int thisSize = memberInfo.sizeOfMemberConnections();
+				if (thisSize<sizeFound)
+				{
+					memberFound = memberInfo;
+					sizeFound = thisSize;
+				}
+			}
+		}
+		if (memberFound==null)
+			throw new EtchRouterException(1, String.format( "No matching active member is registered in round robin plugin group \"%s\", application attributes is \"%s\"",
+				_installInfo.getName(), appAttrs.getEncodedString()));
+		return memberFound;
+	}
+
+}

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/plugin/RoundRobinPluginGroup.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/plugin/RoundRobinPluginGroup.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/ApplicationAttributes.java
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/ApplicationAttributes.java?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/ApplicationAttributes.java (added)
+++ incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/ApplicationAttributes.java Fri Feb 27 16:37:17 2009
@@ -0,0 +1,79 @@
+/* $Id$
+ *
+ * Copyright 2009-2010 Cisco Systems Inc.
+ *
+ * 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.etch.services.router.utils;
+
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * 
+ * @author Wei Wang (weiwa@cisco.com)
+ *
+ */
+public class ApplicationAttributes extends AttributesBase
+{
+	/**
+	 * Constructor
+	 * 
+	 * @param paramStr a URL query string, like "name1=value1&name2=value2". Each name field
+	 *                 may have pattern like either "&lt;pluginName&gt;.&lt;attrName&gt;"
+	 *                 or "&lt;attrName&gt;", where "attrName" doesn't contain ".". When matching
+	 *                 a PluginAttributes object, all the attributes whose name starts with the plugin's
+	 *                 name + "." or doesn't contain "." will be taken to match the corresponding attribute
+	 *                 with the plugin.
+	 * @throws UnsupportedEncodingException
+	 */
+	public ApplicationAttributes( String paramStr ) throws UnsupportedEncodingException
+	{
+		this( paramStr, null );
+	}
+	
+	/**
+	 * 
+	 * @param paramStr a URL query string, like "name1=value1&name2=value2". Each name field
+	 *                 may have pattern like either "&lt;pluginName&gt;.&lt;attrName&gt;"
+	 *                 or "&lt;attrName&gt;", where "attrName" doesn't contain ".". When matching
+	 *                 a PluginAttributes object, all the attributes whose name starts with the plugin's
+	 *                 name + "." or doesn't contain "." will be taken to match the corresponding attribute
+	 *                 with the plugin.
+	 * @param charset
+	 * @throws UnsupportedEncodingException
+	 */
+	public ApplicationAttributes( String paramStr, String charset ) throws UnsupportedEncodingException
+	{
+		super( paramStr, charset );
+	}
+
+	public List<String> getKeysForPlugin( String pluginName )
+	{
+		return getKeysWithPrefix( String.format( "%s.", pluginName ));
+	}
+	
+	public List<String> getGlobalKeys()
+	{
+		List<String> keyList = new ArrayList<String>();
+		Set<String> keys = this.keySet();
+		for (String key : keys)
+		{
+			if (key.indexOf( '.' ) < 0)
+				keyList.add( key );
+		}
+		return keyList;
+	}
+}

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/ApplicationAttributes.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/ApplicationAttributes.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/AttributesBase.java
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/AttributesBase.java?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/AttributesBase.java (added)
+++ incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/AttributesBase.java Fri Feb 27 16:37:17 2009
@@ -0,0 +1,118 @@
+/* $Id$
+ *
+ * Copyright 2009-2010 Cisco Systems Inc.
+ *
+ * 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.etch.services.router.utils;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * 
+ * @author Wei Wang (weiwa@cisco.com)
+ *
+ */
+public abstract class AttributesBase extends LinkedHashMap<String, String>
+{
+	public static final String _DEFAULT_CHAR_SET = "ISO-8859-1";
+	
+	protected AttributesBase( String paramStr, String charset ) throws UnsupportedEncodingException
+	{
+		if ( paramStr==null ) return;
+		if (charset==null || charset.trim().length()==0) charset = _DEFAULT_CHAR_SET;
+		String[] toks = paramStr.split( "&" );
+		int idx;
+		String name, value;
+		for (String tok : toks)
+		{
+			idx = tok.indexOf( '=' );
+			if (idx<0)
+			{
+				continue;
+			}
+			name = tok.substring( 0, idx );
+			value = tok.substring( idx+1 );
+			name = URLDecoder.decode( name, charset );
+			value = URLDecoder.decode( value, charset );
+			put( name, value );
+		}	
+	}
+	
+	protected List<String> getKeysWithPrefix( String prefix )
+	{
+		List<String> result = new ArrayList<String>();
+		Set<String> keys = this.keySet();
+		for (String key : keys)
+		{
+			if (key.startsWith( prefix )) result.add( key );
+		}
+		return result;
+	}
+	
+
+	/**
+	 * 
+	 * @return
+	 */
+	public String getEncodedString()
+	{
+		return getEncodedString( null );
+	}
+	
+	/**
+	 * 
+	 * @param charset
+	 * @return
+	 */
+	public String getEncodedString( String charset )
+	{
+		if (charset==null || charset.trim().length()==0) charset = _DEFAULT_CHAR_SET;
+		Set<String> keys = this.keySet();
+		StringBuilder sb = new StringBuilder();
+		int count = 0;
+		String value, encodedStr;
+		for (String key : keys)
+		{
+			if (count>0) sb.append( "&" );
+			value = this.get( key );
+			try
+			{
+				encodedStr = URLEncoder.encode( key, charset );
+			}
+			catch (Exception e)
+			{
+				encodedStr = key;
+			}
+			sb.append( encodedStr );
+			try
+			{
+				encodedStr = value==null ? "" : URLEncoder.encode( value, charset );
+			}
+			catch (Exception e)
+			{
+				encodedStr = value;
+			}
+			sb.append( "=" ).append( encodedStr );
+			count++;
+		}
+		return sb.toString();
+	}
+
+}

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/AttributesBase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/AttributesBase.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/LocalEnumImportExportHelper.java
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/LocalEnumImportExportHelper.java?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/LocalEnumImportExportHelper.java (added)
+++ incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/LocalEnumImportExportHelper.java Fri Feb 27 16:37:17 2009
@@ -0,0 +1,91 @@
+/* $Id$
+ *
+ * Copyright 2009-2010 Cisco Systems Inc.
+ *
+ * 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.etch.services.router.utils;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.etch.bindings.java.msg.StructValue;
+import org.apache.etch.bindings.java.msg.Type;
+import org.apache.etch.bindings.java.msg.ValueFactory;
+
+public class LocalEnumImportExportHelper extends LocalTypeImportExportHelper
+{	
+	private List<String> _entryValues = null;
+	
+	private Map<String, Object> _enumConstMap = null;
+	
+	private Method _nameMethod = null;
+	
+	private Map<String, org.apache.etch.bindings.java.msg.Field> _fieldMap = null;
+	
+	public LocalEnumImportExportHelper( Type enumType, List<String> entryValues )
+		throws Exception
+	{
+		super( enumType );
+		_entryValues = entryValues;
+		initAndValidate();
+	}
+	
+	private void initAndValidate() throws Exception
+	{
+		String typeName = _type.getName();
+		if (!_typeClass.isEnum())
+			throw new Exception(String.format( "The loaded class type '%s' is not an enum type", typeName ));
+		Object[] enumValues = _typeClass.getEnumConstants();
+		if (_entryValues.size()!=enumValues.length)
+			throw new Exception(String.format( 
+				"The number of declared enum fields in Enum type '%s' is %s, but the size of entry value list is %s",
+				typeName, enumValues.length, _entryValues.size() ));
+		_enumConstMap = new HashMap<String, Object>(_entryValues.size());
+		_fieldMap = new HashMap<String, org.apache.etch.bindings.java.msg.Field>();
+		_nameMethod = _typeClass.getMethod( "name", null );
+		for (int i=0; i<enumValues.length; i++)
+		{
+			String name = (String)(_nameMethod.invoke( enumValues[i], null ));
+			if (!_entryValues.contains( name ))
+				throw new Exception(String.format( "The declared field '%s' in enum type '%s' is not included in the entry value list", name, typeName ));
+			_enumConstMap.put( name, enumValues[i] );
+			_fieldMap.put( name, new org.apache.etch.bindings.java.msg.Field(name) );
+		}
+	}
+	
+	public StructValue exportValue( ValueFactory vf, Object value )
+	{
+		StructValue struct = new StructValue( _type, vf );
+		try
+		{
+			String name = (String)_nameMethod.invoke( value, null );
+			struct.put( _fieldMap.get( name ), true );
+		}
+		catch (Exception e)
+		{
+			throw new RuntimeException(e);
+		}
+
+		return struct;
+	}
+
+	public Object importValue( StructValue struct )
+	{
+		org.apache.etch.bindings.java.msg.Field key = struct.keySet().iterator().next();
+		return _enumConstMap.get( key.getName() );
+	}
+
+}

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/LocalEnumImportExportHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/LocalEnumImportExportHelper.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/LocalStructImportExportHelper.java
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/LocalStructImportExportHelper.java?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/LocalStructImportExportHelper.java (added)
+++ incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/LocalStructImportExportHelper.java Fri Feb 27 16:37:17 2009
@@ -0,0 +1,104 @@
+/* $Id$
+ *
+ * Copyright 2009-2010 Cisco Systems Inc.
+ *
+ * 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.etch.services.router.utils;
+
+import java.lang.reflect.Constructor;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.etch.bindings.java.msg.StructValue;
+import org.apache.etch.bindings.java.msg.Type;
+import org.apache.etch.bindings.java.msg.ValueFactory;
+
+public class LocalStructImportExportHelper extends LocalTypeImportExportHelper
+{
+
+	private List<String> _fieldNames = null;
+	
+	private Map<String, org.apache.etch.bindings.java.msg.Field> _fieldMap = null;
+	
+	private Map<String, java.lang.reflect.Field> _reflectFieldMap = null;
+	
+	private Constructor _constructor = null;
+
+	public LocalStructImportExportHelper( Type structType, List<String> fieldNames)
+		throws Exception
+	{
+		super( structType );
+		_fieldNames = fieldNames;
+		initAndValidate();
+	}
+	
+	private void initAndValidate() throws Exception
+	{
+		String typeName = _type.getName();
+		if (_typeClass.isEnum())
+			throw new Exception(String.format( "The loaded class type '%s' is not struct or exception type", typeName ));
+		_constructor = _typeClass.getConstructor( );
+		java.lang.reflect.Field[] publicFields = _typeClass.getFields();
+		if (publicFields.length!=_fieldNames.size())
+			throw new Exception(String.format( 
+				"The number of public fields in class type '%s' is %s, but the size of field name list is %s",
+				typeName, publicFields.length, _fieldNames.size() ));
+		_fieldMap = new HashMap<String, org.apache.etch.bindings.java.msg.Field>(publicFields.length);
+		_reflectFieldMap = new HashMap<String, java.lang.reflect.Field>(publicFields.length);
+		for (java.lang.reflect.Field reflectField : publicFields)
+		{
+			String name = reflectField.getName();
+			if (!_fieldNames.contains( name ))
+				throw new Exception(String.format( "The public field '%s' in class type '%s' is not included in the field name list", name, typeName ));
+			_fieldMap.put( name, new org.apache.etch.bindings.java.msg.Field(name) );
+			_reflectFieldMap.put( name, reflectField );
+		}
+	}
+	
+	public StructValue exportValue( ValueFactory vf, Object value )
+	{
+		StructValue struct = new StructValue( _type, vf );
+		try
+		{
+			for (String name : _fieldNames)
+			{
+				struct.put( _fieldMap.get( name ), _reflectFieldMap.get( name ).get( value ) );
+			}
+		}
+		catch (Exception e)
+		{
+			throw new RuntimeException(e);
+		}
+		return struct;
+	}
+
+	public Object importValue( StructValue struct )
+	{
+		try
+		{
+			Object instance = _constructor.newInstance( );
+			for (String name : _fieldNames)
+			{
+				_reflectFieldMap.get( name ).set( instance, struct.get( _fieldMap.get( name ) ) );
+			}
+			return instance;
+		}
+		catch (Exception e)
+		{
+			throw new RuntimeException(e);
+		}
+	}
+
+}

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/LocalStructImportExportHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/LocalStructImportExportHelper.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/LocalTypeImportExportHelper.java
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/LocalTypeImportExportHelper.java?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/LocalTypeImportExportHelper.java (added)
+++ incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/LocalTypeImportExportHelper.java Fri Feb 27 16:37:17 2009
@@ -0,0 +1,44 @@
+/* $Id$
+ *
+ * Copyright 2009-2010 Cisco Systems Inc.
+ *
+ * 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.etch.services.router.utils;
+
+import org.apache.etch.bindings.java.msg.ImportExportHelper;
+import org.apache.etch.bindings.java.msg.Type;
+
+public abstract class LocalTypeImportExportHelper implements ImportExportHelper
+{
+
+	protected Type _type = null;
+	
+	protected Class _typeClass = null;
+	
+	public LocalTypeImportExportHelper(Type myType) throws Exception
+	{
+		_type = myType;
+		String typeName = myType.getName();
+		int idx = typeName.lastIndexOf( '.' );
+		if (idx <= 0) throw new Exception(String.format( "Invalid Etch sub-type name '%s'", typeName ));
+		String intfName = typeName.substring( 0, idx );
+		String className = intfName + "$" + typeName.substring( idx+1 );
+		_typeClass = this.getClass().forName( className );
+	}
+
+	public Class getTypeClass()
+	{
+		return _typeClass;
+	}
+}

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/LocalTypeImportExportHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/LocalTypeImportExportHelper.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/PluginAttributes.java
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/PluginAttributes.java?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/PluginAttributes.java (added)
+++ incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/PluginAttributes.java Fri Feb 27 16:37:17 2009
@@ -0,0 +1,113 @@
+/* $Id$
+ *
+ * Copyright 2009-2010 Cisco Systems Inc.
+ *
+ * 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.etch.services.router.utils;
+
+import java.io.UnsupportedEncodingException;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * 
+ * @author Wei Wang (weiwa@cisco.com)
+ *
+ */
+public class PluginAttributes extends AttributesBase
+{	
+
+	private String _pluginName = null;
+	
+	/**
+	 * Constructor 
+	 * 
+	 * @param pluginName name of the plugin
+	 * @param paramStr a URL query string, like "name1=value1&name2=value2". Note that each name field
+	 *                 must not contain "." - the "." is used in ApplicationAttribute name as a delimiter
+	 *                 between plugin name and plugin attribute name.
+	 * @throws UnsupportedEncodingException
+	 */
+	public PluginAttributes( String pluginName, String paramStr ) throws UnsupportedEncodingException
+	{
+		this( pluginName, paramStr, null );
+	}
+	
+	/**
+	 * Constructor 
+	 * 
+	 * @param pluginName name of the plugin
+	 * @param paramStr a URL query string, like "name1=value1&name2=value2". Note that each name field
+	 *                 must not contain "."
+	 * @param charset
+	 * @throws UnsupportedEncodingException
+	 */
+	public PluginAttributes( String pluginName, String paramStr, String charset ) throws UnsupportedEncodingException
+	{
+		super( paramStr, charset );
+		_pluginName = pluginName;
+	}
+
+	/**
+	 * Check whether attributes specified with an application match the plugin attributes
+	 * 
+	 * It assumes that the plugin's each attribute name doesn't contain ".". Each 
+	 * ApplicationAttributes' attribute name may be either like 
+	 * "&lt;pluginName&gt;.&lt;pluginAattrNamePattern&gt;" or "&lt;pluginAttrNamePattern&gt;"
+	 * 
+	 * An ApplicationAttributes object matches this PluginAttributes only when all its attributes,
+	 * whose name either starts with "&lt;thisPluginName&gt;." or doesn't contain ".", are equal to
+	 * the attributes of this plugin attrs.
+	 * 
+	 * @param appAttrs the application's attributes object
+	 * 
+	 * @return true if matches 
+	 */
+	public boolean matches( ApplicationAttributes appAttrs )
+	{
+		if (appAttrs==null) return true;
+		List<String> appKeys = appAttrs.getKeysForPlugin( _pluginName );
+		int startIdx = _pluginName.length() + 1;
+		String suffix, thisAttr, appAttr;
+		for (String appKey : appKeys)
+		{
+			suffix = appKey.substring( startIdx );
+			thisAttr = this.get( suffix );
+			appAttr = appAttrs.get( appKey );
+			if (thisAttr==null)
+			{
+				if (appAttr!=null) return false;
+			}
+			else if (!thisAttr.equals( appAttr ))
+			{
+				return false;
+			}
+		}
+		appKeys = appAttrs.getGlobalKeys();
+		for (String appKey : appKeys)
+		{
+			thisAttr = this.get( appKey );
+			appAttr = appAttrs.get( appKey );
+			if (thisAttr==null)
+			{
+				if (appAttr!=null) return false;
+			}
+			else if (!thisAttr.equals( appAttr ))
+			{
+				return false;
+			}
+		}
+		return true;
+	}
+}

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/PluginAttributes.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/PluginAttributes.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/StructValueImportExportHelper.java
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/StructValueImportExportHelper.java?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/StructValueImportExportHelper.java (added)
+++ incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/StructValueImportExportHelper.java Fri Feb 27 16:37:17 2009
@@ -0,0 +1,41 @@
+/* $Id$
+ *
+ * Copyright 2009-2010 Cisco Systems Inc.
+ *
+ * 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.etch.services.router.utils;
+
+import org.apache.etch.bindings.java.msg.ImportExportHelper;
+import org.apache.etch.bindings.java.msg.StructValue;
+import org.apache.etch.bindings.java.msg.ValueFactory;
+
+public class StructValueImportExportHelper implements ImportExportHelper
+{
+
+	public StructValueImportExportHelper()
+	{
+		
+	}
+	
+	public StructValue exportValue( ValueFactory vf, Object value )
+	{
+		return (StructValue)value;
+	}
+
+	public Object importValue( StructValue struct )
+	{
+		return struct;
+	}
+
+}

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/StructValueImportExportHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/StructValueImportExportHelper.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/UniqueKeyGenerator.java
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/UniqueKeyGenerator.java?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/UniqueKeyGenerator.java (added)
+++ incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/UniqueKeyGenerator.java Fri Feb 27 16:37:17 2009
@@ -0,0 +1,71 @@
+/* $Id$
+ *
+ * Copyright 2009-2010 Cisco Systems Inc.
+ *
+ * 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.etch.services.router.utils;
+
+import java.util.Date;
+
+/**
+ * Generate unique key
+ * 
+ * @author Wei Wang (weiwa@cisco.com)
+ *
+ */
+public class UniqueKeyGenerator
+{
+	private static final Object _SYNC_OBJ = new Object();
+	
+	private static UniqueKeyGenerator _INSTANCE = null;
+	
+	private long _lastValue;
+	
+	public static UniqueKeyGenerator getInstance()
+	{
+		if (_INSTANCE==null)
+		{
+			synchronized(_SYNC_OBJ)
+			{
+				if (_INSTANCE==null)
+					_INSTANCE = new UniqueKeyGenerator();
+			}
+		}
+		return _INSTANCE;
+	}
+	
+	private UniqueKeyGenerator()
+	{
+		_lastValue = (new Date()).getTime();
+	}
+	
+	/**
+	 * Generate unique key
+	 * 
+	 * @param prefix
+	 * @return
+	 */
+	public String generateKey(String prefix)
+	{
+		synchronized(_SYNC_OBJ)
+		{
+			long myVal = (new Date()).getTime();
+			if (myVal<=_lastValue) {
+				myVal = _lastValue + 1;
+			}
+			_lastValue = myVal;
+			return (prefix==null ? ""+_lastValue : prefix+_lastValue);
+		}
+	}
+}

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/UniqueKeyGenerator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/UniqueKeyGenerator.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/XmlBindingData.java
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/XmlBindingData.java?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/XmlBindingData.java (added)
+++ incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/XmlBindingData.java Fri Feb 27 16:37:17 2009
@@ -0,0 +1,180 @@
+/* $Id$
+ *
+ * Copyright 2009-2010 Cisco Systems Inc.
+ *
+ * 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.etch.services.router.utils;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+
+import org.apache.etch.services.router.xml.Exception;
+import org.apache.etch.services.router.xml.Module;
+
+
+/**
+ * Utility class to parse an Etch-compiled XML binding file and return
+ * the parsed result in a data object
+ * 
+ * @author Wei Wang (weiwa@cisco.com)
+ *
+ */
+public class XmlBindingData
+{
+	private static JAXBContext _jaxbContext = null;
+
+	/**
+	 * Factory method to get the parsed result object from an etch XML binding file
+	 * 
+	 * @param xmlFile
+	 * @return
+	 * @throws JAXBException
+	 * @throws IOException
+	 */
+	public static XmlBindingData loadXmlBindingFile(File xmlFile) throws JAXBException, IOException 
+	{
+		if (_jaxbContext==null)
+			_jaxbContext = JAXBContext.newInstance( "org.apache.etch.services.router.xml" );
+        Unmarshaller u = _jaxbContext.createUnmarshaller();
+        Module mod = (Module)(u.unmarshal( new FileInputStream( xmlFile ) ));
+        return new XmlBindingData(mod);
+	}
+	
+	private List<Module.Service.Enums.Enum> _enums;
+    protected List<Module.Service.Structs.Struct> _structs;
+    protected List<org.apache.etch.services.router.xml.Exception> _exceptions;
+    protected List<Module.Service.Methods.Method> _methods;
+    protected List<Module.Service.Externs.Extern> _externs;
+    
+    /**
+     * Getter
+     * 
+     * @return
+     */
+	public List<Module.Service.Enums.Enum> getEnums()
+	{
+		return _enums;
+	}
+
+	/**
+	 * getter
+	 * 
+	 * @return
+	 */
+	public List<Module.Service.Structs.Struct> getStructs()
+	{
+		return _structs;
+	}
+
+	/**
+	 * getter
+	 * 
+	 * @return
+	 */
+	public List<org.apache.etch.services.router.xml.Exception> getExceptions()
+	{
+		return _exceptions;
+	}
+
+	/**
+	 * getter
+	 * 
+	 * @return
+	 */
+	public List<Module.Service.Methods.Method> getMethods()
+	{
+		return _methods;
+	}
+	
+	public List<Module.Service.Externs.Extern> getExterns()
+	{
+		return _externs;
+	}
+
+	private XmlBindingData(Module mod)
+	{
+		_enums = new ArrayList<Module.Service.Enums.Enum>();
+		_structs = new ArrayList<Module.Service.Structs.Struct>();
+		_exceptions = new ArrayList<org.apache.etch.services.router.xml.Exception>();
+		_methods = new ArrayList<Module.Service.Methods.Method>();
+		_externs = new ArrayList<Module.Service.Externs.Extern>();
+		parseModule(mod);
+	}
+	
+	private void parseModule(Module mod)
+	{
+		List<Module.Service> svcList = mod.getService();
+		if (svcList==null) return;
+		for (Module.Service svc : svcList)
+		{
+			parseService(svc);
+		}
+	}
+	
+	private void parseService(Module.Service svc)
+	{
+		List<Module.Service.Enums> enums = svc.getEnums();
+		if (enums!=null)
+		{
+			for (Module.Service.Enums myenum : enums)
+			{
+				List<Module.Service.Enums.Enum> enumL = myenum.getEnum();
+				if (enumL!=null) _enums.addAll( enumL );
+			}
+		}
+		List<Module.Service.Structs> structs = svc.getStructs();
+		if (structs!=null)
+		{
+			for (Module.Service.Structs mystructs : structs)
+			{
+				List<Module.Service.Structs.Struct> structL = mystructs.getStruct();
+				if (structL!=null) _structs.addAll( structL );
+			}
+		}
+		List<Module.Service.Exceptions> exps = svc.getExceptions();
+		if (exps!=null)
+		{
+			for (Module.Service.Exceptions myexps : exps)
+			{
+				List<Exception> expL = myexps.getException();
+				if (expL!=null) _exceptions.addAll( expL );
+			}
+		}
+		List<Module.Service.Methods> methods = svc.getMethods();
+		if (methods!=null)
+		{
+			for (Module.Service.Methods mymethods : methods)
+			{
+				List<Module.Service.Methods.Method> methodL = mymethods.getMethod();
+				if (methodL!=null) _methods.addAll( methodL );
+			}
+		}
+		List<Module.Service.Externs> externs = svc.getExterns();
+		if (externs!=null)
+		{
+			for (Module.Service.Externs anExterns : externs)
+			{
+				List<Module.Service.Externs.Extern> externL = anExterns.getExtern();
+				if (externL!=null) _externs.addAll( externL );
+			}
+		}
+	}
+}

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/XmlBindingData.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/XmlBindingData.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/XmlBindingDataParser.java
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/XmlBindingDataParser.java?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/XmlBindingDataParser.java (added)
+++ incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/XmlBindingDataParser.java Fri Feb 27 16:37:17 2009
@@ -0,0 +1,617 @@
+/* $Id$
+ *
+ * Copyright 2009-2010 Cisco Systems Inc.
+ *
+ * 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.etch.services.router.utils;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.etch.bindings.java.msg.AsyncMode;
+import org.apache.etch.bindings.java.msg.Direction;
+import org.apache.etch.bindings.java.msg.Type;
+import org.apache.etch.bindings.java.msg.Validator;
+import org.apache.etch.bindings.java.support.DefaultValueFactory;
+import org.apache.etch.bindings.java.support.Validator_StructValue;
+import org.apache.etch.bindings.java.support.Validator_boolean;
+import org.apache.etch.bindings.java.support.Validator_byte;
+import org.apache.etch.bindings.java.support.Validator_custom;
+import org.apache.etch.bindings.java.support.Validator_double;
+import org.apache.etch.bindings.java.support.Validator_float;
+import org.apache.etch.bindings.java.support.Validator_int;
+import org.apache.etch.bindings.java.support.Validator_long;
+import org.apache.etch.bindings.java.support.Validator_object;
+import org.apache.etch.bindings.java.support.Validator_short;
+import org.apache.etch.bindings.java.support.Validator_string;
+import org.apache.etch.bindings.java.support.Validator_void;
+import org.apache.etch.services.router.xml.Module;
+
+/**
+ * 
+ * @author Wei Wang (weiwa@cisco.com)
+ *
+ */
+public class XmlBindingDataParser
+{
+
+	private static final Logger _LOGGER = Logger.getLogger( XmlBindingDataParser.class.getName());
+	
+	private Map<String, LocalTypeImportExportHelper> _localImpExpHelperMap = null;
+	
+	private Map<String, StructValueImportExportHelper> _structValueImpExpHelperMap = null;
+	
+	private Map<Type, Module.Service.Structs.Struct> _structType2StructMap = null;
+	
+	private Map<Type, org.apache.etch.services.router.xml.Exception> _excpType2ExcpMap = null;
+	
+	private Map<Type, Module.Service.Methods.Method> _methodType2MethodMap = null;
+	
+	private List<Type> _resultMethodTypes = null;
+	
+	private List<Type> _methodTypes = null;
+	
+	private List<Type> _enumTypes = null;
+	
+	private List<Type> _structTypes = null;
+	
+	private List<Type> _exceptionTypes = null;
+	
+	private List<Type> _externTypes = null;
+	
+	// extern name/shortName to fully qualified name map:
+	private Map<String, String> _externTypeNameMap = null;
+	
+	private StructValueImportExportHelper _structValueHelper = null;
+	
+	private Map<String, Type> _typeName2TypeMap = null;
+	
+	/**
+	 * 
+	 * @param data
+	 * @throws Exception
+	 */
+	public XmlBindingDataParser( XmlBindingData data )
+		throws Exception
+	{
+		_structValueHelper = new StructValueImportExportHelper();
+		_localImpExpHelperMap = new HashMap<String, LocalTypeImportExportHelper>();
+		_structType2StructMap = new HashMap<Type, Module.Service.Structs.Struct>();
+		_excpType2ExcpMap = new HashMap<Type, org.apache.etch.services.router.xml.Exception>();
+		_methodType2MethodMap = new HashMap<Type, Module.Service.Methods.Method>();
+		_resultMethodTypes = new ArrayList<Type>();
+		_methodTypes = new ArrayList<Type>();
+		_enumTypes = new ArrayList<Type>();
+		_structTypes = new ArrayList<Type>();
+		_exceptionTypes = new ArrayList<Type>();
+		_typeName2TypeMap = new HashMap<String, Type>();
+		_structValueImpExpHelperMap = new HashMap<String, StructValueImportExportHelper>();
+		_externTypes = new ArrayList<Type>();
+		_externTypeNameMap = new HashMap<String, String>(); 
+		
+		parseData(data);
+	}
+	
+	private void parseData(XmlBindingData data) throws Exception
+	{
+		parseEnums(data.getEnums());
+		parseStructs(data.getStructs());
+		parseExceptions(data.getExceptions());
+		parseExterns(data.getExterns());
+		parseMethods(data.getMethods());
+		parseFields();
+	}
+	
+	private void parseExterns(List<Module.Service.Externs.Extern> externs) throws Exception
+	{
+		String name, typeName;
+		for (Module.Service.Externs.Extern extern : externs)
+		{
+			name = extern.getName();
+			typeName = extern.getTypeName();
+			_externTypeNameMap.put( name, typeName );
+			_externTypeNameMap.put( typeName, typeName );
+			Type myType = new Type(typeName);
+			_externTypes.add( myType );
+			_typeName2TypeMap.put( typeName, myType );
+			_structValueImpExpHelperMap.put( myType.getName(), _structValueHelper );
+		}
+	}
+	
+	private void parseFields() throws Exception
+	{
+		parseStructFields();
+		parseExceptionFields();
+		parseMethodFields();
+	}
+	
+	public LocalTypeImportExportHelper getLocalImportExportHelper( String typeName )
+	{
+		return _localImpExpHelperMap.get( typeName );
+	}
+	
+	public StructValueImportExportHelper getStructValueImportExportHelper( String typeName )
+	{
+		return _structValueImpExpHelperMap.get( typeName );
+	}
+	
+	public List<Type> getMethodTypes()
+	{
+		return _methodTypes;
+	}
+
+	public List<Type> getEnumTypes()
+	{
+		return _enumTypes;
+	}
+
+	public List<Type> getStructTypes()
+	{
+		return _structTypes;
+	}
+
+	public List<Type> getExceptionTypes()
+	{
+		return _exceptionTypes;
+	}
+
+	public List<Type> getExternTypes()
+	{
+		return _externTypes;
+	}
+	/**
+	 * 
+	 * @param enums
+	 * @return
+	 */
+	private void parseEnums(List<Module.Service.Enums.Enum> enums)
+		throws Exception
+	{
+		String typeName = null;
+		for (Module.Service.Enums.Enum myenum : enums)
+		{
+			typeName = myenum.getTypeName();
+			Type myType = new Type(typeName);
+			_enumTypes.add( myType );
+			_typeName2TypeMap.put( typeName, myType );
+			resolveEnumType(myenum, myType);
+		}
+	}
+	
+	private void resolveEnumType(Module.Service.Enums.Enum myenum, Type myType)
+		throws Exception
+	{
+		List<Module.Service.Enums.Enum.Entry> entries = myenum.getEntry();
+		List<String> entryValues = new ArrayList<String>(entries.size());
+		for (Module.Service.Enums.Enum.Entry entry : entries)
+		{
+			entryValues.add( entry.getValue() );
+			myType.putValidator( new org.apache.etch.bindings.java.msg.Field( entry.getValue()), org.apache.etch.bindings.java.support.Validator_boolean.get( 0 ) );
+		}
+		try
+		{
+			LocalEnumImportExportHelper helper = new LocalEnumImportExportHelper(myType, entryValues);
+			_LOGGER.log( Level.FINE, "The enum type \"{0}\" is locally defined", myType.getName() );
+			_localImpExpHelperMap.put( myType.getName(), helper );
+		}
+		catch (ClassNotFoundException e)
+		{
+			_LOGGER.log( Level.FINEST, String.format( "The enum type \"{0}\" is not locally defined: ", myType.getName()), e );
+			_structValueImpExpHelperMap.put( myType.getName(), _structValueHelper );
+		}	
+	}
+	
+	/**
+	 * 
+	 * @param structs
+	 * @return
+	 */
+	private void parseStructs(List<Module.Service.Structs.Struct> structs)
+		throws Exception
+	{
+		String typeName = null;
+		for (Module.Service.Structs.Struct mystruct : structs)
+		{
+			typeName = mystruct.getTypeName();
+			Type myType = new Type(typeName);
+			_structTypes.add( myType );
+			_structType2StructMap.put( myType, mystruct );
+			_typeName2TypeMap.put( typeName, myType );
+			resolveStructType(mystruct, myType);
+		}
+	}
+	
+	private void resolveStructType(Module.Service.Structs.Struct mystruct, Type myType)
+		throws Exception
+	{
+		List<org.apache.etch.services.router.xml.Field> fields = mystruct.getField();
+		List<String> fieldNames = new ArrayList<String>(fields.size());
+		for (org.apache.etch.services.router.xml.Field field : fields)
+		{
+			fieldNames.add( field.getName() );
+		}
+		try
+		{
+			LocalStructImportExportHelper helper = new LocalStructImportExportHelper(myType, fieldNames);
+			_LOGGER.log( Level.FINE, "The struct type \"{0}\" is locally defined: ", myType.getName() );
+			_localImpExpHelperMap.put( myType.getName(), helper );
+		}
+		catch (ClassNotFoundException e)
+		{
+			_LOGGER.log( Level.FINEST, String.format( "The struct type \"%s\" is not locally defined: ", myType.getName()), e );
+			_structValueImpExpHelperMap.put( myType.getName(), _structValueHelper );
+		}
+	}
+	
+	private void parseStructFields() throws Exception
+	{
+		for (Type structType : _structTypes)
+		{
+			Module.Service.Structs.Struct mystruct = _structType2StructMap.get( structType );
+			parseStructFields( mystruct, structType);
+		}
+	}
+	
+	private void parseStructFields( Module.Service.Structs.Struct mystruct, Type structType )
+	{
+		List<org.apache.etch.services.router.xml.Field> myFields = mystruct.getField();
+		resolveFieldValidators( structType, myFields );
+	}
+	
+	/**
+	 * 
+	 * @param exceptions
+	 * @return
+	 */
+	private void parseExceptions(List<org.apache.etch.services.router.xml.Exception> exceptions)
+		throws Exception
+	{
+		String typeName = null;
+		for (org.apache.etch.services.router.xml.Exception myexp : exceptions)
+		{
+			typeName = myexp.getTypeName();
+			Type myType = new Type(typeName);
+			_exceptionTypes.add( myType );
+			_excpType2ExcpMap.put( myType, myexp );
+			_typeName2TypeMap.put( typeName, myType );
+			resolveExceptionType(myexp, myType);
+		}
+	}
+
+	private void resolveExceptionType(org.apache.etch.services.router.xml.Exception myexp, Type myType)
+		throws Exception
+	{
+		List<org.apache.etch.services.router.xml.Field> fields = myexp.getField();
+		List<String> fieldNames = new ArrayList<String>(fields.size());
+		for (org.apache.etch.services.router.xml.Field field : fields)
+		{
+			fieldNames.add( field.getName() );
+		}
+		try
+		{
+			LocalStructImportExportHelper helper = new LocalStructImportExportHelper(myType, fieldNames);
+			_LOGGER.log( Level.FINE, "The exception type \"{0}\" is locally defined", myType.getName() );
+			_localImpExpHelperMap.put( myType.getName(), helper );
+		}
+		catch (ClassNotFoundException e)
+		{
+			_LOGGER.log( Level.FINEST, String.format( "The exception type \"%s\" is not locally defined: ", myType.getName()), e );
+			_structValueImpExpHelperMap.put( myType.getName(), _structValueHelper );
+		}
+	}
+	
+	private void parseExceptionFields()
+	{
+		for (Type myType : _exceptionTypes)
+		{
+			org.apache.etch.services.router.xml.Exception myexcp = _excpType2ExcpMap.get( myType );
+			parseExceptionFields( myexcp, myType);
+		}
+	}
+	
+	private void parseExceptionFields( org.apache.etch.services.router.xml.Exception myexcp, Type excpType)
+	{
+		List<org.apache.etch.services.router.xml.Field> myFields = myexcp.getField();
+		resolveFieldValidators( excpType, myFields );
+	}
+	
+	/**
+	 * Note: this must be called after all enum, struct and exception types are parsed, otherwise
+	 * the import-export helpers will not be created for the validator setup
+	 * 
+	 * @param methods
+	 * @return
+	 */	
+	private void parseMethods(List<Module.Service.Methods.Method> methods)
+	{
+		Map<String, Type> types = new LinkedHashMap<String, Type>(methods.size());
+		Map<Type, Module.Service.Methods.Method.Result> type2resultMap = 
+			new HashMap<Type, Module.Service.Methods.Method.Result>(methods.size()); 
+		String typeName = null;
+		for (Module.Service.Methods.Method mymethod : methods)
+		{
+			typeName = mymethod.getTypeName();
+			Type myType = new Type(typeName);
+			_methodTypes.add( myType );
+			types.put( typeName, myType );
+			_methodType2MethodMap.put( myType, mymethod );
+			String asyncReceiverMode = mymethod.getAsyncReceiverMode();
+			//String isOneway = mymethod.getIsOneway();
+			String messageDirection = mymethod.getMessageDirection();
+			AsyncMode mode = getAsyncModeEnumByName( asyncReceiverMode );
+			if (mode==null)
+			{
+				_LOGGER.log( Level.SEVERE, "Unknown AsyncReceiverMode attribute \"{0}\" for method \"{1}\" ", new Object[]{ asyncReceiverMode, typeName } );
+			}
+			else
+			{
+				myType.setAsyncMode( mode );
+			}
+			Direction direction = getDirectionEnumByName( messageDirection );
+			if (direction==null)
+			{
+				_LOGGER.log( Level.SEVERE, "Unknown MessageDirection attribute \"{0}\" for method \"{1}\" ", new Object[]{ messageDirection, typeName } );
+			}
+			else
+			{
+				myType.setDirection( direction );
+			}
+			String timeout = mymethod.getTimeout();
+			if (timeout!=null)
+			{
+				try
+				{
+					myType.setTimeout( Integer.parseInt( timeout ) );
+				}
+				catch (Exception e)
+				{
+					_LOGGER.log( Level.SEVERE, "Unknown TimeOut attribute \"{0}\" for method \"{1}\" ", new Object[]{ timeout, typeName } );
+				}
+			}
+			//String responseField = mymethod.getResponseField();
+			List<Module.Service.Methods.Method.Result> methResults = mymethod.getResult();
+			if (methResults != null && (!methResults.isEmpty()))
+			{
+				type2resultMap.put( myType, methResults.get( 0 ) );
+			}
+		}
+		Set<Type> keys = type2resultMap.keySet();
+		for (Type myType : keys)
+		{
+			Module.Service.Methods.Method.Result result = type2resultMap.get( myType );
+			String fieldName = result.getFieldName();
+			if (fieldName != null)
+			{
+				Type resultType = types.get( fieldName );
+				if (resultType==null)
+				{
+					_LOGGER.log( Level.SEVERE, "The result field \"{0}\" is not defined for method \"{1}\" ", new Object[] { fieldName, myType.getName() } );
+				}
+				else
+				{
+					myType.setResult( resultType );
+					_resultMethodTypes.add( resultType );
+				}
+			}
+		}
+	}
+	
+	private void parseMethodFields()
+	{
+		for (Type myType : _methodTypes)
+		{
+			Module.Service.Methods.Method mymethod = _methodType2MethodMap.get( myType );
+			boolean isResultMethod = _resultMethodTypes.contains( myType );
+			parseMethodFields( mymethod, myType, isResultMethod);
+		}
+	}
+	
+	private void parseMethodFields(Module.Service.Methods.Method mymethod, Type myType, boolean isResultMethod )
+	{
+		if (isResultMethod)
+		{
+			myType.putValidator( DefaultValueFactory._mf__inReplyTo, org.apache.etch.bindings.java.support.Validator_long.get( 0 ) );
+			myType.putValidator( DefaultValueFactory._mf_result, org.apache.etch.bindings.java.support.Validator_RuntimeException.get() );
+		}
+		myType.putValidator( DefaultValueFactory._mf__messageId, org.apache.etch.bindings.java.support.Validator_long.get( 0 ) );
+		List<org.apache.etch.services.router.xml.Field> myfields = mymethod.getField();
+		resolveFieldValidators( myType, myfields);
+		if (isResultMethod) return;
+		Type resultType = myType.getResult();
+		if (resultType==null) return;
+		List<org.apache.etch.services.router.xml.Exception> myexps = mymethod.getException();
+		if (myexps!=null && myexps.size()>0)
+		{
+			for (org.apache.etch.services.router.xml.Exception exp : myexps)
+			{
+				String expTypeName = exp.getType();
+				LocalTypeImportExportHelper helper = getLocalImportExportHelper( expTypeName );
+				if (helper != null)
+				{
+					resultType.putValidator( DefaultValueFactory._mf_result, Validator_custom.get( helper.getTypeClass(), 0, true ) );
+				}
+			}
+		}
+	}
+	
+	private void resolveFieldValidators( Type myType, List<org.apache.etch.services.router.xml.Field> myFields)
+	{
+		for (org.apache.etch.services.router.xml.Field myfield : myFields)
+		{
+			String fieldName = myfield.getName();
+			String isArray = myfield.getIsArray();
+			String dimension = myfield.getDimension();
+			int nDims = 0;
+			if (!"false".equalsIgnoreCase( isArray ))
+			{
+				try
+				{
+					nDims = Integer.parseInt( dimension );
+				}
+				catch (Exception e)
+				{
+					_LOGGER.log( Level.SEVERE, String.format( "Invalid dimmension attribute of field \"%s\" in Type \"%s\"", fieldName, myType.getName() ), e );
+				}
+			}
+			String isPrimitive = myfield.getIsPrimitiveType();
+			String typeName = myfield.getType();
+			Validator validator = getWellknownValidator(typeName, nDims);
+			org.apache.etch.bindings.java.msg.Field thisField = new org.apache.etch.bindings.java.msg.Field(fieldName);
+			if (validator!=null)
+			{
+				myType.putValidator( thisField, validator );
+			}
+			else if ("true".equalsIgnoreCase( isPrimitive ))
+			{
+				_LOGGER.log( Level.SEVERE, "Unknown primitive type \"{0}\" of field \"{1}\" in Type \"{2}\"", new Object[] { typeName, fieldName, myType.getName() } );
+			}
+			else
+			{
+				LocalTypeImportExportHelper helper = getLocalImportExportHelper( typeName );
+				if (helper != null)
+				{
+					myType.putValidator( thisField, Validator_custom.get( helper.getTypeClass(), nDims, true ) );
+				}
+				else
+				{
+					StructValueImportExportHelper structHelper = getStructValueImportExportHelper( typeName );
+					boolean done = false;
+					if (structHelper!=null)
+					{
+						Type fieldType = _typeName2TypeMap.get( typeName );
+						if (fieldType!=null)
+						{
+							myType.putValidator( thisField, Validator_StructValue.get( fieldType, nDims ) );
+							done = true;
+						}
+					}
+					else
+					{
+						String externFullName = _externTypeNameMap.get( typeName );
+						if (externFullName != null)
+						{
+							structHelper = getStructValueImportExportHelper( externFullName );
+							Type fieldType = _typeName2TypeMap.get( externFullName );
+							if (structHelper!=null && fieldType!=null)
+							{
+								myType.putValidator( thisField, Validator_StructValue.get( fieldType, nDims ) );
+								done = true;
+							}
+						}
+					}
+					if (!done)
+						_LOGGER.log( Level.SEVERE, "The custom type \"{0}\" of field \"{1}\" in type \"{2}\" is not defined", new Object[] { typeName, fieldName, myType.getName() } );
+				}
+			}
+		}
+
+	}
+	
+	private AsyncMode getAsyncModeEnumByName(String name)
+	{
+		AsyncMode[] vals = AsyncMode.values();
+		for (AsyncMode val : vals)
+		{
+			if (val.name().equalsIgnoreCase( name ))
+				return val;
+		}
+		return null;
+	}
+
+	private Direction getDirectionEnumByName(String name)
+	{
+		Direction[] vals = Direction.values();
+		for (Direction val : vals)
+		{
+			if (val.name().equalsIgnoreCase( name ))
+				return val;
+		}
+		return null;	
+	}
+	
+	/**
+	 * Get non-customized type's validator by name and dimensions
+	 * 
+	 * @param typeName
+	 * @param nDims
+	 * @return
+	 */
+	public static Validator getWellknownValidator(String typeName, int nDims)
+	{
+		if ("void".equals( typeName ))
+		{
+			return Validator_void.get( nDims );
+		}
+		else if ("boolean".equals( typeName ))
+		{
+			return Validator_boolean.get(nDims);
+		}
+		else if ("byte".equals( typeName ))
+		{
+			return Validator_byte.get(nDims);
+		}
+		else if ("double".equals( typeName ))
+		{
+			return Validator_double.get(nDims);
+		}
+		else if ("float".equals( typeName ))
+		{
+			return Validator_float.get(nDims);
+		}
+		else if ("int".equals( typeName ))
+		{
+			return Validator_int.get(nDims);
+		}
+		else if ("long".equals( typeName ))
+		{
+			return Validator_long.get(nDims);
+		}
+		else if ("object".equals( typeName ))
+		{
+			return Validator_object.get(nDims);
+		}
+		else if ("short".equals( typeName ))
+		{
+			return Validator_short.get(nDims);
+		}
+		else if ("string".equals( typeName ))
+		{
+			return Validator_string.get(nDims);
+		}
+		else if ("Map".equals( typeName ))
+		{
+			return Validator_custom.get( java.util.Map.class, nDims, true );
+		}
+		else if ("Datetime".equals( typeName ))
+		{
+			return Validator_custom.get( java.util.Date.class, nDims, true );
+		}
+		else if ("List".equals( typeName ))
+		{
+			return Validator_custom.get( java.util.List.class, nDims, true );
+		}
+		else if ("Set".equals( typeName ))
+		{
+			return Validator_custom.get( java.util.Set.class, nDims, true );
+		}
+		
+		return null;
+	}
+}

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/XmlBindingDataParser.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/utils/XmlBindingDataParser.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/Exception.java
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/Exception.java?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/Exception.java (added)
+++ incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/Exception.java Fri Feb 27 16:37:17 2009
@@ -0,0 +1,283 @@
+/* $Id$
+ *
+ * Copyright 2009-2010 Cisco Systems Inc.
+ *
+ * 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.
+ */
+
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2008.12.02 at 02:28:29 PM CST 
+//
+
+
+package org.apache.etch.services.router.xml;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType>
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         &lt;element ref="{}field" maxOccurs="unbounded" minOccurs="0"/>
+ *       &lt;/sequence>
+ *       &lt;attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       &lt;attribute name="isUnchecked" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       &lt;attribute name="typeId" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       &lt;attribute name="typeName" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       &lt;attribute name="baseType" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       &lt;attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+    "description",
+    "field"
+})
+@XmlRootElement(name = "exception")
+public class Exception {
+
+    protected String description;
+    protected List<Field> field;
+    @XmlAttribute
+    protected String name;
+    @XmlAttribute
+    protected String isUnchecked;
+    @XmlAttribute
+    protected String typeId;
+    @XmlAttribute
+    protected String typeName;
+    @XmlAttribute
+    protected String baseType;
+    @XmlAttribute
+    protected String type;
+
+    /**
+     * Gets the value of the description property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * Sets the value of the description property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setDescription(String value) {
+        this.description = value;
+    }
+
+    /**
+     * Gets the value of the field property.
+     * 
+     * <p>
+     * This accessor method returns a reference to the live list,
+     * not a snapshot. Therefore any modification you make to the
+     * returned list will be present inside the JAXB object.
+     * This is why there is not a <CODE>set</CODE> method for the field property.
+     * 
+     * <p>
+     * For example, to add a new item, do as follows:
+     * <pre>
+     *    getField().add(newItem);
+     * </pre>
+     * 
+     * 
+     * <p>
+     * Objects of the following type(s) are allowed in the list
+     * {@link Field }
+     * 
+     * 
+     */
+    public List<Field> getField() {
+        if (field == null) {
+            field = new ArrayList<Field>();
+        }
+        return this.field;
+    }
+
+    /**
+     * Gets the value of the name property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Sets the value of the name property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setName(String value) {
+        this.name = value;
+    }
+
+    /**
+     * Gets the value of the isUnchecked property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getIsUnchecked() {
+        return isUnchecked;
+    }
+
+    /**
+     * Sets the value of the isUnchecked property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setIsUnchecked(String value) {
+        this.isUnchecked = value;
+    }
+
+    /**
+     * Gets the value of the typeId property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getTypeId() {
+        return typeId;
+    }
+
+    /**
+     * Sets the value of the typeId property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setTypeId(String value) {
+        this.typeId = value;
+    }
+
+    /**
+     * Gets the value of the typeName property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getTypeName() {
+        return typeName;
+    }
+
+    /**
+     * Sets the value of the typeName property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setTypeName(String value) {
+        this.typeName = value;
+    }
+
+    /**
+     * Gets the value of the baseType property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getBaseType() {
+        return baseType;
+    }
+
+    /**
+     * Sets the value of the baseType property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setBaseType(String value) {
+        this.baseType = value;
+    }
+
+    /**
+     * Gets the value of the type property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getType() {
+        return type;
+    }
+
+    /**
+     * Sets the value of the type property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setType(String value) {
+        this.type = value;
+    }
+
+}

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/Exception.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/Exception.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/Field.java
URL: http://svn.apache.org/viewvc/incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/Field.java?rev=748580&view=auto
==============================================================================
--- incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/Field.java (added)
+++ incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/Field.java Fri Feb 27 16:37:17 2009
@@ -0,0 +1,276 @@
+/* $Id$
+ *
+ * Copyright 2009-2010 Cisco Systems Inc.
+ *
+ * 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.
+ */
+
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2008.12.02 at 02:28:29 PM CST 
+//
+
+
+package org.apache.etch.services.router.xml;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType>
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       &lt;/sequence>
+ *       &lt;attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       &lt;attribute name="fieldId" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       &lt;attribute name="fieldName" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       &lt;attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       &lt;attribute name="isPrimitiveType" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       &lt;attribute name="isArray" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       &lt;attribute name="dimension" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+    "description"
+})
+@XmlRootElement(name = "field")
+public class Field {
+
+    protected String description;
+    @XmlAttribute
+    protected String name;
+    @XmlAttribute
+    protected String fieldId;
+    @XmlAttribute
+    protected String fieldName;
+    @XmlAttribute
+    protected String type;
+    @XmlAttribute
+    protected String isPrimitiveType;
+    @XmlAttribute
+    protected String isArray;
+    @XmlAttribute
+    protected String dimension;
+
+    /**
+     * Gets the value of the description property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * Sets the value of the description property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setDescription(String value) {
+        this.description = value;
+    }
+
+    /**
+     * Gets the value of the name property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Sets the value of the name property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setName(String value) {
+        this.name = value;
+    }
+
+    /**
+     * Gets the value of the fieldId property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getFieldId() {
+        return fieldId;
+    }
+
+    /**
+     * Sets the value of the fieldId property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setFieldId(String value) {
+        this.fieldId = value;
+    }
+
+    /**
+     * Gets the value of the fieldName property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getFieldName() {
+        return fieldName;
+    }
+
+    /**
+     * Sets the value of the fieldName property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setFieldName(String value) {
+        this.fieldName = value;
+    }
+
+    /**
+     * Gets the value of the type property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getType() {
+        return type;
+    }
+
+    /**
+     * Sets the value of the type property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setType(String value) {
+        this.type = value;
+    }
+
+    /**
+     * Gets the value of the isPrimitiveType property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getIsPrimitiveType() {
+        return isPrimitiveType;
+    }
+
+    /**
+     * Sets the value of the isPrimitiveType property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setIsPrimitiveType(String value) {
+        this.isPrimitiveType = value;
+    }
+
+    /**
+     * Gets the value of the isArray property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getIsArray() {
+        return isArray;
+    }
+
+    /**
+     * Sets the value of the isArray property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setIsArray(String value) {
+        this.isArray = value;
+    }
+
+    /**
+     * Gets the value of the dimension property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getDimension() {
+        return dimension;
+    }
+
+    /**
+     * Sets the value of the dimension property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setDimension(String value) {
+        this.dimension = value;
+    }
+
+}

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/Field.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/etch/branches/router/services/router/src/main/java/org/apache/etch/services/router/xml/Field.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"