Пример #1
0
def getSystemInformation():
    """
	Returns some system information,
	regarding the hardware, os, and the application (the server)
	
	@since: 1.0

	@rtype: a dict[string] of string
	@returns: a dict with some supposedly interesting info
	"""
    import platform

    ret = {}
    # Platform
    ret['machine'] = platform.machine()
    ret['node'] = platform.node()
    ret['system'] = platform.system()
    ret['architecture'] = platform.architecture()[0]
    ret['release'] = platform.system()
    ret['python-version'] = platform.python_version()
    # Physical
    # TODO
    # Application (low-level)
    ret['ws-version'] = Versions.getWsVersion()
    ret['xc-version'] = Versions.getXcVersion()
    ret['server-version'] = Versions.getServerVersion()

    return ret
Пример #2
0
def getSystemInformation():
	"""
	Returns some system information,
	regarding the hardware, os, and the application (the server)
	
	@since: 1.0

	@rtype: a dict[string] of string
	@returns: a dict with some supposedly interesting info
	"""
	import platform

	ret = {}
	# Platform
	ret['machine'] = platform.machine()
	ret['node'] = platform.node()
	ret['system'] = platform.system()
	ret['architecture'] = platform.architecture()[0]
	ret['release'] = platform.system()
	ret['python-version'] = platform.python_version()
	# Physical
	# TODO
	# Application (low-level)
	ret['ws-version'] = Versions.getWsVersion()
	ret['xc-version'] = Versions.getXcVersion()
	ret['server-version'] = Versions.getServerVersion()

	return ret
Пример #3
0
    def _notify(self, path, backendType, event):
        """
		We notify the filesystem:/directory URI subscribers
		whenever a new entry is created/deleted or a file in this dir is modified.
		
		WARNING/FIXME: the application type may not be correctly
		identified in all case, especially when creating a package forlder,
		as the package.xml is created after the directory...
		"""
        if path.endswith('/'):
            path = path[:-1]
        objectpath, objectname = os.path.split(path)
        if not objectpath:
            objectpath = '/'
        applicationType = self.getApplicationType(objectname, objectpath,
                                                  backendType)
        getLogger().debug("notifying fs change: %s:%s %s (%s)" %
                          (objectpath, objectname, event, applicationType))
        if applicationType:
            uri = 'filesystem:%s' % objectpath
            notification = Messages.Notification("FILE-EVENT", uri, "Xc",
                                                 Versions.getXcVersion())
            notification.setHeader('File-Type', applicationType)
            notification.setHeader('File-Path', objectpath)
            notification.setHeader('File-Name', objectname)
            notification.setHeader('Reason', event)
            EventManager.instance().dispatchNotification(notification)
Пример #4
0
def getXcVersion():
	"""
	Returns the Xc interface API version.
	
	Format A.B:
	- A += 1 if not backward compatible.
	- B += 1 if enriched API, but still backward compatible.
	
	@rtype: string
	@returns: the Xc API version
	"""
	return Versions.getXcVersion()
Пример #5
0
def getXcVersion():
    """
	Returns the Xc interface API version.
	
	Format A.B:
	- A += 1 if not backward compatible.
	- B += 1 if enriched API, but still backward compatible.
	
	@rtype: string
	@returns: the Xc API version
	"""
    return Versions.getXcVersion()
Пример #6
0
	def _notifyFileRenamed(self, filename, newName):
		"""
		Filename is the path+name to the previous name, before renaming.
		"""
		if filename.endswith('/'):
			filename = filename[:-1]
		objectpath, objectname = os.path.split(filename)
		if not objectpath:
			objectpath = '/'
		applicationType = self.getApplicationType(newName, objectpath, 'file')
		if applicationType:
			uri = 'filesystem:%s' % objectpath
			notification = Messages.Notification("FILE-EVENT", uri, "Xc", Versions.getXcVersion())
			notification.setHeader('File-Type', applicationType)
			notification.setHeader('File-Path', objectpath)
			notification.setHeader('File-Name', objectname)
			notification.setHeader('Reason', 'renamed')
			notification.setHeader('File-New-Name', newName)
			EventManager.instance().dispatchNotification(notification)
Пример #7
0
	def _notifyFileRenamed(self, filename, newName):
		"""
		Filename is the path+name to the previous name, before renaming.
		"""
		if filename.endswith('/'):
			filename = filename[:-1]
		objectpath, objectname = os.path.split(filename)
		if not objectpath:
			objectpath = '/'
		applicationType = self.getApplicationType(newName, objectpath, 'file')
		if applicationType:
			uri = 'filesystem:%s' % objectpath
			notification = Messages.Notification("FILE-EVENT", uri, "Xc", Versions.getXcVersion())
			notification.setHeader('File-Type', applicationType)
			notification.setHeader('File-Path', objectpath)
			notification.setHeader('File-Name', objectname)
			notification.setHeader('Reason', 'renamed')
			notification.setHeader('File-New-Name', newName)
			EventManager.instance().dispatchNotification(notification)
Пример #8
0
	def _notify(self, path, backendType, event):
		"""
		We notify the filesystem:/directory URI subscribers
		whenever a new entry is created/deleted or a file in this dir is modified.
		
		WARNING/FIXME: the application type may not be correctly
		identified in all case, especially when creating a package forlder,
		as the package.xml is created after the directory...
		"""
		if path.endswith('/'):
			path = path[:-1]
		objectpath, objectname = os.path.split(path)
		if not objectpath:
			objectpath = '/'
		applicationType = self.getApplicationType(objectname, objectpath, backendType)
		getLogger().debug("notifying fs change: %s:%s %s (%s)" % (objectpath, objectname, event, applicationType))
		if applicationType:
			uri = 'filesystem:%s' % objectpath
			notification = Messages.Notification("FILE-EVENT", uri, "Xc", Versions.getXcVersion())
			notification.setHeader('File-Type', applicationType)
			notification.setHeader('File-Path', objectpath)
			notification.setHeader('File-Name', objectname)
			notification.setHeader('Reason', event)
			EventManager.instance().dispatchNotification(notification)
Пример #9
0
def getVersion():
    ret = "Testerman Server %s" % Versions.getServerVersion() + "\n" + \
       "API versions:\n Ws: %s\n Xc: %s" % (Versions.getWsVersion(), Versions.getXcVersion())
    return ret
Пример #10
0
def getVersion():
	ret = "Testerman Server %s" % Versions.getServerVersion() + "\n" + \
				"API versions:\n Ws: %s\n Xc: %s" % (Versions.getWsVersion(), Versions.getXcVersion())
	return ret