예제 #1
0
 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
예제 #2
0
 def __getconfigid__(self):
     id = AdminConfig.list(self.__was_cfg_type__,
                           self.parent.__getconfigid__())
     if (id is None) or (id == ''):
         return None
     else:
         return id
예제 #3
0
	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
예제 #4
0
 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']])
예제 #5
0
 def getThreadPools(self):
     tps = {}
     def getTpName(x): return x.split('(')[0]
     for name in map(getTpName, AdminConfig.list('ThreadPool', AdminConfig.getid(self.__was_cfg_path__))):
         tps[name] = self.getThreadPool(name)
         
     return tps
예제 #6
0
 def __getconfigid__(self, id=None):
     for lpid in AdminConfig.list(
             self.__was_cfg_type__,
             self.parent.__getconfigid__()).splitlines():
         if lpid.startswith(self.name):
             return lpid
     return None
예제 #7
0
 def __getconfigid__(self):
     for pid in AdminConfig.list(
             Property.__was_cfg_type__,
             self.parent.__getconfigid__()).splitlines():
         if pid.startswith(self.name):
             return pid
     return None
예제 #8
0
    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}
예제 #9
0
	def getListenerPorts(self):
		lps = {}
		if not self.exists():
			return lps #Nothing to do as there is no MessageListenerService available on this server 
        
		for lpname in map(lambda x: x.split('(')[0], AdminConfig.list('ListenerPort', self.__getconfigid__()).splitlines()):
			lps[lpname] = ListenerPort(lpname, self)
		return lps
예제 #10
0
def getNodeId(serverId):
    nodeName = getNodeName(serverId)
    nodeList = AdminConfig.list('Node').splitlines()
    nodeId = None
    for node in nodeList:
        if (node.find(nodeName) != -1):
            nodeId = node
    return nodeId
예제 #11
0
 def __getconfigid__(self):
     id = None
     virtualHosts = AdminConfig.list('VirtualHost').splitlines()
     for virtualHostId in virtualHosts:
         if (virtualHostId.find(self.virtualHostName) != -1):
             id = virtualHostId
             break
     return id
예제 #12
0
def getNodeId(serverId):
    nodeName = getNodeName(serverId)
    nodeList = AdminConfig.list('Node').splitlines()
    nodeId = None
    for node in nodeList:
        if (node.find(nodeName) != -1): 
            nodeId = node
    return nodeId    
예제 #13
0
 def __getconfigid__(self):
     id = None
     virtualHosts = AdminConfig.list('VirtualHost').splitlines()
     for virtualHostId in virtualHosts:
         if ( virtualHostId.find(self.virtualHostName) != -1 ):
             id = virtualHostId
             break
     return id
예제 #14
0
 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
예제 #15
0
 def __wasinit__(self):
     clusters = AdminConfig.list('ServerCluster').splitlines()
     for clusterId in clusters:
         clusterName = getClusterName(clusterId)
         if clusterName == self.name:
             self.clusterId = clusterId
     
     if (self.clusterId is None):
         raise IllegalArgumentException, "No cluster '%s' was found in cell '%s'" % (self.name, self.cell.name)
예제 #16
0
def testAllDataSourcesInCurrentCell():
	print "Testing all DataSource..."
	for dsName in map(lambda x: x.split('(')[0], AdminConfig.list('DataSource').splitlines()):
		try:
			ds = DataSource()
			ds.name = dsName
			testDataSource(ds)
		except:
			print >> sys.stderr, "ERROR: datasource '%s' is not working properly. Exception is: %s" % (dsName, sys.exc_info())
예제 #17
0
    def __wasinit__(self):
        clusters = AdminConfig.list('ServerCluster').splitlines()
        for clusterId in clusters:
            clusterName = getClusterName(clusterId)
            if clusterName == self.name:
                self.clusterId = clusterId

        if (self.clusterId is None):
            raise IllegalArgumentException, "No cluster '%s' was found in cell '%s'" % (
                self.name, self.cell.name)
예제 #18
0
 def __loadattrs__(self, skip_attrs = []):
     Resource.__loadattrs__(self, skip_attrs)
     if not self.exists(): return
     for serverId in AdminConfig.list('Server', self.__was_cfg_path__).splitlines():
         server = None
         if isNodeAgentServer(serverId):
             server = NodeAgent(serverId, self)
         else:
             server = Node(serverId, self)
         self.__servers.append(server)
예제 #19
0
 def removeAll(self):
     map(
         lambda x: Library(x).remove(),  # remove library by given name
         map(
             lambda x: x.split('(')[0].split(Library.__NAMEPREFIX__)[
                 1],  # get library name from ID 
             filter(
                 lambda x: x.startswith(Library.__NAMEPREFIX__
                                        ),  # get only custom libraries
                 AdminConfig.list(self.__was_cfg_type__).splitlines())))
