You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wookie.apache.org by sc...@apache.org on 2010/03/16 16:57:37 UTC
svn commit: r923822 - in /incubator/wookie/trunk/connector/python: ./
wookie/ wookie/widget/
Author: scottbw
Date: Tue Mar 16 15:57:36 2010
New Revision: 923822
URL: http://svn.apache.org/viewvc?rev=923822&view=rev
Log:
Adding initial Python connector framework (thanks to Raido Kuli for the patch). See WOOKIE-127
Added:
incubator/wookie/trunk/connector/python/
incubator/wookie/trunk/connector/python/TestWookieService.py
incubator/wookie/trunk/connector/python/wookie/
incubator/wookie/trunk/connector/python/wookie/WookieConnectorService.py
incubator/wookie/trunk/connector/python/wookie/WookieServerConnection.py
incubator/wookie/trunk/connector/python/wookie/__init__.py
incubator/wookie/trunk/connector/python/wookie/widget/
incubator/wookie/trunk/connector/python/wookie/widget/Instance.py
incubator/wookie/trunk/connector/python/wookie/widget/Instances.py
incubator/wookie/trunk/connector/python/wookie/widget/Property.py
incubator/wookie/trunk/connector/python/wookie/widget/User.py
incubator/wookie/trunk/connector/python/wookie/widget/Widget.py
incubator/wookie/trunk/connector/python/wookie/widget/__init__.py
Added: incubator/wookie/trunk/connector/python/TestWookieService.py
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/connector/python/TestWookieService.py?rev=923822&view=auto
==============================================================================
--- incubator/wookie/trunk/connector/python/TestWookieService.py (added)
+++ incubator/wookie/trunk/connector/python/TestWookieService.py Tue Mar 16 15:57:36 2010
@@ -0,0 +1,75 @@
+#
+# 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 wookie import WookieConnectorService
+from wookie.widget import Property
+from wookie.widget import User
+
+# @param host, path, api_key, shareddatakey
+WookieConn = WookieConnectorService.WookieConnectorService('localhost:8080', '/wookie', 'TEST','localhost_python')
+# set Widget user
+WookieConn.setUser("demo_python", "demo_python_screenName")
+
+print WookieConn.getCurrentUser().getLoginName()
+print WookieConn.getCurrentUser().getScreenName()
+
+# params: name, value, isPublic (default: false)
+prop1 = Property.Property("test", "proov")
+print prop1.getName()+":"+prop1.getValue()+":"+prop1.getIsPublic()
+
+# get available widgets
+widgetList = WookieConn.getAvailableWidgets()
+
+a = widgetList[12]
+b = widgetList[11]
+#a = 'http://www.getwookie.org/widgets/weather'
+
+# create or get instances
+
+retrievedInstance = WookieConn.getOrCreateInstance(a)
+if retrievedInstance:
+ print retrievedInstance.getTitle()+'\n'+retrievedInstance.getUrl()
+ print retrievedInstance.getWidth()+'\n'+retrievedInstance.getHeight()
+
+ # add participant, returns string "true" (if exists, or created) or "false"
+ print WookieConn.addParticipant(retrievedInstance, User.User("ants_python", "ants_screenName"))
+
+ # get participants, return list of participants
+ users = WookieConn.getParticipants(retrievedInstance)
+ print users[0].getLoginName()+":"+users[0].getScreenName()+":"+users[0].getThumbnail()
+
+ # delete participant
+ WookieConn.deleteParticipant(retrievedInstance, User.User("ants_python"));
+
+ # add property
+ # params: name, value, is_public
+ prop2 = Property.Property("python_prop", "demo")
+ WookieConn.setProperty(retrievedInstance, prop2)
+
+ # get property, return property objec, if failed then "false"
+ retrievedProp = WookieConn.getProperty(retrievedInstance, prop2)
+ print retrievedProp.getValue()
+
+ #delete property, returns "true" or "false"
+ WookieConn.deleteProperty(retrievedInstance, prop2)
+
+retrievedInstance2 = WookieConn.getOrCreateInstance(b)
+if retrievedInstance2:
+ print retrievedInstance2.getTitle()+'\n'+retrievedInstance2.getUrl()
+ print retrievedInstance2.getWidth()+'\n'+retrievedInstance2.getHeight()
+
+
+retrievedInstance3 = WookieConn.getOrCreateInstance('http://www.getwookie.org/widgets/weather')
+if retrievedInstance3:
+ print retrievedInstance3.getTitle()+'\n'+retrievedInstance3.getUrl()
+ print retrievedInstance3.getWidth()+'\n'+retrievedInstance3.getHeight()
Added: incubator/wookie/trunk/connector/python/wookie/WookieConnectorService.py
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/connector/python/wookie/WookieConnectorService.py?rev=923822&view=auto
==============================================================================
--- incubator/wookie/trunk/connector/python/wookie/WookieConnectorService.py (added)
+++ incubator/wookie/trunk/connector/python/wookie/WookieConnectorService.py Tue Mar 16 15:57:36 2010
@@ -0,0 +1,359 @@
+#
+# 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 xml.dom import minidom
+import httplib
+import urllib
+httplib.HTTPConnection.debugLevel = 1
+from WookieServerConnection import WookieServerConnection
+from wookie.widget import Widget
+from wookie.widget import Instance
+from wookie.widget import Instances
+from wookie.widget import User
+from wookie.widget import Property
+
+
+class WookieConnectorService:
+ __connection = ""
+ __widgetInstances = Instances.Instances()
+ __currentUser = ""
+
+ def __init__(self, wookieUrl, wookiePath = "", api_key = "", shareddatakey = ""):
+ self.__connection = WookieServerConnection(wookieUrl, api_key, shareddatakey, wookiePath)
+
+ # set current user
+ # @param username, screenname
+
+ def setUser(self, loginName, screenName = ""):
+ if screenName == "":
+ screenName = loginName
+ self.__currentUser = User.User(loginName, screenName)
+
+ # get current use
+ # @return User object
+
+ def getCurrentUser(self):
+ return self.__currentUser
+
+ # get current connection object
+ # @return WookieServerConnection
+
+ def getConnection(self):
+ return self.__connection
+
+ # get all available widgets
+ # @return list of widgets
+
+ def getAvailableWidgets(self):
+ socket = httplib.HTTPConnection(self.getConnection().getUrl())
+ socket.request('GET', self.getConnection().getPath()+'/widgets?all=true')
+ response = socket.getresponse()
+ xmldoc = ''
+ try:
+ xmldoc = minidom.parseString(response.read());
+ except Exception:
+ print 'Error getting widgets XML'
+ socket.close()
+
+ ##define widgetList
+ widgetList = []
+ if xmldoc:
+ widgetsAvailable = xmldoc.getElementsByTagName('widget')
+ if widgetsAvailable:
+ for widget in widgetsAvailable:
+
+ ##get widget title
+ widgetTitle = self.getText(widget.getElementsByTagName('title'));
+
+ ##get widget url
+ widgetGuid = widget.getAttribute('identifier')
+
+ ##get widget description
+ widgetDesc = self.getText(widget.getElementsByTagName('description'));
+
+ ##get widget icon
+ widgetIcon = self.getText(widget.getElementsByTagName('icon'));
+
+ if widgetTitle and widgetGuid:
+ widgetList.append(Widget.Widget(widgetGuid, widgetTitle, widgetDesc, widgetIcon))
+ else:
+ print 'No widgets found'
+ return widgetList
+
+ # Function to get Text value from XML node
+ # @param parentElement
+ # @return string
+
+ def getText(self, parentElement):
+ try:
+ node = parentElement[0].childNodes[0]
+ if node.nodeType == node.TEXT_NODE:
+ return node.nodeValue
+ except IndexError:
+ pass
+ return ''
+
+ # Get or create widget instance
+ # @param Widget instance or plain text GUID
+ # @return new widget instance
+
+ def getOrCreateInstance(self, widget_or_guid):
+ if widget_or_guid != str(widget_or_guid):
+ guid = widget_or_guid.getGuid()
+ else:
+ guid = widget_or_guid
+ if self.getCurrentUser().getLoginName() == "":
+ print "Current user loginName value empty (\"\")"
+ return
+ if guid:
+ params = urllib.urlencode({'api_key': self.getConnection().getApiKey(),
+ 'userid': self.getCurrentUser().getLoginName(),
+ 'shareddatakey': self.getConnection().getSharedDataKey(),
+ 'widgetid': guid})
+ headers = {"Content-type": "application/x-www-form-urlencoded",
+ "Accept": "text/xml"}
+ socket = httplib.HTTPConnection(self.getConnection().getUrl())
+ socket.request('POST', self.getConnection().getPath()+'/widgetinstances', params, headers)
+ try:
+ response = socket.getresponse()
+ except ResponseNotReady:
+ response = socket.getresponse()
+
+ if response.status == 201:
+ response = socket.getresponse()
+ instanceXml = response.read()
+ socket.close()
+ newInstance = self.parseInstance(instanceXml, guid)
+ if newInstance:
+ self.__widgetInstances.put(newInstance)
+ self.addParticipant(newInstance, self.getCurrentUser())
+ return newInstance
+ else:
+ return
+
+ # Parse widget instance XML
+ # @param xml, guid
+ # @return new widget instance
+
+ def parseInstance(self, xml, guid):
+ newInstance = ''
+ xmlDoc = ''
+ try:
+ xmlDoc = minidom.parseString(xml)
+ except Exception:
+ print 'Could not parse instance xml'
+ if xmlDoc:
+ url = self.getText(xmlDoc.getElementsByTagName('url'))
+ title = self.getText(xmlDoc.getElementsByTagName('title'))
+ height = self.getText(xmlDoc.getElementsByTagName('height'))
+ width = self.getText(xmlDoc.getElementsByTagName('width'))
+ isMaximizable = self.getText(xmlDoc.getElementsByTagName('maximize'))
+ newInstance = Instance.Instance(url, guid, title, height, width, isMaximizable)
+ return newInstance
+
+ # Get list of participants
+ # @param widget instance
+ # @return List participants
+
+ def getParticipants(self, widgetInstance):
+ participantsList = []
+ if widgetInstance == "":
+ print "No widget instance"
+ return
+ queryString = '?api_key='+self.getConnection().getApiKey()
+ queryString += '&userid='+self.getCurrentUser().getLoginName()
+ queryString += '&shareddatakey='+self.getConnection().getSharedDataKey()
+ queryString += '&widgetid='+widgetInstance.getGuid()
+
+ socket = httplib.HTTPConnection(self.getConnection().getUrl())
+ socket.request('GET', self.getConnection().getPath()+'/participants'+queryString)
+ try:
+ response = socket.getresponse()
+ except ResponseNotReady:
+ response = socket.getresponse()
+
+ if response.status == 200:
+ xmlDoc = ""
+ try:
+ xmlDoc = minidom.parseString(response.read())
+ participants = xmlDoc.getElementsByTagName("participant")
+ if participants:
+ for participant in participants:
+ participant_id = participant.getAttribute("id")
+ display_name = participant.getAttribute("display_name")
+ thumbnailURL = participant.getAttribute("thumbnail_url")
+ newUser = User.User(participant_id, display_name)
+ newUser.setThumbnail(thumbnailURL)
+ participantsList.append(newUser)
+ except Exception:
+ print "Could not parse participants XML"
+
+ return participantsList
+ if response.status != 200:
+ print "HTTP Status: "+response.status+"\nResponseText: "+response.read()
+ return
+ socket.close()
+ return participantsList
+
+ # Add participant to current widget instance
+ # @param widgetInstance, userInstance
+ # @return true if added, false otherwise
+
+ def addParticipant(self, widgetInstance, userInstance):
+ params = urllib.urlencode({'api_key': self.getConnection().getApiKey(),
+ 'userid': self.getCurrentUser().getLoginName(),
+ 'shareddatakey': self.getConnection().getSharedDataKey(),
+ 'widgetid': widgetInstance.getGuid(),
+ 'participant_id': userInstance.getLoginName(),
+ 'participant_display_name': userInstance.getScreenName(),
+ 'participant_thumbnail_url': userInstance.getThumbnail()})
+
+ headers = {"Content-type": "application/x-www-form-urlencoded",
+ "Accept": "text/xml"}
+ socket = httplib.HTTPConnection(self.getConnection().getUrl())
+ socket.request('POST', self.getConnection().getPath()+'/participants', params, headers)
+ try:
+ response = socket.getresponse()
+ except ResponseNotReady:
+ response = socket.getresponse()
+ if response.status == 201:
+ return 'true'
+ if response.status == 200:
+ return 'true'
+ return 'false'
+
+ # Delete participant
+ # @param widgetIntance, userInstance
+ # @return true if done, false if failed
+
+ def deleteParticipant(self, widgetInstance, userInstance):
+ if widgetInstance == "":
+ print "No widget instance"
+ return
+ if userInstance == "":
+ print "No user instance"
+ return
+ queryString = '?api_key='+self.getConnection().getApiKey()
+ queryString += '&userid='+self.getCurrentUser().getLoginName()
+ queryString += '&shareddatakey='+self.getConnection().getSharedDataKey()
+ queryString += '&widgetid='+widgetInstance.getGuid()
+ queryString += '&participant_id='+userInstance.getLoginName()
+
+ socket = httplib.HTTPConnection(self.getConnection().getUrl())
+ socket.request('DELETE', self.getConnection().getPath()+'/participants'+queryString)
+ try:
+ response = socket.getresponse()
+ except ResponseNotReady:
+ response = socket.getresponse()
+
+ if response.status == 200:
+ return 'true'
+ if response.status == 404:
+ return 'false'
+
+ print "deleteParticipant error: \n"+response.status
+ return
+
+ # Set widget property
+ # @param widgetInstance, property instance
+ # @return true or false
+
+ def setProperty(self, widgetInstance, propertyInstance):
+ if widgetInstance == "":
+ print "No widget instance"
+ return
+ if propertyInstance == "":
+ print "No property instance"
+ return
+ params = urllib.urlencode({'api_key': self.getConnection().getApiKey(),
+ 'userid': self.getCurrentUser().getLoginName(),
+ 'shareddatakey': self.getConnection().getSharedDataKey(),
+ 'widgetid': widgetInstance.getGuid(),
+ 'propertyname': propertyInstance.getName(),
+ 'propertyvalue': propertyInstance.getValue(),
+ 'is_public': propertyInstance.getIsPublic()})
+
+ headers = {"Content-type": "application/x-www-form-urlencoded",
+ "Accept": "text/plain"}
+ socket = httplib.HTTPConnection(self.getConnection().getUrl())
+ socket.request('POST', self.getConnection().getPath()+'/properties', params, headers)
+ try:
+ response = socket.getresponse()
+ except ResponseNotReady:
+ response = socket.getresponse()
+ if response.status == 200:
+ return 'true'
+ if response.status == 201:
+ return 'true'
+ if response.status > 201:
+ print "setProperty error: "+response.status
+ return 'false'
+
+ # Delete property
+ # @param widgetInstance, property instance
+ # @return true or false
+
+ def deleteProperty(self, widgetInstance, propertyInstance):
+ if widgetInstance == "":
+ print "No widget instance"
+ return
+ if propertyInstance == "":
+ print "No property instance"
+ return
+ queryString = '?api_key='+self.getConnection().getApiKey()
+ queryString += '&userid='+self.getCurrentUser().getLoginName()
+ queryString += '&shareddatakey='+self.getConnection().getSharedDataKey()
+ queryString += '&widgetid='+widgetInstance.getGuid()
+ queryString += '&propertyname='+propertyInstance.getName()
+
+ socket = httplib.HTTPConnection(self.getConnection().getUrl())
+ socket.request('DELETE', self.getConnection().getPath()+'/properties'+queryString)
+ try:
+ response = socket.getresponse()
+ except ResponseNotReady:
+ response = socket.getresponse()
+ if response.status == 200:
+ return 'true'
+ if response.status == 404:
+ return 'false'
+ print "deleteProperty error: "+response.status
+ return 'false'
+
+ # Get property
+ # @param widget instance, property instance
+ # @return retrieved property instance
+
+ def getProperty(self, widgetInstance, propertyInstance):
+ if widgetInstance == "":
+ print "No widget instance"
+ return
+ if propertyInstance == "":
+ print "No property instance"
+ return
+ queryString = '?api_key='+self.getConnection().getApiKey()
+ queryString += '&userid='+self.getCurrentUser().getLoginName()
+ queryString += '&shareddatakey='+self.getConnection().getSharedDataKey()
+ queryString += '&widgetid='+widgetInstance.getGuid()
+ queryString += '&propertyname='+propertyInstance.getName()
+
+ socket = httplib.HTTPConnection(self.getConnection().getUrl())
+ socket.request('GET', self.getConnection().getPath()+'/properties'+queryString)
+ try:
+ response = socket.getresponse()
+ except ResponseNotReady:
+ response = socket.getresponse()
+ propertyValue = response.read()
+ if response.status == 200:
+ return Property.Property(propertyInstance.getName(), propertyValue)
+ print "getProperty error: "+response.status
+ return 'false'
Added: incubator/wookie/trunk/connector/python/wookie/WookieServerConnection.py
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/connector/python/wookie/WookieServerConnection.py?rev=923822&view=auto
==============================================================================
--- incubator/wookie/trunk/connector/python/wookie/WookieServerConnection.py (added)
+++ incubator/wookie/trunk/connector/python/wookie/WookieServerConnection.py Tue Mar 16 15:57:36 2010
@@ -0,0 +1,37 @@
+#
+# 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.
+#
+class WookieServerConnection:
+ __url = ''
+ __api_key = ''
+ __shareddatakey = ''
+ __wookiePath = '/wookie'
+
+ def __init__(self, wookieUrl, api_key, shareddatakey, wookiePath = ''):
+ self.__url = wookieUrl
+ self.__api_key = api_key
+ self.__shareddatakey = shareddatakey
+ if wookiePath != '':
+ self.__wookiePath = wookiePath
+
+ def getUrl(self):
+ return self.__url
+
+ def getPath(self):
+ return self.__wookiePath
+
+ def getApiKey(self):
+ return self.__api_key
+
+ def getSharedDataKey(self):
+ return self.__shareddatakey
Added: incubator/wookie/trunk/connector/python/wookie/__init__.py
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/connector/python/wookie/__init__.py?rev=923822&view=auto
==============================================================================
--- incubator/wookie/trunk/connector/python/wookie/__init__.py (added)
+++ incubator/wookie/trunk/connector/python/wookie/__init__.py Tue Mar 16 15:57:36 2010
@@ -0,0 +1,13 @@
+#
+# 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.
+#
\ No newline at end of file
Added: incubator/wookie/trunk/connector/python/wookie/widget/Instance.py
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/connector/python/wookie/widget/Instance.py?rev=923822&view=auto
==============================================================================
--- incubator/wookie/trunk/connector/python/wookie/widget/Instance.py (added)
+++ incubator/wookie/trunk/connector/python/wookie/widget/Instance.py Tue Mar 16 15:57:36 2010
@@ -0,0 +1,64 @@
+#
+# 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.
+#
+class Instance:
+ __url = ''
+ __guid = ''
+ __title = ''
+ __height = ''
+ __width = ''
+ __maximize = ''
+
+ def __init__(self, newUrl, newGuid, newTitle, newHeight, newWidth, newMaximize):
+ self.setUrl(newUrl)
+ self.setGuid(newGuid)
+ self.setTitle(newTitle)
+ self.setHeight(newHeight)
+ self.setWidth(newWidth)
+ self.setMaximize(newMaximize)
+
+ def setUrl(self, newUrl):
+ self.__url = newUrl
+
+ def setGuid(self, newGuid):
+ self.__guid = newGuid
+
+ def setTitle(self, newTitle):
+ self.__title = newTitle
+
+ def setHeight(self, newHeight):
+ self.__height = newHeight
+
+ def setWidth(self, newWidth):
+ self.__width = newWidth
+
+ def setMaximize(self, newMaximize):
+ self.__maximize = newMaximize
+
+ def getUrl(self):
+ return self.__url
+
+ def getGuid(self):
+ return self.__guid
+
+ def getTitle(self):
+ return self.__title
+
+ def getHeight(self):
+ return self.__height
+
+ def getWidth(self):
+ return self.__width
+
+ def isMaximize(self):
+ return self.__maximize
Added: incubator/wookie/trunk/connector/python/wookie/widget/Instances.py
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/connector/python/wookie/widget/Instances.py?rev=923822&view=auto
==============================================================================
--- incubator/wookie/trunk/connector/python/wookie/widget/Instances.py (added)
+++ incubator/wookie/trunk/connector/python/wookie/widget/Instances.py Tue Mar 16 15:57:36 2010
@@ -0,0 +1,22 @@
+#
+# 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.
+#
+class Instances:
+ __instances = []
+ def put(self, instance):
+ self.__instances.append(instance)
+
+ def get(self):
+ return self.__instances
+ def __init__(self):
+ print 'tere'
\ No newline at end of file
Added: incubator/wookie/trunk/connector/python/wookie/widget/Property.py
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/connector/python/wookie/widget/Property.py?rev=923822&view=auto
==============================================================================
--- incubator/wookie/trunk/connector/python/wookie/widget/Property.py (added)
+++ incubator/wookie/trunk/connector/python/wookie/widget/Property.py Tue Mar 16 15:57:36 2010
@@ -0,0 +1,41 @@
+#
+# 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.
+#
+class Property:
+ __propertyName = ""
+ __propertyValue = ""
+ __isPublic = "false"
+
+ def __init__(self, propertyName, propertyValue, isPublic = ""):
+ self.setName(propertyName)
+ self.setValue(propertyValue)
+ if isPublic != "":
+ self.setIsPublic(isPublic)
+
+ def setName(self, name):
+ self.__propertyName = name
+
+ def setValue(self, value):
+ self.__propertyValue = value
+
+ def setIsPublic(self, isPublic):
+ self.__isPublic = isPublic
+
+ def getName(self):
+ return self.__propertyName
+
+ def getValue(self):
+ return self.__propertyValue
+
+ def getIsPublic(self):
+ return self.__isPublic
Added: incubator/wookie/trunk/connector/python/wookie/widget/User.py
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/connector/python/wookie/widget/User.py?rev=923822&view=auto
==============================================================================
--- incubator/wookie/trunk/connector/python/wookie/widget/User.py (added)
+++ incubator/wookie/trunk/connector/python/wookie/widget/User.py Tue Mar 16 15:57:36 2010
@@ -0,0 +1,42 @@
+#
+# 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.
+#
+class User:
+
+ __loginName = "UNKOWN"
+ __screenName = "UNKOWN"
+ __thumbnailURL = ""
+
+ def __init__(self, loginName, screenName = ""):
+ self.setLoginName(loginName)
+ if screenName == "":
+ screenName = loginName
+ self.setScreenName(screenName)
+
+ def setLoginName(self, loginName):
+ self.__loginName = loginName
+
+ def setScreenName(self, screenName):
+ self.__screenName = screenName
+
+ def setThumbnail(self, newUrl):
+ self.__thumbnailURL = newUrl;
+
+ def getLoginName(self):
+ return self.__loginName
+
+ def getScreenName(self):
+ return self.__screenName
+
+ def getThumbnail(self):
+ return self.__thumbnailURL
Added: incubator/wookie/trunk/connector/python/wookie/widget/Widget.py
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/connector/python/wookie/widget/Widget.py?rev=923822&view=auto
==============================================================================
--- incubator/wookie/trunk/connector/python/wookie/widget/Widget.py (added)
+++ incubator/wookie/trunk/connector/python/wookie/widget/Widget.py Tue Mar 16 15:57:36 2010
@@ -0,0 +1,48 @@
+#
+# 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.
+#
+class Widget:
+ __title = ''
+ __guid = ''
+ __desc = ''
+ __icon = ''
+
+ def __init__ (self, guid, title, desc, icon):
+ self.setTitle(title)
+ self.setGuid(guid)
+ self.setDescription(desc)
+ self.setIcon(icon)
+
+ def getTitle(self):
+ return self.__title
+
+ def getGuid(self):
+ return self.__guid
+
+ def getDescription(self):
+ return self.__desc
+
+ def getIcon(self):
+ return self.__icon
+
+ def setTitle(self, title):
+ self.__title = title
+
+ def setGuid(self, url):
+ self.__guid = url
+
+ def setDescription(self, desc):
+ self.__desc = desc
+
+ def setIcon(self, iconUrl):
+ self.__icon = iconUrl
Added: incubator/wookie/trunk/connector/python/wookie/widget/__init__.py
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/connector/python/wookie/widget/__init__.py?rev=923822&view=auto
==============================================================================
--- incubator/wookie/trunk/connector/python/wookie/widget/__init__.py (added)
+++ incubator/wookie/trunk/connector/python/wookie/widget/__init__.py Tue Mar 16 15:57:36 2010
@@ -0,0 +1,13 @@
+#
+# 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.
+#
\ No newline at end of file