CMS 3D CMS Logo

Public Member Functions | Private Attributes

python::connectstrParser::connectstrParser Class Reference

List of all members.

Public Member Functions

def __init__
def fullfrontierStr
def needsitelocalinfo
def parse
def protocol
def schemaname
def service
def servlettotranslate

Private Attributes

 __connectstr
 __pattern
 __protocol
 __schemaname
 __servicename
 __servlettotranslate

Detailed Description

Definition at line 2 of file connectstrParser.py.


Constructor & Destructor Documentation

def python::connectstrParser::connectstrParser::__init__ (   self,
  connectstr 
)

Definition at line 3 of file connectstrParser.py.

00004                                  :
00005         self.__connectstr=connectstr
00006         self.__pattern=re.compile('(^[\w]+)(://)(.+)(/)(.+)')
00007         self.__protocol=''
00008         self.__schemaname=''
00009         self.__servicename=''
        self.__servlettotranslate=[]

Member Function Documentation

def python::connectstrParser::connectstrParser::fullfrontierStr (   self,
  schemaname,
  parameterDict 
)

Definition at line 45 of file connectstrParser.py.

00046                                                       :
00047         if len(parameterDict)==0:
00048             raise 'empty frontier parameters, cannot construct full connect string'
00049         result='frontier://'
00050         for k,v in parameterDict.items():
00051             ##if attr name=url, concatenate; if attrname=value discard
00052             if k=='load' and v[0][0]=='balance':
00053                 result+='(loadbalance='+v[0][1]+')'
00054                 continue
00055             for (attrname,attrvalue) in v:
00056                 if attrname=='url':
00057                     if k=='server':
00058                         fields=attrvalue.rsplit('/')
00059                         if len(fields)>3:
00060                             fields[-1]=self.servlettotranslate()[0]
00061                             attrvalue='/'.join(fields)
00062                     result+='('+k+'url='+attrvalue+')'
00063                 else:
00064                     result+='('+k+'='+attrvalue+')'
00065         if len(self.servlettotranslate())>1:
00066             result+=self.servlettotranslate()[1]
00067         result+='/'+schemaname
        return result
def python::connectstrParser::connectstrParser::needsitelocalinfo (   self)

Definition at line 33 of file connectstrParser.py.

00034                                :
00035         if self.__protocol=='frontier':
00036             if len(self.__servlettotranslate)==0:
00037                 return False
00038             else :
00039                 return True
00040         else:
            return False
def python::connectstrParser::connectstrParser::parse (   self)

Definition at line 10 of file connectstrParser.py.

00011                    :
00012         result=re.match(self.__pattern,self.__connectstr)
00013         if result is not None:
00014             protocol=result.group(1)
00015             if protocol!='frontier' and protocol!='oracle':
00016                 raise 'unsupported technology',protocol
00017             self.__protocol=protocol
00018             self.__schemaname=result.group(5)
00019             self.__servicename=result.group(3)
00020             if self.__protocol=='frontier':
00021                 if self.__servicename.find('(')==-1:
00022                     if self.__servicename.find('/')==-1:
00023                         self.__servlettotranslate.append(self.__servicename)
00024                 elif self.__servicename.find('/') == -1:
00025                     self.__servlettotranslate.append(self.__servicename.split('(',1)[0])
00026                     self.__servlettotranslate.append('('+self.__servicename.split('(',1)[1])
                    
def python::connectstrParser::connectstrParser::protocol (   self)

Definition at line 27 of file connectstrParser.py.

00028                       :
        return self.__protocol
def python::connectstrParser::connectstrParser::schemaname (   self)

Definition at line 29 of file connectstrParser.py.

00030                         :
        return self.__schemaname
def python::connectstrParser::connectstrParser::service (   self)

Definition at line 31 of file connectstrParser.py.

00032                      :
        return self.__servicename
def python::connectstrParser::connectstrParser::servlettotranslate (   self)
return a list, first is the servlet name, second is whatever additional parameter, if any.

Definition at line 41 of file connectstrParser.py.

00042                                 :
00043         """return a list, first is the servlet name, second is whatever additional parameter, if any.
00044         """
        return self.__servlettotranslate

Member Data Documentation

Definition at line 3 of file connectstrParser.py.

Definition at line 3 of file connectstrParser.py.

Definition at line 3 of file connectstrParser.py.

Definition at line 3 of file connectstrParser.py.

Definition at line 3 of file connectstrParser.py.

Definition at line 3 of file connectstrParser.py.