예제 #20
0
 def __loadattrs__(self, skip_attrs=[]):
     Resource.__loadattrs__(self, skip_attrs)
     if not self.exists(): return
     for serverId in AdminConfig.list('Server',
                                      self.__was_cfg_path__).splitlines():
         server = None
         if isNodeAgentServer(serverId):
             server = NodeAgent(serverId, self)
         else:
             server = Node(serverId, self)
         self.__servers.append(server)
예제 #21
0
    def getListenerPorts(self):
        lps = {}
        if not self.exists():
            return lps  #Nothing to do as there is no MessageListenerService available on this server

        for lpname in map(
                lambda x: x.split('(')[0],
                AdminConfig.list('ListenerPort',
                                 self.__getconfigid__()).splitlines()):
            lps[lpname] = ListenerPort(lpname, self)
        return lps
예제 #22
0
	def removeAll(self):
		map(
			lambda x: Library(x).remove(), # remove library by given name
			map(
				lambda x: x.split('(')[0].split(Library.__NAMEPREFIX__)[1], # get library name from ID 
				filter( 
					lambda x: x.startswith(Library.__NAMEPREFIX__), # get only custom libraries
					AdminConfig.list(self.__was_cfg_type__).splitlines()
				)
			)
		)
예제 #23
0
    def __getconfigid__(self):
        if not self.__wasid is None:
            return self.__wasid

        for targetName, id in map(
                lambda x: [x.split('|')[0].split('/')[-1], x],
                AdminConfig.list(self.__was_cfg_type__).splitlines()):
            if targetName == self.targetResourceName:
                self.__wasid = id
                break

        return self.__wasid
예제 #24
0
 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
예제 #25
0
	def __getconfigid__(self):
		if not self.__wasid is None:
			return self.__wasid
		
		for targetName, id in map(
			lambda x: [x.split('|')[0].split('/')[-1], x],
			AdminConfig.list(self.__was_cfg_type__).splitlines()
		):
			if targetName == self.targetResourceName:
				self.__wasid = id
				break
		
		return self.__wasid
예제 #26
0
    def getThreadPools(self):
        tps = {}

        def getTpName(x):
            return x.split('(')[0]

        for name in map(
                getTpName,
                AdminConfig.list('ThreadPool',
                                 AdminConfig.getid(self.__was_cfg_path__))):
            tps[name] = self.getThreadPool(name)

        return tps
예제 #27
0
 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']])
예제 #28
0
 def __getserverids__(self):
     return AdminConfig.list('Server', self.__was_cfg_path__).splitlines()
예제 #29
0
	def __getconfigid__(self):
		for pid in AdminConfig.list(Property.__was_cfg_type__, self.parent.__getconfigid__()).splitlines():
			if pid.startswith(self.name):
				return pid
		return None
예제 #30
0
	def __getconfigid__(self, id = None):
		return AdminConfig.list(self.__was_cfg_type__, self.parent.__getconfigid__()).splitlines()[0]
예제 #31
0
 def getNodeAgentServers(self):
     return map(NodeAgent, filter(isNodeAgentServer, AdminConfig.list('Server').splitlines()))
예제 #32
0
	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)
예제 #33
0
	def __getconfigid__(self):
		id = AdminConfig.list(self.__was_cfg_type__, self.parent.__getconfigid__())
		if (id is None) or (id == ''):
			return None
		else:
			return id
예제 #34
0
 def getHostAliasIds(self):
     return AdminConfig.list('HostAlias', self.__was_cfg_path__)
예제 #35
0
 def getHostAliasIds(self):
     return AdminConfig.list('HostAlias', self.__was_cfg_path__)
예제 #36
0
	def __getconfigid__(self, id = None):
		for lpid in AdminConfig.list(self.__was_cfg_type__, self.parent.__getconfigid__()).splitlines():
			if lpid.startswith(self.name):
				return lpid
		return None
예제 #37
0
 def getSharedLibraryReferenceIds(self):
     return AdminConfig.list('LibraryRef',
                             self.__was_cfg_path__).splitlines()
예제 #38
0
 def getNodeAgentServers(self):
     return map(
         NodeAgent,
         filter(isNodeAgentServer,
                AdminConfig.list('Server').splitlines()))
예제 #39
0
 def __getconfigid__(self, id=None):
     return AdminConfig.list(self.__was_cfg_type__,
                             self.parent.__getconfigid__()).splitlines()[0]
예제 #40
0
 def getSharedLibraryReferenceIds(self):
     return AdminConfig.list('LibraryRef', self.__was_cfg_path__).splitlines()
예제 #41
0
 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)
예제 #42
0
	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
예제 #43
0
	def removeAll(self):
		for id in AdminConfig.list('J2CActivationSpec').splitlines():
			logging.info('Deleting J2CActivationSpec %s' % id.split('(')[0])
			AdminTask.deleteSIBJMSActivationSpec(id)
예제 #44
0
 def __getserverids__(self):
     return AdminConfig.list('Server', self.__was_cfg_path__).splitlines()
예제 #45
0
	def __getconfigid__(self):
		return AdminConfig.list(self.__was_cfg_type__, self.__was_cfg_path__).splitlines()[0]
예제 #46
0
	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