[Dev OpenGP] [31] New class structure

[ Thread Index | Date Index | More opengp.tuxfamily.org/development Archives ]


Revision: 31
Author:   alband85
Date:     2009-03-11 15:46:38 +0100 (Wed, 11 Mar 2009)

Log Message:
-----------
New class structure

Modified Paths:
--------------
    trunk/src/OgpCore.py
    trunk/src/Plugin.py


Modified: trunk/src/OgpCore.py
===================================================================
--- trunk/src/OgpCore.py	2009-03-11 10:37:26 UTC (rev 30)
+++ trunk/src/OgpCore.py	2009-03-11 14:46:38 UTC (rev 31)
@@ -9,12 +9,12 @@
 
 	__instance = None
 
-	def __init__(self, uri, dn=None, passwd=None, cert=None):
+	def __init__(self, uri, dn=None, passwd=None, certs=None):
 		""" Create singleton instance """
 		# Check whether we already have an instance
 		if OgpCore.__instance is None:
 			# Create and remember instance
-			OgpCore.__instance = OgpCore.__ogpcore(uri, dn, passwd, cert)
+			OgpCore.__instance = OgpCore.__ogpcore(uri, dn, passwd, certs)
 		# Store instance reference as the only member in the handle
 		self.__dict__['OgpCore__instance'] = OgpCore.__instance
 
@@ -26,16 +26,19 @@
 		""" Delegate access to implementation """
 		return setattr(self.__instance, attr, value)
 
+	def getInstance():
+		return OgpCore.__instance
+	getInstance = staticmethod(getInstance)
 	
 	class __ogpcore:
 
-		def	__init__(self, uri, dn=None, passwd=None, cert=None):
+		def	__init__(self, uri, dn=None, passwd=None, certs=None):
 			"""
 				Initlialize connection to LDAP server. 
 				uri: ldap://host:port
 				dn: usdr dn
 				passwd: user password
-				cert: path to cert file (.pem)
+				certs: path to cert file (.pem)
 			"""
 			self.l = ldap.initialize(uri)
 			self.l.simple_bind_s(dn, passwd)
@@ -51,10 +54,18 @@
 			attrs[OgpLDAPConsts.ATTR_CONFIG] = OgpLDAPConsts.VALUE_CONFIG
 			self.__add(dn, attrs) 
 
+		def deleteDN(self, dn):
+			#self.__delete(dn)
+			pass
+
+
 		def __add(self, dn, attrs):
 			ldif = modlist.addModlist(attrs)
 			self.l.add_s(dn,ldif)
 
+		def __delete(self, dn):
+			self.l.delete_s(dn)
+
 		def createMachine(self, dn, others={}):
 			attrs = others
 			attrs['objectClass'] = OgpLDAPConsts.OBJECTCLASS_MACHINE
@@ -70,20 +81,14 @@
 			attrs[OgpLDAPConsts.ATTR_CONFIG] = OgpLDAPConsts.VALUE_CONFIG
 			self.__add(dn, attrs)
 
-		def push(self, plugin, dn, overwrite):
+		def merge(self, parent, child):
 			pass
 
-		def pull(self, ou, recursive):
-			pass
+		def xml2conf(self, xml, xslt):
+			return # TODO
 
-		def pullPlugin(self, ou, plugin, recursive):
+		def pullPluginConf(self, dn, pluginName, fullTree=False):
 			pass
 
-		def getFileList(self, ou, recursive):
+		def pushPluginConf(self, dn, conf):
 			pass
-
-		def build(self, ou, recursive):
-			pass
-
-		def buildFile(self, ou, recursive):
-			pass

Modified: trunk/src/Plugin.py
===================================================================
--- trunk/src/Plugin.py	2009-03-11 10:37:26 UTC (rev 30)
+++ trunk/src/Plugin.py	2009-03-11 14:46:38 UTC (rev 31)
@@ -7,20 +7,43 @@
 class Plugin (object):
 	__metaclass__ = Metaclass
 
+	def __init__(self, dn):
+		self.__dn = dn
+
+	def getPluginFromName(plugin):
+		return
 	getPluginFromName = staticmethod('getPluginFromName')
-	def getPluginFromName(plugin):
-		pass
 	
 	# Abstract methods
-	mergeDescription = AbstractMethod('mergeDescription')
-	toString = AbstractMethod('toString')
-	toXML = AbstractMethod('toXML')
+	#mergeDescription = AbstractMethod('mergeDescription')
 
 	def getName():
 		return ""
 
-	def mergeFile(parentFile, childFile):
+	def installConf(self):
 		pass
 
-	def mergeSecurity(parentSecurity, childSecurity):
+	def help(self, cmd):
 		pass
+
+	def runCommand(self, argv):
+		pass
+
+	def update(self):
+		"""
+			Commit changes
+		"""
+		pass
+
+	def cancel(self):
+		"""
+			Do not commit and delete changes.
+		"""
+		pass
+
+	def pullFile(self, file, fullTree=False):
+		pass
+
+	def pushFile(self, file, content):
+		pass
+


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/