You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@etch.apache.org by di...@apache.org on 2009/03/12 01:23:34 UTC
svn commit: r752702 [3/8] - in /incubator/etch/trunk/binding-python: ./
compiler/ compiler/src/main/java/etch/ compiler/src/main/java/etch/bindings/
compiler/src/main/java/etch/bindings/python/
compiler/src/main/java/etch/bindings/python/compiler/ comp...
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/Type.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/Type.py?rev=752702&view=auto
==============================================================================
--- incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/Type.py (added)
+++ incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/Type.py Thu Mar 12 00:23:28 2009
@@ -0,0 +1,292 @@
+"""
+$Id: Type.py 712749 2008-08-18 03:26:52Z dixson3 $
+
+# Copyright 2007-2008 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.
+#
+"""
+from __future__ import absolute_import
+
+import types
+from .IdName import *
+from ...python.Exceptions import *
+from .FieldMap import *
+from .ComboValidator import *
+from .AsyncMode import *
+from .Direction import *
+
+class Type(IdName):
+ """
+ Type denotes the type of a struct or message. When used with a message it
+ typically denotes an action or event.
+ """
+
+ def __init__(self, *args, **kwargs):
+ """
+ Constructs the type
+
+ @param type_id The id of the type
+ @param type_name The name of the type
+ """
+ super(Type,self).__init__(*args, **kwargs)
+
+ self.__rType = None
+ self.__helper = None
+ self.__clss = None
+ self.__locked = False
+ self.__timeout = 0
+ self.__responseField = None
+ self.__stubHelper = None
+ self.__superType = None
+ self.__asyncMode = AsyncMode.NONE
+ self.__direction = Direction.BOTH
+ self.__validators = {} # TODO: self.__validators should be synchronized?
+ self.__fields = FieldMap()
+
+ def getValidator(self, key):
+ """
+ @param key
+ @return The validator for this key of this type
+ """
+ return self.__validators.get(key, None)
+
+ def putValidator(self, key, vldtr):
+ """
+ Adds the validator to the chain for this key
+
+ @param key
+ @param vldtr
+ """
+ self.checkNotLocked()
+
+ if vldtr == None:
+ return;
+
+ if self.__fields.get(key.getId()) == None:
+ self.addField(key)
+
+ v = self.__validators.get(key, None)
+ if v != None:
+ self.__validators[key] = ComboValidator(v, vldtr)
+ else:
+ self.__validators[key] = vldtr
+
+ def clearValidator(self, key):
+ """
+ Removes the validator chain for this key
+
+ @param key
+ """
+ self.checkNotLocked()
+ del self.__validators[key]
+
+ def getResult(self):
+ """
+ @return The result message type of this message type
+ """
+ return self.__rType
+
+ def setResult(self, rType):
+ """
+ Sets the result message type of this message type
+
+ @param rType
+ """
+ self.checkNotLocked()
+ self.__rType = rType
+
+ def getImportExportHelper(self):
+ """
+ @return The associated import/export helper
+ """
+ return self.__helper
+
+ def setImportExportHelper(self, helper):
+ """
+ Sets the associated import/export helper
+
+ @param helper
+ """
+ self.checkNotLocked()
+ self.__helper = helper
+
+
+ def getComponentType(self):
+ """
+ @return the associated component type for an array of this type
+ """
+ return self.__clss
+
+ def setComponentType(self, clss):
+ """
+ Sets the associated component type fro an array of this type.
+
+ This type is not used when de-serializing the array component, just
+ when allocating the array itself.
+
+ @param clss
+ """
+ self.checkNotLocked()
+ self.__clss = clss
+
+
+ def getStubHelper(self):
+ """
+ @return An object to help the stub dispatch the received message
+ """
+ return self.__stubHelper
+
+ def setStubHelper(self, stubHelper):
+ """
+ Sets an object to help the stub dispatch the recieved message
+
+ @param stubHelper
+ """
+ if self.__stubHelper != None:
+ raise IllegalStateException, "stubHelper is already set"
+ self.__stubHelper = stubHelper
+
+ def lock(self):
+ """
+ Locks the fields for this type
+ """
+ self.__locked = True
+ self.__fields.lock()
+
+ def checkNotLocked(self):
+ if self.__locked:
+ raise IllegalStateException, "locked"
+
+ def addField(self, field):
+ """
+ Adds a field to the set of fields
+
+ @param field A Field to add
+ @return The argument
+ @throws IllegalArguementException
+ """
+ return self.__fields.add(field)
+
+ def getField(self, key):
+ """
+ Translates a field id or name into the appropriate Field object
+
+ @param key A Field id or name
+ @return Id translated into the appropriate Field
+ """
+ return self.__fields.get(key)
+
+ def getFields(self):
+ """
+ @return A set of all the fields
+ """
+ return set(self.__fields.values())
+
+ def getTimeout(self):
+ """
+ @return The time in milliseconds to wait for this response message
+ """
+ return self.__timeout
+
+ def setTimeout(self, timeout):
+ """
+ @param timeout the time in milliseconds to wait for this response message
+ """
+ self.checkNotLocked()
+ if not isinstance(timeout, (types.LongType, types.IntType)):
+ raise IllegalArgumentException, "timeout must be an integer"
+ if timeout < 0:
+ raise IllegalArgumentException, "timeout cannot be negative"
+
+ self.__timeout = timeout
+
+ def getResponseField(self):
+ """
+ @return the field with the value of this response.
+ """
+ return self.__responseField
+
+ def setResponseField(self, responseField):
+ """
+ @param responseField the field with the value of this response
+ """
+ self.checkNotLocked()
+ self.__responseField = responseField
+
+ def isAssignableFrom(self, other):
+ """
+ Checks whether this type is assignment compatible with other. This
+ means that the other is a subclass of this one
+
+ @param other
+ @return True if this type is assignable from other
+ """
+ return other != None and (self == other or self.isAssignableFrom(other.superType()))
+
+ def checkIsAssignableFrom(self, other):
+ """
+ Checks to see if this type is assignable from the other type.
+
+ @param other
+ @raises IllegalArgumentException if self is not assignable from otherType
+
+ """
+ if not self.isAssignableFrom(other):
+ raise IllegalArgumentException "This is not a super type of other"
+
+ def superType(self):
+ """
+ @return the super type of this type. If struct A extends B, then B is the super type of A
+ """
+ return self.__supertype
+
+ def setSuperType(self, superType):
+ """
+ Sets the super type of this type. If struct A extends B, then B is the super type of A.
+ @param superType
+ """
+ self.checkNotLocked()
+ self.__superType = superType
+
+ def getAsyncMode(self):
+ """
+ @return the AsyncMode for this type.
+ """
+ return self.__asyncMode
+
+ def setAsyncMode(self, mode):
+ """
+ Sets the AsyncMode for this type.
+ @param mode
+ """
+ self.checkNotLocked()
+ self.__asyncMode = mode
+
+ def getDirection(self):
+ """
+ @return the message direction
+ """
+ return self.__direction
+
+ def setDirection(self, direction):
+ """
+ Sets the message direction
+ @param direction the direction to set
+ """
+ if self.checkNotLocked()
+ self.__direction = direction
+
+
+
+
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/Type.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/Type.py
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/Type.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/TypeMap.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/TypeMap.py?rev=752702&view=auto
==============================================================================
--- incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/TypeMap.py (added)
+++ incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/TypeMap.py Thu Mar 12 00:23:28 2009
@@ -0,0 +1,30 @@
+"""
+$Id: TypeMap.py 718128 2008-11-16 22:35:35Z dixson $
+
+# Copyright 2007-2008 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.
+#
+"""
+from __future__ import absolute_import
+from .IdNameMap import *
+from .Type import *
+
+class TypeMap(IdNameMap):
+ """
+ TypeMap is a IdNameMap for Type
+ """
+
+ def makeNew(self, name):
+ return Type(name)
+
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/TypeMap.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/TypeMap.py
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/TypeMap.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/Validator.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/Validator.py?rev=752702&view=auto
==============================================================================
--- incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/Validator.py (added)
+++ incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/Validator.py Thu Mar 12 00:23:28 2009
@@ -0,0 +1,65 @@
+"""
+$Id: Validator.py 712748 2008-08-17 05:58:09Z dixson3 $
+
+# Copyright 2007-2008 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.
+#
+"""
+from __future__ import absolute_import
+from ...python.Exceptions import *
+
+class Validator(object):
+ """
+ Validate values put into messages.
+ """
+
+ MAX_NDIMS = 9
+ """The maximum number of dimensions for arrays (9)"""
+
+ MAX_CACHED = 4
+ """The maximum number of validators to cache per type."""
+
+ NONE = "Validator.NONE"
+ """No validation on put or output"""
+
+ MISSING_OK = "Validator.MISSING_OK"
+ """Validation on put or output if validator defined"""
+
+ FULL = "Validator.FULL"
+ """Like MISSING_OK, but fail if no validator defined"""
+
+ def elementValidator(self):
+ """
+ Return for an array type, return a validator for an element of the array
+ """
+ raise AbstractMethodException
+
+ def validate(self, value):
+ """
+ Checks the value for being valid. If valid, return true
+
+ @param value The value to be validated
+ @return True if the value is valid by any validator in the chain
+ """
+ raise AbstractMethodException
+
+ def validateValue(self, value):
+ """
+ @param value
+ @return the appropriate value given the input value and this validator's
+ sensibility about what it should really be (e.g., input Byte, but output
+ Long.
+ """
+ raise AbstractMethodException
+
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/Validator.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/Validator.py
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/Validator.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/ValueFactory.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/ValueFactory.py?rev=752702&view=auto
==============================================================================
--- incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/ValueFactory.py (added)
+++ incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/ValueFactory.py Thu Mar 12 00:23:28 2009
@@ -0,0 +1,176 @@
+"""
+$Id: ValueFactory.py 712748 2008-08-17 05:58:09Z dixson3 $
+
+# Copyright 2007-2008 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.
+#
+"""
+from __future__ import absolute_import
+from ...python.Exceptions import *
+
+class ValueFactory(object):
+ """
+ Interface which defines the value factory which helps the NSDL compiler
+ serialize and deserialize messages, convert values, etc.
+ """
+
+ ## Type Methods
+
+ def getType(self, key):
+ """
+ Translates a type id into the appropriate Etch.Msg.Type
+
+ @param key A type 'id' or a type 'name'
+ @return KEY translated into the appropriate type
+ """
+ raise UndefinedInterfaceMethodException
+
+ def addType(self, typ):
+ """
+ Adds the type if it doesn't already exist. Use this to dynamically add types to
+ a ValueFactory. The type is per instance of the ValueFactory, not global. Not available
+ if dynamic typing is locked.
+
+ @param typ
+ """
+ raise UndefinedInterfaceMethodException
+
+ def lockDynamicTypes(self):
+ """
+ Locks the dynamic typing so that no new types may be created by addType or getType
+ """
+ raise UndefinedInterfaceMethodException
+
+ def unlockDynamicTypes(self):
+ """
+ Unlocks the dynamic typing so that new types may be created by addType or getType.
+ """
+ raise UndefinedInterfaceMethodException
+
+ def getTypes(self):
+ """
+ @return a collection of all the types
+ """
+ raise UndefinedInterfaceMethodException
+
+ ## String Encoding
+
+ def getStringEncoding(self):
+ """
+ @return the encoding to use for strings
+ """
+ raise UndefinedInterfaceMethodException
+
+ ## Message ID
+
+ def getMessageId(self, msg):
+ """
+ @param msg The message whose well-known message-id field is to be
+ returned
+ @return The value of the well-known message-id field. This is
+ a unique identifier for this message on a particular
+ transport during a particular session. If there is no
+ well-known message-isd field defined, or if the
+ message-id field has not been set, then return None
+ """
+ raise UndefinedInterfaceMethodException
+
+ def setMessageId(self, msg, msgid):
+ """
+ Sets the value of the well-known message-id
+
+ @param msg the message whose well-known message-id is to be set
+ @param msgid the value of the well-known message-id field
+ """
+ raise UndefinedInterfaceMethodException
+
+ def get_mf__messageId(self):
+ """
+ @return well-known message field for message id
+ """
+ raise UndefinedInterfaceMethodException
+
+ ## IN REPLY TO
+
+ def getInReplyTo(self, msg):
+ """
+ @param msg The message whose well-known in-reply-to field is to be returned
+ @return hte value o the in-reply-to field
+ """
+ raise UndefinedInterfaceMethodException
+
+ def setInReplyTo(self, msg, msgid):
+ """
+ @param msg The message wholes well-known in-reply-to field is to be set
+ @param msgid The valud ot the well-known in-reply-to field
+ """
+ raise UndefinedInterfaceMethodException
+
+
+ def get_mf__inReplyTo(self):
+ """
+ @return well-known message field for in reply to
+ """
+ raise UndefinedInterfaceMethodException
+
+ ## Value Conversion
+
+ def exportCustomValue(self, value):
+ """
+ Converts a value to a struct value representation to be exported to a tagged data output
+
+ @param value A custom type defined by a service, or a well-known standard type
+ @return A struct value representing the value
+ @throws UnsupportedOperationException if the type cannot be exported
+ """
+ raise UnsupportedOperationException
+
+ def importCustomValue(self, structValue):
+ """
+ Converts a struct value imported from a tagged data input to a normal type
+
+ @param structValue A Struct value representation
+ @return A custom type
+ @throws UnsupportedOpertationException if the type cannot be imported
+ """
+ raise UnsupportedOperationException
+
+ def getCustomStructType(self, cls):
+ """
+ @param c The class of a custom value
+ @return the Struct type of a custom value class
+ @throws UnsupportedOperationException
+ """
+ raise UnsupportedOperationException
+
+ def get_mt__exception(self):
+ """
+ @return a well-known message type for exception thrown by one-way message.
+ """
+ raise UndefinedInterfaceMethodException
+
+ def getLevel(self):
+ """
+ @return the validation level of field StructValue.put and TaggedDataOutput
+ """
+ raise UndefinedInterfaceMethodException
+
+ def setLevel(self, level):
+ """
+ Sets the validation level of field StructValue.put and TaggedDataOutput
+
+ @param level
+ @return the old value
+ """
+ raise UndefinedInterfaceMethodException
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/ValueFactory.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/ValueFactory.py
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/ValueFactory.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/__init__.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/__init__.py?rev=752702&view=auto
==============================================================================
--- incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/__init__.py (added)
+++ incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/__init__.py Thu Mar 12 00:23:28 2009
@@ -0,0 +1,33 @@
+"""
+$Id: __init__.py 712748 2008-08-17 05:58:09Z dixson3 $
+
+# Copyright 2007-2008 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.
+#
+"""
+from __future__ import absolute_import
+from .AsyncMode import *
+from .ComboValidator import *
+from .Direction import *
+from .Field import *
+from .FieldMap import *
+from .IdName import *
+from .IdNameMap import *
+from .ImportExportHelper import *
+from .Message import *
+from .StructValue import *
+from .Type import *
+from .TypeMap import *
+from .Validator import *
+from .ValueFactory import *
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/__init__.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/__init__.py
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/msg/__init__.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/AuthExceptionSerializer.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/AuthExceptionSerializer.py?rev=752702&view=auto
==============================================================================
--- incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/AuthExceptionSerializer.py (added)
+++ incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/AuthExceptionSerializer.py Thu Mar 12 00:23:28 2009
@@ -0,0 +1,54 @@
+"""
+$Id: AuthExceptionSerializer.py 712747 2008-08-16 21:53:35Z dixson3 $
+
+# Copyright 2007-2008 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.
+#
+"""
+from __future__ import absolute_import
+from ..msg.Field import *
+from ..msg.ImportExportHelper import *
+from ..msg.StructValue import *
+from ..msg.Type import *
+from .Class2TypeMap import *
+from .Validator_string import *
+from ._Etch_AuthException import *
+
+class AuthExceptionSerializer(ImportExportHelper):
+
+ FIELD_NAME = "msg"
+
+ @staticmethod
+ def init(typ, class2type):
+ field = typ.getField(AuthExceptionSerializer.FIELD_NAME)
+ class2type[_Etch_AuthException] = typ
+ typ.setComponentType(_Etch_AuthException)
+ typ.setImportExportHelper(AuthExceptionSerializer(typ, field))
+ typ.putValidator(field, Validator_string.get(0))
+ typ.lock()
+
+ def __init__(self, typ, field):
+ self.__type = typ
+ self.__field = field
+
+ def exportValue(self, value):
+ sv = StructValue(self.__type)
+ sv[field] = repr(value)
+ return sv
+
+ def importValue(self, structValue):
+ structValue.checkType(self.__type)
+ return _Etch_AuthException(structValue[self.__field])
+
+
\ No newline at end of file
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/AuthExceptionSerializer.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/AuthExceptionSerializer.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Class2TypeMap.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Class2TypeMap.py?rev=752702&view=auto
==============================================================================
--- incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Class2TypeMap.py (added)
+++ incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Class2TypeMap.py Thu Mar 12 00:23:28 2009
@@ -0,0 +1,65 @@
+"""
+$Id: Class2TypeMap.py 712747 2008-08-16 21:53:35Z dixson3 $
+
+# Copyright 2007-2008 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.
+#
+"""
+from __future__ import absolute_import
+from ..msg.Type import *
+from ...python.Exceptions import *
+
+class Class2TypeMap(object):
+ """
+ Mapping between Class and Type
+ """
+
+ def __init__(self):
+ self.__c2t = {}
+ self.__locked = False
+
+ def __getitem__(self, c):
+ return self.__c2t[c]
+
+ def get(self, c):
+ try:
+ return self.__getitem__(c)
+ except:
+ return None
+
+ def __setitem__(self, c, t):
+ if self.__locked:
+ raise IllegalStateException, "locked"
+
+ x = self.get(c)
+ if x != None:
+ if x != t:
+ raise IllegalArgumentException, "type %s: class %s is already mapped to type %s" % (t,c,x)
+ # x == t, ergo our work is finished
+ return
+
+ self.__c2t[c] = t
+
+ def __iter__(self):
+ return self.__c2t.__iter__()
+
+ def put(self, c, t):
+ self.__setitem__(c,t)
+
+ def lock(self):
+ self.__locked = True
+
+ def addAll(self, other):
+ for c in other:
+ self.put(c,other[c])
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Class2TypeMap.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Class2TypeMap.py
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Class2TypeMap.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/DefaultServerFactory.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/DefaultServerFactory.py?rev=752702&view=auto
==============================================================================
(empty)
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/DefaultServerFactory.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/DefaultServerFactory.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/DefaultValueFactory.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/DefaultValueFactory.py?rev=752702&view=auto
==============================================================================
--- incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/DefaultValueFactory.py (added)
+++ incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/DefaultValueFactory.py Thu Mar 12 00:23:28 2009
@@ -0,0 +1,115 @@
+"""
+$Id: DefaultValueFactory.py 712747 2008-08-16 21:53:35Z dixson3 $
+
+# Copyright 2007-2008 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.
+#
+"""
+from __future__ import absolute_import
+from ..msg.Field import *
+from ..msg.ImportExportHelper import *
+from ..msg.Message import *
+from ..msg.StructValue import *
+from ..msg.Type import *
+from ..msg.ValueFactory import *
+from ..util.DateSerializer import *
+from ..util.ListSerializer import *
+from ..util.MapSerializer import *
+from ..util.SetSerializer import *
+from .Validator_RuntimeException import *
+from .Validator_long import *
+
+class DefaultValueFactory(ValueFactory):
+ """
+ Default implementation of ValueFactory which provides some
+ dynamic type and field support, as well as standard value
+ conversions and import and rt.
+ """
+
+ # Names
+
+ ETCH_RUNTIME_EXCEPTION_TYPE_NAME = "_Etch_RuntimeException"
+ ETCH_LIST_TYPE_NAME = "_Etch_List"
+ ETCH_MAP_TYPE_NAME = "_Etch_Map"
+ ETCH_SET_TYPE_NAME = "_Etch_Set"
+ ETCH_DATETIME_TYPE_NAME = "_Etch_Datetime"
+ ETCH_AUTH_EXCEPTION_TYPE_NAME = "_Etch_AuthException"
+ ETCH_EXCEPTION_MESSAGE_NAME = "_exception"
+ MSG_FIELD_NAME = "msg"
+ MESSAGE_ID_FIELD_NAME = "_messageId"
+ IN_REPLY_TO_FIELD_NAME = "_inReplyTo"
+ RESULT_FIELD_NAME = "result"
+
+ # Fields
+
+ _mf_msg = Field(MSG_FIELD_NAME)
+ """The msg field of the standard unchecked exception"""
+
+ _mf__messageId = Field(MESSAGE_ID_FIELD_NAME)
+ """The well-known _messageId field"""
+
+ _mf__inReplyTo = Field(IN_REPLY_TO_FIELD_NAME)
+ """The well-known _inReplyTo field"""
+
+ _mf_result = Field(RESULT_FIELD_NAME)
+ """The well-known result field"""
+
+
+ @staticmethod
+ def init(typs, class2type):
+ """
+ Initializes the standard types and fields needed by all
+ etch generated value factories.
+
+ @param types
+ @param class2type
+ """
+ cls = DefaultValueFactory
+
+ RuntimeExceptionSerialzier.init(typs[cls.ETCH_RUNTIME_EXCEPTION_TYPE_NAME], class2type)
+ ListSerialzier.init(typs[cls.ETCH_LIST_TYPE_NAME], class2type)
+ MapSerialzier.init(typs[cls.ETCH_MAP_TYPE_NAME], class2type)
+ SetSerialzier.init(typs[cls.ETCH_SET_TYPE_NAME], class2type)
+ DateSerialzier.init(typs[cls.ETCH_DATETIME_TYPE_NAME], class2type)
+ AuthExceptionSerialzier.init(typs[cls.ETCH_AUTH_EXCEPTION_TYPE_NAME], class2type)
+
+ # _mt__Etch_AuthException
+
+ t = typs.get(cls.ETCH_EXCEPTION_MESSAGE_NAME)
+ t.putValidator( cls._mf_result, Validator_RuntimeException.get())
+ t.putValidator( cls._mf__messageId, Validator_long.get(0))
+ t.putValidator( cls._mf__inReplyTo, Validator_long.get(0))
+
+ def __init__(self, typs, class2type):
+ """
+ Constructs the DefaultValueFactory.
+
+ @param typs
+ @param class2type
+ """
+ cls = self.__class__
+ self.__types = typs
+ self.__class2type = class2type
+ self._mt__Etch_RuntimeException = typs.get(cls.ETCH_RUNTIME_EXCEPTION_TYPE_NAME)
+ self._mt__Etch_List = typs.get(cls.ETCH_LIST_TYPE_NAME)
+ self._mt__Etch_Map = typs.get(cls.ETCH_MAP_TYPE_NAME)
+ self._mt__Etch_Set = typs.get(cls.ETCH_SET_TYPE_NAME)
+ self._mt__Etch_Datetime = typs.get(cls.ETCH_DATETIME_TYPE_NAME)
+ self._mt__Etch_AuthException = typs.get(cls.ETCH_AUTH_EXCEPTION_TYPE_NAME)
+ self._mt__exception = typs.get(cls.ETCH_EXCEPTION_MESSAGE_NAME)
+
+ def get_mt__Etch_RuntimeException(self):
+ return _mt__Etch_RuntimeException
+
+
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/DefaultValueFactory.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/DefaultValueFactory.py
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/DefaultValueFactory.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/DeliveryService.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/DeliveryService.py?rev=752702&view=auto
==============================================================================
--- incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/DeliveryService.py (added)
+++ incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/DeliveryService.py Thu Mar 12 00:23:28 2009
@@ -0,0 +1,75 @@
+"""
+$Id: DeliveryService.py 712747 2008-08-16 21:53:35Z dixson3 $
+
+# Copyright 2007-2008 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.
+#
+"""
+from __future__ import absolute_import
+from ...python.Exceptions import *
+from ..msg.Field import *
+from ..msg.Message import *
+from ..msg.Type import *
+from ...util.core.io.Transport import *
+
+class DeliveryService(Transport):
+ """
+ Adapter between remote and message source.
+ """
+
+ def send(self, msg):
+ """
+ Sends the message to the recipient, but does not wait for any response.
+
+ @param msg - the message to send
+ @raises Exception - if there is a problem sending
+ """
+ raise UnimplementedInterfaceMethodException
+
+ def begincall(self, msg):
+ """
+ Sends the message which begins a call sequence.
+
+ @param msg - the message to send.
+ @return - a mailbox which can be used to read response,
+ using {@link #endcall(Mailbox, Type, Field, int)}
+ """
+ raise UnimplementedInterfaceMethodException
+
+ def endcall(self, mb, responseType):
+ """
+ @param mb
+ @param responseType - the type of the expected response.
+ @param responseField - the field of the expected response which would
+ contain any result value or raised exception
+ @return - the value of the response field if it isn't an exception
+ @raises Exception - if there is a problem sending or a timeout waiting
+ or if the result value was an exception.
+ """
+ raise UnimplementedInterfaceMethodException
+
+ def getSource(self):
+ """
+ @return - the message source of this delivery service
+ """
+ raise UnimplementedInterfaceMethodException
+
+ def addStub(self, stub):
+ """
+ Adds a stub to receive messages from the message source.
+ @param stub
+ """
+ raise UnimplementedInterfaceMethodException
+
+
\ No newline at end of file
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/DeliveryService.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/DeliveryService.py
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/DeliveryService.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/DummyValueFactory.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/DummyValueFactory.py?rev=752702&view=auto
==============================================================================
(empty)
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/DummyValueFactory.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/DummyValueFactory.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/FreePool.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/FreePool.py?rev=752702&view=auto
==============================================================================
--- incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/FreePool.py (added)
+++ incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/FreePool.py Thu Mar 12 00:23:28 2009
@@ -0,0 +1,85 @@
+"""
+$Id: FreePool.py 712747 2008-08-16 21:53:35Z dixson3 $
+
+# Copyright 2007-2008 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.
+#
+"""
+from __future__ import absolute_import
+from .Pool import *
+
+class ThreadGroup:
+ pass
+
+class Thread:
+ pass
+
+
+class _Runnable(object):
+ def __init__(self, poolRunnable):
+ self.__poolRunnable = poolRunnable
+
+ def run(self):
+ try:
+ self.__poolRunnable.run()
+ except Exception, e:
+ self.__poolRunnable.exception(e)
+
+class FreePool(Pool):
+ """
+ A free implementation of Pool.
+ """
+
+ def __init__(self, maxSize=50):
+ """
+ Constructs a FreePool with specified maxSize.
+
+ @param maxSize - maximum number of free threads at one time, after
+ maximum is reached, reject the requests. Default size is 50.
+ """
+ self.__maxSize = maxSize
+ self.__tg = ThreadGroup("FreePoolThreadGroup")
+ self.__open = True
+
+ def close(self):
+ """
+ Closes the pool. This just marks the pool as being closed, it doesn't
+ actually do anything to the currently running thread. But no more
+ threads are allowed to start.
+ """
+ self.__open = False
+
+ def join(self):
+ """
+ Joins each of the threads in this pool until there are none left. The
+ pool will be closed first.
+
+ @raises Exception
+ """
+ self.close()
+ lst = [None for x in range(0,10)]
+ n = self.__tg.enumerate(lst)
+ while n > 0:
+ for i in range(0,n):
+ lst[i].join()
+ n = self.__tg.enumerate(lst)
+
+ def run(self, poolRunnable):
+ # TODO: Whole method Sychronized?
+
+ if not self.__open or self.__tg.activeCount() >= self.__maxSize:
+ raise IllegalStateException, "free pool thread count exceeded or pool closed"
+
+ Thread(self.__tg, _Runnable(poolRunnable)).start()
+
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/FreePool.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/FreePool.py
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/FreePool.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Mailbox.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Mailbox.py?rev=752702&view=auto
==============================================================================
--- incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Mailbox.py (added)
+++ incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Mailbox.py Thu Mar 12 00:23:28 2009
@@ -0,0 +1,20 @@
+"""
+$Id: Mailbox.py 712747 2008-08-16 21:53:35Z dixson3 $
+
+# Copyright 2007-2008 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.
+#
+"""
+from __future__ import absolute_import
+
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Mailbox.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Mailbox.py
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Mailbox.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/NullPool.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/NullPool.py?rev=752702&view=auto
==============================================================================
--- incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/NullPool.py (added)
+++ incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/NullPool.py Thu Mar 12 00:23:28 2009
@@ -0,0 +1,31 @@
+"""
+$Id: NullPool.py 712747 2008-08-16 21:53:35Z dixson3 $
+
+# Copyright 2007-2008 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.
+#
+"""
+from __future__ import absolute_import
+from .Pool import *
+
+class NullPool(Pool):
+ """
+ A pool which runs the runnable directly.
+ """
+ def run(self, runnable):
+ try:
+ runnable.run()
+ except Exception, e:
+ runnable.exception(e)
+
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/NullPool.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/NullPool.py
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/NullPool.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/ObjSession.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/ObjSession.py?rev=752702&view=auto
==============================================================================
--- incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/ObjSession.py (added)
+++ incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/ObjSession.py Thu Mar 12 00:23:28 2009
@@ -0,0 +1,20 @@
+"""
+$Id: ObjSession.py 712747 2008-08-16 21:53:35Z dixson3 $
+
+# Copyright 2007-2008 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.
+#
+"""
+from __future__ import absolute_import
+
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/ObjSession.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/ObjSession.py
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/ObjSession.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Pool.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Pool.py?rev=752702&view=auto
==============================================================================
--- incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Pool.py (added)
+++ incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Pool.py Thu Mar 12 00:23:28 2009
@@ -0,0 +1,54 @@
+"""
+$Id: Pool.py 712747 2008-08-16 21:53:35Z dixson3 $
+
+# Copyright 2007-2008 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.
+#
+"""
+from __future__ import absolute_import
+from ...python.Exceptions import *
+
+__all__ = ['PoolRunnable', 'Pool']
+
+class PoolRunnable(object):
+ """
+ A runnable which can throw an exception
+ """
+
+ def run(self):
+ """
+ @raises Exception
+ """
+ raise UnimplementedInterfaceMethodException
+
+ def exception(self, e):
+ """
+ Reports an exception raised by the run method
+
+ @param e
+ """
+ raise UnimplementedInterfaceMethodException
+
+class Pool(object):
+ """
+ Interface to a queued or free thread pool.
+ """
+
+ def run(self, runnable):
+ """
+ @param runnable - the thing to run
+ @raises Exception - if there is a problem scheduling the runnable to run
+ """
+ raise UnimplementedInterfaceMethodException
+
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Pool.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Pool.py
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Pool.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/QueuePool.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/QueuePool.py?rev=752702&view=auto
==============================================================================
--- incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/QueuePool.py (added)
+++ incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/QueuePool.py Thu Mar 12 00:23:28 2009
@@ -0,0 +1,58 @@
+"""
+$Id: QueuePool.py 712747 2008-08-16 21:53:35Z dixson3 $
+
+# Copyright 2007-2008 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.
+#
+"""
+from __future__ import absolute_import
+from .Pool import *
+from ...util.TodoManager import *
+from ...util.Todo import *
+
+__all__ = ['QueuedPool']
+
+class _Todo(Todo):
+
+ def __init__(self, runnable):
+ super(_Todo,self).__init__()
+ self.__runnable = runnable
+
+ def doit(self, mgr):
+ self.__runnable.run()
+
+ def exception(self, mgr, e):
+ self.__runnable.exception(e)
+
+
+class QueuedPool(Pool):
+ """
+ A queued implementation of pool
+ """
+
+ def __init__(self, mgr=None):
+ """
+ Constructs the queued pool with a specified todo manager.
+
+ @param mgr - if mgr is not specified or None, use the default manager
+ @raises Exception
+ """
+ if mgr == None:
+ mgr = TodoManager.getTodoManager()
+
+ self.__mgr = mgr
+
+ def run(self, runnable):
+ self.__mgr.add(_Todo(runnable))
+
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/QueuePool.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/QueuePool.py
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/QueuePool.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/RemoteBase.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/RemoteBase.py?rev=752702&view=auto
==============================================================================
--- incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/RemoteBase.py (added)
+++ incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/RemoteBase.py Thu Mar 12 00:23:28 2009
@@ -0,0 +1,20 @@
+"""
+$Id: RemoteBase.py 712747 2008-08-16 21:53:35Z dixson3 $
+
+# Copyright 2007-2008 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.
+#
+"""
+from __future__ import absolute_import
+
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/RemoteBase.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/RemoteBase.py
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/RemoteBase.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/RuntimeExceptionSerializer.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/RuntimeExceptionSerializer.py?rev=752702&view=auto
==============================================================================
--- incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/RuntimeExceptionSerializer.py (added)
+++ incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/RuntimeExceptionSerializer.py Thu Mar 12 00:23:28 2009
@@ -0,0 +1,64 @@
+"""
+$Id: RuntimeExceptionSerializer.py 712747 2008-08-16 21:53:35Z dixson3 $
+
+# Copyright 2007-2008 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.
+#
+"""
+from __future__ import absolute_import
+from ..msg.Field import *
+from ..msg.ImportExportHelper import *
+from ..msg.StructValue import *
+from ..msg.Type import *
+from ._Etch_RuntimeException import *
+from .Validator_string import *
+
+class RuntimeExceptionSerializer(ImportExportHelper):
+
+ FIELD_NAME = "msg"
+
+ @staticmethod
+ def init(typ, class2type):
+ """
+ Defines custom fields in the value factory so that the importer can
+ find them.
+
+ @param typ
+ @param class2type
+ """
+ field = typ.getField(RuntimeExceptionSerializer.FIELD_NAME)
+ class2type[_Etch_RuntimeException] = typ
+ typ.setComponentType(_Etch_RuntimeException)
+ typ.setImportExportHelper(RuntimeExceptionSerializer(typ,field))
+ typ.putValidator(field, Validator_string.get(0))
+ typ.lock()
+
+ def __init__(self, typ, field):
+ """
+ Constructs the RuntimeExceptionSerializer
+
+ @param typ
+ @param field
+ """
+ self.__type = typ
+ self.__field = field
+
+ def exportValue(self, value):
+ sv = StructValue(self.__type)
+ sv[self.__field] = repr(value)
+ return sv
+
+ def importValue(self, structValue):
+ structValue.checkType(self.__type)
+ return _Etch_RuntimeException(structValue[self.__field])
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/RuntimeExceptionSerializer.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/RuntimeExceptionSerializer.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/ServerFactory.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/ServerFactory.py?rev=752702&view=auto
==============================================================================
(empty)
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/ServerFactory.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/ServerFactory.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/StubBase.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/StubBase.py?rev=752702&view=auto
==============================================================================
--- incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/StubBase.py (added)
+++ incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/StubBase.py Thu Mar 12 00:23:28 2009
@@ -0,0 +1,19 @@
+"""
+$Id: StubBase.py 712747 2008-08-16 21:53:35Z dixson3 $
+
+# Copyright 2007-2008 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.
+#
+"""
+from __future__ import absolute_import
\ No newline at end of file
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/StubBase.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/StubBase.py
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/StubBase.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/StubHelper.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/StubHelper.py?rev=752702&view=auto
==============================================================================
--- incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/StubHelper.py (added)
+++ incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/StubHelper.py Thu Mar 12 00:23:28 2009
@@ -0,0 +1,44 @@
+"""
+$Id: StubHelper.py 712747 2008-08-16 21:53:35Z dixson3 $
+
+# Copyright 2007-2008 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.
+#
+"""
+from __future__ import *
+from ...python.Exception import *
+
+class StubHelper(object):
+ """
+ Generated code to dispatch method from message.
+ """
+
+ def __init__(self):
+ """
+ Constructs a StubHelper which uses synchronous mode to dispatch method
+ from message.
+ """
+ pass
+
+ def run(self, src, obj, sender, msg):
+ """
+ Dispatches the method from message.
+
+ @param src
+ @param obj
+ @param sender
+ @param msg
+ @raises Exception
+ """
+ raise AbstractMethodException
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/StubHelper.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/StubHelper.py
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/StubHelper.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/StubIntf.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/StubIntf.py?rev=752702&view=auto
==============================================================================
--- incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/StubIntf.py (added)
+++ incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/StubIntf.py Thu Mar 12 00:23:28 2009
@@ -0,0 +1,28 @@
+"""
+$Id: StubIntf.py 712747 2008-08-16 21:53:35Z dixson3 $
+
+# Copyright 2007-2008 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.
+#
+"""
+from __future__ import *
+from .MessageHandler import *
+from ...util.core.io.Session import *
+
+class StubIntf(MessageHandler,Session):
+ """
+ Interface required by DeliveryService
+ """
+ pass
+
\ No newline at end of file
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/StubIntf.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/StubIntf.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/TransportFactory.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/TransportFactory.py?rev=752702&view=auto
==============================================================================
(empty)
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/TransportFactory.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/TransportFactory.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/TransportHelper.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/TransportHelper.py?rev=752702&view=auto
==============================================================================
(empty)
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/TransportHelper.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/TransportHelper.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/TypeValidator.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/TypeValidator.py?rev=752702&view=auto
==============================================================================
--- incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/TypeValidator.py (added)
+++ incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/TypeValidator.py Thu Mar 12 00:23:28 2009
@@ -0,0 +1,19 @@
+"""
+$Id: TypeValidator.py 712747 2008-08-16 21:53:35Z dixson3 $
+
+# Copyright 2007-2008 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.
+#
+"""
+from __future__ import absolute_import
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/TypeValidator.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/TypeValidator.py
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/TypeValidator.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_RuntimeException.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_RuntimeException.py?rev=752702&view=auto
==============================================================================
--- incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_RuntimeException.py (added)
+++ incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_RuntimeException.py Thu Mar 12 00:23:28 2009
@@ -0,0 +1,41 @@
+"""
+etch.support.Validator_RuntimeException
+
+# Copyright 2007-2008 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.
+#
+"""
+
+from etch.support.TypeValidator import *
+from etch.transport.fmt.TypeCode import TypeCode
+from etch.util.Exceptions import *
+
+class Validator_RuntimeException(ScalarOnlyTypeValidator):
+ """
+ Validator for RuntimeException
+ """
+
+ def __init__(self):
+ self.description = "RuntimeException"
+
+ def elementValidator(self):
+ raise IllegalArgumentException, "Not an array"
+
+ def validate(self, value):
+ return isinstance(value, Exception)
+
+ def checkValue(self, value):
+ if self.validate(value):
+ return TypeCode.CUSTOM
+ return None
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_RuntimeException.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_RuntimeException.py
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_RuntimeException.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_StructValue.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_StructValue.py?rev=752702&view=auto
==============================================================================
(empty)
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_StructValue.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_StructValue.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_boolean.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_boolean.py?rev=752702&view=auto
==============================================================================
--- incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_boolean.py (added)
+++ incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_boolean.py Thu Mar 12 00:23:28 2009
@@ -0,0 +1,48 @@
+"""
+Etch.Support.Validator_boolean
+
+# Copyright 2007-2008 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.
+#
+"""
+import types
+from etch.support.TypeValidator import *
+from etch.transport.fmt.TypeCode import TypeCode
+from etch.util.Exceptions import *
+from etch.util.Types import *
+from etch.transport.fmt.TypeCode import *
+
+class Validator_boolean(ScalarAndArrayTypeValidator):
+ """
+ Validator for boolean
+ """
+
+ def __init__(self, nDims=0):
+ """
+ Construct the validator.
+
+ @param nDims the number of dimensions. 0 or scalar.
+ """
+ typs = [types.BooleanType]
+ super(Validator_boolean,self).__init__(typs, None, nDims, "boolean[%d]" % nDims, False, [TypeCode.BOOLS, TypeCode.BOOLEAN_TRUE])
+
+
+ def checkValue(self, value):
+ tc = super(Validator_boolean,self).checkValue(value)
+
+ if tc == TypeCode.BOOLEAN_TRUE:
+ if value == False:
+ tc = TypeCode.BOOLEAN_FALSE
+
+ return tc
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_boolean.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_boolean.py
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_boolean.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_byte.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_byte.py?rev=752702&view=auto
==============================================================================
--- incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_byte.py (added)
+++ incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_byte.py Thu Mar 12 00:23:28 2009
@@ -0,0 +1,37 @@
+"""
+Etch.Support.Validator_byte
+
+# Copyright 2007-2008 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.
+#
+"""
+import types
+from etch.support.TypeValidator import *
+from etch.transport.fmt.TypeCode import *
+from etch.util.Exceptions import *
+from etch.util.Types import *
+
+class Validator_byte(NumberTypeValidator):
+ """
+ Validator for byte
+ """
+
+ def __init__(self, nDims=0):
+ """
+ Construct the validator.
+
+ @param nDims the number of dimensions. 0 for a scalar.
+ """
+ typs = [Byte]
+ super(Validator_byte,self).__init__(typs, ByteArray, nDims, "byte[%d]" % nDims, Byte, [TypeCode.BYTES, TypeCode.BYTE])
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_byte.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_byte.py
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_byte.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_custom.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_custom.py?rev=752702&view=auto
==============================================================================
--- incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_custom.py (added)
+++ incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_custom.py Thu Mar 12 00:23:28 2009
@@ -0,0 +1,37 @@
+"""
+etch.support.Validator_custom
+
+# Copyright 2007-2008 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.
+#
+"""
+
+from etch.util.Exceptions import *
+from etch.transport.fmt.TypeCode import TypeCode
+from etch.support.TypeValidator import *
+
+class Validator_custom(ScalarAndArrayTypeValidator):
+ """
+ Validator for Custom Types
+ """
+
+ def __init__(self, className, nDims=0):
+ """
+ Constructor
+
+ @param className The class name to validate
+ @param nDims The number of dimensions, use 0 for scalar
+ """
+ super(Validator_custom,self).__init__(className, className, nDims, "%s[%d]" % (repr(className), nDims), True, TypeCode.CUSTOM)
+ self.__class__.setClassName(className)
\ No newline at end of file
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_custom.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_custom.py
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_custom.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_double.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_double.py?rev=752702&view=auto
==============================================================================
--- incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_double.py (added)
+++ incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_double.py Thu Mar 12 00:23:28 2009
@@ -0,0 +1,37 @@
+"""
+Etch.Support.Validator_double
+
+# Copyright 2007-2008 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.
+#
+"""
+import types
+from etch.support.TypeValidator import *
+from etch.transport.fmt.TypeCode import *
+from etch.util.Exceptions import *
+from etch.util.Types import *
+
+class Validator_double(ScalarAndArrayTypeValidator):
+ """
+ Validator for double
+ """
+
+ def __init__(self, nDims):
+ """
+ Construct the validator.
+
+ @param nDims the number of dimensions. 0 or scalar.
+ """
+ typs = [float, Double]
+ super(Validator_double,self).__init__(typs, None, nDims, "double[%d]" % nDims, False, [TypeCode.DOUBLES, TypeCode.DOUBLE])
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_double.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_double.py
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_double.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_float.py
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_float.py?rev=752702&view=auto
==============================================================================
--- incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_float.py (added)
+++ incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_float.py Thu Mar 12 00:23:28 2009
@@ -0,0 +1,37 @@
+"""
+Etch.Support.Validator_float
+
+# Copyright 2007-2008 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.
+#
+"""
+import types
+from etch.support.TypeValidator import *
+from etch.transport.fmt.TypeCode import *
+from etch.util.Exceptions import *
+from etch.util.Types import *
+
+class Validator_float(ScalarAndArrayTypeValidator):
+ """
+ Validator for float
+ """
+
+ def __init__(self, nDims):
+ """
+ Construct the validator.
+
+ @param nDims the number of dimensions. 0 or scalar.
+ """
+ typs = [float, Float]
+ super(Validator_float,self).__init__(typs, None, nDims, "float[%d]" % nDims, False, [TypeCode.FLOATS, TypeCode.FLOATS])
\ No newline at end of file
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_float.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_float.py
------------------------------------------------------------------------------
svn:executable = *
Propchange: incubator/etch/trunk/binding-python/runtime/src/main/python/etch/binding/support/Validator_float.py
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"