def remove(self): for busMemberId in AdminConfig.showAttribute(self.__getconfigid__(), 'busMembers')[1:-1].splitlines(): node = AdminConfig.showAttribute(busMemberId, 'node') server = AdminConfig.showAttribute(busMemberId, 'server') # Remove associated DataSource dsName = '_%s.%s-%s' % (node, server, self.bus) ds = DataSource(dsName) ds.remove() Resource.remove(self)
def __loadattrs__(self): Resource.__loadattrs__(self) if not self.exists(): return id = AdminConfig.showAttribute(self.__getconfigid__(), 'claims') if not id is None: self.claims = CommonSecureInterop(id, self) id = AdminConfig.showAttribute(self.__getconfigid__(), 'performs') if not id is None: self.performs = CommonSecureInterop(id, self)
def getVariableValue(self, _symbolicName, parentConfigId): variableSubstitutionEntries = AdminConfig.list( 'VariableSubstitutionEntry', parentConfigId) value = None for variableSubstitutionEntry in variableSubstitutionEntries.splitlines( ): symbolicName = AdminConfig.showAttribute(variableSubstitutionEntry, 'symbolicName') if (symbolicName == _symbolicName): value = AdminConfig.showAttribute(variableSubstitutionEntry, 'value') return value
def __getconfigid__(self): for librefId in AdminConfig.list(self.__was_cfg_type__).splitlines(): libName = AdminConfig.showAttribute(librefId, 'libraryName') if (libName == self.libraryName and librefId.find(self.targetResourceName) != -1): return librefId return None
def addApplicationFirstClassLoader(self): classLoaderIds = AdminConfig.list('Classloader', self.__getconfigid__()).splitlines() logging.debug('%i classloader(s) is defined on server %s' % (len(classLoaderIds), self.serverName)) if (len(classLoaderIds) > 2): raise IllegalStateException, 'There is more than two classloader on server %s. another classloader cannot be added for safety reasons' % ( self.id) if (len(classLoaderIds) == 2): raise IllegalStateException, 'CSE WAS Automation FW does not support several classloader for server.. please contact architecture team' if (len(classLoaderIds) == 1): classLoaderMode = AdminConfig.showAttribute( classLoaderIds[0], 'mode') logging.debug('server %s already has one %s classloader defined' % (self.serverName, classLoaderMode)) if (classLoaderMode == 'PARENT_LAST'): logging.info( 'a PARENT_LAST ClassLoader already exist on this server.. there is no need to create another one' ) if (classLoaderMode == 'PARENT_FIRST'): raise IllegalStateException, 'CSE WAS Automation FW does not support several classloader for server.. please contact architecture team' if (len(classLoaderIds) == 0): #TODO refactoring on class loader class to have proper scope SERVER other than application logging.debug( 'about to create a new classloader PARENT_LAST on server %s' % (self.__getconfigid__())) AdminConfig.create('Classloader', self.getApplicationServerId(), [['mode', 'PARENT_LAST']])
def __getconfigid__(self, id = None): if self.__wasid is None: for tp in AdminConfig.list(self.__was_cfg_type__, self.parent.__getconfigid__()).splitlines(): if AdminConfig.showAttribute(tp, 'name') == self.name: self.__wasid = tp break return self.__wasid
def getTransportLayer(self): id = filter( lambda x: x.find('TransportLayer') > 0, AdminConfig.showAttribute(self.__getconfigid__(), 'layers')[1:-1].split() )[0] return TransportLayer(id, self)
def __init__(self): self.vms = {'cells': {}, 'clusters': {}, 'nodes': {}, 'servers': {}} for vmid in AdminConfig.list('VariableMap').splitlines(): vars = {} for varid in AdminConfig.list('VariableSubstitutionEntry', vmid).splitlines(): name = AdminConfig.showAttribute(varid, 'symbolicName') vars[name] = { 'id': varid, 'name': name, 'value': AdminConfig.showAttribute(varid, 'value') } scope = vmid.split('/')[-1].split('|')[0] type = vmid.split('/')[-2].replace('(', '') self.vms[type][scope] = {'id': vmid, 'vars': vars}
def __getconfigid__(self, id=None): if self.__wasid is None: for tp in AdminConfig.list( self.__was_cfg_type__, self.parent.__getconfigid__()).splitlines(): if AdminConfig.showAttribute(tp, 'name') == self.name: self.__wasid = tp break return self.__wasid
def addApplicationFirstClassLoader(self): classLoaderIds = AdminConfig.list('Classloader',self.__getconfigid__()).splitlines() logging.debug('%i classloader(s) is defined on server %s' % (len(classLoaderIds), self.serverName)) if(len(classLoaderIds)>2): raise IllegalStateException, 'There is more than two classloader on server %s. another classloader cannot be added for safety reasons' % (self.id) if(len(classLoaderIds)==2): raise IllegalStateException, 'CSE WAS Automation FW does not support several classloader for server.. please contact architecture team' if(len(classLoaderIds)==1): classLoaderMode = AdminConfig.showAttribute(classLoaderIds[0],'mode') logging.debug('server %s already has one %s classloader defined' % (self.serverName, classLoaderMode)) if (classLoaderMode=='PARENT_LAST'): logging.info('a PARENT_LAST ClassLoader already exist on this server.. there is no need to create another one') if (classLoaderMode=='PARENT_FIRST'): raise IllegalStateException, 'CSE WAS Automation FW does not support several classloader for server.. please contact architecture team' if(len(classLoaderIds)==0): #TODO refactoring on class loader class to have proper scope SERVER other than application logging.debug('about to create a new classloader PARENT_LAST on server %s' % (self.__getconfigid__())) AdminConfig.create('Classloader',self.getApplicationServerId(),[['mode','PARENT_LAST']])
def __getconfigid__(self, id = None): for res in AdminConfig.list(self.__was_cfg_type__).splitlines(): if (not res is None) and (res != '') and (self.alias == AdminConfig.showAttribute(res, 'alias')): return res return None
def __loadattrs__(self): Resource.__loadattrs__(self) if not self.exists(): return classloader = AdminConfig.showAttribute(self.__getconfigid__(), 'classloader') self.__classloader = ClassLoader()
def __loadattrs__(self): Resource.__loadattrs__(self) if not self.exists(): return deployedObj = AdminConfig.showAttribute(self.__getconfigid__(), 'deployedObject') self.__deployedObject = DeployedObject(deployedObj, self)
def remove(self): for librefId in AdminConfig.list('LibraryRef').splitlines(): libName = AdminConfig.showAttribute(librefId, 'libraryName') if self.name == libName: AdminConfig.remove(librefId) Resource.remove(self)
def __getconfigid__(self): for librefId in AdminConfig.list(self.__was_cfg_type__).splitlines(): libName = AdminConfig.showAttribute(librefId, 'libraryName') if (libName == self.libraryName and librefId.find(self.targetResourceName)!=-1 ): return librefId return None
def getIbmIIOPSecurityProtocol(self): id = AdminConfig.showAttribute(self.__getconfigid__(), 'IBM') return IIOPSecurityProtocol(id, self)
def __getattrobj__(self, name): id = AdminConfig.showAttribute(self.__getconfigid__(), name) return TransportQOP(id, self)