""" This class represents the list of targets """ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Copyright 2004 Dries Verachtert import config import storagefactory from log4py import Logger class TargetList: def __init__(self): self.__config = config.Config.getInstance() self.__storage = storagefactory.StorageFactory.getStorage() self.__cat = Logger().get_instance(self) self.__targets = [] def getTargetByName(self,name): for i in self.__targets: if i.getName() == name: return i return None def getTargetById(self,id): for i in self.__targets: if i.getId() == id: return i return None def addTarget(self, newTarget): self.__targets.append(newTarget) self.__storage.updateTarget(newTarget) def getTargetNames(self): retval = [] for j in self.__targets: retval.append(j.getName()) return retval