Index: sim/trunk/src/test/rewolucja/resources/logical/LogicalResource.java
===================================================================
--- /xssim/trunk/src/test/rewolucja/resources/logical/LogicalResource.java	(revision 188)
+++ 	(revision )
@@ -1,301 +1,0 @@
-package test.rewolucja.resources.logical;
-
-import eduni.simjava.Sim_event;
-import eduni.simjava.Sim_port;
-import eduni.simjava.Sim_system;
-import gridsim.GridSim;
-import gridsim.GridSimTags;
-import gridsim.IO_data;
-import gridsim.gssim.GssimTags;
-import gridsim.gssim.network.ExtendedGridSimCore;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import schedframe.resources.ResourceStateDescription;
-import schedframe.resources.providers.LocalSystem;
-import schedframe.resources.units.ResourceUnit;
-import schedframe.scheduling.events.SchedulingEventType;
-import schedframe.scheduling.plugin.SchedulingPluginConfiguration;
-import schedframe.scheduling.utils.ResourceParameterName;
-import test.rewolucja.GSSIMJobInterface;
-import test.rewolucja.resources.Resource;
-import test.rewolucja.resources.ResourceStatus;
-import test.rewolucja.resources.ResourceType;
-import test.rewolucja.resources.StructureEntityInterface;
-import test.rewolucja.resources.exception.ResourceException;
-import test.rewolucja.resources.physical.base.ComputingResource;
-import test.rewolucja.scheduling.implementation.ManagementSystem;
-
-public class LogicalResource extends ExtendedGridSimCore implements Resource, StructureEntityInterface<LogicalResource>{
-
-	protected ManagementSystem managementSystem;
-	
-	protected List<ComputingResource> resources;
-	
-	protected LogicalResource parent;
-	protected List<LogicalResource> children;
-	
-	protected ResourceStatus status;
-	
-	public LogicalResource(ManagementSystem manSys) throws Exception {
-		super(manSys.getName(), 1);
-		this.managementSystem = manSys;
-		this.resources = new ArrayList<ComputingResource>();
-		this.status = ResourceStatus.AVAILABLE;
-		init();
-	}
-
-	public LogicalResource(ManagementSystem manSys, List<ComputingResource> res) throws Exception {
-		super(manSys.getName(), 1);
-		this.managementSystem = manSys;
-		this.resources = new ArrayList<ComputingResource>();
-		this.status = ResourceStatus.AVAILABLE;
-		addResources(res);
-		init();
-	}
-
-	public void init(){
-		managementSystem.init(this);
-		Integer lResIdObj = new Integer(get_id());
-		
-		List<Integer> res = GridSim.getGridResourceList();
-		res.add(lResIdObj);
-
-		/*if (supportsAR) {
-			res = GridSim.getAdvancedReservationList();
-			res.add(resIdObj);
-		} */
-
-	}
-	
-	public void addChild(LogicalResource child) {
-		child.setParent(this);
-		if (children == null) {
-			children = new ArrayList<LogicalResource>();
-		}
-		children.add(child);
-	}
-
-	public List<LogicalResource> getChildren() {
-		return children;
-	}
-
-	public void setParent(LogicalResource newParent) {
-		parent = newParent;
-	}
-
-	public LogicalResource getParent() {
-		return parent;
-	}
-
-	public void addResource(ComputingResource resource) {
-		resources.add(resource);
-	}
-
-	public void addResources(List<ComputingResource> res) {
-		for(ComputingResource resource:res){
-			resources.add(resource);
-			resource.setLogicalResource(this);
-			for(ComputingResource child: resource.filterDescendants(new Properties())){
-				child.setLogicalResource(this);
-			}
-		}
-	}
-
-	public List<ComputingResource> getResources() {
-		return resources;
-	}
-
-	public void body() {
-
-		SchedulingPluginConfiguration pluginConfig = managementSystem.getPluginConfiguration();
-		if (pluginConfig != null) {
-			Map<SchedulingEventType, Object> events = pluginConfig.getServedEvents();
-			if (events != null) {
-				Object obj = events.get(SchedulingEventType.TIMER);
-				if (obj != null) {
-					int delay = (Integer) obj;
-					send(this.get_id(), delay, GssimTags.TIMER);
-
-				}
-			}
-		}
-
-		// Process events until END_OF_SIMULATION is received from the
-		// GridSimShutdown Entity
-		Sim_event ev = new Sim_event();
-		sim_get_next(ev);
-		// boolean run = true;
-		boolean run = true;
-		while (Sim_system.running()  && run) {
-			// sim_get_next(ev);
-			// if the simulation finishes then exit the loop
-			if (ev.get_tag() == GridSimTags.END_OF_SIMULATION) {
-				// managemetnSystem_.setEndSimulation();
-				run = false;
-				break;
-			}
-
-			// process the received event
-			processRequest(ev);
-			sim_get_next(ev);
-		}
-
-	}
-	
-	protected void processRequest(Sim_event ev) {
-		switch (ev.get_tag()) {
-
-		case GridSimTags.GRIDLET_SUBMIT:
-			processGSSIMJobSubmit(ev, false);
-			break;
-
-		case GridSimTags.GRIDLET_SUBMIT_ACK:
-			processGSSIMJobSubmit(ev, true);
-			break;
-
-		case GridSimTags.GRIDLET_RETURN:
-			processGSSIMJobReturn(ev);
-			break;
-
-		default:
-			processOtherRequest(ev);
-			break;
-		}
-	}
-
-	protected void processOtherRequest(Sim_event ev) {
-		switch (ev.get_tag()) {
-		case GssimTags.QUERY_RESOURCE_DESC:
-			ResourceStateDescription desc = new ResourceStateDescription(new LocalSystem(get_name(), null, null));
-			Map<ResourceParameterName, ResourceUnit> units = new HashMap<ResourceParameterName, ResourceUnit>();
-			//ResourceComponentsNew resourceComponents = new ResourceComponentsNew(get_name());
-			//resourceComponents.addAll(resources);
-			//units.put(ResourceParameterName.RESOURCECOMPONENTS, resourceComponents);
-
-			desc.addResourceUnit(units);
-			desc.setQueuesSize(managementSystem.getQueuesSize());
-			IO_data data = new IO_data(desc, 0, ev.get_src());
-			send(ev.get_src(), GridSimTags.SCHEDULE_NOW, GssimTags.QUERY_RESOURCE_DESC_RESULT, data);
-			break;
-
-		default:
-			managementSystem.processEvent(ev);
-			break;
-		}
-	}
-	
-	/*public boolean processOtherEvent(Sim_event ev) {
-		return false;
-	}*/
-	
-	protected void processGSSIMJobReturn(Sim_event ev) {
-		GSSIMJobInterface<?> job = (GSSIMJobInterface<?>) ev.get_data();
-		managementSystem.notifyReturnedJob(job);
-	}
-
-	protected void processGSSIMJobSubmit(Sim_event ev, boolean ack) {
-		GSSIMJobInterface<?> job = (GSSIMJobInterface<?>) ev.get_data();
-		managementSystem.notifySubmittedJob(job, ack);
-	}
-	
-	public void send(String entityName, double delay, int tag, Object data){
-		super.send(entityName, delay, tag, data);
-	}
-	
-	public void send(int destID, double delay, int tag){
-		super.send(destID, delay, tag);
-	}
-	
-	public void send(int destID, double delay, int tag, Object data){
-		super.send(destID, delay, tag, data);
-	}
-	
-	public void send(Sim_port destPort, double delay, int tag, Object data) {
-		super.send(destPort, delay, tag, data);
-	}
-
-	public void sendInternal(double delay, int tag, Object data) {
-		this.send(this.get_id(), delay, tag, data);
-	}
-	
-	/*protected void send(int dest, int tag, int transaction, Object obj){
-		IO_data data = new Transaction_IO_data(transaction, obj, 8, dest);
-		super.send(dest, GridSimTags.SCHEDULE_NOW, tag, data);
-	}*/
-	
-	public Sim_port getOutputPort() {
-		return output;
-	}
-
-	public LogicalResource getLogicalResource(String resourceName){
-		ComputingResource resourceWithName = null;
-		for(int i = 0 ; i < resources.size() && resourceWithName == null; i++){
-			ComputingResource resource = resources.get(i);
-			if(resource.getName().equals(resourceName))
-				resourceWithName = resource;
-			else
-				try {
-					resourceWithName = resource.getDescendantsByName(resourceName);
-				} catch (ResourceException e) {
-					return null;
-				}
-		}
-		if(resourceWithName == null)
-			return null;
-		List<ComputingResource> children = resourceWithName.getChildren();
-		Set<LogicalResource> childrenControllers = new HashSet<LogicalResource>();
-		for(ComputingResource child:children) {
-			childrenControllers.add(child.getLogicalResource());
-		}
-		Set<LogicalResource> tempChildrenControllers = new HashSet<LogicalResource>(childrenControllers);
-		while(childrenControllers.size() != 1){
-			childrenControllers = new HashSet<LogicalResource>();
-			for(LogicalResource lr:tempChildrenControllers){
-				childrenControllers.add(lr.getParent());
-			}
-			tempChildrenControllers = new HashSet<LogicalResource>(childrenControllers);
-		}
-		Iterator<LogicalResource> it = childrenControllers.iterator();
-		LogicalResource potentialLogicalResource = it.next();
-		if(potentialLogicalResource.getResources().containsAll(children))
-			return potentialLogicalResource;
-		return null;
-
-	}
-	
-	public long getQueueLoad(String queueName) throws NoSuchFieldException{
-		Map<String, Integer> queue_size = managementSystem.getQueuesSize();
-		long load = 0;
-		if(queueName == null){
-			for(String queue: queue_size.keySet()){
-				load += queue_size.get(queue);
-			}
-			return load;
-		}
-		else if(queue_size.containsKey(queueName))
-			return queue_size.get(queueName);
-		else
-			throw new NoSuchFieldException("Queue " + queueName + 
-							" is not available in resource " + get_name());
-	}
-
-	public ResourceType getType() {
-		return ResourceType.RESOURCE_PROVIDER;
-	}
-
-	public ResourceStatus getStatus() {
-		return status;
-	}
-	
-	public void setStatus(ResourceStatus newStatus) {
-		status = newStatus;
-	}
-}
