Ignore:
Timestamp:
04/06/12 11:04:29 (13 years ago)
Author:
wojtekp
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • xssim/trunk/src/test/rewolucja/resources/manager/implementation/ResourceManager.java

    r187 r223  
    2222import test.rewolucja.resources.UnitState; 
    2323import test.rewolucja.resources.exception.ResourceException; 
    24 import test.rewolucja.resources.logical.LogicalResource; 
     24import test.rewolucja.resources.logical.base.LogicalResource; 
    2525import test.rewolucja.resources.manager.interfaces.ResourceManagerInterface; 
    2626import test.rewolucja.resources.physical.base.ComputingResource; 
     
    3232        //private Log log = LogFactory.getLog(ResourceManager.class); 
    3333 
    34         protected List<ComputingResource> resources; 
    35         protected List<LogicalResource> logicalResource; 
     34        protected List<ComputingResource> compResources; 
     35        protected List<LogicalResource> logicalResources; 
    3636        protected ResourceCharacteristics resourceCharacteristic; 
    3737 
    38         public ResourceManager(List<ComputingResource> resources, List<LogicalResource> logicalLayers) { 
    39                 this.resources = resources; 
    40                 this.logicalResource = logicalLayers; 
     38        public ResourceManager(List<ComputingResource> resources, List<LogicalResource> logicalRes) { 
     39                this.compResources = resources; 
     40                this.logicalResources = logicalRes; 
    4141                this.resourceCharacteristic = new ResourceCharacteristics(); 
    4242                for(ComputingResource resource : resources){ 
     
    5353 
    5454        public ResourceManager(ComputingResource resource) { 
    55                 this.resources = resource.getChildren(); 
     55                this.compResources = resource.getChildren(); 
    5656                this.resourceCharacteristic = resource.getResourceCharacteristic(); 
    5757                // this.logicalLayers = resource.getLogaicaLayer().getChildren(); 
     
    5959 
    6060        public List<ComputingResource> getResources() { 
    61                 return resources; 
     61                return compResources; 
    6262        } 
    6363 
    6464        public boolean areResourcesAchievable(ResourceType type) { 
    65                 if (resources != null) { 
     65                if (compResources != null) { 
    6666                        Stack<ComputingResource> toExamine = new Stack<ComputingResource>(); 
    67                         for (ComputingResource resource : resources) 
     67                        for (ComputingResource resource : compResources) 
    6868                                toExamine.push(resource); 
    6969 
     
    8989        public List<? extends ComputingResource> getResourcesOfType(ResourceType type) throws ResourceException { 
    9090                List<ComputingResource> resourcesOfType = new ArrayList<ComputingResource>(); 
    91                 for (ComputingResource resource : resources) { 
     91                for (ComputingResource resource : compResources) { 
    9292                        if (resource.getType() == type) { 
    9393                                resourcesOfType.add(resource); 
     
    102102 
    103103                List<ComputingResource> resourcesOfType = new ArrayList<ComputingResource>(); 
    104                 for (ComputingResource resource : resources) { 
     104                for (ComputingResource resource : compResources) { 
    105105                        if (resource.getType() == type) { 
    106106                                if (resource.getStatus() == status) { 
     
    116116 
    117117                ComputingResource resourceWithName = null; 
    118                 for (int i = 0; i < resources.size() && resourceWithName == null; i++) { 
    119                         ComputingResource resource = resources.get(i); 
     118                for (int i = 0; i < compResources.size() && resourceWithName == null; i++) { 
     119                        ComputingResource resource = compResources.get(i); 
    120120                        if (resource.getName().compareTo(resourceName) == 0) 
    121121                                resourceWithName = resource; 
     
    129129                List<ResourceUnit> resourceUnit = new ArrayList<ResourceUnit>(); 
    130130                Stack<ComputingResource> toExamine = new Stack<ComputingResource>(); 
    131                 for (ComputingResource resource : resources) 
     131                for (ComputingResource resource : compResources) 
    132132                        toExamine.push(resource); 
    133133                while (!toExamine.isEmpty()) { 
     
    169169        public List<? extends ComputingResource> filterResources(Properties properties) { 
    170170                List<ComputingResource> descendants = new ArrayList<ComputingResource>(); 
    171                 for (ComputingResource resource : resources) { 
     171                for (ComputingResource resource : compResources) { 
    172172                        ResourceValidator resourceValidator =  new ResourcePropertiesValidator(properties); 
    173173                        if (resourceValidator.validate(resource)) 
     
    180180 
    181181        public List<LogicalResource> getResourceProviders() { 
    182                 return logicalResource; 
     182                return logicalResources; 
    183183        } 
    184184         
     
    188188                } 
    189189                ComputingResource resourceWithName = null; 
    190                 for(int i = 0 ; i < resources.size() && resourceWithName == null; i++){ 
    191                         ComputingResource resource = resources.get(i); 
     190                for(int i = 0 ; i < compResources.size() && resourceWithName == null; i++){ 
     191                        ComputingResource resource = compResources.get(i); 
    192192                        if(resource.getName().equals(resName)) 
    193193                                resourceWithName = resource; 
Note: See TracChangeset for help on using the changeset viewer.