def isUfsUrl(url): ''' In format of xxxx://xxxx ''' if url.find(config.getFsProtocolSeparator()) == -1: return False else: return True
def get_fs_protocol_separator(): try: import configurationTools as config return config.getFsProtocolSeparator() except ImportError: return "://"
def getUrlForUuid(id): return u"uuid"+config.getFsProtocolSeparator()+id
def isUuid(url): return (url.find(u"uuid"+config.getFsProtocolSeparator()) == 0)
def parseUrl(url): return url.split(config.getFsProtocolSeparator(),2)
import socket import configurationTools as config import transform import localLibSys from localLibs.logSys.logSys import * gUfsObjUrlPrefix = u'ufsFs'+config.getFsProtocolSeparator() gUfsObjUrlSeparator = u'/' def parseUrl(url): return url.split(config.getFsProtocolSeparator(),2) def getHostName(): return unicode(socket.gethostname()) def getUfsUrlForPath(fullPath): fullPath = transform.transformDirToInternal(fullPath) return gUfsObjUrlPrefix + getHostName() + gUfsObjUrlSeparator + fullPath def getFullPathFromUfsUrl(ufsUrl): if not isUfsFs(ufsUrl): cl(ufsUrl) raise "not ufs url" objPath = parseUrl(ufsUrl)[1] hostname, fullPath = objPath.split(gUfsObjUrlSeparator, 1) #print hostname, fullPath