ohla-devel Mailing List for Open HLA (Page 3)
Status: Beta
Brought to you by:
mnewcomb
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
(5) |
Apr
(8) |
May
|
Jun
(1) |
Jul
|
Aug
(3) |
Sep
(6) |
Oct
(7) |
Nov
(65) |
Dec
(21) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(13) |
Feb
(34) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
From: <mne...@us...> - 2006-12-21 19:19:58
|
Revision: 82 http://svn.sourceforge.net/ohla/?rev=82&view=rev Author: mnewcomb Date: 2006-12-21 11:19:58 -0800 (Thu, 21 Dec 2006) Log Message: ----------- rolled back latest change because I think I can maintain most of my current architecture Modified Paths: -------------- trunk/rti/src/java/net/sf/ohla/rti1516/federation/FederationExecution.java trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/AttributeInstance.java trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/ObjectInstance.java trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/ObjectManager.java Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federation/FederationExecution.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federation/FederationExecution.java 2006-12-17 18:48:20 UTC (rev 81) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federation/FederationExecution.java 2006-12-21 19:19:58 UTC (rev 82) @@ -402,7 +402,7 @@ registerObjectInstance.getId(), objectInstanceRegistered)); objectManager.registerObjectInstance( - objectInstanceHandle, objectClass, name, + objectInstanceHandle, objectClass, registerObjectInstance.getPublishedAttributeHandles(), getFederateHandle(session)); Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/AttributeInstance.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/AttributeInstance.java 2006-12-17 18:48:20 UTC (rev 81) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/AttributeInstance.java 2006-12-21 19:19:58 UTC (rev 82) @@ -16,30 +16,17 @@ package net.sf.ohla.rti1516.federation.objects; -import java.io.Serializable; - import java.util.Iterator; import java.util.LinkedHashSet; -import net.sf.ohla.rti1516.OHLARegionHandleSet; import net.sf.ohla.rti1516.fdd.Attribute; -import hla.rti1516.AttributeHandle; import hla.rti1516.FederateHandle; -import hla.rti1516.OrderType; -import hla.rti1516.RegionHandleSet; -import hla.rti1516.TransportationType; public class AttributeInstance - implements Serializable { protected final Attribute attribute; - protected TransportationType transportationType; - protected OrderType orderType; - - protected RegionHandleSet associatedRegions = new OHLARegionHandleSet(); - protected FederateHandle owner; /** @@ -65,46 +52,6 @@ return attribute; } - public AttributeHandle getAttributeHandle() - { - return attribute.getAttributeHandle(); - } - - public TransportationType getTransportationType() - { - return transportationType; - } - - public void setTransportationType(TransportationType transportationType) - { - this.transportationType = transportationType; - } - - public OrderType getOrderType() - { - return orderType; - } - - public void setOrderType(OrderType orderType) - { - this.orderType = orderType; - } - - public RegionHandleSet getAssociatedRegions() - { - return associatedRegions; - } - - public void associateRegionsForUpdates(RegionHandleSet regionHandles) - { - associatedRegions.addAll(regionHandles); - } - - public void unassociateRegionsForUpdates(RegionHandleSet regionHandles) - { - associatedRegions.removeAll(regionHandles); - } - public FederateHandle getOwner() { return owner; @@ -125,8 +72,6 @@ owner = null; wantsToDivest = false; - // TODO: reset transportation/order types to what's in FDD? - // give ownership to the next in line // if (!requestingOwnership.isEmpty()) @@ -151,8 +96,6 @@ owner = null; wantsToDivest = false; - // TODO: reset transportation/order types to what's in FDD? - // give ownership to the next in line // if (!requestingOwnership.isEmpty()) @@ -203,8 +146,6 @@ i.remove(); wantsToDivest = false; - - // TODO: reset transportation/order types to what's in FDD? } return divested ? owner : null; Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/ObjectInstance.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/ObjectInstance.java 2006-12-17 18:48:20 UTC (rev 81) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/ObjectInstance.java 2006-12-21 19:19:58 UTC (rev 82) @@ -16,25 +16,23 @@ package net.sf.ohla.rti1516.federation.objects; -import java.io.Serializable; - import java.util.HashMap; import java.util.Map; import java.util.Set; -import java.util.concurrent.locks.ReadWriteLock; -import java.util.concurrent.locks.ReentrantReadWriteLock; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; -import net.sf.ohla.rti1516.OHLAAttributeHandleSet; -import net.sf.ohla.rti1516.fdd.Attribute; import net.sf.ohla.rti1516.fdd.ObjectClass; -import net.sf.ohla.rti1516.federate.callbacks.AttributeIsNotOwned; -import net.sf.ohla.rti1516.federate.callbacks.AttributeIsOwnedByRTI; +import net.sf.ohla.rti1516.fdd.Attribute; import net.sf.ohla.rti1516.federate.callbacks.AttributeOwnershipAcquisitionNotification; import net.sf.ohla.rti1516.federate.callbacks.AttributeOwnershipUnavailable; import net.sf.ohla.rti1516.federate.callbacks.ConfirmAttributeOwnershipAcquisitionCancellation; -import net.sf.ohla.rti1516.federate.callbacks.InformAttributeOwnership; import net.sf.ohla.rti1516.federate.callbacks.RequestAttributeOwnershipRelease; import net.sf.ohla.rti1516.federate.callbacks.RequestDivestitureConfirmation; +import net.sf.ohla.rti1516.federate.callbacks.AttributeIsNotOwned; +import net.sf.ohla.rti1516.federate.callbacks.AttributeIsOwnedByRTI; +import net.sf.ohla.rti1516.federate.callbacks.InformAttributeOwnership; +import net.sf.ohla.rti1516.OHLAAttributeHandleSet; import net.sf.ohla.rti1516.federation.FederationExecution; import org.apache.mina.common.IoSession; @@ -42,34 +40,32 @@ import hla.rti1516.AttributeHandle; import hla.rti1516.AttributeHandleSet; import hla.rti1516.FederateHandle; -import hla.rti1516.ObjectClassHandle; import hla.rti1516.ObjectInstanceHandle; public class ObjectInstance - implements Serializable { - protected final ObjectInstanceHandle objectInstanceHandle; - protected final ObjectClass objectClass; - protected final String name; + protected ObjectInstanceHandle objectInstanceHandle; + protected ObjectClass objectClass; - protected ReadWriteLock objectLock = new ReentrantReadWriteLock(true); + protected Lock objectLock = new ReentrantLock(true); protected Map<AttributeHandle, AttributeInstance> attributes = new HashMap<AttributeHandle, AttributeInstance>(); public ObjectInstance(ObjectInstanceHandle objectInstanceHandle, - ObjectClass objectClass, String name, + ObjectClass objectClass, Set<AttributeHandle> publishedAttributeHandles, FederateHandle owner) { this.objectInstanceHandle = objectInstanceHandle; this.objectClass = objectClass; - this.name = name; for (Attribute attribute : objectClass.getAttributes().values()) { - AttributeInstance attributeInstance = new AttributeInstance(attribute); - attributes.put(attribute.getAttributeHandle(), attributeInstance); + AttributeInstance attributeInstance = + new AttributeInstance(attribute); + attributes.put(attribute.getAttributeHandle(), + attributeInstance); if (publishedAttributeHandles.contains(attribute.getAttributeHandle())) { @@ -83,21 +79,11 @@ return objectInstanceHandle; } - public ObjectClassHandle getObjectClassHandle() - { - return objectClass.getObjectClassHandle(); - } - public ObjectClass getObjectClass() { return objectClass; } - public String getName() - { - return name; - } - public FederateHandle getOwner(AttributeHandle attributeHandle) { return attributes.get(attributeHandle).getOwner(); @@ -107,7 +93,7 @@ AttributeHandleSet attributeHandles, FederationExecution federationExecution) { - objectLock.writeLock().lock(); + objectLock.lock(); try { Map<FederateHandle, AttributeHandleSet> newOwners = @@ -145,14 +131,14 @@ } finally { - objectLock.writeLock().unlock(); + objectLock.unlock(); } } public void negotiatedAttributeOwnershipDivestiture( AttributeHandleSet attributeHandles, byte[] tag, IoSession session) { - objectLock.writeLock().lock(); + objectLock.lock(); try { AttributeHandleSet divestableAttributeHandles = @@ -174,14 +160,14 @@ } finally { - objectLock.writeLock().unlock(); + objectLock.unlock(); } } public void confirmDivestiture(AttributeHandleSet attributeHandles, FederationExecution federationExecution) { - objectLock.writeLock().lock(); + objectLock.lock(); try { Map<FederateHandle, AttributeHandleSet> newOwners = @@ -219,7 +205,7 @@ } finally { - objectLock.writeLock().unlock(); + objectLock.unlock(); } } @@ -227,7 +213,7 @@ AttributeHandleSet attributeHandles, byte[] tag, FederateHandle acquiree, IoSession session, FederationExecution federationExecution) { - objectLock.writeLock().lock(); + objectLock.lock(); try { AttributeHandleSet acquiredAttributeHandles = @@ -311,7 +297,7 @@ } finally { - objectLock.writeLock().unlock(); + objectLock.unlock(); } } @@ -319,7 +305,7 @@ AttributeHandleSet attributeHandles, FederateHandle acquiree, IoSession session) { - objectLock.writeLock().lock(); + objectLock.lock(); try { AttributeHandleSet acquiredAttributeHandles = @@ -351,14 +337,14 @@ } finally { - objectLock.writeLock().unlock(); + objectLock.unlock(); } } public Map<AttributeHandle, FederateHandle> attributeOwnershipDivestitureIfWanted( AttributeHandleSet attributeHandles) { - objectLock.writeLock().lock(); + objectLock.lock(); try { Map<AttributeHandle, FederateHandle> newOwners = @@ -377,14 +363,14 @@ } finally { - objectLock.writeLock().unlock(); + objectLock.unlock(); } } public void cancelNegotiatedAttributeOwnershipDivestiture( AttributeHandleSet attributeHandles, FederateHandle owner) { - objectLock.writeLock().lock(); + objectLock.lock(); try { for (AttributeHandle attributeHandle : attributeHandles) @@ -395,7 +381,7 @@ } finally { - objectLock.writeLock().unlock(); + objectLock.unlock(); } } @@ -403,7 +389,7 @@ AttributeHandleSet attributeHandles, FederateHandle acquiree, IoSession session) { - objectLock.writeLock().lock(); + objectLock.lock(); try { AttributeHandleSet canceledOwnershipAcquisitionAttributeHandles = @@ -425,17 +411,18 @@ } finally { - objectLock.writeLock().unlock(); + objectLock.unlock(); } } public void queryAttributeOwnership(AttributeHandle attributeHandle, IoSession session) { - objectLock.writeLock().lock(); + objectLock.lock(); try { - AttributeInstance attributeInstance = attributes.get(attributeHandle); + AttributeInstance attributeInstance = + attributes.get(attributeHandle); assert attributeInstance != null; FederateHandle owner = attributeInstance.getOwner(); @@ -457,7 +444,7 @@ } finally { - objectLock.writeLock().unlock(); + objectLock.unlock(); } } } Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/ObjectManager.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/ObjectManager.java 2006-12-17 18:48:20 UTC (rev 81) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/ObjectManager.java 2006-12-21 19:19:58 UTC (rev 82) @@ -18,12 +18,9 @@ import java.util.Collections; import java.util.HashMap; -import java.util.HashSet; import java.util.Map; import java.util.Set; -import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReadWriteLock; -import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantReadWriteLock; import net.sf.ohla.rti1516.fdd.ObjectClass; @@ -43,15 +40,6 @@ { protected FederationExecution federationExecution; - protected Lock reservedObjectInstanceNamesLock = new ReentrantLock(true); - protected Map<String, ObjectInstanceHandle> reservedObjectInstanceNames = - new HashMap<String, ObjectInstanceHandle>(); - protected Map<ObjectInstanceHandle, String> reservedObjectInstanceNamesByHandle = - new HashMap<ObjectInstanceHandle, String>(); - - protected Lock retiredObjectInstanceNamesLock = new ReentrantLock(true); - protected Set<String> retiredObjectInstanceNames = new HashSet<String>(); - protected ReadWriteLock objectsLock = new ReentrantReadWriteLock(true); protected Map<ObjectInstanceHandle, ObjectInstance> objects = new HashMap<ObjectInstanceHandle, ObjectInstance>(); @@ -63,15 +51,13 @@ public void registerObjectInstance( ObjectInstanceHandle objectInstanceHandle, ObjectClass objectClass, - String name, Set<AttributeHandle> publishedAttributeHandles, - FederateHandle owner) + Set<AttributeHandle> publishedAttributeHandles, FederateHandle owner) { objectsLock.writeLock().lock(); try { objects.put(objectInstanceHandle, new ObjectInstance( - objectInstanceHandle, objectClass, name, - publishedAttributeHandles, owner)); + objectInstanceHandle, objectClass, publishedAttributeHandles, owner)); } finally { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mne...@us...> - 2006-12-17 18:48:23
|
Revision: 81 http://svn.sourceforge.net/ohla/?rev=81&view=rev Author: mnewcomb Date: 2006-12-17 10:48:20 -0800 (Sun, 17 Dec 2006) Log Message: ----------- more refactoring in preparation of moving to centralized RTI Modified Paths: -------------- trunk/rti/src/java/net/sf/ohla/rti1516/federation/FederationExecution.java trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/AttributeInstance.java trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/ObjectInstance.java trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/ObjectManager.java Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federation/FederationExecution.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federation/FederationExecution.java 2006-12-16 03:16:37 UTC (rev 80) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federation/FederationExecution.java 2006-12-17 18:48:20 UTC (rev 81) @@ -402,7 +402,7 @@ registerObjectInstance.getId(), objectInstanceRegistered)); objectManager.registerObjectInstance( - objectInstanceHandle, objectClass, + objectInstanceHandle, objectClass, name, registerObjectInstance.getPublishedAttributeHandles(), getFederateHandle(session)); Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/AttributeInstance.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/AttributeInstance.java 2006-12-16 03:16:37 UTC (rev 80) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/AttributeInstance.java 2006-12-17 18:48:20 UTC (rev 81) @@ -16,17 +16,30 @@ package net.sf.ohla.rti1516.federation.objects; +import java.io.Serializable; + import java.util.Iterator; import java.util.LinkedHashSet; +import net.sf.ohla.rti1516.OHLARegionHandleSet; import net.sf.ohla.rti1516.fdd.Attribute; +import hla.rti1516.AttributeHandle; import hla.rti1516.FederateHandle; +import hla.rti1516.OrderType; +import hla.rti1516.RegionHandleSet; +import hla.rti1516.TransportationType; public class AttributeInstance + implements Serializable { protected final Attribute attribute; + protected TransportationType transportationType; + protected OrderType orderType; + + protected RegionHandleSet associatedRegions = new OHLARegionHandleSet(); + protected FederateHandle owner; /** @@ -52,6 +65,46 @@ return attribute; } + public AttributeHandle getAttributeHandle() + { + return attribute.getAttributeHandle(); + } + + public TransportationType getTransportationType() + { + return transportationType; + } + + public void setTransportationType(TransportationType transportationType) + { + this.transportationType = transportationType; + } + + public OrderType getOrderType() + { + return orderType; + } + + public void setOrderType(OrderType orderType) + { + this.orderType = orderType; + } + + public RegionHandleSet getAssociatedRegions() + { + return associatedRegions; + } + + public void associateRegionsForUpdates(RegionHandleSet regionHandles) + { + associatedRegions.addAll(regionHandles); + } + + public void unassociateRegionsForUpdates(RegionHandleSet regionHandles) + { + associatedRegions.removeAll(regionHandles); + } + public FederateHandle getOwner() { return owner; @@ -72,6 +125,8 @@ owner = null; wantsToDivest = false; + // TODO: reset transportation/order types to what's in FDD? + // give ownership to the next in line // if (!requestingOwnership.isEmpty()) @@ -96,6 +151,8 @@ owner = null; wantsToDivest = false; + // TODO: reset transportation/order types to what's in FDD? + // give ownership to the next in line // if (!requestingOwnership.isEmpty()) @@ -146,6 +203,8 @@ i.remove(); wantsToDivest = false; + + // TODO: reset transportation/order types to what's in FDD? } return divested ? owner : null; Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/ObjectInstance.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/ObjectInstance.java 2006-12-16 03:16:37 UTC (rev 80) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/ObjectInstance.java 2006-12-17 18:48:20 UTC (rev 81) @@ -16,23 +16,25 @@ package net.sf.ohla.rti1516.federation.objects; +import java.io.Serializable; + import java.util.HashMap; import java.util.Map; import java.util.Set; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantLock; +import java.util.concurrent.locks.ReadWriteLock; +import java.util.concurrent.locks.ReentrantReadWriteLock; +import net.sf.ohla.rti1516.OHLAAttributeHandleSet; +import net.sf.ohla.rti1516.fdd.Attribute; import net.sf.ohla.rti1516.fdd.ObjectClass; -import net.sf.ohla.rti1516.fdd.Attribute; +import net.sf.ohla.rti1516.federate.callbacks.AttributeIsNotOwned; +import net.sf.ohla.rti1516.federate.callbacks.AttributeIsOwnedByRTI; import net.sf.ohla.rti1516.federate.callbacks.AttributeOwnershipAcquisitionNotification; import net.sf.ohla.rti1516.federate.callbacks.AttributeOwnershipUnavailable; import net.sf.ohla.rti1516.federate.callbacks.ConfirmAttributeOwnershipAcquisitionCancellation; +import net.sf.ohla.rti1516.federate.callbacks.InformAttributeOwnership; import net.sf.ohla.rti1516.federate.callbacks.RequestAttributeOwnershipRelease; import net.sf.ohla.rti1516.federate.callbacks.RequestDivestitureConfirmation; -import net.sf.ohla.rti1516.federate.callbacks.AttributeIsNotOwned; -import net.sf.ohla.rti1516.federate.callbacks.AttributeIsOwnedByRTI; -import net.sf.ohla.rti1516.federate.callbacks.InformAttributeOwnership; -import net.sf.ohla.rti1516.OHLAAttributeHandleSet; import net.sf.ohla.rti1516.federation.FederationExecution; import org.apache.mina.common.IoSession; @@ -40,32 +42,34 @@ import hla.rti1516.AttributeHandle; import hla.rti1516.AttributeHandleSet; import hla.rti1516.FederateHandle; +import hla.rti1516.ObjectClassHandle; import hla.rti1516.ObjectInstanceHandle; public class ObjectInstance + implements Serializable { - protected ObjectInstanceHandle objectInstanceHandle; - protected ObjectClass objectClass; + protected final ObjectInstanceHandle objectInstanceHandle; + protected final ObjectClass objectClass; + protected final String name; - protected Lock objectLock = new ReentrantLock(true); + protected ReadWriteLock objectLock = new ReentrantReadWriteLock(true); protected Map<AttributeHandle, AttributeInstance> attributes = new HashMap<AttributeHandle, AttributeInstance>(); public ObjectInstance(ObjectInstanceHandle objectInstanceHandle, - ObjectClass objectClass, + ObjectClass objectClass, String name, Set<AttributeHandle> publishedAttributeHandles, FederateHandle owner) { this.objectInstanceHandle = objectInstanceHandle; this.objectClass = objectClass; + this.name = name; for (Attribute attribute : objectClass.getAttributes().values()) { - AttributeInstance attributeInstance = - new AttributeInstance(attribute); - attributes.put(attribute.getAttributeHandle(), - attributeInstance); + AttributeInstance attributeInstance = new AttributeInstance(attribute); + attributes.put(attribute.getAttributeHandle(), attributeInstance); if (publishedAttributeHandles.contains(attribute.getAttributeHandle())) { @@ -79,11 +83,21 @@ return objectInstanceHandle; } + public ObjectClassHandle getObjectClassHandle() + { + return objectClass.getObjectClassHandle(); + } + public ObjectClass getObjectClass() { return objectClass; } + public String getName() + { + return name; + } + public FederateHandle getOwner(AttributeHandle attributeHandle) { return attributes.get(attributeHandle).getOwner(); @@ -93,7 +107,7 @@ AttributeHandleSet attributeHandles, FederationExecution federationExecution) { - objectLock.lock(); + objectLock.writeLock().lock(); try { Map<FederateHandle, AttributeHandleSet> newOwners = @@ -131,14 +145,14 @@ } finally { - objectLock.unlock(); + objectLock.writeLock().unlock(); } } public void negotiatedAttributeOwnershipDivestiture( AttributeHandleSet attributeHandles, byte[] tag, IoSession session) { - objectLock.lock(); + objectLock.writeLock().lock(); try { AttributeHandleSet divestableAttributeHandles = @@ -160,14 +174,14 @@ } finally { - objectLock.unlock(); + objectLock.writeLock().unlock(); } } public void confirmDivestiture(AttributeHandleSet attributeHandles, FederationExecution federationExecution) { - objectLock.lock(); + objectLock.writeLock().lock(); try { Map<FederateHandle, AttributeHandleSet> newOwners = @@ -205,7 +219,7 @@ } finally { - objectLock.unlock(); + objectLock.writeLock().unlock(); } } @@ -213,7 +227,7 @@ AttributeHandleSet attributeHandles, byte[] tag, FederateHandle acquiree, IoSession session, FederationExecution federationExecution) { - objectLock.lock(); + objectLock.writeLock().lock(); try { AttributeHandleSet acquiredAttributeHandles = @@ -297,7 +311,7 @@ } finally { - objectLock.unlock(); + objectLock.writeLock().unlock(); } } @@ -305,7 +319,7 @@ AttributeHandleSet attributeHandles, FederateHandle acquiree, IoSession session) { - objectLock.lock(); + objectLock.writeLock().lock(); try { AttributeHandleSet acquiredAttributeHandles = @@ -337,14 +351,14 @@ } finally { - objectLock.unlock(); + objectLock.writeLock().unlock(); } } public Map<AttributeHandle, FederateHandle> attributeOwnershipDivestitureIfWanted( AttributeHandleSet attributeHandles) { - objectLock.lock(); + objectLock.writeLock().lock(); try { Map<AttributeHandle, FederateHandle> newOwners = @@ -363,14 +377,14 @@ } finally { - objectLock.unlock(); + objectLock.writeLock().unlock(); } } public void cancelNegotiatedAttributeOwnershipDivestiture( AttributeHandleSet attributeHandles, FederateHandle owner) { - objectLock.lock(); + objectLock.writeLock().lock(); try { for (AttributeHandle attributeHandle : attributeHandles) @@ -381,7 +395,7 @@ } finally { - objectLock.unlock(); + objectLock.writeLock().unlock(); } } @@ -389,7 +403,7 @@ AttributeHandleSet attributeHandles, FederateHandle acquiree, IoSession session) { - objectLock.lock(); + objectLock.writeLock().lock(); try { AttributeHandleSet canceledOwnershipAcquisitionAttributeHandles = @@ -411,18 +425,17 @@ } finally { - objectLock.unlock(); + objectLock.writeLock().unlock(); } } public void queryAttributeOwnership(AttributeHandle attributeHandle, IoSession session) { - objectLock.lock(); + objectLock.writeLock().lock(); try { - AttributeInstance attributeInstance = - attributes.get(attributeHandle); + AttributeInstance attributeInstance = attributes.get(attributeHandle); assert attributeInstance != null; FederateHandle owner = attributeInstance.getOwner(); @@ -444,7 +457,7 @@ } finally { - objectLock.unlock(); + objectLock.writeLock().unlock(); } } } Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/ObjectManager.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/ObjectManager.java 2006-12-16 03:16:37 UTC (rev 80) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/ObjectManager.java 2006-12-17 18:48:20 UTC (rev 81) @@ -18,9 +18,12 @@ import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; import java.util.Set; +import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReadWriteLock; +import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantReadWriteLock; import net.sf.ohla.rti1516.fdd.ObjectClass; @@ -40,6 +43,15 @@ { protected FederationExecution federationExecution; + protected Lock reservedObjectInstanceNamesLock = new ReentrantLock(true); + protected Map<String, ObjectInstanceHandle> reservedObjectInstanceNames = + new HashMap<String, ObjectInstanceHandle>(); + protected Map<ObjectInstanceHandle, String> reservedObjectInstanceNamesByHandle = + new HashMap<ObjectInstanceHandle, String>(); + + protected Lock retiredObjectInstanceNamesLock = new ReentrantLock(true); + protected Set<String> retiredObjectInstanceNames = new HashSet<String>(); + protected ReadWriteLock objectsLock = new ReentrantReadWriteLock(true); protected Map<ObjectInstanceHandle, ObjectInstance> objects = new HashMap<ObjectInstanceHandle, ObjectInstance>(); @@ -51,13 +63,15 @@ public void registerObjectInstance( ObjectInstanceHandle objectInstanceHandle, ObjectClass objectClass, - Set<AttributeHandle> publishedAttributeHandles, FederateHandle owner) + String name, Set<AttributeHandle> publishedAttributeHandles, + FederateHandle owner) { objectsLock.writeLock().lock(); try { objects.put(objectInstanceHandle, new ObjectInstance( - objectInstanceHandle, objectClass, publishedAttributeHandles, owner)); + objectInstanceHandle, objectClass, name, + publishedAttributeHandles, owner)); } finally { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mne...@us...> - 2006-12-16 03:16:37
|
Revision: 80 http://svn.sourceforge.net/ohla/?rev=80&view=rev Author: mnewcomb Date: 2006-12-15 19:16:37 -0800 (Fri, 15 Dec 2006) Log Message: ----------- refactoring in preparation of moving to centralized RTI Modified Paths: -------------- trunk/rti/src/java/net/sf/ohla/rti1516/federation/FederationExecution.java Added Paths: ----------- trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/ trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/AttributeInstance.java trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/ObjectInstance.java trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/ObjectManager.java Removed Paths: ------------- trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/AttributeInstanceOwnership.java trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/ObjectInstanceOwnership.java trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/OwnershipManager.java trunk/rti/src/java/net/sf/ohla/rti1516/federation/ownership/ Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federation/FederationExecution.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federation/FederationExecution.java 2006-12-16 03:12:41 UTC (rev 79) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federation/FederationExecution.java 2006-12-16 03:16:37 UTC (rev 80) @@ -35,7 +35,7 @@ import net.sf.ohla.rti1516.federate.callbacks.FederationSynchronized; import net.sf.ohla.rti1516.federate.callbacks.InitiateFederateSave; import net.sf.ohla.rti1516.federate.callbacks.RemoveObjectInstance; -import net.sf.ohla.rti1516.federation.ownership.OwnershipManager; +import net.sf.ohla.rti1516.federation.objects.ObjectManager; import net.sf.ohla.rti1516.federation.time.TimeKeeper; import net.sf.ohla.rti1516.messages.AttributeOwnershipAcquisition; import net.sf.ohla.rti1516.messages.AttributeOwnershipAcquisitionIfAvailable; @@ -140,7 +140,7 @@ protected Map<RegionHandle, Map<DimensionHandle, RangeBounds>> regions = new HashMap<RegionHandle, Map<DimensionHandle, RangeBounds>>(); - protected OwnershipManager ownershipManager = new OwnershipManager(this); + protected ObjectManager objectManager = new ObjectManager(this); protected TimeKeeper timeKeeper; @@ -401,7 +401,7 @@ session.write(new RequestResponse( registerObjectInstance.getId(), objectInstanceRegistered)); - ownershipManager.registerObjectInstance( + objectManager.registerObjectInstance( objectInstanceHandle, objectClass, registerObjectInstance.getPublishedAttributeHandles(), getFederateHandle(session)); @@ -530,7 +530,7 @@ subscribeObjectClassAttributes.getObjectClassHandle()); assert objectClass != null; - ownershipManager.subscribeObjectClassAttributes( + objectManager.subscribeObjectClassAttributes( objectClass, subscribeObjectClassAttributes.getAttributeHandles(), subscribeObjectClassAttributes.getAttributesAndRegions(), session); } @@ -1060,7 +1060,7 @@ federationExecutionStateLock.readLock().lock(); try { - ownershipManager.unconditionalAttributeOwnershipDivestiture( + objectManager.unconditionalAttributeOwnershipDivestiture( unconditionalAttributeOwnershipDivestiture.getObjectInstanceHandle(), unconditionalAttributeOwnershipDivestiture.getAttributeHandles()); } @@ -1077,7 +1077,7 @@ federationExecutionStateLock.readLock().lock(); try { - ownershipManager.negotiatedAttributeOwnershipDivestiture( + objectManager.negotiatedAttributeOwnershipDivestiture( negotiatedAttributeOwnershipDivestiture.getObjectInstanceHandle(), negotiatedAttributeOwnershipDivestiture.getAttributeHandles(), negotiatedAttributeOwnershipDivestiture.getTag(), session); @@ -1094,7 +1094,7 @@ federationExecutionStateLock.readLock().lock(); try { - ownershipManager.confirmDivestiture( + objectManager.confirmDivestiture( confirmDivestiture.getObjectInstanceHandle(), confirmDivestiture.getAttributeHandles()); } @@ -1111,7 +1111,7 @@ federationExecutionStateLock.readLock().lock(); try { - ownershipManager.attributeOwnershipAcquisition( + objectManager.attributeOwnershipAcquisition( attributeOwnershipAcquisition.getObjectInstanceHandle(), attributeOwnershipAcquisition.getAttributeHandles(), attributeOwnershipAcquisition.getTag(), getFederateHandle(session), @@ -1130,7 +1130,7 @@ federationExecutionStateLock.readLock().lock(); try { - ownershipManager.attributeOwnershipAcquisitionIfAvailable( + objectManager.attributeOwnershipAcquisitionIfAvailable( attributeOwnershipAcquisitionIfAvailable.getObjectInstanceHandle(), attributeOwnershipAcquisitionIfAvailable.getAttributeHandles(), getFederateHandle(session), session); @@ -1149,7 +1149,7 @@ try { Map<AttributeHandle, FederateHandle> newOwners = - ownershipManager.attributeOwnershipDivestitureIfWanted( + objectManager.attributeOwnershipDivestitureIfWanted( attributeOwnershipDivestitureIfWanted.getObjectInstanceHandle(), attributeOwnershipDivestitureIfWanted.getAttributeHandles()); @@ -1235,7 +1235,7 @@ federationExecutionStateLock.readLock().lock(); try { - ownershipManager.cancelNegotiatedAttributeOwnershipDivestiture( + objectManager.cancelNegotiatedAttributeOwnershipDivestiture( cancelNegotiatedAttributeOwnershipDivestiture.getObjectInstanceHandle(), cancelNegotiatedAttributeOwnershipDivestiture.getAttributeHandles(), getFederateHandle(session)); @@ -1253,7 +1253,7 @@ federationExecutionStateLock.readLock().lock(); try { - ownershipManager.cancelAttributeOwnershipAcquisition( + objectManager.cancelAttributeOwnershipAcquisition( cancelAttributeOwnershipAcquisition.getObjectInstanceHandle(), cancelAttributeOwnershipAcquisition.getAttributeHandles(), getFederateHandle(session), session); @@ -1270,7 +1270,7 @@ federationExecutionStateLock.readLock().lock(); try { - ownershipManager.queryAttributeOwnership( + objectManager.queryAttributeOwnership( queryAttributeOwnership.getObjectInstanceHandle(), queryAttributeOwnership.getAttributeHandle(), session); } Copied: trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects (from rev 78, trunk/rti/src/java/net/sf/ohla/rti1516/federation/ownership) Added: trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/AttributeInstance.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/AttributeInstance.java (rev 0) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/AttributeInstance.java 2006-12-16 03:16:37 UTC (rev 80) @@ -0,0 +1,167 @@ +/* + * Copyright (c) 2006, Michael Newcomb + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.ohla.rti1516.federation.objects; + +import java.util.Iterator; +import java.util.LinkedHashSet; + +import net.sf.ohla.rti1516.fdd.Attribute; + +import hla.rti1516.FederateHandle; + +public class AttributeInstance +{ + protected final Attribute attribute; + + protected FederateHandle owner; + + /** + * Set if the owner of this attribute is willing to divest ownership. + */ + protected boolean wantsToDivest; + + /** + * The 'ownership' line. When federates request ownership of this attribute + * they are placed into a line and given ownership based upon when they + * entered the line. + */ + protected LinkedHashSet<FederateHandle> requestingOwnership = + new LinkedHashSet<FederateHandle>(); + + public AttributeInstance(Attribute attribute) + { + this.attribute = attribute; + } + + public Attribute getAttribute() + { + return attribute; + } + + public FederateHandle getOwner() + { + return owner; + } + + public void setOwner(FederateHandle owner) + { + this.owner = owner; + } + + public boolean wantsToDivest() + { + return wantsToDivest; + } + + public FederateHandle unconditionalAttributeOwnershipDivestiture() + { + owner = null; + wantsToDivest = false; + + // give ownership to the next in line + // + if (!requestingOwnership.isEmpty()) + { + Iterator<FederateHandle> i = requestingOwnership.iterator(); + owner = i.next(); + i.remove(); + } + + return owner; + } + + public boolean negotiatedAttributeOwnershipDivestiture(byte[] tag) + { + wantsToDivest = true; + + return !requestingOwnership.isEmpty(); + } + + public FederateHandle confirmDivestiture() + { + owner = null; + wantsToDivest = false; + + // give ownership to the next in line + // + if (!requestingOwnership.isEmpty()) + { + Iterator<FederateHandle> i = requestingOwnership.iterator(); + owner = i.next(); + i.remove(); + } + + return owner; + } + + public FederateHandle attributeOwnershipAcquisition(FederateHandle acquiree) + { + if (!attributeOwnershipAcquisitionIfAvailable(acquiree)) + { + // get in line + // + requestingOwnership.add(acquiree); + } + + return owner; + } + + public boolean attributeOwnershipAcquisitionIfAvailable( + FederateHandle acquiree) + { + if (owner == null) + { + // acquire this attribute if it is unowned + // + owner = acquiree; + wantsToDivest = false; + } + return owner == acquiree; + } + + public FederateHandle attributeOwnershipDivestitureIfWanted() + { + boolean divested = !requestingOwnership.isEmpty(); + + // give ownership to the next in line + // + if (divested) + { + Iterator<FederateHandle> i = requestingOwnership.iterator(); + owner = i.next(); + i.remove(); + + wantsToDivest = false; + } + + return divested ? owner : null; + } + + public boolean cancelAttributeOwnershipAcquisition(FederateHandle acquiree) + { + return requestingOwnership.remove(acquiree); + } + + public void cancelNegotiatedAttributeOwnershipDivestiture( + FederateHandle owner) + { + if (owner.equals(this.owner)) + { + wantsToDivest = false; + } + } +} Deleted: trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/AttributeInstanceOwnership.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federation/ownership/AttributeInstanceOwnership.java 2006-12-10 19:05:45 UTC (rev 78) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/AttributeInstanceOwnership.java 2006-12-16 03:16:37 UTC (rev 80) @@ -1,167 +0,0 @@ -/* - * Copyright (c) 2006, Michael Newcomb - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ohla.rti1516.federation.ownership; - -import java.util.Iterator; -import java.util.LinkedHashSet; - -import net.sf.ohla.rti1516.fdd.Attribute; - -import hla.rti1516.FederateHandle; - -public class AttributeInstanceOwnership -{ - protected final Attribute attribute; - - protected FederateHandle owner; - - /** - * Set if the owner of this attribute is willing to divest ownership. - */ - protected boolean wantsToDivest; - - /** - * The 'ownership' line. When federates request ownership of this attribute - * they are placed into a line and given ownership based upon when they - * entered the line. - */ - protected LinkedHashSet<FederateHandle> requestingOwnership = - new LinkedHashSet<FederateHandle>(); - - public AttributeInstanceOwnership(Attribute attribute) - { - this.attribute = attribute; - } - - public Attribute getAttribute() - { - return attribute; - } - - public FederateHandle getOwner() - { - return owner; - } - - public void setOwner(FederateHandle owner) - { - this.owner = owner; - } - - public boolean wantsToDivest() - { - return wantsToDivest; - } - - public FederateHandle unconditionalAttributeOwnershipDivestiture() - { - owner = null; - wantsToDivest = false; - - // give ownership to the next in line - // - if (!requestingOwnership.isEmpty()) - { - Iterator<FederateHandle> i = requestingOwnership.iterator(); - owner = i.next(); - i.remove(); - } - - return owner; - } - - public boolean negotiatedAttributeOwnershipDivestiture(byte[] tag) - { - wantsToDivest = true; - - return !requestingOwnership.isEmpty(); - } - - public FederateHandle confirmDivestiture() - { - owner = null; - wantsToDivest = false; - - // give ownership to the next in line - // - if (!requestingOwnership.isEmpty()) - { - Iterator<FederateHandle> i = requestingOwnership.iterator(); - owner = i.next(); - i.remove(); - } - - return owner; - } - - public FederateHandle attributeOwnershipAcquisition(FederateHandle acquiree) - { - if (!attributeOwnershipAcquisitionIfAvailable(acquiree)) - { - // get in line - // - requestingOwnership.add(acquiree); - } - - return owner; - } - - public boolean attributeOwnershipAcquisitionIfAvailable( - FederateHandle acquiree) - { - if (owner == null) - { - // acquire this attribute if it is unowned - // - owner = acquiree; - wantsToDivest = false; - } - return owner == acquiree; - } - - public FederateHandle attributeOwnershipDivestitureIfWanted() - { - boolean divested = !requestingOwnership.isEmpty(); - - // give ownership to the next in line - // - if (divested) - { - Iterator<FederateHandle> i = requestingOwnership.iterator(); - owner = i.next(); - i.remove(); - - wantsToDivest = false; - } - - return divested ? owner : null; - } - - public boolean cancelAttributeOwnershipAcquisition(FederateHandle acquiree) - { - return requestingOwnership.remove(acquiree); - } - - public void cancelNegotiatedAttributeOwnershipDivestiture( - FederateHandle owner) - { - if (owner.equals(this.owner)) - { - wantsToDivest = false; - } - } -} Added: trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/ObjectInstance.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/ObjectInstance.java (rev 0) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/ObjectInstance.java 2006-12-16 03:16:37 UTC (rev 80) @@ -0,0 +1,450 @@ +/* + * Copyright (c) 2006, Michael Newcomb + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.ohla.rti1516.federation.objects; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; + +import net.sf.ohla.rti1516.fdd.ObjectClass; +import net.sf.ohla.rti1516.fdd.Attribute; +import net.sf.ohla.rti1516.federate.callbacks.AttributeOwnershipAcquisitionNotification; +import net.sf.ohla.rti1516.federate.callbacks.AttributeOwnershipUnavailable; +import net.sf.ohla.rti1516.federate.callbacks.ConfirmAttributeOwnershipAcquisitionCancellation; +import net.sf.ohla.rti1516.federate.callbacks.RequestAttributeOwnershipRelease; +import net.sf.ohla.rti1516.federate.callbacks.RequestDivestitureConfirmation; +import net.sf.ohla.rti1516.federate.callbacks.AttributeIsNotOwned; +import net.sf.ohla.rti1516.federate.callbacks.AttributeIsOwnedByRTI; +import net.sf.ohla.rti1516.federate.callbacks.InformAttributeOwnership; +import net.sf.ohla.rti1516.OHLAAttributeHandleSet; +import net.sf.ohla.rti1516.federation.FederationExecution; + +import org.apache.mina.common.IoSession; + +import hla.rti1516.AttributeHandle; +import hla.rti1516.AttributeHandleSet; +import hla.rti1516.FederateHandle; +import hla.rti1516.ObjectInstanceHandle; + +public class ObjectInstance +{ + protected ObjectInstanceHandle objectInstanceHandle; + protected ObjectClass objectClass; + + protected Lock objectLock = new ReentrantLock(true); + + protected Map<AttributeHandle, AttributeInstance> attributes = + new HashMap<AttributeHandle, AttributeInstance>(); + + public ObjectInstance(ObjectInstanceHandle objectInstanceHandle, + ObjectClass objectClass, + Set<AttributeHandle> publishedAttributeHandles, + FederateHandle owner) + { + this.objectInstanceHandle = objectInstanceHandle; + this.objectClass = objectClass; + + for (Attribute attribute : objectClass.getAttributes().values()) + { + AttributeInstance attributeInstance = + new AttributeInstance(attribute); + attributes.put(attribute.getAttributeHandle(), + attributeInstance); + + if (publishedAttributeHandles.contains(attribute.getAttributeHandle())) + { + attributeInstance.setOwner(owner); + } + } + } + + public ObjectInstanceHandle getObjectInstanceHandle() + { + return objectInstanceHandle; + } + + public ObjectClass getObjectClass() + { + return objectClass; + } + + public FederateHandle getOwner(AttributeHandle attributeHandle) + { + return attributes.get(attributeHandle).getOwner(); + } + + public void unconditionalAttributeOwnershipDivestiture( + AttributeHandleSet attributeHandles, + FederationExecution federationExecution) + { + objectLock.lock(); + try + { + Map<FederateHandle, AttributeHandleSet> newOwners = + new HashMap<FederateHandle, AttributeHandleSet>(); + for (AttributeHandle attributeHandle : attributeHandles) + { + FederateHandle newOwner = + attributes.get( + attributeHandle).unconditionalAttributeOwnershipDivestiture(); + if (newOwner != null) + { + AttributeHandleSet acquiredAttributes = newOwners.get(newOwner); + if (acquiredAttributes == null) + { + acquiredAttributes = new OHLAAttributeHandleSet(); + newOwners.put(newOwner, acquiredAttributes); + } + acquiredAttributes.add(attributeHandle); + } + } + + // notify the new owners + // + for (Map.Entry<FederateHandle, AttributeHandleSet> entry : + newOwners.entrySet()) + { + IoSession ownerSession = + federationExecution.getFederateSession(entry.getKey()); + if (ownerSession != null) + { + ownerSession.write(new AttributeOwnershipAcquisitionNotification( + objectInstanceHandle, entry.getValue())); + } + } + } + finally + { + objectLock.unlock(); + } + } + + public void negotiatedAttributeOwnershipDivestiture( + AttributeHandleSet attributeHandles, byte[] tag, IoSession session) + { + objectLock.lock(); + try + { + AttributeHandleSet divestableAttributeHandles = + new OHLAAttributeHandleSet(); + for (AttributeHandle attributeHandle : attributeHandles) + { + if (attributes.get( + attributeHandle).negotiatedAttributeOwnershipDivestiture(tag)) + { + divestableAttributeHandles.add(attributeHandle); + } + } + + if (!divestableAttributeHandles.isEmpty()) + { + session.write(new RequestDivestitureConfirmation( + objectInstanceHandle, divestableAttributeHandles)); + } + } + finally + { + objectLock.unlock(); + } + } + + public void confirmDivestiture(AttributeHandleSet attributeHandles, + FederationExecution federationExecution) + { + objectLock.lock(); + try + { + Map<FederateHandle, AttributeHandleSet> newOwners = + new HashMap<FederateHandle, AttributeHandleSet>(); + for (AttributeHandle attributeHandle : attributeHandles) + { + FederateHandle newOwner = + attributes.get(attributeHandle).confirmDivestiture(); + if (newOwner != null) + { + AttributeHandleSet acquiredAttributes = newOwners.get(newOwner); + if (acquiredAttributes == null) + { + acquiredAttributes = new OHLAAttributeHandleSet(); + newOwners.put(newOwner, acquiredAttributes); + } + acquiredAttributes.add(attributeHandle); + System.out.printf("%s - %s\n", newOwner, acquiredAttributes); + } + } + + // notify the new owners + // + for (Map.Entry<FederateHandle, AttributeHandleSet> entry : + newOwners.entrySet()) + { + IoSession ownerSession = + federationExecution.getFederateSession(entry.getKey()); + if (ownerSession != null) + { + ownerSession.write(new AttributeOwnershipAcquisitionNotification( + objectInstanceHandle, entry.getValue())); + } + } + } + finally + { + objectLock.unlock(); + } + } + + public void attributeOwnershipAcquisition( + AttributeHandleSet attributeHandles, byte[] tag, FederateHandle acquiree, + IoSession session, FederationExecution federationExecution) + { + objectLock.lock(); + try + { + AttributeHandleSet acquiredAttributeHandles = + new OHLAAttributeHandleSet(); + Map<FederateHandle, AttributeHandleSet> federatesThatNeedToConfirmDivestiture = + new HashMap<FederateHandle, AttributeHandleSet>(); + Map<FederateHandle, AttributeHandleSet> federatesThatNeedToRelease = + new HashMap<FederateHandle, AttributeHandleSet>(); + + for (AttributeHandle attributeHandle : attributeHandles) + { + AttributeInstance attributeInstance = + attributes.get(attributeHandle); + + FederateHandle owner = + attributeInstance.attributeOwnershipAcquisition(acquiree); + if (acquiree.equals(owner)) + { + // the attribute was unowned and therefore immediately acquired + // + acquiredAttributeHandles.add(attributeHandle); + } + else if (attributeInstance.wantsToDivest()) + { + // the attribute is owned but the owner is willing to divest + // + AttributeHandleSet divestingAttributeHandles = + federatesThatNeedToConfirmDivestiture.get(owner); + if (divestingAttributeHandles == null) + { + divestingAttributeHandles = new OHLAAttributeHandleSet(); + federatesThatNeedToConfirmDivestiture.put( + owner, divestingAttributeHandles); + } + divestingAttributeHandles.add(attributeHandle); + } + else + { + // the attribute is owned but the owner is unwilling to divest + // + AttributeHandleSet releasingAttributeHandles = + federatesThatNeedToRelease.get(owner); + if (releasingAttributeHandles == null) + { + releasingAttributeHandles = new OHLAAttributeHandleSet(); + federatesThatNeedToRelease.put(owner, releasingAttributeHandles); + } + releasingAttributeHandles.add(attributeHandle); + } + } + + if (!acquiredAttributeHandles.isEmpty()) + { + session.write(new AttributeOwnershipAcquisitionNotification( + objectInstanceHandle, acquiredAttributeHandles, tag)); + } + + for (Map.Entry<FederateHandle, AttributeHandleSet> entry : + federatesThatNeedToConfirmDivestiture.entrySet()) + { + IoSession federateSession = + federationExecution.getFederateSession(entry.getKey()); + if (federateSession != null) + { + federateSession.write(new RequestDivestitureConfirmation( + objectInstanceHandle, entry.getValue())); + } + } + + for (Map.Entry<FederateHandle, AttributeHandleSet> entry : + federatesThatNeedToRelease.entrySet()) + { + IoSession federateSession = + federationExecution.getFederateSession(entry.getKey()); + if (federateSession != null) + { + federateSession.write(new RequestAttributeOwnershipRelease( + objectInstanceHandle, entry.getValue(), tag)); + } + } + } + finally + { + objectLock.unlock(); + } + } + + public void attributeOwnershipAcquisitionIfAvailable( + AttributeHandleSet attributeHandles, FederateHandle acquiree, + IoSession session) + { + objectLock.lock(); + try + { + AttributeHandleSet acquiredAttributeHandles = + new OHLAAttributeHandleSet(); + for (AttributeHandle attributeHandle : attributeHandles) + { + if (attributes.get( + attributeHandle).attributeOwnershipAcquisitionIfAvailable(acquiree)) + { + acquiredAttributeHandles.add(attributeHandle); + } + } + + if (!acquiredAttributeHandles.isEmpty()) + { + session.write(new AttributeOwnershipAcquisitionNotification( + objectInstanceHandle, acquiredAttributeHandles)); + } + + AttributeHandleSet unacquiredAttributeHandles = + new OHLAAttributeHandleSet(attributeHandles); + unacquiredAttributeHandles.removeAll(acquiredAttributeHandles); + + if (!unacquiredAttributeHandles.isEmpty()) + { + session.write(new AttributeOwnershipUnavailable( + objectInstanceHandle, unacquiredAttributeHandles)); + } + } + finally + { + objectLock.unlock(); + } + } + + public Map<AttributeHandle, FederateHandle> attributeOwnershipDivestitureIfWanted( + AttributeHandleSet attributeHandles) + { + objectLock.lock(); + try + { + Map<AttributeHandle, FederateHandle> newOwners = + new HashMap<AttributeHandle, FederateHandle>(); + for (AttributeHandle attributeHandle : attributeHandles) + { + FederateHandle newOwner = attributes.get( + attributeHandle).attributeOwnershipDivestitureIfWanted(); + if (newOwner != null) + { + newOwners.put(attributeHandle, newOwner); + } + } + + return newOwners; + } + finally + { + objectLock.unlock(); + } + } + + public void cancelNegotiatedAttributeOwnershipDivestiture( + AttributeHandleSet attributeHandles, FederateHandle owner) + { + objectLock.lock(); + try + { + for (AttributeHandle attributeHandle : attributeHandles) + { + attributes.get( + attributeHandle).cancelNegotiatedAttributeOwnershipDivestiture(owner); + } + } + finally + { + objectLock.unlock(); + } + } + + public void cancelAttributeOwnershipAcquisition( + AttributeHandleSet attributeHandles, FederateHandle acquiree, + IoSession session) + { + objectLock.lock(); + try + { + AttributeHandleSet canceledOwnershipAcquisitionAttributeHandles = + new OHLAAttributeHandleSet(); + for (AttributeHandle attributeHandle : attributeHandles) + { + if (attributes.get( + attributeHandle).cancelAttributeOwnershipAcquisition(acquiree)) + { + canceledOwnershipAcquisitionAttributeHandles.add(attributeHandle); + } + } + + if (!canceledOwnershipAcquisitionAttributeHandles.isEmpty()) + { + session.write(new ConfirmAttributeOwnershipAcquisitionCancellation( + objectInstanceHandle, canceledOwnershipAcquisitionAttributeHandles)); + } + } + finally + { + objectLock.unlock(); + } + } + + public void queryAttributeOwnership(AttributeHandle attributeHandle, + IoSession session) + { + objectLock.lock(); + try + { + AttributeInstance attributeInstance = + attributes.get(attributeHandle); + assert attributeInstance != null; + + FederateHandle owner = attributeInstance.getOwner(); + if (owner == null) + { + session.write(new AttributeIsNotOwned( + objectInstanceHandle, attributeHandle)); + } + else if (attributeInstance.getAttribute().isMOM()) + { + session.write(new AttributeIsOwnedByRTI( + objectInstanceHandle, attributeHandle)); + } + else + { + session.write(new InformAttributeOwnership( + objectInstanceHandle, attributeHandle, owner)); + } + } + finally + { + objectLock.unlock(); + } + } +} Deleted: trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/ObjectInstanceOwnership.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federation/ownership/ObjectInstanceOwnership.java 2006-12-10 19:05:45 UTC (rev 78) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/ObjectInstanceOwnership.java 2006-12-16 03:16:37 UTC (rev 80) @@ -1,450 +0,0 @@ -/* - * Copyright (c) 2006, Michael Newcomb - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ohla.rti1516.federation.ownership; - -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantLock; - -import net.sf.ohla.rti1516.fdd.ObjectClass; -import net.sf.ohla.rti1516.fdd.Attribute; -import net.sf.ohla.rti1516.federate.callbacks.AttributeOwnershipAcquisitionNotification; -import net.sf.ohla.rti1516.federate.callbacks.AttributeOwnershipUnavailable; -import net.sf.ohla.rti1516.federate.callbacks.ConfirmAttributeOwnershipAcquisitionCancellation; -import net.sf.ohla.rti1516.federate.callbacks.RequestAttributeOwnershipRelease; -import net.sf.ohla.rti1516.federate.callbacks.RequestDivestitureConfirmation; -import net.sf.ohla.rti1516.federate.callbacks.AttributeIsNotOwned; -import net.sf.ohla.rti1516.federate.callbacks.AttributeIsOwnedByRTI; -import net.sf.ohla.rti1516.federate.callbacks.InformAttributeOwnership; -import net.sf.ohla.rti1516.OHLAAttributeHandleSet; -import net.sf.ohla.rti1516.federation.FederationExecution; - -import org.apache.mina.common.IoSession; - -import hla.rti1516.AttributeHandle; -import hla.rti1516.AttributeHandleSet; -import hla.rti1516.FederateHandle; -import hla.rti1516.ObjectInstanceHandle; - -public class ObjectInstanceOwnership -{ - protected ObjectInstanceHandle objectInstanceHandle; - protected ObjectClass objectClass; - - protected Lock objectLock = new ReentrantLock(true); - - protected Map<AttributeHandle, AttributeInstanceOwnership> attributes = - new HashMap<AttributeHandle, AttributeInstanceOwnership>(); - - public ObjectInstanceOwnership(ObjectInstanceHandle objectInstanceHandle, - ObjectClass objectClass, - Set<AttributeHandle> publishedAttributeHandles, - FederateHandle owner) - { - this.objectInstanceHandle = objectInstanceHandle; - this.objectClass = objectClass; - - for (Attribute attribute : objectClass.getAttributes().values()) - { - AttributeInstanceOwnership attributeInstanceOwnership = - new AttributeInstanceOwnership(attribute); - attributes.put(attribute.getAttributeHandle(), - attributeInstanceOwnership); - - if (publishedAttributeHandles.contains(attribute.getAttributeHandle())) - { - attributeInstanceOwnership.setOwner(owner); - } - } - } - - public ObjectInstanceHandle getObjectInstanceHandle() - { - return objectInstanceHandle; - } - - public ObjectClass getObjectClass() - { - return objectClass; - } - - public FederateHandle getOwner(AttributeHandle attributeHandle) - { - return attributes.get(attributeHandle).getOwner(); - } - - public void unconditionalAttributeOwnershipDivestiture( - AttributeHandleSet attributeHandles, - FederationExecution federationExecution) - { - objectLock.lock(); - try - { - Map<FederateHandle, AttributeHandleSet> newOwners = - new HashMap<FederateHandle, AttributeHandleSet>(); - for (AttributeHandle attributeHandle : attributeHandles) - { - FederateHandle newOwner = - attributes.get( - attributeHandle).unconditionalAttributeOwnershipDivestiture(); - if (newOwner != null) - { - AttributeHandleSet acquiredAttributes = newOwners.get(newOwner); - if (acquiredAttributes == null) - { - acquiredAttributes = new OHLAAttributeHandleSet(); - newOwners.put(newOwner, acquiredAttributes); - } - acquiredAttributes.add(attributeHandle); - } - } - - // notify the new owners - // - for (Map.Entry<FederateHandle, AttributeHandleSet> entry : - newOwners.entrySet()) - { - IoSession ownerSession = - federationExecution.getFederateSession(entry.getKey()); - if (ownerSession != null) - { - ownerSession.write(new AttributeOwnershipAcquisitionNotification( - objectInstanceHandle, entry.getValue())); - } - } - } - finally - { - objectLock.unlock(); - } - } - - public void negotiatedAttributeOwnershipDivestiture( - AttributeHandleSet attributeHandles, byte[] tag, IoSession session) - { - objectLock.lock(); - try - { - AttributeHandleSet divestableAttributeHandles = - new OHLAAttributeHandleSet(); - for (AttributeHandle attributeHandle : attributeHandles) - { - if (attributes.get( - attributeHandle).negotiatedAttributeOwnershipDivestiture(tag)) - { - divestableAttributeHandles.add(attributeHandle); - } - } - - if (!divestableAttributeHandles.isEmpty()) - { - session.write(new RequestDivestitureConfirmation( - objectInstanceHandle, divestableAttributeHandles)); - } - } - finally - { - objectLock.unlock(); - } - } - - public void confirmDivestiture(AttributeHandleSet attributeHandles, - FederationExecution federationExecution) - { - objectLock.lock(); - try - { - Map<FederateHandle, AttributeHandleSet> newOwners = - new HashMap<FederateHandle, AttributeHandleSet>(); - for (AttributeHandle attributeHandle : attributeHandles) - { - FederateHandle newOwner = - attributes.get(attributeHandle).confirmDivestiture(); - if (newOwner != null) - { - AttributeHandleSet acquiredAttributes = newOwners.get(newOwner); - if (acquiredAttributes == null) - { - acquiredAttributes = new OHLAAttributeHandleSet(); - newOwners.put(newOwner, acquiredAttributes); - } - acquiredAttributes.add(attributeHandle); - System.out.printf("%s - %s\n", newOwner, acquiredAttributes); - } - } - - // notify the new owners - // - for (Map.Entry<FederateHandle, AttributeHandleSet> entry : - newOwners.entrySet()) - { - IoSession ownerSession = - federationExecution.getFederateSession(entry.getKey()); - if (ownerSession != null) - { - ownerSession.write(new AttributeOwnershipAcquisitionNotification( - objectInstanceHandle, entry.getValue())); - } - } - } - finally - { - objectLock.unlock(); - } - } - - public void attributeOwnershipAcquisition( - AttributeHandleSet attributeHandles, byte[] tag, FederateHandle acquiree, - IoSession session, FederationExecution federationExecution) - { - objectLock.lock(); - try - { - AttributeHandleSet acquiredAttributeHandles = - new OHLAAttributeHandleSet(); - Map<FederateHandle, AttributeHandleSet> federatesThatNeedToConfirmDivestiture = - new HashMap<FederateHandle, AttributeHandleSet>(); - Map<FederateHandle, AttributeHandleSet> federatesThatNeedToRelease = - new HashMap<FederateHandle, AttributeHandleSet>(); - - for (AttributeHandle attributeHandle : attributeHandles) - { - AttributeInstanceOwnership attributeInstanceOwnership = - attributes.get(attributeHandle); - - FederateHandle owner = - attributeInstanceOwnership.attributeOwnershipAcquisition(acquiree); - if (acquiree.equals(owner)) - { - // the attribute was unowned and therefore immediately acquired - // - acquiredAttributeHandles.add(attributeHandle); - } - else if (attributeInstanceOwnership.wantsToDivest()) - { - // the attribute is owned but the owner is willing to divest - // - AttributeHandleSet divestingAttributeHandles = - federatesThatNeedToConfirmDivestiture.get(owner); - if (divestingAttributeHandles == null) - { - divestingAttributeHandles = new OHLAAttributeHandleSet(); - federatesThatNeedToConfirmDivestiture.put( - owner, divestingAttributeHandles); - } - divestingAttributeHandles.add(attributeHandle); - } - else - { - // the attribute is owned but the owner is unwilling to divest - // - AttributeHandleSet releasingAttributeHandles = - federatesThatNeedToRelease.get(owner); - if (releasingAttributeHandles == null) - { - releasingAttributeHandles = new OHLAAttributeHandleSet(); - federatesThatNeedToRelease.put(owner, releasingAttributeHandles); - } - releasingAttributeHandles.add(attributeHandle); - } - } - - if (!acquiredAttributeHandles.isEmpty()) - { - session.write(new AttributeOwnershipAcquisitionNotification( - objectInstanceHandle, acquiredAttributeHandles, tag)); - } - - for (Map.Entry<FederateHandle, AttributeHandleSet> entry : - federatesThatNeedToConfirmDivestiture.entrySet()) - { - IoSession federateSession = - federationExecution.getFederateSession(entry.getKey()); - if (federateSession != null) - { - federateSession.write(new RequestDivestitureConfirmation( - objectInstanceHandle, entry.getValue())); - } - } - - for (Map.Entry<FederateHandle, AttributeHandleSet> entry : - federatesThatNeedToRelease.entrySet()) - { - IoSession federateSession = - federationExecution.getFederateSession(entry.getKey()); - if (federateSession != null) - { - federateSession.write(new RequestAttributeOwnershipRelease( - objectInstanceHandle, entry.getValue(), tag)); - } - } - } - finally - { - objectLock.unlock(); - } - } - - public void attributeOwnershipAcquisitionIfAvailable( - AttributeHandleSet attributeHandles, FederateHandle acquiree, - IoSession session) - { - objectLock.lock(); - try - { - AttributeHandleSet acquiredAttributeHandles = - new OHLAAttributeHandleSet(); - for (AttributeHandle attributeHandle : attributeHandles) - { - if (attributes.get( - attributeHandle).attributeOwnershipAcquisitionIfAvailable(acquiree)) - { - acquiredAttributeHandles.add(attributeHandle); - } - } - - if (!acquiredAttributeHandles.isEmpty()) - { - session.write(new AttributeOwnershipAcquisitionNotification( - objectInstanceHandle, acquiredAttributeHandles)); - } - - AttributeHandleSet unacquiredAttributeHandles = - new OHLAAttributeHandleSet(attributeHandles); - unacquiredAttributeHandles.removeAll(acquiredAttributeHandles); - - if (!unacquiredAttributeHandles.isEmpty()) - { - session.write(new AttributeOwnershipUnavailable( - objectInstanceHandle, unacquiredAttributeHandles)); - } - } - finally - { - objectLock.unlock(); - } - } - - public Map<AttributeHandle, FederateHandle> attributeOwnershipDivestitureIfWanted( - AttributeHandleSet attributeHandles) - { - objectLock.lock(); - try - { - Map<AttributeHandle, FederateHandle> newOwners = - new HashMap<AttributeHandle, FederateHandle>(); - for (AttributeHandle attributeHandle : attributeHandles) - { - FederateHandle newOwner = attributes.get( - attributeHandle).attributeOwnershipDivestitureIfWanted(); - if (newOwner != null) - { - newOwners.put(attributeHandle, newOwner); - } - } - - return newOwners; - } - finally - { - objectLock.unlock(); - } - } - - public void cancelNegotiatedAttributeOwnershipDivestiture( - AttributeHandleSet attributeHandles, FederateHandle owner) - { - objectLock.lock(); - try - { - for (AttributeHandle attributeHandle : attributeHandles) - { - attributes.get( - attributeHandle).cancelNegotiatedAttributeOwnershipDivestiture(owner); - } - } - finally - { - objectLock.unlock(); - } - } - - public void cancelAttributeOwnershipAcquisition( - AttributeHandleSet attributeHandles, FederateHandle acquiree, - IoSession session) - { - objectLock.lock(); - try - { - AttributeHandleSet canceledOwnershipAcquisitionAttributeHandles = - new OHLAAttributeHandleSet(); - for (AttributeHandle attributeHandle : attributeHandles) - { - if (attributes.get( - attributeHandle).cancelAttributeOwnershipAcquisition(acquiree)) - { - canceledOwnershipAcquisitionAttributeHandles.add(attributeHandle); - } - } - - if (!canceledOwnershipAcquisitionAttributeHandles.isEmpty()) - { - session.write(new ConfirmAttributeOwnershipAcquisitionCancellation( - objectInstanceHandle, canceledOwnershipAcquisitionAttributeHandles)); - } - } - finally - { - objectLock.unlock(); - } - } - - public void queryAttributeOwnership(AttributeHandle attributeHandle, - IoSession session) - { - objectLock.lock(); - try - { - AttributeInstanceOwnership attributeInstanceOwnership = - attributes.get(attributeHandle); - assert attributeInstanceOwnership != null; - - FederateHandle owner = attributeInstanceOwnership.getOwner(); - if (owner == null) - { - session.write(new AttributeIsNotOwned( - objectInstanceHandle, attributeHandle)); - } - else if (attributeInstanceOwnership.getAttribute().isMOM()) - { - session.write(new AttributeIsOwnedByRTI( - objectInstanceHandle, attributeHandle)); - } - else - { - session.write(new InformAttributeOwnership( - objectInstanceHandle, attributeHandle, owner)); - } - } - finally - { - objectLock.unlock(); - } - } -} Added: trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/ObjectManager.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/ObjectManager.java (rev 0) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/ObjectManager.java 2006-12-16 03:16:37 UTC (rev 80) @@ -0,0 +1,295 @@ +/* + * Copyright (c) 2006, Michael Newcomb + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.ohla.rti1516.federation.objects; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.locks.ReadWriteLock; +import java.util.concurrent.locks.ReentrantReadWriteLock; + +import net.sf.ohla.rti1516.fdd.ObjectClass; +import net.sf.ohla.rti1516.federate.callbacks.DiscoverObjectInstance; +import net.sf.ohla.rti1516.federation.FederationExecution; + +import org.apache.mina.common.IoSession; +import org.apache.mina.common.WriteFuture; + +import hla.rti1516.AttributeHandle; +import hla.rti1516.AttributeHandleSet; +import hla.rti1516.AttributeSetRegionSetPairList; +import hla.rti1516.FederateHandle; +import hla.rti1516.ObjectInstanceHandle; + +public class ObjectManager +{ + protected FederationExecution federationExecution; + + protected ReadWriteLock objectsLock = new ReentrantReadWriteLock(true); + protected Map<ObjectInstanceHandle, ObjectInstance> objects = + new HashMap<ObjectInstanceHandle, ObjectInstance>(); + + public ObjectManager(FederationExecution federationExecution) + { + this.federationExecution = federationExecution; + } + + public void registerObjectInstance( + ObjectInstanceHandle objectInstanceHandle, ObjectClass objectClass, + Set<AttributeHandle> publishedAttributeHandles, FederateHandle owner) + { + objectsLock.writeLock().lock(); + try + { + objects.put(objectInstanceHandle, new ObjectInstance( + objectInstanceHandle, objectClass, publishedAttributeHandles, owner)); + } + finally + { + objectsLock.writeLock().unlock(); + } + } + + public void subscribeObjectClassAttributes( + ObjectClass objectClass, AttributeHandleSet attributeHandles, + AttributeSetRegionSetPairList attributesAndRegions, IoSession session) + { + objectsLock.readLock().lock(); + try + { + WriteFuture lastWriteFuture = null; + for (ObjectInstance objectInstance : objects.values()) + { + if (objectClass.isAssignableFrom( + objectInstance.getObjectClass())) + { + // TODO: DDM + + lastWriteFuture = session.write(new DiscoverObjectInstance( + objectInstance.getObjectInstanceHandle(), + objectClass.getObjectClassHandle())); + } + } + + if (lastWriteFuture != null) + { + // wait until the last discover has been sent + // + lastWriteFuture.join(); + } + } + finally + { + objectsLock.readLock().unlock(); + } + } + + public void unconditionalAttributeOwnershipDivestiture( + ObjectInstanceHandle objectInstanceHandle, + AttributeHandleSet attributeHandles) + { + objectsLock.readLock().lock(); + try + { + ObjectInstance objectInstance = + objects.get(objectInstanceHandle); + if (objectInstance != null) + { + objectInstance.unconditionalAttributeOwnershipDivestiture( + attributeHandles, federationExecution); + } + } + finally + { + objectsLock.readLock().unlock(); + } + } + + public void negotiatedAttributeOwnershipDivestiture( + ObjectInstanceHandle objectInstanceHandle, + AttributeHandleSet attributeHandles, byte[] tag, IoSession session) + { + objectsLock.readLock().lock(); + try + { + ObjectInstance objectInstance = + objects.get(objectInstanceHandle); + if (objectInstance != null) + { + objectInstance.negotiatedAttributeOwnershipDivestiture( + attributeHandles, tag, session); + } + } + finally + { + objectsLock.readLock().unlock(); + } + } + + public void confirmDivestiture(ObjectInstanceHandle objectInstanceHandle, + AttributeHandleSet attributeHandles) + { + objectsLock.readLock().lock(); + try + { + ObjectInstance objectInstance = + objects.get(objectInstanceHandle); + if (objectInstance != null) + { + objectInstance.confirmDivestiture( + attributeHandles, federationExecution); + } + } + finally + { + objectsLock.readLock().unlock(); + } + } + + public void attributeOwnershipAcquisition( + ObjectInstanceHandle objectInstanceHandle, + AttributeHandleSet attributeHandles, byte[] tag, FederateHandle acquiree, + IoSession session) + { + objectsLock.readLock().lock(); + try + { + ObjectInstance objectInstance = + objects.get(objectInstanceHandle); + if (objectInstance != null) + { + objectInstance.attributeOwnershipAcquisition( + attributeHandles, tag, acquiree, session, federationExecution); + } + } + finally + { + objectsLock.readLock().unlock(); + } + } + + public void attributeOwnershipAcquisitionIfAvailable( + ObjectInstanceHandle objectInstanceHandle, + AttributeHandleSet attributeHandles, FederateHandle acquiree, + IoSession session) + { + objectsLock.readLock().lock(); + try + { + ObjectInstance objectInstance = + objects.get(objectInstanceHandle); + if (objectInstance != null) + { + objectInstance.attributeOwnershipAcquisitionIfAvailable( + attributeHandles, acquiree, session); + } + } + finally + { + objectsLock.readLock().unlock(); + } + } + + public Map<AttributeHandle, FederateHandle> attributeOwnershipDivestitureIfWanted( + ObjectInstanceHandle objectInstanceHandle, + AttributeHandleSet attributeHandles) + { + objectsLock.readLock().lock(); + try + { + ObjectInstance objectInstance = + objects.get(objectInstanceHandle); + return objectInstance != null ? + objectInstance.attributeOwnershipDivestitureIfWanted( + attributeHandles) : + (Map<AttributeHandle, FederateHandle>) Collections.EMPTY_MAP; + } + finally + { + objectsLock.readLock().unlock(); + } + } + + public void cancelNegotiatedAttributeOwnershipDivestiture( + ObjectInstanceHandle objectInstanceHandle, + AttributeHandleSet attributeHandles, FederateHandle owner) + { + objectsLock.readLock().lock(); + try + { + ObjectInstance objectInstance = + objects.get(objectInstanceHandle); + if (objectInstance != null) + { + objectInstance.cancelNegotiatedAttributeOwnershipDivestiture( + attributeHandles, owner); + } + } + finally + { + objectsLock.readLock().unlock(); + } + } + + public void cancelAttributeOwnershipAcquisition( + ObjectInstanceHandle objectInstanceHandle, + AttributeHandleSet attributeHandles, FederateHandle acquiree, + IoSession session) + { + objectsLock.readLock().lock(); + try + { + ObjectInstance objectInstance = + objects.get(objectInstanceHandle); + if (objectInstance != null) + { + objectInstance.cancelAttributeOwnershipAcquisition( + attributeHandles, acquiree, session); + } + } + finally + { + objectsLock.readLock().unlock(); + } + } + + public void queryAttributeOwnership( + ObjectInstanceHandle objectInstanceHandle, AttributeHandle attributeHandle, + IoSession session) + { + objectsLock.readLock().lock(); + try + { + ObjectInstance objectInstance = + objects.get(objectInstanceHandle); + if (objectInstance == null) + { + // the object was deleted after a query was issued... + } + else + { + objectInstance.queryAttributeOwnership( + attributeHandle, session); + } + } + finally + { + objectsLock.readLock().unlock(); + } + } +} Deleted: trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/OwnershipManager.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federation/ownership/OwnershipManager.java 2006-12-10 19:05:45 UTC (rev 78) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federation/objects/OwnershipManager.java 2006-12-16 03:16:37 UTC (rev 80) @@ -1,295 +0,0 @@ -/* - * Copyright (c) 2006, Michael Newcomb - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ohla.rti1516.federation.ownership; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.locks.ReadWriteLock; -import java.util.concurrent.locks.ReentrantReadWriteLock; - -import net.sf.ohla.rti1516.fdd.ObjectClass; -import net.sf.ohla.rti1516.federate.callbacks.DiscoverObjectInstance; -import net.sf.ohla.rti1516.federation.FederationExecution; - -import org.apache.mina.common.IoSession; -import org.apache.mina.common.WriteFuture; - -import hla.rti1516.AttributeHandle; -import hla.rti1516.AttributeHandleSet; -import hla.rti1516.AttributeSetRegionSetPairList; -import hla.rti1516.FederateHandle; -import hla.rti1516.ObjectInstanceHandle; - -public class OwnershipManager -{ - protected FederationExecution federationExecution; - - protected ReadWriteLock objectsLock = new ReentrantReadWriteLock(true); - protected Map<ObjectInstanceHandle, ObjectInstanceOwnership> objects = - new HashMap<ObjectInstanceHandle, ObjectInstanceOwnership>(); - - public OwnershipManager(FederationExecution federationExecution) - { - this.federationExecution = federationExecution; - } - - public void registerObjectInstance( - ObjectInstanceHandle objectInstanceHandle, ObjectClass objectClass, - Set<AttributeHandle> publishedAttributeHandles, FederateHandle owner) - { - objectsLock.writeLock().lock(); - try - { - objects.put(objectInstanceHandle, new ObjectInstanceOwnership( - objectInstanceHandle, objectClass, publishedAttributeHandles, owner)); - } - finally - { - objectsLock.writeLock().unlock(); - } - } - - public void subscribeObjectClassAttributes( - ObjectClass objectClass, AttributeHandleSet attributeHandles, - AttributeSetRegionSetPairList attributesAndRegions, IoSession session) - { - objectsLock.readLock().lock(); - try - { - WriteFuture lastWriteFuture = null; - for (ObjectInstanceOwnership objectInstanceOwnership : objects.values()) - { - if (objectClass.isAssignableFrom( - objectInstanceOwnership.getObjectClass())) - { - // TODO: DDM - - lastWriteFuture = session.write(new DiscoverObjectInstance( - objectInstanceOwnership.getObjectInstanceHandle(), - objectClass.getObjectClassHandle())); - } - } - - if (lastWriteFuture != null) - { - // wait until the last discover has been sent - // - lastWriteFuture.join(); - } - } - finally - { - objectsLock.readLock().unlock(); - } - } - - public void unconditionalAttributeOwnershipDivestiture( - ObjectInstanceHandle objectInstanceHandle, - AttributeHandleSet attributeHandles) - { - objectsLock.readLock().lock(); - try - { - ObjectInstanceOwnership objectInstanceOwnership = - objects.get(objectInstanceHandle); - if (objectInstanceOwnership != null) - { - objectInstanceOwnership.unconditionalAttributeOwnershipDivestiture( - attributeHandles, federationExecution); - } - } - finally - { - objectsLock.readLock().unlock(); - } - } - - public void negotiatedAttributeOwnershipDivestiture( - ObjectInstanceHandle objectInstanceHandle, - AttributeHandleSet attributeHandles, byte[] tag, IoSession session) - { - objectsLock.readLock().lock(); - try - { - ObjectInstanceOwnership objectInstanceOwnership = - objects.get(objectInstanceHandle); - if (objectInstanceOwnership != null) - { - objectInstanceOwnership.negotiatedAttributeOwnershipDivestiture( - attributeHandles, tag, session); - } - } - finally - { - objectsLock.readLock().unlock(); - } - } - - public void confirmDivestiture(ObjectInstanceHandle objectInstanceHandle, - AttributeHandleSet attributeHandles) - { - objectsLock.readLock().lock(); - try - { - ObjectInstanceOwnership objectInstanceOwnership = - objects.get(objectInstanceHandle); - if (objectInstanceOwnership != null) - { - objectInstanceOwnership.confirmDivestiture( - attributeHandles, federationExecution); - } - } - finally - { - objectsLock.readLock().unlock(); - } - } - - public void attributeOwnershipAcquisition( - ObjectInstanceHandle objectInstanceHandle, - AttributeHandleSet attributeHandles, byte[] tag, FederateHandle acquiree, - IoSession session) - { - objectsLock.readLock().lock(); - try - { - ObjectInstanceOwnership objectInstanceOwnership = - objects.get(objectInstanceHandle); - if (objectInstanceOwnership != null) - { - objectInstanceOwnership.attributeOwnershipAcquisition( - attributeHandles, tag, acquiree, session, federationExecution); - } - } - finally - { - objectsLock.readLock().unlock(); - } - } - - public void attributeOwnershipAcquisitionIfAvailable( - ObjectInstanceHandle objectInstanceHandle, - AttributeHandleSet attributeHandles, FederateHandle acquiree, - IoSession session) - { - objectsLock.readLock().lock(); - try - { - ObjectInstanceOwnership objectInstanceOwnership = - objects.get(objectInstanceHandle); - if (objectInstanceOwnership != null) - { - objectInstanceOwnership.attributeOwnershipAcquisitionIfAvailable( - attributeHandles, acquiree, session); - } - } - finally - { - objectsLock.readLock().unlock(); - } - } - - public Map<AttributeHandle, FederateHandle> attributeOwnershipDivestitureIfWanted( - ObjectInstanceHandle objectInstanceHandle, - AttributeHandleSet attributeHandles) - { - objectsLock.readLock().lock(); - try - { - Object... [truncated message content] |
From: <mne...@us...> - 2006-12-16 03:12:41
|
Revision: 79 http://svn.sourceforge.net/ohla/?rev=79&view=rev Author: mnewcomb Date: 2006-12-15 19:12:41 -0800 (Fri, 15 Dec 2006) Log Message: ----------- reverted back to version 72 because changes were too drastic, going to take slower approach Modified Paths: -------------- trunk/hla-1.3/src/java/hla/rti/RTIambassador.java trunk/ieee-1516/src/java/hla/rti1516/RTIambassador.java trunk/rti/src/java/net/sf/ohla/rti/OHLARTIambassador.java trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java trunk/rti/src/java/net/sf/ohla/rti1516/federate/MessageRetractionManager.java trunk/rti/src/java/net/sf/ohla/rti1516/federate/RegionManager.java trunk/rti/src/java/net/sf/ohla/rti1516/federate/callbacks/CallbackManager.java trunk/rti/src/java/net/sf/ohla/rti1516/federate/filter/InterestManagementFilter.java trunk/rti/src/java/net/sf/ohla/rti1516/federate/time/TimeManager.java Added Paths: ----------- trunk/rti/src/java/net/sf/ohla/rti1516/federate/objects/ trunk/rti/src/java/net/sf/ohla/rti1516/federate/objects/AttributeInstance.java trunk/rti/src/java/net/sf/ohla/rti1516/federate/objects/ObjectInstance.java trunk/rti/src/java/net/sf/ohla/rti1516/federate/objects/ObjectManager.java trunk/thirdparty/apache/mina/lib/backport-util-concurrent.jar trunk/thirdparty/apache/mina/lib/mina-core-1.1.0-SNAPSHOT.jar Removed Paths: ------------- trunk/rti/src/java/net/sf/ohla/rti1516/federate/objects/AttributeInstance.java trunk/rti/src/java/net/sf/ohla/rti1516/federate/objects/ObjectInstance.java trunk/rti/src/java/net/sf/ohla/rti1516/federate/objects/ObjectManager.java trunk/thirdparty/apache/mina/lib/mina-core-2.0.0-M1-SNAPSHOT.jar Modified: trunk/hla-1.3/src/java/hla/rti/RTIambassador.java =================================================================== --- trunk/hla-1.3/src/java/hla/rti/RTIambassador.java 2006-12-10 19:05:45 UTC (rev 78) +++ trunk/hla-1.3/src/java/hla/rti/RTIambassador.java 2006-12-16 03:12:41 UTC (rev 79) @@ -4,20 +4,20 @@ public interface RTIambassador { - void createFederationExecution(String federationExecutionName, URL fed) + void createFederationExecution(String federationName, URL fed) throws FederationExecutionAlreadyExists, CouldNotOpenFED, ErrorReadingFED, RTIinternalError; - void destroyFederationExecution(String federationExecutionName) + void destroyFederationExecution(String federationName) throws FederatesCurrentlyJoined, FederationExecutionDoesNotExist, RTIinternalError; - int joinFederationExecution(String federateType, String federationExecutionName, + int joinFederationExecution(String federateType, String federationName, FederateAmbassador federateAmbassador) throws FederateAlreadyExecutionMember, FederationExecutionDoesNotExist, SaveInProgress, RestoreInProgress, RTIinternalError; - int joinFederationExecution(String federateType, String federationExecutionName, + int joinFederationExecution(String federateType, String federationName, FederateAmbassador federateAmbassador, MobileFederateServices mobileFederateServices) throws FederateAlreadyExecutionMember, FederationExecutionDoesNotExist, Modified: trunk/ieee-1516/src/java/hla/rti1516/RTIambassador.java =================================================================== --- trunk/ieee-1516/src/java/hla/rti1516/RTIambassador.java 2006-12-10 19:05:45 UTC (rev 78) +++ trunk/ieee-1516/src/java/hla/rti1516/RTIambassador.java 2006-12-16 03:12:41 UTC (rev 79) @@ -13,7 +13,7 @@ * argument shall identify the FOM that furnishes the FDD for the federation * execution to be created. * - * @param federationExecutionName the name of the federation execution + * @param federationName the name of the federation execution * @param fdd the FOM document designator (FDD) * @throws FederationExecutionAlreadyExists thrown if the specified federation * name already exists @@ -21,7 +21,7 @@ * @throws ErrorReadingFDD thrown if the FDD could not be read * @throws RTIinternalError thrown if the RTI encountered an error */ - void createFederationExecution(String federationExecutionName, URL fdd) + void createFederationExecution(String federationName, URL fdd) throws FederationExecutionAlreadyExists, CouldNotOpenFDD, ErrorReadingFDD, RTIinternalError; @@ -32,14 +32,14 @@ * federates (all joined federates shall have resigned, either by explicit * action or via MOM activity) before this service is invoked. * - * @param federationExecutionName the name of the federation execution + * @param federationName the name of the federation execution * @throws FederatesCurrentlyJoined thrown if there are still federates joined * to the specified federation execution * @throws FederationExecutionDoesNotExist thrown if the federation execution * specified does not exist * @throws RTIinternalError thrown if the RTI encountered an error */ - void destroyFederationExecution(String federationExecutionName) + void destroyFederationExecution(String federationName) throws FederatesCurrentlyJoined, FederationExecutionDoesNotExist, RTIinternalError; @@ -52,7 +52,7 @@ * designator shall be unique for the lifetime of the federation execution. * * @param federateType - * @param federationExecutionName the name of the federation execution to join + * @param federationName the name of the federation execution to join * @param federateAmbassador * @param mobileFederateServices * @return the unique federate handle representing this federate @@ -65,7 +65,7 @@ * @throws RTIinternalError thrown if the RTI encountered an error */ FederateHandle joinFederationExecution( - String federateType, String federationExecutionName, + String federateType, String federationName, FederateAmbassador federateAmbassador, MobileFederateServices mobileFederateServices) throws FederateAlreadyExecutionMember, FederationExecutionDoesNotExist, @@ -185,7 +185,7 @@ throws FederateNotExecutionMember, SaveInProgress, RestoreInProgress, RTIinternalError; - void requestFederationSave(String label, LogicalTime saveTime) + void requestFederationSave(String label, LogicalTime time) throws LogicalTimeAlreadyPassed, InvalidLogicalTime, FederateUnableToUseTime, FederateNotExecutionMember, SaveInProgress, RestoreInProgress, RTIinternalError; Modified: trunk/rti/src/java/net/sf/ohla/rti/OHLARTIambassador.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti/OHLARTIambassador.java 2006-12-10 19:05:45 UTC (rev 78) +++ trunk/rti/src/java/net/sf/ohla/rti/OHLARTIambassador.java 2006-12-16 03:12:41 UTC (rev 79) @@ -36,6 +36,7 @@ import net.sf.ohla.rti1516.OHLAObjectInstanceHandle; import net.sf.ohla.rti1516.OHLAParameterHandle; import net.sf.ohla.rti1516.OHLARegionHandleSet; +import net.sf.ohla.rti1516.federate.Federate; import net.sf.ohla.rti1516.fdd.ObjectClass; import org.slf4j.Logger; @@ -214,6 +215,11 @@ protected LogicalTimeIntervalFactory logicalTimeIntervalFactory; protected hla.rti1516.LogicalTimeIntervalFactory ieee1516LogicalTimeIntervalFactory; + public Federate getJoinedFederate() + { + return rtiAmbassador.getJoinedFederate(); + } + public void createFederationExecution(String name, URL fed) throws FederationExecutionAlreadyExists, CouldNotOpenFED, ErrorReadingFED, RTIinternalError Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java 2006-12-10 19:05:45 UTC (rev 78) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java 2006-12-16 03:12:41 UTC (rev 79) @@ -63,7 +63,7 @@ import net.sf.ohla.rti1516.federate.callbacks.SynchronizationPointRegistrationFailed; import net.sf.ohla.rti1516.federate.callbacks.SynchronizationPointRegistrationSucceeded; import net.sf.ohla.rti1516.federate.filter.InterestManagementFilter; -import net.sf.ohla.rti1516.federation.objects.ObjectManager; +import net.sf.ohla.rti1516.federate.objects.ObjectManager; import net.sf.ohla.rti1516.federate.time.TimeManager; import net.sf.ohla.rti1516.filter.RequestResponseFilter; import net.sf.ohla.rti1516.messages.DefaultResponse; @@ -138,6 +138,7 @@ import hla.rti1516.DimensionHandleFactory; import hla.rti1516.DimensionHandleSet; import hla.rti1516.DimensionHandleSetFactory; +import hla.rti1516.FederateAlreadyExecutionMember; import hla.rti1516.FederateAmbassador; import hla.rti1516.FederateHandle; import hla.rti1516.FederateHandleFactory; @@ -3253,6 +3254,15 @@ return "1516.1.5"; } + protected void checkIfAlreadyExecutionMember() + throws FederateAlreadyExecutionMember + { + if (federateHandle != null) + { + throw new FederateAlreadyExecutionMember(federateHandle.toString()); + } + } + protected void startPeerAcceptor(String federateType) throws RTIinternalError { Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federate/MessageRetractionManager.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federate/MessageRetractionManager.java 2006-12-10 19:05:45 UTC (rev 78) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federate/MessageRetractionManager.java 2006-12-16 03:12:41 UTC (rev 79) @@ -17,6 +17,8 @@ public class MessageRetractionManager { + protected Federate federate; + protected AtomicLong messageRetractionCount = new AtomicLong(); protected Lock messageRetractionsLock = new ReentrantLock(true); @@ -25,8 +27,9 @@ protected Queue<MessageRetraction> messageRetractionsByExpiration = new PriorityQueue<MessageRetraction>(); - public MessageRetractionManager() + public MessageRetractionManager(Federate federate) { + this.federate = federate; } public MessageRetractionHandle add(LogicalTime time) Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federate/RegionManager.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federate/RegionManager.java 2006-12-10 19:05:45 UTC (rev 78) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federate/RegionManager.java 2006-12-16 03:12:41 UTC (rev 79) @@ -11,16 +11,17 @@ import net.sf.ohla.rti1516.OHLARegionHandleSet; import net.sf.ohla.rti1516.fdd.FDD; +import net.sf.ohla.rti1516.messages.CreateRegion; import net.sf.ohla.rti1516.messages.CommitRegionModifications; -import net.sf.ohla.rti1516.messages.CreateRegion; +import net.sf.ohla.rti1516.messages.RegionCreated; +import net.sf.ohla.rti1516.messages.RegionModificationsCommitted; import net.sf.ohla.rti1516.messages.DeleteRegion; +import net.sf.ohla.rti1516.messages.RegionDeleted; import net.sf.ohla.rti1516.messages.GetRangeBounds; -import org.apache.mina.common.IoSession; import org.apache.mina.common.WriteFuture; import hla.rti1516.AttributeHandleSet; -import hla.rti1516.AttributeHandleSetFactory; import hla.rti1516.AttributeRegionAssociation; import hla.rti1516.DimensionHandle; import hla.rti1516.DimensionHandleSet; @@ -39,20 +40,15 @@ public class RegionManager { - protected IoSession rtiSession; - protected FDD fdd; - protected AttributeHandleSetFactory attributeHandleSetFactory; + protected Federate federate; protected ReadWriteLock regionsLock = new ReentrantReadWriteLock(true); protected Map<RegionHandle, Region> regions = new HashMap<RegionHandle, Region>(); - public RegionManager(IoSession rtiSession, FDD fdd, - AttributeHandleSetFactory attributeHandleSetFactory) + public RegionManager(Federate federate) { - this.rtiSession = rtiSession; - this.fdd = fdd; - this.attributeHandleSetFactory = attributeHandleSetFactory; + this.federate = federate; } public RegionHandle createRegion(DimensionHandleSet dimensionHandles) @@ -61,7 +57,7 @@ try { CreateRegion createRegion = new CreateRegion(dimensionHandles); - WriteFuture writeFuture = rtiSession.write(createRegion); + WriteFuture writeFuture = federate.getRTISession().write(createRegion); // TODO: set timeout // @@ -83,13 +79,15 @@ try { regions.put(regionHandle, new Region( - regionHandle, dimensionHandles, fdd)); + regionHandle, dimensionHandles, federate.getFDD())); } finally { regionsLock.writeLock().unlock(); } + federate.sendToPeers(new RegionCreated(regionHandle, dimensionHandles)); + return regionHandle; } catch (InterruptedException ie) @@ -149,7 +147,8 @@ { GetRangeBounds getRangeBounds = new GetRangeBounds(regionHandle, dimensionHandle); - WriteFuture writeFuture = rtiSession.write(getRangeBounds); + WriteFuture writeFuture = + federate.getRTISession().write(getRangeBounds); // TODO: set timeout // @@ -236,7 +235,8 @@ { CommitRegionModifications commitRegionModifications = new CommitRegionModifications(regionModifications); - WriteFuture writeFuture = rtiSession.write(commitRegionModifications); + WriteFuture writeFuture = federate.getRTISession().write( + commitRegionModifications); // TODO: set timeout // @@ -250,6 +250,9 @@ // TODO: set timeout // commitRegionModifications.await(); + + federate.sendToPeers( + new RegionModificationsCommitted(regionModifications)); } catch (InterruptedException ie) { @@ -279,7 +282,7 @@ region.checkIfInUse(); DeleteRegion deleteRegion = new DeleteRegion(regionHandle); - WriteFuture writeFuture = rtiSession.write(deleteRegion); + WriteFuture writeFuture = federate.getRTISession().write(deleteRegion); // TODO: set timeout // @@ -295,6 +298,8 @@ deleteRegion.await(); regions.remove(regionHandle); + + federate.sendToPeers(new RegionDeleted(regionHandle)); } catch (InterruptedException ie) { @@ -575,7 +580,8 @@ associatedObjects.get(objectInstanceHandle); if (existingAttributeHandles == null) { - existingAttributeHandles = attributeHandleSetFactory.create(); + existingAttributeHandles = + federate.getAttributeHandleSetFactory().create(); associatedObjects.put(objectInstanceHandle, existingAttributeHandles); } @@ -606,7 +612,8 @@ subscribedObjectClasses.get(objectClassHandle); if (existingAttributeHandles == null) { - existingAttributeHandles = attributeHandleSetFactory.create(); + existingAttributeHandles = + federate.getAttributeHandleSetFactory().create(); subscribedObjectClasses.put(objectClassHandle, existingAttributeHandles); } Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federate/callbacks/CallbackManager.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federate/callbacks/CallbackManager.java 2006-12-10 19:05:45 UTC (rev 78) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federate/callbacks/CallbackManager.java 2006-12-16 03:12:41 UTC (rev 79) @@ -22,10 +22,11 @@ import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; +import net.sf.ohla.rti1516.federate.Federate; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import hla.rti1516.FederateAmbassador; import hla.rti1516.RTIexception; public class CallbackManager @@ -33,7 +34,7 @@ private static final Logger log = LoggerFactory.getLogger(CallbackManager.class); - protected FederateAmbassador federateAmbassador; + protected Federate federate; protected boolean enabled = true; @@ -43,9 +44,9 @@ protected Queue<Callback> heldCallbacks = new LinkedList<Callback>(); - public CallbackManager(FederateAmbassador federateAmbassador) + public CallbackManager(Federate federate) { - this.federateAmbassador = federateAmbassador; + this.federate = federate; } public void add(Callback callback) @@ -125,17 +126,17 @@ nanoTime + maxNanosTimeout, nanoTime); } - public void enableCallbacks() + public synchronized void enableCallbacks() { enabled = true; } - public void disableCallbacks() + public synchronized void disableCallbacks() { enabled = false; } - protected boolean evokeCallback(long nanoTimeout) + protected synchronized boolean evokeCallback(long nanoTimeout) { Callback callback = null; @@ -160,7 +161,7 @@ { try { - callback.execute(federateAmbassador); + callback.execute(federate.getFederateAmbassador()); } catch (Throwable t) { @@ -171,9 +172,9 @@ return areCallbacksPending(); } - protected boolean evokeMultipleCallbacks(long minNanoExpiration, - long maxNanoExpiration, - long nanoTime) + protected synchronized boolean evokeMultipleCallbacks(long minNanoExpiration, + long maxNanoExpiration, + long nanoTime) { while ((nanoTime < minNanoExpiration && evokeCallback(minNanoExpiration - nanoTime)) || @@ -187,14 +188,14 @@ return areCallbacksPending(); } - protected boolean evokeCallback() + protected synchronized boolean evokeCallback() { Callback callback = nextCallback(); if (callback != null) { try { - callback.execute(federateAmbassador); + callback.execute(federate.getFederateAmbassador()); } catch (RTIexception rtie) { Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federate/filter/InterestManagementFilter.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federate/filter/InterestManagementFilter.java 2006-12-10 19:05:45 UTC (rev 78) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federate/filter/InterestManagementFilter.java 2006-12-16 03:12:41 UTC (rev 79) @@ -20,6 +20,7 @@ import net.sf.ohla.rti1516.fdd.InteractionClass; import net.sf.ohla.rti1516.fdd.ObjectClass; +import net.sf.ohla.rti1516.federate.Federate; import net.sf.ohla.rti1516.federate.SubscriptionManager; import net.sf.ohla.rti1516.federate.callbacks.ReceiveInteraction; import net.sf.ohla.rti1516.federate.callbacks.ReflectAttributeValues; Copied: trunk/rti/src/java/net/sf/ohla/rti1516/federate/objects (from rev 72, trunk/rti/src/java/net/sf/ohla/rti1516/federate/objects) Deleted: trunk/rti/src/java/net/sf/ohla/rti1516/federate/objects/AttributeInstance.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federate/objects/AttributeInstance.java 2006-12-06 04:09:24 UTC (rev 72) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federate/objects/AttributeInstance.java 2006-12-16 03:12:41 UTC (rev 79) @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2006, Michael Newcomb - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ohla.rti1516.federate.objects; - -import java.io.Serializable; - -import net.sf.ohla.rti1516.fdd.Attribute; -import net.sf.ohla.rti1516.OHLARegionHandleSet; - -import hla.rti1516.AttributeAlreadyBeingDivested; -import hla.rti1516.AttributeDivestitureWasNotRequested; -import hla.rti1516.AttributeHandle; -import hla.rti1516.OrderType; -import hla.rti1516.RegionHandleSet; -import hla.rti1516.TransportationType; - -public class AttributeInstance - implements Serializable -{ - protected final Attribute attribute; - - protected TransportationType transportationType; - protected OrderType orderType; - - protected RegionHandleSet associatedRegions = new OHLARegionHandleSet(); - - public AttributeInstance(Attribute attribute) - { - this.attribute = attribute; - - transportationType = attribute.getTransportationType(); - orderType = attribute.getOrderType(); - } - - public Attribute getAttribute() - { - return attribute; - } - - public AttributeHandle getAttributeHandle() - { - return attribute.getAttributeHandle(); - } - - public TransportationType getTransportationType() - { - return transportationType; - } - - public void setTransportationType(TransportationType transportationType) - { - this.transportationType = transportationType; - } - - public OrderType getOrderType() - { - return orderType; - } - - public void setOrderType(OrderType orderType) - { - this.orderType = orderType; - } - - public RegionHandleSet getAssociatedRegions() - { - return associatedRegions; - } - - public void associateRegionsForUpdates(RegionHandleSet regionHandles) - { - associatedRegions.addAll(regionHandles); - } - - public void unassociateRegionsForUpdates(RegionHandleSet regionHandles) - { - associatedRegions.removeAll(regionHandles); - } - - public void negotiatedAttributeOwnershipDivestiture() - { - } - - public void confirmDivestiture() - { - } - - public void cancelNegotiatedAttributeOwnershipDivestiture() - { - } - - public void cancelAttributeOwnershipAcquisition() - { - } - - public void checkIfAttributeDivestitureWasNotRequested() - throws AttributeDivestitureWasNotRequested - { - // TODO: check status - } - - public void checkIfAttributeAlreadyBeingDivested() - throws AttributeAlreadyBeingDivested - { - // TODO: check status - } -} Copied: trunk/rti/src/java/net/sf/ohla/rti1516/federate/objects/AttributeInstance.java (from rev 72, trunk/rti/src/java/net/sf/ohla/rti1516/federate/objects/AttributeInstance.java) =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federate/objects/AttributeInstance.java (rev 0) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federate/objects/AttributeInstance.java 2006-12-16 03:12:41 UTC (rev 79) @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2006, Michael Newcomb + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.ohla.rti1516.federate.objects; + +import java.io.Serializable; + +import net.sf.ohla.rti1516.fdd.Attribute; +import net.sf.ohla.rti1516.OHLARegionHandleSet; + +import hla.rti1516.AttributeAlreadyBeingDivested; +import hla.rti1516.AttributeDivestitureWasNotRequested; +import hla.rti1516.AttributeHandle; +import hla.rti1516.OrderType; +import hla.rti1516.RegionHandleSet; +import hla.rti1516.TransportationType; + +public class AttributeInstance + implements Serializable +{ + protected final Attribute attribute; + + protected TransportationType transportationType; + protected OrderType orderType; + + protected RegionHandleSet associatedRegions = new OHLARegionHandleSet(); + + public AttributeInstance(Attribute attribute) + { + this.attribute = attribute; + + transportationType = attribute.getTransportationType(); + orderType = attribute.getOrderType(); + } + + public Attribute getAttribute() + { + return attribute; + } + + public AttributeHandle getAttributeHandle() + { + return attribute.getAttributeHandle(); + } + + public TransportationType getTransportationType() + { + return transportationType; + } + + public void setTransportationType(TransportationType transportationType) + { + this.transportationType = transportationType; + } + + public OrderType getOrderType() + { + return orderType; + } + + public void setOrderType(OrderType orderType) + { + this.orderType = orderType; + } + + public RegionHandleSet getAssociatedRegions() + { + return associatedRegions; + } + + public void associateRegionsForUpdates(RegionHandleSet regionHandles) + { + associatedRegions.addAll(regionHandles); + } + + public void unassociateRegionsForUpdates(RegionHandleSet regionHandles) + { + associatedRegions.removeAll(regionHandles); + } + + public void negotiatedAttributeOwnershipDivestiture() + { + } + + public void confirmDivestiture() + { + } + + public void cancelNegotiatedAttributeOwnershipDivestiture() + { + } + + public void cancelAttributeOwnershipAcquisition() + { + } + + public void checkIfAttributeDivestitureWasNotRequested() + throws AttributeDivestitureWasNotRequested + { + // TODO: check status + } + + public void checkIfAttributeAlreadyBeingDivested() + throws AttributeAlreadyBeingDivested + { + // TODO: check status + } +} Deleted: trunk/rti/src/java/net/sf/ohla/rti1516/federate/objects/ObjectInstance.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federate/objects/ObjectInstance.java 2006-12-06 04:09:24 UTC (rev 72) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federate/objects/ObjectInstance.java 2006-12-16 03:12:41 UTC (rev 79) @@ -1,1125 +0,0 @@ -/* - * Copyright (c) 2006, Michael Newcomb - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ohla.rti1516.federate.objects; - -import java.io.Serializable; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.locks.ReadWriteLock; -import java.util.concurrent.locks.ReentrantReadWriteLock; - -import net.sf.ohla.rti1516.fdd.Attribute; -import net.sf.ohla.rti1516.fdd.ObjectClass; -import net.sf.ohla.rti1516.federate.Federate; -import net.sf.ohla.rti1516.federate.callbacks.ReflectAttributeValues; -import net.sf.ohla.rti1516.OHLAAttributeHandleSet; -import net.sf.ohla.rti1516.OHLARegionHandleSet; -import net.sf.ohla.rti1516.messages.AttributeOwnershipAcquisition; -import net.sf.ohla.rti1516.messages.AttributeOwnershipAcquisitionIfAvailable; -import net.sf.ohla.rti1516.messages.AttributeOwnershipDivestitureIfWanted; -import net.sf.ohla.rti1516.messages.AttributeOwnershipDivestitureIfWantedResponse; -import net.sf.ohla.rti1516.messages.CancelAttributeOwnershipAcquisition; -import net.sf.ohla.rti1516.messages.CancelNegotiatedAttributeOwnershipDivestiture; -import net.sf.ohla.rti1516.messages.ConfirmDivestiture; -import net.sf.ohla.rti1516.messages.DefaultResponse; -import net.sf.ohla.rti1516.messages.NegotiatedAttributeOwnershipDivestiture; -import net.sf.ohla.rti1516.messages.QueryAttributeOwnership; -import net.sf.ohla.rti1516.messages.RequestAttributeValueUpdate; -import net.sf.ohla.rti1516.messages.UnconditionalAttributeOwnershipDivestiture; - -import org.apache.mina.common.IoSession; -import org.apache.mina.common.WriteFuture; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import hla.rti1516.AttributeAcquisitionWasNotRequested; -import hla.rti1516.AttributeAlreadyBeingAcquired; -import hla.rti1516.AttributeAlreadyBeingDivested; -import hla.rti1516.AttributeAlreadyOwned; -import hla.rti1516.AttributeDivestitureWasNotRequested; -import hla.rti1516.AttributeHandle; -import hla.rti1516.AttributeHandleSet; -import hla.rti1516.AttributeHandleValueMap; -import hla.rti1516.AttributeNotDefined; -import hla.rti1516.AttributeNotOwned; -import hla.rti1516.AttributeRegionAssociation; -import hla.rti1516.DeletePrivilegeNotHeld; -import hla.rti1516.FederateAmbassador; -import hla.rti1516.FederateOwnsAttributes; -import hla.rti1516.LogicalTime; -import hla.rti1516.MessageRetractionHandle; -import hla.rti1516.ObjectClassHandle; -import hla.rti1516.ObjectInstanceHandle; -import hla.rti1516.OrderType; -import hla.rti1516.OwnershipAcquisitionPending; -import hla.rti1516.RTIinternalError; -import hla.rti1516.RegionHandleSet; -import hla.rti1516.TransportationType; - -public class ObjectInstance - implements Serializable -{ - private static final Logger log = - LoggerFactory.getLogger(ObjectInstance.class); - - protected final ObjectInstanceHandle objectInstanceHandle; - protected final ObjectClass objectClass; - protected final String name; - - protected Map<AttributeHandle, AttributeInstance> attributes = - new HashMap<AttributeHandle, AttributeInstance>(); - - protected Set<AttributeHandle> attributeHandlesBeingAcquired = - new HashSet<AttributeHandle>(); - protected Set<AttributeHandle> attributeHandlesBeingAcquiredIfAvailable = - new HashSet<AttributeHandle>(); - - protected ReadWriteLock objectLock = new ReentrantReadWriteLock(true); - - public ObjectInstance(ObjectInstanceHandle objectInstanceHandle, - ObjectClass objectClass, String name) - { - this.objectInstanceHandle = objectInstanceHandle; - this.objectClass = objectClass; - this.name = name; - } - - public ObjectInstance(ObjectInstanceHandle objectInstanceHandle, - ObjectClass objectClass, String name, - Set<AttributeHandle> publishedAttributeHandles) - { - this(objectInstanceHandle, objectClass, name); - - for (AttributeHandle attributeHandle : publishedAttributeHandles) - { - Attribute attribute = objectClass.getAttributes().get(attributeHandle); - assert attribute != null; - - // create an attribute instance for each of the published attributes - // - attributes.put(attributeHandle, new AttributeInstance(attribute)); - } - - Attribute attribute = objectClass.getAttributesByName().get( - Attribute.HLA_PRIVILEGE_TO_DELETE_OBJECT); - assert attribute != null; - if (!attributes.containsKey(attribute.getAttributeHandle())) - { - // create an attribute instance for the HLA privilege to delete - // object attribute - // - attributes.put(attribute.getAttributeHandle(), - new AttributeInstance(attribute)); - } - } - - public ObjectInstanceHandle getObjectInstanceHandle() - { - return objectInstanceHandle; - } - - public ObjectClassHandle getObjectClassHandle() - { - return objectClass.getObjectClassHandle(); - } - - public ObjectClass getObjectClass() - { - return objectClass; - } - - public String getName() - { - return name; - } - - public void updateAttributeValues(AttributeHandleValueMap attributeValues, - byte[] tag, Federate federate) - throws AttributeNotDefined, AttributeNotOwned - { - objectLock.readLock().lock(); - try - { - checkIfAttributeNotOwned(attributeValues.keySet()); - - federate.sendToPeers(new ReflectAttributeValues( - objectInstanceHandle, objectClass.getObjectClassHandle(), - attributeValues, tag, OrderType.RECEIVE, - TransportationType.HLA_RELIABLE)); - } - finally - { - objectLock.readLock().unlock(); - } - } - - public void updateAttributeValues( - AttributeHandleValueMap attributeValues, byte[] tag, - LogicalTime updateTime, MessageRetractionHandle messageRetractionHandle, - OrderType sentOrderType, Federate federate) - throws AttributeNotDefined, AttributeNotOwned - { - objectLock.readLock().lock(); - try - { - if (sentOrderType == OrderType.TIMESTAMP) - { - // TODO: divide attributes by order type - } - - RegionHandleSet sentRegionHandles = new OHLARegionHandleSet(); - for (AttributeHandle attributeHandle : attributeValues.keySet()) - { - sentRegionHandles.addAll( - getAttributeInstance(attributeHandle).getAssociatedRegions()); - } - - federate.sendToPeers(new ReflectAttributeValues( - objectInstanceHandle, objectClass.getObjectClassHandle(), - attributeValues, tag, sentOrderType, TransportationType.HLA_RELIABLE, - updateTime, messageRetractionHandle, sentRegionHandles)); - } - finally - { - objectLock.readLock().unlock(); - } - } - - public void deleteObjectInstance(byte[] tag) - throws DeletePrivilegeNotHeld - { - objectLock.readLock().lock(); - try - { - Attribute attribute = objectClass.getAttributesByName().get( - Attribute.HLA_PRIVILEGE_TO_DELETE_OBJECT); - assert attribute != null; - if (!attributes.containsKey(attribute.getAttributeHandle())) - { - throw new DeletePrivilegeNotHeld(objectInstanceHandle.toString()); - } - } - finally - { - objectLock.readLock().unlock(); - } - } - - public void localDeleteObjectInstance() - throws FederateOwnsAttributes - { - objectLock.readLock().lock(); - try - { - if (!attributes.isEmpty()) - { - throw new FederateOwnsAttributes(String.format( - "%s - %s", objectInstanceHandle, attributes.keySet())); - } - } - finally - { - objectLock.readLock().unlock(); - } - } - - public void unconditionalAttributeOwnershipDivestiture( - AttributeHandleSet attributeHandles, IoSession rtiSession) - throws AttributeNotDefined, AttributeNotOwned, RTIinternalError - { - WriteFuture writeFuture; - - objectLock.writeLock().lock(); - try - { - checkIfAttributeNotOwned(attributeHandles); - - attributes.keySet().removeAll(attributeHandles); - - writeFuture = rtiSession.write( - new UnconditionalAttributeOwnershipDivestiture( - objectInstanceHandle, attributeHandles)); - } - finally - { - objectLock.writeLock().unlock(); - } - - // TODO: set timeout - // - writeFuture.join(); - if (!writeFuture.isWritten()) - { - throw new RTIinternalError("error communicating with RTI"); - } - } - - public void negotiatedAttributeOwnershipDivestiture( - AttributeHandleSet attributeHandles, byte[] tag, IoSession rtiSession) - throws AttributeNotDefined, AttributeNotOwned, - AttributeAlreadyBeingDivested, RTIinternalError - { - WriteFuture writeFuture; - - objectLock.writeLock().lock(); - try - { - checkIfAttributeAlreadyBeingDivested(attributeHandles); - - for (AttributeHandle attributeHandle : attributeHandles) - { - getAttributeInstance( - attributeHandle).negotiatedAttributeOwnershipDivestiture(); - } - - writeFuture = rtiSession.write( - new NegotiatedAttributeOwnershipDivestiture( - objectInstanceHandle, attributeHandles, tag)); - } - finally - { - objectLock.writeLock().unlock(); - } - - // TODO: set timeout - // - writeFuture.join(); - if (!writeFuture.isWritten()) - { - throw new RTIinternalError("error communicating with RTI"); - } - } - - public void confirmDivestiture(AttributeHandleSet attributeHandles, - byte[] tag, IoSession rtiSession) - throws AttributeNotDefined, AttributeNotOwned, - AttributeDivestitureWasNotRequested, RTIinternalError - { - WriteFuture writeFuture; - - objectLock.writeLock().lock(); - try - { - checkIfAttributeDivestitureWasNotRequested(attributeHandles); - - for (AttributeHandle attributeHandle : attributeHandles) - { - getAttributeInstance(attributeHandle).confirmDivestiture(); - attributes.remove(attributeHandle); - } - - writeFuture = rtiSession.write( - new ConfirmDivestiture(objectInstanceHandle, attributeHandles, tag)); - } - finally - { - objectLock.writeLock().unlock(); - } - - // TODO: set timeout - // - writeFuture.join(); - if (!writeFuture.isWritten()) - { - throw new RTIinternalError("error communicating with RTI"); - } - } - - public void attributeOwnershipAcquisition( - AttributeHandleSet attributeHandles, byte[] tag, IoSession rtiSession) - throws FederateOwnsAttributes, RTIinternalError - { - WriteFuture writeFuture; - - objectLock.writeLock().lock(); - try - { - checkIfFederateOwnsAttributes(attributeHandles); - - attributeHandlesBeingAcquired.addAll(attributeHandles); - - writeFuture = - rtiSession.write(new AttributeOwnershipAcquisition( - objectInstanceHandle, attributeHandles, tag)); - } - finally - { - objectLock.writeLock().unlock(); - } - - // TODO: set timeout - // - writeFuture.join(); - if (!writeFuture.isWritten()) - { - throw new RTIinternalError("error communicating with RTI"); - } - } - - public void attributeOwnershipAcquisitionIfAvailable( - AttributeHandleSet attributeHandles, IoSession rtiSession) - throws AttributeNotDefined, FederateOwnsAttributes, - AttributeAlreadyBeingAcquired, RTIinternalError - { - WriteFuture writeFuture; - - objectLock.writeLock().lock(); - try - { - Set<AttributeHandle> ownedAttributeHandles = - new HashSet<AttributeHandle>(); - Set<AttributeHandle> attributeHandlesAlreadyBeingAcquired = - new HashSet<AttributeHandle>(); - - for (AttributeHandle attributeHandle : attributeHandles) - { - objectClass.checkIfAttributeNotDefined(attributeHandle); - - if (attributes.containsKey(attributeHandle)) - { - ownedAttributeHandles.add(attributeHandle); - } - else if (attributeHandlesBeingAcquiredIfAvailable.contains( - attributeHandle)) - { - attributeHandlesAlreadyBeingAcquired.add(attributeHandle); - } - } - - if (!ownedAttributeHandles.isEmpty()) - { - throw new FederateOwnsAttributes(String.format( - "%s - %s", objectInstanceHandle, ownedAttributeHandles)); - } - else if (!attributeHandlesAlreadyBeingAcquired.isEmpty()) - { - throw new AttributeAlreadyBeingAcquired( - attributeHandlesAlreadyBeingAcquired.toString()); - } - - attributeHandlesBeingAcquiredIfAvailable.addAll(attributeHandles); - - writeFuture = - rtiSession.write(new AttributeOwnershipAcquisitionIfAvailable( - objectInstanceHandle, attributeHandles)); - } - finally - { - objectLock.writeLock().unlock(); - } - - // TODO: set timeout - // - writeFuture.join(); - if (!writeFuture.isWritten()) - { - throw new RTIinternalError("error communicating with RTI"); - } - } - - public AttributeHandleSet attributeOwnershipDivestitureIfWanted( - AttributeHandleSet attributeHandles, IoSession rtiSession) - throws AttributeNotDefined, AttributeNotOwned, RTIinternalError - { - objectLock.writeLock().lock(); - try - { - checkIfAttributeNotOwned(attributeHandles); - - AttributeOwnershipDivestitureIfWanted - attributeOwnershipDivestitureIfWanted = - new AttributeOwnershipDivestitureIfWanted( - objectInstanceHandle, attributeHandles); - WriteFuture writeFuture = - rtiSession.write(attributeOwnershipDivestitureIfWanted); - - // TODO: set timeout - // - writeFuture.join(); - - if (!writeFuture.isWritten()) - { - throw new RTIinternalError("error communicating with RTI"); - } - - try - { - // TODO: set timeout - // - Object response = attributeOwnershipDivestitureIfWanted.getResponse(); - - assert response instanceof AttributeOwnershipDivestitureIfWantedResponse : - String.format("unexpected response: %s", response); - - AttributeOwnershipDivestitureIfWantedResponse - attributeOwnershipDivestitureIfWantedResponse = - (AttributeOwnershipDivestitureIfWantedResponse) response; - - AttributeHandleSet divestedAttributeHandles = - attributeOwnershipDivestitureIfWantedResponse.getAttributeHandles(); - - attributes.keySet().removeAll(divestedAttributeHandles); - - // confirm that the attributes have been divested - // - writeFuture = rtiSession.write(new DefaultResponse( - attributeOwnershipDivestitureIfWantedResponse.getId())); - - if (!writeFuture.isWritten()) - { - throw new RTIinternalError("error communicating with RTI"); - } - - return divestedAttributeHandles; - } - catch (InterruptedException ie) - { - throw new RTIinternalError("interrupted awaitng response", ie); - } - catch (ExecutionException ee) - { - throw new RTIinternalError("unable to get response", ee); - } - } - finally - { - objectLock.writeLock().unlock(); - } - } - - public void cancelNegotiatedAttributeOwnershipDivestiture( - AttributeHandleSet attributeHandles, IoSession rtiSession) - throws AttributeNotDefined, AttributeNotOwned, - AttributeDivestitureWasNotRequested, RTIinternalError - { - WriteFuture writeFuture; - - objectLock.readLock().lock(); - try - { - for (AttributeHandle attributeHandle : attributeHandles) - { - getAttributeInstance( - attributeHandle).checkIfAttributeDivestitureWasNotRequested(); - } - - for (AttributeHandle attributeHandle : attributeHandles) - { - getAttributeInstance( - attributeHandle).cancelNegotiatedAttributeOwnershipDivestiture(); - } - - writeFuture = rtiSession.write( - new CancelNegotiatedAttributeOwnershipDivestiture( - objectInstanceHandle, attributeHandles)); - } - finally - { - objectLock.readLock().unlock(); - } - - // TODO: set timeout - // - writeFuture.join(); - if (!writeFuture.isWritten()) - { - throw new RTIinternalError("error communicating with RTI"); - } - } - - public void cancelAttributeOwnershipAcquisition( - AttributeHandleSet attributeHandles, IoSession rtiSession) - throws AttributeNotDefined, AttributeAlreadyOwned, - AttributeAcquisitionWasNotRequested, RTIinternalError - { - WriteFuture writeFuture; - - objectLock.readLock().lock(); - try - { - for (AttributeHandle attributeHandle : attributeHandles) - { - AttributeInstance attributeInstance = attributes.get(attributeHandle); - if (attributeInstance != null) - { - throw new AttributeAlreadyOwned(String.format("%s", attributeHandle)); - } - else if (!attributeHandlesBeingAcquired.contains(attributeHandle)) - { - throw new AttributeAcquisitionWasNotRequested( - String.format("%s", attributeHandle)); - } - else - { - objectClass.checkIfAttributeNotDefined(attributeHandle); - } - } - - for (AttributeHandle attributeHandle : attributeHandles) - { - attributes.get(attributeHandle).cancelAttributeOwnershipAcquisition(); - } - - writeFuture = rtiSession.write( - new CancelAttributeOwnershipAcquisition( - objectInstanceHandle, attributeHandles)); - } - finally - { - objectLock.readLock().unlock(); - } - - // TODO: set timeout - // - writeFuture.join(); - if (!writeFuture.isWritten()) - { - throw new RTIinternalError("error communicating with RTI"); - } - } - - public void queryAttributeOwnership(AttributeHandle attributeHandle, - IoSession rtiSession) - throws AttributeNotDefined, RTIinternalError - { - objectClass.checkIfAttributeNotDefined(attributeHandle); - - WriteFuture writeFuture; - - objectLock.readLock().lock(); - try - { - writeFuture = rtiSession.write( - new QueryAttributeOwnership(objectInstanceHandle, attributeHandle)); - } - finally - { - objectLock.readLock().unlock(); - } - - // TODO: set timeout - // - writeFuture.join(); - if (!writeFuture.isWritten()) - { - throw new RTIinternalError("error communicating with RTI"); - } - } - - public boolean isAttributeOwnedByFederate(AttributeHandle attributeHandle) - throws AttributeNotDefined - { - boolean owned; - - objectLock.readLock().lock(); - try - { - owned = attributes.get(attributeHandle) != null; - } - finally - { - objectLock.readLock().unlock(); - } - - if (!owned) - { - objectClass.checkIfAttributeNotDefined(attributeHandle); - } - - return owned; - } - - public void changeAttributeOrderType(Set<AttributeHandle> attributeHandles, - OrderType orderType) - throws AttributeNotDefined, AttributeNotOwned - { - objectLock.readLock().lock(); - try - { - for (AttributeHandle attributeHandle : attributeHandles) - { - getAttributeInstance(attributeHandle).setOrderType(orderType); - } - } - finally - { - objectLock.readLock().unlock(); - } - } - - public void changeAttributeTransportationType( - Set<AttributeHandle> attributeHandles, - TransportationType transportationType) - throws AttributeNotDefined, AttributeNotOwned - { - objectLock.readLock().lock(); - try - { - for (AttributeHandle attributeHandle : attributeHandles) - { - getAttributeInstance(attributeHandle).setTransportationType( - transportationType); - } - } - finally - { - objectLock.readLock().unlock(); - } - } - - public void requestAttributeValueUpdate(AttributeHandleSet attributeHandles, - byte[] tag, Federate federate) - throws AttributeNotDefined - { - objectClass.checkIfAttributeNotDefined(attributeHandles); - - attributeHandles = new OHLAAttributeHandleSet(attributeHandles); - - objectLock.readLock().lock(); - try - { - // only request updates for un-owned attributes - // - attributeHandles.removeAll(attributes.keySet()); - - federate.sendToPeers(new RequestAttributeValueUpdate( - objectInstanceHandle, attributeHandles, tag)); - } - finally - { - objectLock.readLock().unlock(); - } - } - - public void associateRegionsForUpdates( - AttributeRegionAssociation attributeRegionAssociation) - { - objectLock.readLock().lock(); - try - { - for (AttributeHandle attributeHandle : attributeRegionAssociation.attributes) - { - AttributeInstance attribute = attributes.get(attributeHandle); - if (attribute != null) - { - attribute.associateRegionsForUpdates( - attributeRegionAssociation.regions); - } - } - } - finally - { - objectLock.readLock().unlock(); - } - } - - public void unassociateRegionsForUpdates( - AttributeRegionAssociation attributeRegionAssociation) - { - objectLock.readLock().lock(); - try - { - for (AttributeHandle attributeHandle : attributeRegionAssociation.attributes) - { - AttributeInstance attribute = attributes.get(attributeHandle); - if (attribute != null) - { - attribute.unassociateRegionsForUpdates( - attributeRegionAssociation.regions); - } - } - } - finally - { - objectLock.readLock().unlock(); - } - } - - public void unpublishObjectClassAttributes( - AttributeHandleSet attributeHandles, IoSession rtiSession) - throws RTIinternalError - { - WriteFuture writeFuture; - - objectLock.writeLock().lock(); - try - { - attributes.keySet().removeAll(attributeHandles); - - writeFuture = rtiSession.write( - new UnconditionalAttributeOwnershipDivestiture( - objectInstanceHandle, attributeHandles)); - } - finally - { - objectLock.writeLock().unlock(); - } - - // TODO: set timeout - // - writeFuture.join(); - if (!writeFuture.isWritten()) - { - throw new RTIinternalError("error communicating with RTI"); - } - } - - public void checkIfOwnershipAcquisitionPending() - throws OwnershipAcquisitionPending - { - objectLock.writeLock().lock(); - try - { - if (!attributeHandlesBeingAcquired.isEmpty() || - !attributeHandlesBeingAcquiredIfAvailable.isEmpty()) - { - AttributeHandleSet allAttributeHandlesBeingAcquired = - new OHLAAttributeHandleSet(attributeHandlesBeingAcquired); - allAttributeHandlesBeingAcquired.addAll( - attributeHandlesBeingAcquiredIfAvailable); - throw new OwnershipAcquisitionPending( - allAttributeHandlesBeingAcquired.toString()); - } - } - finally - { - objectLock.writeLock().unlock(); - } - } - - public void checkIfOwnershipAcquisitionPending( - Set<AttributeHandle> attributeHandles) - throws OwnershipAcquisitionPending - { - objectLock.writeLock().lock(); - try - { - AttributeHandleSet allAttributeHandlesBeingAcquired = - new OHLAAttributeHandleSet(); - for (AttributeHandle attributeHandle : attributeHandles) - { - if (attributeHandlesBeingAcquired.contains(attributeHandle) || - attributeHandlesBeingAcquiredIfAvailable.contains(attributeHandle)) - { - allAttributeHandlesBeingAcquired.add(attributeHandle); - } - } - - if (!allAttributeHandlesBeingAcquired.isEmpty()) - { - throw new OwnershipAcquisitionPending( - allAttributeHandlesBeingAcquired.toString()); - } - } - finally - { - objectLock.writeLock().unlock(); - } - } - - public void checkIfFederateOwnsAttributes() - throws FederateOwnsAttributes - { - objectLock.readLock().lock(); - try - { - if (!attributes.isEmpty()) - { - throw new FederateOwnsAttributes(String.format( - "%s - %s", objectInstanceHandle, attributes.keySet())); - } - } - finally - { - objectLock.readLock().unlock(); - } - } - - public int hashCode() - { - return objectInstanceHandle.hashCode(); - } - - public boolean equals(Object rhs) - { - return rhs instanceof ObjectInstance && equals((ObjectInstance) rhs); - } - - public boolean equals(ObjectInstance rhs) - { - return rhs != null && objectInstanceHandle.equals(rhs.objectInstanceHandle); - } - - public String toString() - { - return String.format("%s (%s, %s)", objectInstanceHandle, name, - objectClass); - } - - protected AttributeInstance getAttributeInstance( - AttributeHandle attributeHandle) - throws AttributeNotDefined, AttributeNotOwned - { - AttributeInstance attributeInstance = attributes.get(attributeHandle); - if (attributeInstance == null) - { - // it might not be defined - // - objectClass.checkIfAttributeNotDefined(attributeHandle); - - throw new AttributeNotOwned(String.format("%s", attributeHandle)); - } - return attributeInstance; - } - - protected void checkIfAttributeNotOwned(Set<AttributeHandle> attributeHandles) - throws AttributeNotDefined, AttributeNotOwned - { - for (AttributeHandle attributeHandle : attributeHandles) - { - if (!attributes.containsKey(attributeHandle)) - { - // it might not be defined - // - objectClass.checkIfAttributeNotDefined(attributeHandle); - - throw new AttributeNotOwned(String.format("%s", attributeHandle)); - } - } - } - - protected void checkIfAttributeAlreadyBeingDivested( - Set<AttributeHandle> attributeHandles) - throws AttributeNotDefined, AttributeNotOwned, AttributeAlreadyBeingDivested - { - for (AttributeHandle attributeHandle : attributeHandles) - { - getAttributeInstance( - attributeHandle).checkIfAttributeAlreadyBeingDivested(); - } - } - - protected void checkIfAttributeDivestitureWasNotRequested( - Set<AttributeHandle> attributeHandles) - throws AttributeNotDefined, AttributeNotOwned, - AttributeDivestitureWasNotRequested - { - for (AttributeHandle attributeHandle : attributeHandles) - { - getAttributeInstance( - attributeHandle).checkIfAttributeDivestitureWasNotRequested(); - } - } - - protected void checkIfFederateOwnsAttributes( - Set<AttributeHandle> attributeHandles) - throws FederateOwnsAttributes - { - Set<AttributeHandle> ownedAttributeHandles = null; - for (AttributeHandle attributeHandle : attributeHandles) - { - if (attributes.containsKey(attributeHandle)) - { - if (ownedAttributeHandles == null) - { - ownedAttributeHandles = new HashSet<AttributeHandle>(); - } - ownedAttributeHandles.add(attributeHandle); - } - } - if (ownedAttributeHandles != null) - { - throw new FederateOwnsAttributes(String.format( - "%s - %s", objectInstanceHandle, ownedAttributeHandles)); - } - } - - public void discoverObjectInstance(ObjectInstanceHandle objectInstanceHandle, - ObjectClassHandle objectClassHandle, - String name, - FederateAmbassador federateAmbassador) - { - objectLock.readLock().lock(); - try - { - federateAmbassador.discoverObjectInstance( - objectInstanceHandle, objectClassHandle, name); - } - catch (Throwable t) - { - log.warn(String.format( - "federate unable to discover object instance: %s", - objectInstanceHandle), t); - } - finally - { - objectLock.readLock().unlock(); - } - } - - public void reflectAttributeValues( - ObjectInstanceHandle objectInstanceHandle, - AttributeHandleValueMap attributeValues, byte[] tag, - OrderType sentOrderType, TransportationType transportationType, - LogicalTime updateTime, OrderType receivedOrderType, - MessageRetractionHandle messageRetractionHandle, - RegionHandleSet sentRegionHandles, FederateAmbassador federateAmbassador) - { - objectLock.readLock().lock(); - try - { - if (updateTime == null) - { - if (sentRegionHandles == null) - { - federateAmbassador.reflectAttributeValues( - objectInstanceHandle, attributeValues, tag, sentOrderType, - transportationType); - } - else - { - federateAmbassador.reflectAttributeValues( - objectInstanceHandle, attributeValues, tag, sentOrderType, - transportationType, sentRegionHandles); - } - } - else if (messageRetractionHandle == null) - { - if (sentRegionHandles == null) - { - federateAmbassador.reflectAttributeValues( - objectInstanceHandle, attributeValues, tag, sentOrderType, - transportationType, updateTime, receivedOrderType); - } - else - { - federateAmbassador.reflectAttributeValues( - objectInstanceHandle, attributeValues, tag, sentOrderType, - transportationType, updateTime, receivedOrderType, sentRegionHandles); - } - } - else if (sentRegionHandles == null) - { - federateAmbassador.reflectAttributeValues( - objectInstanceHandle, attributeValues, tag, sentOrderType, - transportationType, updateTime, receivedOrderType, - messageRetractionHandle); - } - else - { - federateAmbassador.reflectAttributeValues( - objectInstanceHandle, attributeValues, tag, sentOrderType, - transportationType, updateTime, receivedOrderType, - messageRetractionHandle, sentRegionHandles); - } - } - catch (Throwable t) - { - log.warn(String.format( - "federate could not reflect attributes: %s", objectInstanceHandle), t); - } - finally - { - objectLock.readLock().unlock(); - } - } - - public void removeObjectInstance( - ObjectInstanceHandle objectInstanceHandle, byte[] tag, - OrderType sentOrderType, LogicalTime deleteTime, - OrderType receivedOrderType, - MessageRetractionHandle messageRetractionHandle, - FederateAmbassador federateAmbassador) - { - objectLock.readLock().lock(); - try - { - Attribute attribute = objectClass.getAttributesByName().get( - Attribute.HLA_PRIVILEGE_TO_DELETE_OBJECT); - assert attribute != null; - if (!attributes.containsKey(attribute.getAttributeHandle())) - { - if (deleteTime == null) - { - federateAmbassador.removeObjectInstance( - objectInstanceHandle, tag, sentOrderType); - } - else if (messageRetractionHandle == null) - { - federateAmbassador.removeObjectInstance( - objectInstanceHandle, tag, sentOrderType, deleteTime, - receivedOrderType); - } - else - { - federateAmbassador.removeObjectInstance( - objectInstanceHandle, tag, sentOrderType, deleteTime, - receivedOrderType, messageRetractionHandle); - } - } - } - catch (Throwable t) - { - log.warn(String.format( - "federate unable to remove object instance: %s", - objectInstanceHandle), t); - } - finally - { - objectLock.readLock().unlock(); - } - } - - public void attributeOwnershipAcquisitionNotification( - AttributeHandleSet attributeHandles, byte[] tag, - FederateAmbassador federateAmbassador) - { - objectLock.writeLock().lock(); - try - { - attributeHandlesBeingAcquired.removeAll(attributeHandles); - - for (AttributeHandle attributeHandle : attributeHandles) - { - Attribute attribute = objectClass.getAttributes().get(attributeHandle); - assert attribute != null; - - // create an attribute instance for each of the published attributes - // - attributes.put(attributeHandle, new AttributeInstance(attribute)); - } - - federateAmbassador.attributeOwnershipAcquisitionNotification( - objectInstanceHandle, attributeHandles, tag); - } - catch (Throwable t) - { - log.warn(String.format( - "federate unable to acquire object instance attributes: %s - %s", - objectInstanceHandle, attributeHandles), t); - } - finally - { - objectLock.writeLock().unlock(); - } - } -} Copied: trunk/rti/src/java/net/sf/ohla/rti1516/federate/objects/ObjectInstance.java (from rev 72, trunk/rti/src/java/net/sf/ohla/rti1516/federate/objects/ObjectInstance.java) =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federate/objects/ObjectInstance.java (rev 0) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federate/objects/ObjectInstance.java 2006-12-16 03:12:41 UTC (rev 79) @@ -0,0 +1,1125 @@ +/* + * Copyright (c) 2006, Michael Newcomb +... [truncated message content] |
From: <mne...@us...> - 2006-12-10 19:05:44
|
Revision: 78 http://svn.sourceforge.net/ohla/?rev=78&view=rev Author: mnewcomb Date: 2006-12-10 11:05:45 -0800 (Sun, 10 Dec 2006) Log Message: ----------- initial refactor to central-based RTI because of issues related to the spec that really don't allow a peer-to-peer type RTI Modified Paths: -------------- trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java trunk/rti/src/java/net/sf/ohla/rti1516/federate/MessageRetractionManager.java trunk/rti/src/java/net/sf/ohla/rti1516/federate/RegionManager.java trunk/rti/src/java/net/sf/ohla/rti1516/federate/callbacks/CallbackManager.java trunk/rti/src/java/net/sf/ohla/rti1516/federate/filter/InterestManagementFilter.java trunk/rti/src/java/net/sf/ohla/rti1516/federate/time/TimeManager.java Removed Paths: ------------- trunk/rti/src/java/net/sf/ohla/rti1516/federate/objects/ Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java 2006-12-10 19:05:06 UTC (rev 77) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java 2006-12-10 19:05:45 UTC (rev 78) @@ -63,7 +63,7 @@ import net.sf.ohla.rti1516.federate.callbacks.SynchronizationPointRegistrationFailed; import net.sf.ohla.rti1516.federate.callbacks.SynchronizationPointRegistrationSucceeded; import net.sf.ohla.rti1516.federate.filter.InterestManagementFilter; -import net.sf.ohla.rti1516.federate.objects.ObjectManager; +import net.sf.ohla.rti1516.federation.objects.ObjectManager; import net.sf.ohla.rti1516.federate.time.TimeManager; import net.sf.ohla.rti1516.filter.RequestResponseFilter; import net.sf.ohla.rti1516.messages.DefaultResponse; @@ -138,7 +138,6 @@ import hla.rti1516.DimensionHandleFactory; import hla.rti1516.DimensionHandleSet; import hla.rti1516.DimensionHandleSetFactory; -import hla.rti1516.FederateAlreadyExecutionMember; import hla.rti1516.FederateAmbassador; import hla.rti1516.FederateHandle; import hla.rti1516.FederateHandleFactory; @@ -3254,15 +3253,6 @@ return "1516.1.5"; } - protected void checkIfAlreadyExecutionMember() - throws FederateAlreadyExecutionMember - { - if (federateHandle != null) - { - throw new FederateAlreadyExecutionMember(federateHandle.toString()); - } - } - protected void startPeerAcceptor(String federateType) throws RTIinternalError { Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federate/MessageRetractionManager.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federate/MessageRetractionManager.java 2006-12-10 19:05:06 UTC (rev 77) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federate/MessageRetractionManager.java 2006-12-10 19:05:45 UTC (rev 78) @@ -17,8 +17,6 @@ public class MessageRetractionManager { - protected Federate federate; - protected AtomicLong messageRetractionCount = new AtomicLong(); protected Lock messageRetractionsLock = new ReentrantLock(true); @@ -27,9 +25,8 @@ protected Queue<MessageRetraction> messageRetractionsByExpiration = new PriorityQueue<MessageRetraction>(); - public MessageRetractionManager(Federate federate) + public MessageRetractionManager() { - this.federate = federate; } public MessageRetractionHandle add(LogicalTime time) Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federate/RegionManager.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federate/RegionManager.java 2006-12-10 19:05:06 UTC (rev 77) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federate/RegionManager.java 2006-12-10 19:05:45 UTC (rev 78) @@ -11,17 +11,16 @@ import net.sf.ohla.rti1516.OHLARegionHandleSet; import net.sf.ohla.rti1516.fdd.FDD; -import net.sf.ohla.rti1516.messages.CreateRegion; import net.sf.ohla.rti1516.messages.CommitRegionModifications; -import net.sf.ohla.rti1516.messages.RegionCreated; -import net.sf.ohla.rti1516.messages.RegionModificationsCommitted; +import net.sf.ohla.rti1516.messages.CreateRegion; import net.sf.ohla.rti1516.messages.DeleteRegion; -import net.sf.ohla.rti1516.messages.RegionDeleted; import net.sf.ohla.rti1516.messages.GetRangeBounds; +import org.apache.mina.common.IoSession; import org.apache.mina.common.WriteFuture; import hla.rti1516.AttributeHandleSet; +import hla.rti1516.AttributeHandleSetFactory; import hla.rti1516.AttributeRegionAssociation; import hla.rti1516.DimensionHandle; import hla.rti1516.DimensionHandleSet; @@ -40,15 +39,20 @@ public class RegionManager { - protected Federate federate; + protected IoSession rtiSession; + protected FDD fdd; + protected AttributeHandleSetFactory attributeHandleSetFactory; protected ReadWriteLock regionsLock = new ReentrantReadWriteLock(true); protected Map<RegionHandle, Region> regions = new HashMap<RegionHandle, Region>(); - public RegionManager(Federate federate) + public RegionManager(IoSession rtiSession, FDD fdd, + AttributeHandleSetFactory attributeHandleSetFactory) { - this.federate = federate; + this.rtiSession = rtiSession; + this.fdd = fdd; + this.attributeHandleSetFactory = attributeHandleSetFactory; } public RegionHandle createRegion(DimensionHandleSet dimensionHandles) @@ -57,7 +61,7 @@ try { CreateRegion createRegion = new CreateRegion(dimensionHandles); - WriteFuture writeFuture = federate.getRTISession().write(createRegion); + WriteFuture writeFuture = rtiSession.write(createRegion); // TODO: set timeout // @@ -79,15 +83,13 @@ try { regions.put(regionHandle, new Region( - regionHandle, dimensionHandles, federate.getFDD())); + regionHandle, dimensionHandles, fdd)); } finally { regionsLock.writeLock().unlock(); } - federate.sendToPeers(new RegionCreated(regionHandle, dimensionHandles)); - return regionHandle; } catch (InterruptedException ie) @@ -147,8 +149,7 @@ { GetRangeBounds getRangeBounds = new GetRangeBounds(regionHandle, dimensionHandle); - WriteFuture writeFuture = - federate.getRTISession().write(getRangeBounds); + WriteFuture writeFuture = rtiSession.write(getRangeBounds); // TODO: set timeout // @@ -235,8 +236,7 @@ { CommitRegionModifications commitRegionModifications = new CommitRegionModifications(regionModifications); - WriteFuture writeFuture = federate.getRTISession().write( - commitRegionModifications); + WriteFuture writeFuture = rtiSession.write(commitRegionModifications); // TODO: set timeout // @@ -250,9 +250,6 @@ // TODO: set timeout // commitRegionModifications.await(); - - federate.sendToPeers( - new RegionModificationsCommitted(regionModifications)); } catch (InterruptedException ie) { @@ -282,7 +279,7 @@ region.checkIfInUse(); DeleteRegion deleteRegion = new DeleteRegion(regionHandle); - WriteFuture writeFuture = federate.getRTISession().write(deleteRegion); + WriteFuture writeFuture = rtiSession.write(deleteRegion); // TODO: set timeout // @@ -298,8 +295,6 @@ deleteRegion.await(); regions.remove(regionHandle); - - federate.sendToPeers(new RegionDeleted(regionHandle)); } catch (InterruptedException ie) { @@ -580,8 +575,7 @@ associatedObjects.get(objectInstanceHandle); if (existingAttributeHandles == null) { - existingAttributeHandles = - federate.getAttributeHandleSetFactory().create(); + existingAttributeHandles = attributeHandleSetFactory.create(); associatedObjects.put(objectInstanceHandle, existingAttributeHandles); } @@ -612,8 +606,7 @@ subscribedObjectClasses.get(objectClassHandle); if (existingAttributeHandles == null) { - existingAttributeHandles = - federate.getAttributeHandleSetFactory().create(); + existingAttributeHandles = attributeHandleSetFactory.create(); subscribedObjectClasses.put(objectClassHandle, existingAttributeHandles); } Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federate/callbacks/CallbackManager.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federate/callbacks/CallbackManager.java 2006-12-10 19:05:06 UTC (rev 77) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federate/callbacks/CallbackManager.java 2006-12-10 19:05:45 UTC (rev 78) @@ -22,11 +22,10 @@ import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; -import net.sf.ohla.rti1516.federate.Federate; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import hla.rti1516.FederateAmbassador; import hla.rti1516.RTIexception; public class CallbackManager @@ -34,7 +33,7 @@ private static final Logger log = LoggerFactory.getLogger(CallbackManager.class); - protected Federate federate; + protected FederateAmbassador federateAmbassador; protected boolean enabled = true; @@ -44,9 +43,9 @@ protected Queue<Callback> heldCallbacks = new LinkedList<Callback>(); - public CallbackManager(Federate federate) + public CallbackManager(FederateAmbassador federateAmbassador) { - this.federate = federate; + this.federateAmbassador = federateAmbassador; } public void add(Callback callback) @@ -126,17 +125,17 @@ nanoTime + maxNanosTimeout, nanoTime); } - public synchronized void enableCallbacks() + public void enableCallbacks() { enabled = true; } - public synchronized void disableCallbacks() + public void disableCallbacks() { enabled = false; } - protected synchronized boolean evokeCallback(long nanoTimeout) + protected boolean evokeCallback(long nanoTimeout) { Callback callback = null; @@ -161,7 +160,7 @@ { try { - callback.execute(federate.getFederateAmbassador()); + callback.execute(federateAmbassador); } catch (Throwable t) { @@ -172,9 +171,9 @@ return areCallbacksPending(); } - protected synchronized boolean evokeMultipleCallbacks(long minNanoExpiration, - long maxNanoExpiration, - long nanoTime) + protected boolean evokeMultipleCallbacks(long minNanoExpiration, + long maxNanoExpiration, + long nanoTime) { while ((nanoTime < minNanoExpiration && evokeCallback(minNanoExpiration - nanoTime)) || @@ -188,14 +187,14 @@ return areCallbacksPending(); } - protected synchronized boolean evokeCallback() + protected boolean evokeCallback() { Callback callback = nextCallback(); if (callback != null) { try { - callback.execute(federate.getFederateAmbassador()); + callback.execute(federateAmbassador); } catch (RTIexception rtie) { Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federate/filter/InterestManagementFilter.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federate/filter/InterestManagementFilter.java 2006-12-10 19:05:06 UTC (rev 77) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federate/filter/InterestManagementFilter.java 2006-12-10 19:05:45 UTC (rev 78) @@ -20,7 +20,6 @@ import net.sf.ohla.rti1516.fdd.InteractionClass; import net.sf.ohla.rti1516.fdd.ObjectClass; -import net.sf.ohla.rti1516.federate.Federate; import net.sf.ohla.rti1516.federate.SubscriptionManager; import net.sf.ohla.rti1516.federate.callbacks.ReceiveInteraction; import net.sf.ohla.rti1516.federate.callbacks.ReflectAttributeValues; Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federate/time/TimeManager.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federate/time/TimeManager.java 2006-12-10 19:05:06 UTC (rev 77) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federate/time/TimeManager.java 2006-12-10 19:05:45 UTC (rev 78) @@ -19,7 +19,6 @@ import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; -import net.sf.ohla.rti1516.federate.Federate; import net.sf.ohla.rti1516.federate.callbacks.TimeAdvanceGrant; import net.sf.ohla.rti1516.messages.DisableTimeConstrained; import net.sf.ohla.rti1516.messages.DisableTimeRegulation; @@ -29,6 +28,7 @@ import net.sf.ohla.rti1516.messages.TimeAdvanceRequest; import net.sf.ohla.rti1516.messages.TimeAdvanceRequestAvailable; +import org.apache.mina.common.IoSession; import org.apache.mina.common.WriteFuture; import org.slf4j.Logger; @@ -56,7 +56,7 @@ { private static final Logger log = LoggerFactory.getLogger(TimeManager.class); - protected final Federate federate; + protected IoSession rtiSession; protected final MobileFederateServices mobileFederateServices; protected ReadWriteLock timeLock = new ReentrantReadWriteLock(true); @@ -76,11 +76,11 @@ protected LogicalTime advanceRequestTime; protected TimeAdvanceType advanceRequestTimeType; - public TimeManager(Federate federate, + public TimeManager(IoSession rtiSession, MobileFederateServices mobileFederateServices, LogicalTime galt) { - this.federate = federate; + this.rtiSession = rtiSession; this.mobileFederateServices = mobileFederateServices; this.galt = galt; @@ -134,7 +134,7 @@ checkIfRequestForTimeRegulationPending(); WriteFuture writeFuture = - federate.getRTISession().write(new EnableTimeRegulation(lookahead)); + rtiSession.write(new EnableTimeRegulation(lookahead)); // TODO: set timeout // @@ -164,7 +164,7 @@ checkIfTimeRegulationIsNotEnabled(); WriteFuture writeFuture = - federate.getRTISession().write(new DisableTimeRegulation()); + rtiSession.write(new DisableTimeRegulation()); // TODO: set timeout // @@ -200,7 +200,7 @@ checkIfRequestForTimeConstrainedPending(); WriteFuture writeFuture = - federate.getRTISession().write(new EnableTimeConstrained()); + rtiSession.write(new EnableTimeConstrained()); // TODO: set timeout // @@ -228,7 +228,7 @@ checkIfTimeConstrainedIsNotEnabled(); WriteFuture writeFuture = - federate.getRTISession().write(new DisableTimeConstrained()); + rtiSession.write(new DisableTimeConstrained()); // TODO: set timeout // @@ -276,7 +276,7 @@ else { WriteFuture writeFuture = - federate.getRTISession().write(new TimeAdvanceRequest(time)); + rtiSession.write(new TimeAdvanceRequest(time)); // TODO: set timeout // @@ -329,7 +329,7 @@ else { WriteFuture writeFuture = - federate.getRTISession().write(new TimeAdvanceRequestAvailable(time)); + rtiSession.write(new TimeAdvanceRequestAvailable(time)); // TODO: set timeout // @@ -380,7 +380,7 @@ else { WriteFuture writeFuture = - federate.getRTISession().write(new TimeAdvanceRequest(time)); + rtiSession.write(new TimeAdvanceRequest(time)); // TODO: set timeout // @@ -431,7 +431,7 @@ else { WriteFuture writeFuture = - federate.getRTISession().write(new TimeAdvanceRequest(time)); + rtiSession.write(new TimeAdvanceRequest(time)); // TODO: set timeout // @@ -482,7 +482,7 @@ else { WriteFuture writeFuture = - federate.getRTISession().write(new TimeAdvanceRequest(time)); + rtiSession.write(new TimeAdvanceRequest(time)); // TODO: set timeout // @@ -570,7 +570,7 @@ checkIfInTimeAdvancingState(); WriteFuture writeFuture = - federate.getRTISession().write(new ModifyLookahead(lookahead)); + rtiSession.write(new ModifyLookahead(lookahead)); // TODO: set timeout // This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mne...@us...> - 2006-12-10 19:05:06
|
Revision: 77 http://svn.sourceforge.net/ohla/?rev=77&view=rev Author: mnewcomb Date: 2006-12-10 11:05:06 -0800 (Sun, 10 Dec 2006) Log Message: ----------- initial refactor to central-based RTI because of issues related to the spec that really don't allow a peer-to-peer type RTI Modified Paths: -------------- trunk/rti/src/java/net/sf/ohla/rti/OHLARTIambassador.java Modified: trunk/rti/src/java/net/sf/ohla/rti/OHLARTIambassador.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti/OHLARTIambassador.java 2006-12-10 03:41:10 UTC (rev 76) +++ trunk/rti/src/java/net/sf/ohla/rti/OHLARTIambassador.java 2006-12-10 19:05:06 UTC (rev 77) @@ -36,7 +36,6 @@ import net.sf.ohla.rti1516.OHLAObjectInstanceHandle; import net.sf.ohla.rti1516.OHLAParameterHandle; import net.sf.ohla.rti1516.OHLARegionHandleSet; -import net.sf.ohla.rti1516.federate.Federate; import net.sf.ohla.rti1516.fdd.ObjectClass; import org.slf4j.Logger; @@ -215,11 +214,6 @@ protected LogicalTimeIntervalFactory logicalTimeIntervalFactory; protected hla.rti1516.LogicalTimeIntervalFactory ieee1516LogicalTimeIntervalFactory; - public Federate getJoinedFederate() - { - return rtiAmbassador.getJoinedFederate(); - } - public void createFederationExecution(String name, URL fed) throws FederationExecutionAlreadyExists, CouldNotOpenFED, ErrorReadingFED, RTIinternalError This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mne...@us...> - 2006-12-10 03:41:10
|
Revision: 76 http://svn.sourceforge.net/ohla/?rev=76&view=rev Author: mnewcomb Date: 2006-12-09 19:41:10 -0800 (Sat, 09 Dec 2006) Log Message: ----------- changed variable name Modified Paths: -------------- trunk/ieee-1516/src/java/hla/rti1516/RTIambassador.java Modified: trunk/ieee-1516/src/java/hla/rti1516/RTIambassador.java =================================================================== --- trunk/ieee-1516/src/java/hla/rti1516/RTIambassador.java 2006-12-10 03:07:31 UTC (rev 75) +++ trunk/ieee-1516/src/java/hla/rti1516/RTIambassador.java 2006-12-10 03:41:10 UTC (rev 76) @@ -185,7 +185,7 @@ throws FederateNotExecutionMember, SaveInProgress, RestoreInProgress, RTIinternalError; - void requestFederationSave(String label, LogicalTime time) + void requestFederationSave(String label, LogicalTime saveTime) throws LogicalTimeAlreadyPassed, InvalidLogicalTime, FederateUnableToUseTime, FederateNotExecutionMember, SaveInProgress, RestoreInProgress, RTIinternalError; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mne...@us...> - 2006-12-10 03:07:30
|
Revision: 75 http://svn.sourceforge.net/ohla/?rev=75&view=rev Author: mnewcomb Date: 2006-12-09 19:07:31 -0800 (Sat, 09 Dec 2006) Log Message: ----------- renamed federateName to federationExecutionName Modified Paths: -------------- trunk/hla-1.3/src/java/hla/rti/RTIambassador.java trunk/ieee-1516/src/java/hla/rti1516/RTIambassador.java Modified: trunk/hla-1.3/src/java/hla/rti/RTIambassador.java =================================================================== --- trunk/hla-1.3/src/java/hla/rti/RTIambassador.java 2006-12-10 02:57:37 UTC (rev 74) +++ trunk/hla-1.3/src/java/hla/rti/RTIambassador.java 2006-12-10 03:07:31 UTC (rev 75) @@ -4,20 +4,20 @@ public interface RTIambassador { - void createFederationExecution(String federationName, URL fed) + void createFederationExecution(String federationExecutionName, URL fed) throws FederationExecutionAlreadyExists, CouldNotOpenFED, ErrorReadingFED, RTIinternalError; - void destroyFederationExecution(String federationName) + void destroyFederationExecution(String federationExecutionName) throws FederatesCurrentlyJoined, FederationExecutionDoesNotExist, RTIinternalError; - int joinFederationExecution(String federateType, String federationName, + int joinFederationExecution(String federateType, String federationExecutionName, FederateAmbassador federateAmbassador) throws FederateAlreadyExecutionMember, FederationExecutionDoesNotExist, SaveInProgress, RestoreInProgress, RTIinternalError; - int joinFederationExecution(String federateType, String federationName, + int joinFederationExecution(String federateType, String federationExecutionName, FederateAmbassador federateAmbassador, MobileFederateServices mobileFederateServices) throws FederateAlreadyExecutionMember, FederationExecutionDoesNotExist, Modified: trunk/ieee-1516/src/java/hla/rti1516/RTIambassador.java =================================================================== --- trunk/ieee-1516/src/java/hla/rti1516/RTIambassador.java 2006-12-10 02:57:37 UTC (rev 74) +++ trunk/ieee-1516/src/java/hla/rti1516/RTIambassador.java 2006-12-10 03:07:31 UTC (rev 75) @@ -13,7 +13,7 @@ * argument shall identify the FOM that furnishes the FDD for the federation * execution to be created. * - * @param federationName the name of the federation execution + * @param federationExecutionName the name of the federation execution * @param fdd the FOM document designator (FDD) * @throws FederationExecutionAlreadyExists thrown if the specified federation * name already exists @@ -21,7 +21,7 @@ * @throws ErrorReadingFDD thrown if the FDD could not be read * @throws RTIinternalError thrown if the RTI encountered an error */ - void createFederationExecution(String federationName, URL fdd) + void createFederationExecution(String federationExecutionName, URL fdd) throws FederationExecutionAlreadyExists, CouldNotOpenFDD, ErrorReadingFDD, RTIinternalError; @@ -32,14 +32,14 @@ * federates (all joined federates shall have resigned, either by explicit * action or via MOM activity) before this service is invoked. * - * @param federationName the name of the federation execution + * @param federationExecutionName the name of the federation execution * @throws FederatesCurrentlyJoined thrown if there are still federates joined * to the specified federation execution * @throws FederationExecutionDoesNotExist thrown if the federation execution * specified does not exist * @throws RTIinternalError thrown if the RTI encountered an error */ - void destroyFederationExecution(String federationName) + void destroyFederationExecution(String federationExecutionName) throws FederatesCurrentlyJoined, FederationExecutionDoesNotExist, RTIinternalError; @@ -52,7 +52,7 @@ * designator shall be unique for the lifetime of the federation execution. * * @param federateType - * @param federationName the name of the federation execution to join + * @param federationExecutionName the name of the federation execution to join * @param federateAmbassador * @param mobileFederateServices * @return the unique federate handle representing this federate @@ -65,7 +65,7 @@ * @throws RTIinternalError thrown if the RTI encountered an error */ FederateHandle joinFederationExecution( - String federateType, String federationName, + String federateType, String federationExecutionName, FederateAmbassador federateAmbassador, MobileFederateServices mobileFederateServices) throws FederateAlreadyExecutionMember, FederationExecutionDoesNotExist, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mne...@us...> - 2006-12-10 02:57:37
|
Revision: 74 http://svn.sourceforge.net/ohla/?rev=74&view=rev Author: mnewcomb Date: 2006-12-09 18:57:37 -0800 (Sat, 09 Dec 2006) Log Message: ----------- MINA 1.1 was changed to 2.0, so I got 2.0 Added Paths: ----------- trunk/thirdparty/apache/mina/lib/mina-core-2.0.0-M1-SNAPSHOT.jar Removed Paths: ------------- trunk/thirdparty/apache/mina/lib/mina-core-1.1.0-SNAPSHOT.jar Deleted: trunk/thirdparty/apache/mina/lib/mina-core-1.1.0-SNAPSHOT.jar =================================================================== (Binary files differ) Added: trunk/thirdparty/apache/mina/lib/mina-core-2.0.0-M1-SNAPSHOT.jar =================================================================== (Binary files differ) Property changes on: trunk/thirdparty/apache/mina/lib/mina-core-2.0.0-M1-SNAPSHOT.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mne...@us...> - 2006-12-10 02:46:55
|
Revision: 73 http://svn.sourceforge.net/ohla/?rev=73&view=rev Author: mnewcomb Date: 2006-12-09 18:46:55 -0800 (Sat, 09 Dec 2006) Log Message: ----------- updated to latest version of MINA 1.1 SNAPSHOT Modified Paths: -------------- trunk/thirdparty/apache/mina/lib/mina-core-1.1.0-SNAPSHOT.jar Removed Paths: ------------- trunk/thirdparty/apache/mina/lib/backport-util-concurrent.jar Deleted: trunk/thirdparty/apache/mina/lib/backport-util-concurrent.jar =================================================================== (Binary files differ) Modified: trunk/thirdparty/apache/mina/lib/mina-core-1.1.0-SNAPSHOT.jar =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mne...@us...> - 2006-12-06 04:09:24
|
Revision: 72 http://svn.sourceforge.net/ohla/?rev=72&view=rev Author: mnewcomb Date: 2006-12-05 20:09:24 -0800 (Tue, 05 Dec 2006) Log Message: ----------- initial tests for time stamped attribute values and interactions are done Modified Paths: -------------- trunk/testsuite/src/java/net/sf/ohla/rti1516/TimeManagementTestNG.java Modified: trunk/testsuite/src/java/net/sf/ohla/rti1516/TimeManagementTestNG.java =================================================================== --- trunk/testsuite/src/java/net/sf/ohla/rti1516/TimeManagementTestNG.java 2006-12-06 04:08:28 UTC (rev 71) +++ trunk/testsuite/src/java/net/sf/ohla/rti1516/TimeManagementTestNG.java 2006-12-06 04:09:24 UTC (rev 72) @@ -53,6 +53,11 @@ import hla.rti1516.OrderType; import hla.rti1516.TransportationType; import hla.rti1516.ParameterHandleValueMap; +import hla.rti1516.ObjectInstanceNotKnown; +import hla.rti1516.AttributeNotRecognized; +import hla.rti1516.AttributeNotSubscribed; +import hla.rti1516.RegionHandleSet; +import hla.rti1516.MessageRetractionHandle; import hla.rti1516.jlc.NullFederateAmbassador; public class TimeManagementTestNG @@ -71,6 +76,8 @@ protected Integer64Time four = new Integer64Time(4); protected Integer64Time five = new Integer64Time(5); protected Integer64Time six = new Integer64Time(6); + protected Integer64Time seven = new Integer64Time(7); + protected Integer64Time nine = new Integer64Time(9); protected Integer64Time ten = new Integer64Time(10); protected Integer64Time fifteen = new Integer64Time(15); protected Integer64Time twenty = new Integer64Time(20); @@ -609,8 +616,8 @@ rtiAmbassadors.get(2).updateAttributeValues( objectInstanceHandle, attributeValues, null); - // the 2 constrained federates will not receive it because they do not have - // asynchronous delivery enabled and are not in the time + // the 2 constrained federates will not receive it because they do not + // have asynchronous delivery enabled and are not in the time // advancing state // federateAmbassadors.get(3).checkAttributeValuesNotReceived( @@ -626,6 +633,8 @@ federateAmbassadors.get(3).checkTimeAdvanceGrant(five); federateAmbassadors.get(4).checkTimeAdvanceGrant(five); + // attribute values should have been released + // federateAmbassadors.get(3).checkAttributeValues( objectInstanceHandle, attributeValues); federateAmbassadors.get(4).checkAttributeValues( @@ -634,6 +643,21 @@ finally { rtiAmbassadors.get(2).deleteObjectInstance(objectInstanceHandle, null); + + // bring all the federates to the same time + // + rtiAmbassadors.get(2).timeAdvanceRequest(six); + rtiAmbassadors.get(3).timeAdvanceRequest(six); + rtiAmbassadors.get(4).timeAdvanceRequest(six); + + federateAmbassadors.get(2).checkTimeAdvanceGrant(six); + federateAmbassadors.get(3).checkTimeAdvanceGrant(six); + federateAmbassadors.get(4).checkTimeAdvanceGrant(six); + + federateAmbassadors.get(3).checkForRemovedObjectInstanceHandle( + objectInstanceHandle); + federateAmbassadors.get(4).checkForRemovedObjectInstanceHandle( + objectInstanceHandle); } } @@ -659,18 +683,118 @@ // bring all the federates to the same time // - rtiAmbassadors.get(2).timeAdvanceRequest(six); - rtiAmbassadors.get(3).timeAdvanceRequest(six); - rtiAmbassadors.get(4).timeAdvanceRequest(six); + rtiAmbassadors.get(2).timeAdvanceRequest(seven); + rtiAmbassadors.get(3).timeAdvanceRequest(seven); + rtiAmbassadors.get(4).timeAdvanceRequest(seven); - federateAmbassadors.get(2).checkTimeAdvanceGrant(six); - federateAmbassadors.get(3).checkTimeAdvanceGrant(six); - federateAmbassadors.get(4).checkTimeAdvanceGrant(six); + federateAmbassadors.get(2).checkTimeAdvanceGrant(seven); + federateAmbassadors.get(3).checkTimeAdvanceGrant(seven); + federateAmbassadors.get(4).checkTimeAdvanceGrant(seven); + // parameter values should have been released + // federateAmbassadors.get(3).checkParameterValues(parameterValues); federateAmbassadors.get(4).checkParameterValues(parameterValues); } + @Test(dependsOnMethods = {"testSendInteractionWhileNotTimeAdvancing"}) + public void testUpdateValuesInTheFuture() + throws Exception + { + ObjectInstanceHandle objectInstanceHandle = + rtiAmbassadors.get(2).registerObjectInstance(testObjectClassHandle); + try + { + federateAmbassadors.get(3).checkObjectInstanceHandle( + objectInstanceHandle); + federateAmbassadors.get(4).checkObjectInstanceHandle( + objectInstanceHandle); + + AttributeHandleValueMap attributeValues = + rtiAmbassadors.get(1).getAttributeHandleValueMapFactory().create(3); + attributeValues.put(attributeHandle1, ATTRIBUTE1_VALUE.getBytes()); + attributeValues.put(attributeHandle2, ATTRIBUTE2_VALUE.getBytes()); + attributeValues.put(attributeHandle3, ATTRIBUTE3_VALUE.getBytes()); + + rtiAmbassadors.get(2).updateAttributeValues( + objectInstanceHandle, attributeValues, null, ten); + + // the 2 constrained federates will not receive it because they do not + // have asynchronous delivery enabled and are not in the time + // advancing state + // + federateAmbassadors.get(3).checkAttributeValuesNotReceived( + objectInstanceHandle); + federateAmbassadors.get(4).checkAttributeValuesNotReceived( + objectInstanceHandle); + + rtiAmbassadors.get(2).timeAdvanceRequest(nine); + rtiAmbassadors.get(3).timeAdvanceRequest(nine); + rtiAmbassadors.get(4).timeAdvanceRequest(nine); + + federateAmbassadors.get(2).checkTimeAdvanceGrant(nine); + federateAmbassadors.get(3).checkTimeAdvanceGrant(nine); + federateAmbassadors.get(4).checkTimeAdvanceGrant(nine); + + // the 2 constrained federates will not receive it because they have not + // advanced to the scheduled time + // + federateAmbassadors.get(3).checkAttributeValuesNotReceived( + objectInstanceHandle); + federateAmbassadors.get(4).checkAttributeValuesNotReceived( + objectInstanceHandle); + + // bring all the federates to the same time + // + rtiAmbassadors.get(2).timeAdvanceRequest(ten); + rtiAmbassadors.get(3).timeAdvanceRequest(ten); + rtiAmbassadors.get(4).timeAdvanceRequest(ten); + + federateAmbassadors.get(2).checkTimeAdvanceGrant(ten); + federateAmbassadors.get(3).checkTimeAdvanceGrant(ten); + federateAmbassadors.get(4).checkTimeAdvanceGrant(ten); + + // attribute values should have been released + // + federateAmbassadors.get(3).checkAttributeValues( + objectInstanceHandle, attributeValues); + federateAmbassadors.get(4).checkAttributeValues( + objectInstanceHandle, attributeValues); + } + finally + { + try + { + rtiAmbassadors.get(2).deleteObjectInstance(objectInstanceHandle, null); + + System.out.println("fuck me"); + + // bring all the federates to the same time + // + rtiAmbassadors.get(2).timeAdvanceRequest(fifteen); + System.out.println("fuck me 2"); + rtiAmbassadors.get(3).timeAdvanceRequest(fifteen); + System.out.println("fuck me 3"); + rtiAmbassadors.get(4).timeAdvanceRequest(fifteen); + + federateAmbassadors.get(2).checkTimeAdvanceGrant(fifteen); + federateAmbassadors.get(3).checkTimeAdvanceGrant(fifteen); + federateAmbassadors.get(4).checkTimeAdvanceGrant(fifteen); + + System.out.println("fuck you"); + federateAmbassadors.get(3).checkForRemovedObjectInstanceHandle( + objectInstanceHandle); + System.out.println("fuck you too"); + federateAmbassadors.get(4).checkForRemovedObjectInstanceHandle( + objectInstanceHandle); + } + catch (Throwable t) + { + t.printStackTrace(); + } + } + } + protected static class TestFederateAmbassador extends NullFederateAmbassador { @@ -740,7 +864,8 @@ federateTime = null; for (int i = 0; i < 5 && federateTime == null; i++) { - rtiAmbassador.evokeMultipleCallbacks(.1, 1.0); + rtiAmbassador.evokeMultipleCallbacks(.5, 1.0); + System.out.println("&$*%$&%&$*$&$&$"); } assert time.equals(federateTime); } @@ -779,6 +904,7 @@ i++) { rtiAmbassador.evokeMultipleCallbacks(.1, 1.0); + System.out.println("HHHH"); } assert attributeValues.equals( @@ -801,6 +927,19 @@ assert objectInstances.get(objectInstanceHandle).getAttributeValues() == null; } + public void checkForRemovedObjectInstanceHandle( + ObjectInstanceHandle objectInstanceHandle) + throws Exception + { + for (int i = 0; + i < 5 && !objectInstances.get(objectInstanceHandle).isRemoved(); + i++) + { + rtiAmbassador.evokeMultipleCallbacks(.1, 1.0); + } + assert objectInstances.get(objectInstanceHandle).isRemoved(); + } + public void checkParameterValues(ParameterHandleValueMap parameterValues) throws Exception { @@ -862,11 +1001,76 @@ byte[] tag, OrderType sentOrderType, TransportationType transportationType) { + System.out.println("11111"); objectInstances.get(objectInstanceHandle).setAttributeValues( attributeValues); } @Override + public void reflectAttributeValues(ObjectInstanceHandle objectInstanceHandle, + AttributeHandleValueMap attributeValues, + byte[] tag, OrderType sentOrderType, + TransportationType transportationType, + LogicalTime updateTime, + OrderType receivedOrderType) + throws ObjectInstanceNotKnown, AttributeNotRecognized, + AttributeNotSubscribed, FederateInternalError + { + System.out.println("22222"); + objectInstances.get(objectInstanceHandle).setAttributeValues( + attributeValues); + } + + @Override + public void reflectAttributeValues(ObjectInstanceHandle objectInstanceHandle, + AttributeHandleValueMap attributeValues, + byte[] tag, OrderType sentOrderType, + TransportationType transportationType, + LogicalTime updateTime, + OrderType receivedOrderType, + RegionHandleSet regionHandles) + throws ObjectInstanceNotKnown, AttributeNotRecognized, + AttributeNotSubscribed, FederateInternalError + { + System.out.println("33333"); + objectInstances.get(objectInstanceHandle).setAttributeValues( + attributeValues); + } + + @Override + public void reflectAttributeValues(ObjectInstanceHandle objectInstanceHandle, + AttributeHandleValueMap attributeValues, + byte[] tag, OrderType sentOrderType, + TransportationType transportationType, + LogicalTime updateTime, + OrderType receivedOrderType, + MessageRetractionHandle messageRetractionHandle) + throws ObjectInstanceNotKnown, AttributeNotRecognized, + AttributeNotSubscribed, InvalidLogicalTime, FederateInternalError + { + System.out.println("44444"); + objectInstances.get(objectInstanceHandle).setAttributeValues( + attributeValues); + } + + @Override + public void reflectAttributeValues(ObjectInstanceHandle objectInstanceHandle, + AttributeHandleValueMap attributeValues, + byte[] tag, OrderType sentOrderType, + TransportationType transportationType, + LogicalTime updateTime, + OrderType receivedOrderType, + MessageRetractionHandle messageRetractionHandle, + RegionHandleSet regionHandles) + throws ObjectInstanceNotKnown, AttributeNotRecognized, + AttributeNotSubscribed, InvalidLogicalTime, FederateInternalError + { + System.out.println("55555"); + objectInstances.get(objectInstanceHandle).setAttributeValues( + attributeValues); + } + + @Override public void removeObjectInstance(ObjectInstanceHandle objectInstanceHandle, byte[] tag, OrderType sentOrderType) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mne...@us...> - 2006-12-06 04:08:28
|
Revision: 71 http://svn.sourceforge.net/ohla/?rev=71&view=rev Author: mnewcomb Date: 2006-12-05 20:08:28 -0800 (Tue, 05 Dec 2006) Log Message: ----------- scheduled tasks were being released based on GALT even when the federate's time has not yet reached the GALT Modified Paths: -------------- trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java trunk/rti/src/java/net/sf/ohla/rti1516/federate/time/TimeManager.java Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java 2006-12-06 01:45:39 UTC (rev 70) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java 2006-12-06 04:08:28 UTC (rev 71) @@ -534,6 +534,52 @@ return asynchronousDeliveryEnabled; } + public void processFutureTasks(LogicalTime maxFutureTaskTimestamp) + { + futureTasksLock.lock(); + try + { + for (TimestampedFutureTask timestampedFutureTask = futureTasks.peek(); + timestampedFutureTask != null && + timestampedFutureTask.getTime().compareTo( + maxFutureTaskTimestamp) <= 0; + timestampedFutureTask = futureTasks.peek()) + { + try + { + timestampedFutureTask.run(); + } + catch (Throwable t) + { + log.error(String.format("unable to execute scheduled task: %s", + timestampedFutureTask), t); + } + + futureTasks.poll(); + } + } + finally + { + futureTasksLock.unlock(); + } + } + + public void sendToPeers(Message message) + { + peersLock.lock(); + try + { + for (IoSession peerSession : peerSessions.values()) + { + peerSession.write(message); + } + } + finally + { + peersLock.unlock(); + } + } + public boolean process(IoSession session, Object message) { boolean processed = true; @@ -582,25 +628,25 @@ { } - boolean hold = false; + timeManager.getTimeLock().readLock().lock(); + try + { + boolean hold = false; - if (message instanceof ReflectAttributeValues || - message instanceof ReceiveInteraction || - message instanceof RemoveObjectInstance) - { - timeManager.getTimeLock().readLock().lock(); - try + if (message instanceof ReflectAttributeValues || + message instanceof ReceiveInteraction || + message instanceof RemoveObjectInstance) { hold = !isAsynchronousDeliveryEnabled() && timeManager.isTimeConstrainedAndTimeGranted(); } - finally - { - timeManager.getTimeLock().readLock().unlock(); - } + + callbackManager.add((Callback) message, hold); } - - callbackManager.add((Callback) message, hold); + finally + { + timeManager.getTimeLock().readLock().unlock(); + } } else if (message instanceof ObjectInstanceNameReserved) { @@ -619,32 +665,6 @@ log.debug("GALT advanced: {}", galt); timeManager.galtAdvanced(galt); - - futureTasksLock.lock(); - try - { - for (TimestampedFutureTask timestampedFutureTask = futureTasks.peek(); - timestampedFutureTask != null && - timestampedFutureTask.getTime().compareTo(galt) <= 0; - timestampedFutureTask = futureTasks.peek()) - { - try - { - timestampedFutureTask.run(); - } - catch (Throwable t) - { - log.error(String.format("unable to execute scheduled task: %s", - timestampedFutureTask), t); - } - - futureTasks.poll(); - } - } - finally - { - futureTasksLock.unlock(); - } } else { @@ -3234,6 +3254,15 @@ return "1516.1.5"; } + protected void checkIfAlreadyExecutionMember() + throws FederateAlreadyExecutionMember + { + if (federateHandle != null) + { + throw new FederateAlreadyExecutionMember(federateHandle.toString()); + } + } + protected void startPeerAcceptor(String federateType) throws RTIinternalError { @@ -3307,32 +3336,7 @@ } } - public void sendToPeers(Message message) - { - peersLock.lock(); - try - { - for (IoSession peerSession : peerSessions.values()) - { - peerSession.write(message); - } - } - finally - { - peersLock.unlock(); - } - } - - protected void checkIfAlreadyExecutionMember() - throws FederateAlreadyExecutionMember - { - if (federateHandle != null) - { - throw new FederateAlreadyExecutionMember(federateHandle.toString()); - } - } - - public void checkIfSaveInProgress() + protected void checkIfSaveInProgress() throws SaveInProgress { if (federateState == FederateState.SAVE_IN_PROGRESS) @@ -3341,7 +3345,7 @@ } } - public void checkIfRestoreInProgress() + protected void checkIfRestoreInProgress() throws RestoreInProgress { if (federateState == FederateState.RESTORE_IN_PROGRESS) @@ -3350,7 +3354,7 @@ } } - public void checkIfActive() + protected void checkIfActive() throws SaveInProgress, RestoreInProgress, RTIinternalError { if (federateState != FederateState.ACTIVE) @@ -3362,7 +3366,7 @@ } } - public Future<Object> schedule(LogicalTime time, Callable<Object> callable) + protected Future<Object> schedule(LogicalTime time, Callable<Object> callable) { TimestampedFutureTask future = new TimestampedFutureTask(time, callable); @@ -3415,8 +3419,19 @@ public Object call() { - callbackManager.add(callback); + timeManager.getTimeLock().readLock().lock(); + try + { + boolean hold = !isAsynchronousDeliveryEnabled() && + timeManager.isTimeConstrainedAndTimeGranted(); + callbackManager.add(callback, hold); + } + finally + { + timeManager.getTimeLock().readLock().unlock(); + } + return null; } } @@ -3453,8 +3468,6 @@ try { throw new RuntimeException(); -// log.debug("removing {}", getPeerFederateHandle(session)); -// peerSessions.remove(getPeerFederateHandle(session)); } finally { Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federate/time/TimeManager.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federate/time/TimeManager.java 2006-12-06 01:45:39 UTC (rev 70) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federate/time/TimeManager.java 2006-12-06 04:08:28 UTC (rev 71) @@ -679,6 +679,11 @@ try { this.galt = galt; + + LogicalTime maxFutureTaskTimestamp = isTimeAdvancing() ? + (galt.compareTo(advanceRequestTime) <= 0 ? galt : advanceRequestTime) : + (galt.compareTo(federateTime) <= 0 ? galt : federateTime); + federate.processFutureTasks(maxFutureTaskTimestamp); } finally { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mne...@us...> - 2006-12-06 01:45:40
|
Revision: 70 http://svn.sourceforge.net/ohla/?rev=70&view=rev Author: mnewcomb Date: 2006-12-05 17:45:39 -0800 (Tue, 05 Dec 2006) Log Message: ----------- the next task was never checked so infinite loop occured Modified Paths: -------------- trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java 2006-12-05 03:38:24 UTC (rev 69) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java 2006-12-06 01:45:39 UTC (rev 70) @@ -623,9 +623,10 @@ futureTasksLock.lock(); try { - TimestampedFutureTask timestampedFutureTask = futureTasks.peek(); - while (timestampedFutureTask != null && - timestampedFutureTask.getTime().compareTo(galt) <= 0) + for (TimestampedFutureTask timestampedFutureTask = futureTasks.peek(); + timestampedFutureTask != null && + timestampedFutureTask.getTime().compareTo(galt) <= 0; + timestampedFutureTask = futureTasks.peek()) { try { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mne...@us...> - 2006-12-05 03:38:30
|
Revision: 69 http://svn.sourceforge.net/ohla/?rev=69&view=rev Author: mnewcomb Date: 2006-12-04 19:38:24 -0800 (Mon, 04 Dec 2006) Log Message: ----------- formatting Modified Paths: -------------- trunk/testsuite/src/java/net/sf/ohla/rti1516/ObjectManagementTestNG.java Modified: trunk/testsuite/src/java/net/sf/ohla/rti1516/ObjectManagementTestNG.java =================================================================== --- trunk/testsuite/src/java/net/sf/ohla/rti1516/ObjectManagementTestNG.java 2006-12-05 03:37:34 UTC (rev 68) +++ trunk/testsuite/src/java/net/sf/ohla/rti1516/ObjectManagementTestNG.java 2006-12-05 03:38:24 UTC (rev 69) @@ -518,8 +518,7 @@ } public void checkForRemovedObjectInstanceHandle( - ObjectInstanceHandle objectInstanceHandle - ) + ObjectInstanceHandle objectInstanceHandle) throws Exception { for (int i = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mne...@us...> - 2006-12-05 03:37:34
|
Revision: 68 http://svn.sourceforge.net/ohla/?rev=68&view=rev Author: mnewcomb Date: 2006-12-04 19:37:34 -0800 (Mon, 04 Dec 2006) Log Message: ----------- fixed method name Modified Paths: -------------- trunk/testsuite/src/java/net/sf/ohla/rti1516/ObjectManagementTestNG.java Modified: trunk/testsuite/src/java/net/sf/ohla/rti1516/ObjectManagementTestNG.java =================================================================== --- trunk/testsuite/src/java/net/sf/ohla/rti1516/ObjectManagementTestNG.java 2006-12-05 03:30:49 UTC (rev 67) +++ trunk/testsuite/src/java/net/sf/ohla/rti1516/ObjectManagementTestNG.java 2006-12-05 03:37:34 UTC (rev 68) @@ -379,7 +379,7 @@ { rtiAmbassadors.get(0).deleteObjectInstance(objectInstanceHandle, null); - federateAmbassadors.get(2).checkForRemovedlObjectInstanceHandle( + federateAmbassadors.get(2).checkForRemovedObjectInstanceHandle( objectInstanceHandle); } @@ -389,9 +389,9 @@ { rtiAmbassadors.get(1).deleteObjectInstance(objectInstanceHandle2, null); - federateAmbassadors.get(0).checkForRemovedlObjectInstanceHandle( + federateAmbassadors.get(0).checkForRemovedObjectInstanceHandle( objectInstanceHandle2); - federateAmbassadors.get(2).checkForRemovedlObjectInstanceHandle( + federateAmbassadors.get(2).checkForRemovedObjectInstanceHandle( objectInstanceHandle2); } @@ -517,7 +517,7 @@ objectInstances.containsKey(objectInstanceHandle2); } - public void checkForRemovedlObjectInstanceHandle( + public void checkForRemovedObjectInstanceHandle( ObjectInstanceHandle objectInstanceHandle ) throws Exception This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mne...@us...> - 2006-12-05 03:30:49
|
Revision: 67 http://svn.sourceforge.net/ohla/?rev=67&view=rev Author: mnewcomb Date: 2006-12-04 19:30:49 -0800 (Mon, 04 Dec 2006) Log Message: ----------- when re-creating a reflect attribute values message, forgot to include update time, message retraction handle, and sent region handles Modified Paths: -------------- trunk/rti/src/java/net/sf/ohla/rti1516/federate/filter/InterestManagementFilter.java Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federate/filter/InterestManagementFilter.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federate/filter/InterestManagementFilter.java 2006-12-05 02:54:44 UTC (rev 66) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federate/filter/InterestManagementFilter.java 2006-12-05 03:30:49 UTC (rev 67) @@ -256,7 +256,10 @@ objectInstanceHandle, objectClassHandle, trimmedAttributeValues, reflectAttributeValues.getTag(), reflectAttributeValues.getSentOrderType(), - reflectAttributeValues.getTransportationType()); + reflectAttributeValues.getTransportationType(), + reflectAttributeValues.getUpdateTime(), + reflectAttributeValues.getMessageRetractionHandle(), + reflectAttributeValues.getSentRegionHandles()); } return reflectAttributeValues; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mne...@us...> - 2006-12-05 02:54:44
|
Revision: 66 http://svn.sourceforge.net/ohla/?rev=66&view=rev Author: mnewcomb Date: 2006-12-04 18:54:44 -0800 (Mon, 04 Dec 2006) Log Message: ----------- added some tests for receive ordered messages while constrained Modified Paths: -------------- trunk/testsuite/src/java/net/sf/ohla/rti1516/TimeManagementTestNG.java Modified: trunk/testsuite/src/java/net/sf/ohla/rti1516/TimeManagementTestNG.java =================================================================== --- trunk/testsuite/src/java/net/sf/ohla/rti1516/TimeManagementTestNG.java 2006-12-05 02:14:14 UTC (rev 65) +++ trunk/testsuite/src/java/net/sf/ohla/rti1516/TimeManagementTestNG.java 2006-12-05 02:54:44 UTC (rev 66) @@ -18,6 +18,8 @@ import java.util.ArrayList; import java.util.List; +import java.util.Map; +import java.util.HashMap; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; @@ -41,6 +43,16 @@ import hla.rti1516.JoinedFederateIsNotInTimeAdvancingState; import hla.rti1516.InTimeAdvancingState; import hla.rti1516.LogicalTimeAlreadyPassed; +import hla.rti1516.ObjectClassHandle; +import hla.rti1516.AttributeHandle; +import hla.rti1516.AttributeHandleSet; +import hla.rti1516.InteractionClassHandle; +import hla.rti1516.ParameterHandle; +import hla.rti1516.ObjectInstanceHandle; +import hla.rti1516.AttributeHandleValueMap; +import hla.rti1516.OrderType; +import hla.rti1516.TransportationType; +import hla.rti1516.ParameterHandleValueMap; import hla.rti1516.jlc.NullFederateAmbassador; public class TimeManagementTestNG @@ -58,10 +70,25 @@ protected Integer64Time three = new Integer64Time(3); protected Integer64Time four = new Integer64Time(4); protected Integer64Time five = new Integer64Time(5); + protected Integer64Time six = new Integer64Time(6); protected Integer64Time ten = new Integer64Time(10); + protected Integer64Time fifteen = new Integer64Time(15); protected Integer64Time twenty = new Integer64Time(20); + protected Integer64Time thirty = new Integer64Time(30); + protected Integer64Time fourty = new Integer64Time(40); protected Integer64Time oneHundred = new Integer64Time(100); + protected ObjectClassHandle testObjectClassHandle; + protected AttributeHandle attributeHandle1; + protected AttributeHandle attributeHandle2; + protected AttributeHandle attributeHandle3; + protected AttributeHandleSet testObjectAttributeHandles; + + protected InteractionClassHandle testInteractionClassHandle; + protected ParameterHandle parameterHandle1; + protected ParameterHandle parameterHandle2; + protected ParameterHandle parameterHandle3; + public TimeManagementTestNG() { super(5); @@ -94,6 +121,52 @@ rtiAmbassadors.get(4).joinFederationExecution( FEDERATE_TYPE + "5", FEDERATION_NAME, federateAmbassadors.get(4), mobileFederateServices); + + testObjectClassHandle = + rtiAmbassadors.get(0).getObjectClassHandle(TEST_OBJECT); + + attributeHandle1 = rtiAmbassadors.get(0).getAttributeHandle( + testObjectClassHandle, ATTRIBUTE1); + attributeHandle2 = rtiAmbassadors.get(0).getAttributeHandle( + testObjectClassHandle, ATTRIBUTE2); + attributeHandle3 = rtiAmbassadors.get(0).getAttributeHandle( + testObjectClassHandle, ATTRIBUTE3); + + testObjectAttributeHandles = + rtiAmbassadors.get(0).getAttributeHandleSetFactory().create(); + testObjectAttributeHandles.add(attributeHandle1); + testObjectAttributeHandles.add(attributeHandle2); + testObjectAttributeHandles.add(attributeHandle3); + + rtiAmbassadors.get(2).publishObjectClassAttributes( + testObjectClassHandle, testObjectAttributeHandles); + rtiAmbassadors.get(2).subscribeObjectClassAttributes( + testObjectClassHandle, testObjectAttributeHandles); + rtiAmbassadors.get(3).publishObjectClassAttributes( + testObjectClassHandle, testObjectAttributeHandles); + rtiAmbassadors.get(3).subscribeObjectClassAttributes( + testObjectClassHandle, testObjectAttributeHandles); + rtiAmbassadors.get(4).publishObjectClassAttributes( + testObjectClassHandle, testObjectAttributeHandles); + rtiAmbassadors.get(4).subscribeObjectClassAttributes( + testObjectClassHandle, testObjectAttributeHandles); + + testInteractionClassHandle = + rtiAmbassadors.get(0).getInteractionClassHandle(TEST_INTERACTION); + + parameterHandle1 = rtiAmbassadors.get(0).getParameterHandle( + testInteractionClassHandle, PARAMETER1); + parameterHandle2 = rtiAmbassadors.get(0).getParameterHandle( + testInteractionClassHandle, PARAMETER2); + parameterHandle3 = rtiAmbassadors.get(0).getParameterHandle( + testInteractionClassHandle, PARAMETER3); + + rtiAmbassadors.get(2).publishInteractionClass(testInteractionClassHandle); + rtiAmbassadors.get(2).subscribeInteractionClass(testInteractionClassHandle); + rtiAmbassadors.get(3).publishInteractionClass(testInteractionClassHandle); + rtiAmbassadors.get(3).subscribeInteractionClass(testInteractionClassHandle); + rtiAmbassadors.get(4).publishInteractionClass(testInteractionClassHandle); + rtiAmbassadors.get(4).subscribeInteractionClass(testInteractionClassHandle); } @AfterClass @@ -514,6 +587,90 @@ federateAmbassadors.get(3).checkTimeAdvanceGrant(four); } + @Test(dependsOnMethods = {"testTimeAdvanceRequest"}) + public void testUpdateAttributeValuesWhileNotTimeAdvancing() + throws Exception + { + ObjectInstanceHandle objectInstanceHandle = + rtiAmbassadors.get(2).registerObjectInstance(testObjectClassHandle); + try + { + federateAmbassadors.get(3).checkObjectInstanceHandle( + objectInstanceHandle); + federateAmbassadors.get(4).checkObjectInstanceHandle( + objectInstanceHandle); + + AttributeHandleValueMap attributeValues = + rtiAmbassadors.get(1).getAttributeHandleValueMapFactory().create(3); + attributeValues.put(attributeHandle1, ATTRIBUTE1_VALUE.getBytes()); + attributeValues.put(attributeHandle2, ATTRIBUTE2_VALUE.getBytes()); + attributeValues.put(attributeHandle3, ATTRIBUTE3_VALUE.getBytes()); + + rtiAmbassadors.get(2).updateAttributeValues( + objectInstanceHandle, attributeValues, null); + + // the 2 constrained federates will not receive it because they do not have + // asynchronous delivery enabled and are not in the time + // advancing state + // + federateAmbassadors.get(3).checkAttributeValuesNotReceived( + objectInstanceHandle); + federateAmbassadors.get(4).checkAttributeValuesNotReceived( + objectInstanceHandle); + + // bring all the federates to the same time + // + rtiAmbassadors.get(3).timeAdvanceRequest(five); + rtiAmbassadors.get(4).timeAdvanceRequest(five); + + federateAmbassadors.get(3).checkTimeAdvanceGrant(five); + federateAmbassadors.get(4).checkTimeAdvanceGrant(five); + + federateAmbassadors.get(3).checkAttributeValues( + objectInstanceHandle, attributeValues); + federateAmbassadors.get(4).checkAttributeValues( + objectInstanceHandle, attributeValues); + } + finally + { + rtiAmbassadors.get(2).deleteObjectInstance(objectInstanceHandle, null); + } + } + + @Test(dependsOnMethods = {"testUpdateAttributeValuesWhileNotTimeAdvancing"}) + public void testSendInteractionWhileNotTimeAdvancing() + throws Exception + { + ParameterHandleValueMap parameterValues = + rtiAmbassadors.get(0).getParameterHandleValueMapFactory().create(3); + parameterValues.put(parameterHandle1, PARAMETER1_VALUE.getBytes()); + parameterValues.put(parameterHandle2, PARAMETER2_VALUE.getBytes()); + parameterValues.put(parameterHandle3, PARAMETER3_VALUE.getBytes()); + + rtiAmbassadors.get(2).sendInteraction( + testInteractionClassHandle, parameterValues, null); + + // the 2 constrained federates will not receive it because they do not have + // asynchronous delivery enabled and are not in the time + // advancing state + // + federateAmbassadors.get(3).checkParameterValuesNotReceived(); + federateAmbassadors.get(4).checkParameterValuesNotReceived(); + + // bring all the federates to the same time + // + rtiAmbassadors.get(2).timeAdvanceRequest(six); + rtiAmbassadors.get(3).timeAdvanceRequest(six); + rtiAmbassadors.get(4).timeAdvanceRequest(six); + + federateAmbassadors.get(2).checkTimeAdvanceGrant(six); + federateAmbassadors.get(3).checkTimeAdvanceGrant(six); + federateAmbassadors.get(4).checkTimeAdvanceGrant(six); + + federateAmbassadors.get(3).checkParameterValues(parameterValues); + federateAmbassadors.get(4).checkParameterValues(parameterValues); + } + protected static class TestFederateAmbassador extends NullFederateAmbassador { @@ -523,6 +680,11 @@ protected LogicalTime timeConstrainedEnabledTime; protected LogicalTime federateTime; + protected Map<ObjectInstanceHandle, ObjectInstance> objectInstances = + new HashMap<ObjectInstanceHandle, ObjectInstance>(); + + protected ParameterHandleValueMap parameterValues; + public TestFederateAmbassador(RTIambassador rtiAmbassador) { this.rtiAmbassador = rtiAmbassador; @@ -594,6 +756,71 @@ assert federateTime == null; } + public void checkObjectInstanceHandle( + ObjectInstanceHandle objectInstanceHandle) + throws Exception + { + for (int i = 0; + i < 5 && !objectInstances.containsKey(objectInstanceHandle); i++) + { + rtiAmbassador.evokeMultipleCallbacks(.1, 1.0); + } + assert objectInstances.containsKey(objectInstanceHandle); + } + + public void checkAttributeValues(ObjectInstanceHandle objectInstanceHandle, + AttributeHandleValueMap attributeValues) + throws Exception + { + for (int i = 0; + i < 5 && + objectInstances.get(objectInstanceHandle).getAttributeValues() == + null; + i++) + { + rtiAmbassador.evokeMultipleCallbacks(.1, 1.0); + } + + assert attributeValues.equals( + objectInstances.get(objectInstanceHandle).getAttributeValues()); + } + + public void checkAttributeValuesNotReceived( + ObjectInstanceHandle objectInstanceHandle) + throws Exception + { + for (int i = 0; + i < 5 && + objectInstances.get(objectInstanceHandle).getAttributeValues() == + null; + i++) + { + rtiAmbassador.evokeMultipleCallbacks(.1, 1.0); + } + + assert objectInstances.get(objectInstanceHandle).getAttributeValues() == null; + } + + public void checkParameterValues(ParameterHandleValueMap parameterValues) + throws Exception + { + for (int i = 0; i < 5 && this.parameterValues == null; i++) + { + rtiAmbassador.evokeMultipleCallbacks(.1, 1.0); + } + assert parameterValues.equals(this.parameterValues); + } + + public void checkParameterValuesNotReceived() + throws Exception + { + for (int i = 0; i < 5 && this.parameterValues == null; i++) + { + rtiAmbassador.evokeMultipleCallbacks(.1, 1.0); + } + assert parameterValues == null; + } + @Override public void timeRegulationEnabled(LogicalTime time) throws InvalidLogicalTime, NoRequestToEnableTimeRegulationWasPending, @@ -617,8 +844,97 @@ { federateTime = time; } + + @Override + public void discoverObjectInstance( + ObjectInstanceHandle objectInstanceHandle, + ObjectClassHandle objectClassHandle, + String name) + { + objectInstances.put(objectInstanceHandle, new ObjectInstance( + objectInstanceHandle, objectClassHandle, name)); + } + + @Override + public void reflectAttributeValues( + ObjectInstanceHandle objectInstanceHandle, + AttributeHandleValueMap attributeValues, + byte[] tag, OrderType sentOrderType, + TransportationType transportationType) + { + objectInstances.get(objectInstanceHandle).setAttributeValues( + attributeValues); + } + + @Override + public void removeObjectInstance(ObjectInstanceHandle objectInstanceHandle, + byte[] tag, OrderType sentOrderType) + { + objectInstances.get(objectInstanceHandle).setRemoved(true); + } + + @Override + public void receiveInteraction( + InteractionClassHandle interactionClassHandle, + ParameterHandleValueMap parameterValues, + byte[] tag, OrderType sentOrderType, + TransportationType transportationType) + { + this.parameterValues = parameterValues; + } } + protected static class ObjectInstance + { + protected ObjectInstanceHandle objectInstanceHandle; + protected ObjectClassHandle objectClassHandle; + protected String name; + protected AttributeHandleValueMap attributeValues; + protected boolean removed; + + public ObjectInstance(ObjectInstanceHandle objectInstanceHandle, + ObjectClassHandle objectClassHandle, String name) + { + this.objectInstanceHandle = objectInstanceHandle; + this.objectClassHandle = objectClassHandle; + this.name = name; + } + + public ObjectInstanceHandle getObjectInstanceHandle() + { + return objectInstanceHandle; + } + + public ObjectClassHandle getObjectClassHandle() + { + return objectClassHandle; + } + + public String getName() + { + return name; + } + + public AttributeHandleValueMap getAttributeValues() + { + return attributeValues; + } + + public void setAttributeValues(AttributeHandleValueMap attributeValues) + { + this.attributeValues = attributeValues; + } + + public boolean isRemoved() + { + return removed; + } + + public void setRemoved(boolean removed) + { + this.removed = removed; + } + } // public void test() // { // TimeClient tc = new TimeClient("A", new Integer64TimeInterval(3000), false); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mne...@us...> - 2006-12-05 02:14:13
|
Revision: 65 http://svn.sourceforge.net/ohla/?rev=65&view=rev Author: mnewcomb Date: 2006-12-04 18:14:14 -0800 (Mon, 04 Dec 2006) Log Message: ----------- formatting Modified Paths: -------------- trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java 2006-12-05 01:30:40 UTC (rev 64) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java 2006-12-05 02:14:14 UTC (rev 65) @@ -593,7 +593,6 @@ { hold = !isAsynchronousDeliveryEnabled() && timeManager.isTimeConstrainedAndTimeGranted(); - } finally { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mne...@us...> - 2006-12-05 00:36:38
|
Revision: 62 http://svn.sourceforge.net/ohla/?rev=62&view=rev Author: mnewcomb Date: 2006-12-04 16:36:37 -0800 (Mon, 04 Dec 2006) Log Message: ----------- removed old module files Modified Paths: -------------- trunk/build/intellij/OHLA.iws Removed Paths: ------------- trunk/build/intellij/Resources.iml trunk/build/intellij/Toolkit.iml Modified: trunk/build/intellij/OHLA.iws =================================================================== --- trunk/build/intellij/OHLA.iws 2006-12-03 04:04:39 UTC (rev 61) +++ trunk/build/intellij/OHLA.iws 2006-12-05 00:36:37 UTC (rev 62) @@ -378,7 +378,7 @@ <showLibraryContents /> <hideEmptyPackages ProjectPane="true" /> <abbreviatePackageNames /> - <showStructure PackagesPane="false" ProjectPane="false" Favorites="false" Scope="false" /> + <showStructure PackagesPane="false" Favorites="false" ProjectPane="false" Scope="false" /> <autoscrollToSource /> <autoscrollFromSource /> <sortByType /> @@ -397,8 +397,8 @@ <property name="cvs_file_history_flatOrder1" value="1" /> <property name="cvs_file_history_flatWidth1" value="299" /> <property name="cvs_file_history_treeWidth1" value="299" /> + <property name="cvs_file_history_treeWidth3" value="298" /> <property name="cvs_file_history_treeOrder2" value="2" /> - <property name="cvs_file_history_treeWidth3" value="298" /> <property name="GoToClass.includeLibraries" value="false" /> <property name="cvs_file_history_flatOrder2" value="2" /> <property name="MemberChooser.showClasses" value="true" /> @@ -407,8 +407,8 @@ <property name="cvs_file_history_treeWidth2" value="299" /> <property name="cvs_file_history_flatOrder3" value="3" /> <property name="GoToClass.toSaveIncludeLibraries" value="false" /> + <property name="cvs_file_history_treeOrder0" value="0" /> <property name="RunManagerConfig.showSettingsBeforeRunnig" value="true" /> - <property name="cvs_file_history_treeOrder0" value="0" /> </component> <component name="ReadonlyStatusHandler"> <option name="SHOW_DIALOG" value="true" /> @@ -425,6 +425,18 @@ <component name="RestoreUpdateTree" /> <component name="RunManager"> <activeType name="Application" /> + <configuration selected="false" default="true" type="Applet" factoryName="Applet"> + <module name="" /> + <option name="MAIN_CLASS_NAME" /> + <option name="HTML_FILE_NAME" /> + <option name="HTML_USED" value="false" /> + <option name="WIDTH" value="400" /> + <option name="HEIGHT" value="300" /> + <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" /> + <option name="VM_PARAMETERS" /> + <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> + <option name="ALTERNATIVE_JRE_PATH" /> + </configuration> <configuration selected="false" default="true" type="JUnit" factoryName="JUnit"> <module name="" /> <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> @@ -441,34 +453,6 @@ <value defaultName="wholeProject" /> </option> </configuration> - <configuration selected="false" default="true" type="Remote" factoryName="Remote"> - <option name="USE_SOCKET_TRANSPORT" value="true" /> - <option name="SERVER_MODE" value="false" /> - <option name="SHMEM_ADDRESS" value="javadebug" /> - <option name="HOST" value="localhost" /> - <option name="PORT" value="5005" /> - </configuration> - <configuration selected="false" default="true" type="Application" factoryName="Application"> - <option name="MAIN_CLASS_NAME" /> - <option name="VM_PARAMETERS" /> - <option name="PROGRAM_PARAMETERS" /> - <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> - <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> - <option name="ALTERNATIVE_JRE_PATH" /> - <module name="" /> - </configuration> - <configuration selected="false" default="true" type="Applet" factoryName="Applet"> - <module name="" /> - <option name="MAIN_CLASS_NAME" /> - <option name="HTML_FILE_NAME" /> - <option name="HTML_USED" value="false" /> - <option name="WIDTH" value="400" /> - <option name="HEIGHT" value="300" /> - <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" /> - <option name="VM_PARAMETERS" /> - <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> - <option name="ALTERNATIVE_JRE_PATH" /> - </configuration> <configuration selected="false" default="true" type="TestNG" factoryName="TestNG"> <module name="" /> <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> @@ -489,6 +473,22 @@ <option name="PROPERTIES_FILE" /> <properties /> </configuration> + <configuration selected="false" default="true" type="Remote" factoryName="Remote"> + <option name="USE_SOCKET_TRANSPORT" value="true" /> + <option name="SERVER_MODE" value="false" /> + <option name="SHMEM_ADDRESS" value="javadebug" /> + <option name="HOST" value="localhost" /> + <option name="PORT" value="5005" /> + </configuration> + <configuration selected="false" default="true" type="Application" factoryName="Application"> + <option name="MAIN_CLASS_NAME" /> + <option name="VM_PARAMETERS" /> + <option name="PROGRAM_PARAMETERS" /> + <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> + <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> + <option name="ALTERNATIVE_JRE_PATH" /> + <module name="" /> + </configuration> <configuration selected="false" default="false" name="IEEE 1516 Testsuite" type="TestNG" factoryName="TestNG"> <module name="Testsuite" /> <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> @@ -508,14 +508,14 @@ </option> <option name="PROPERTIES_FILE" value="" /> <properties /> + <RunnerSettings RunnerId="Run" /> <RunnerSettings RunnerId="Debug"> <option name="DEBUG_PORT" value="2019" /> <option name="TRANSPORT" value="0" /> <option name="LOCAL" value="true" /> </RunnerSettings> - <RunnerSettings RunnerId="Run" /> + <ConfigurationWrapper RunnerId="Run" /> <ConfigurationWrapper RunnerId="Debug" /> - <ConfigurationWrapper RunnerId="Run" /> </configuration> <configuration selected="true" default="false" name="HLA 1.3 Testsuite" type="TestNG" factoryName="TestNG"> <module name="RTI" /> @@ -545,14 +545,14 @@ <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> <option name="ALTERNATIVE_JRE_PATH" value="" /> <module name="RTI" /> + <RunnerSettings RunnerId="Run" /> <RunnerSettings RunnerId="Debug"> <option name="DEBUG_PORT" value="2738" /> <option name="TRANSPORT" value="0" /> <option name="LOCAL" value="true" /> </RunnerSettings> - <RunnerSettings RunnerId="Run" /> + <ConfigurationWrapper RunnerId="Run" /> <ConfigurationWrapper RunnerId="Debug" /> - <ConfigurationWrapper RunnerId="Run" /> </configuration> </component> <component name="ScopeViewComponent"> @@ -624,12 +624,12 @@ </todo-panel> </component> <component name="ToolWindowManager"> - <frame x="-4" y="-4" width="1288" height="998" extended-state="6" /> + <frame x="-9" y="-2" width="1288" height="998" extended-state="0" /> <editor active="false" /> <layout> <window_info id="CVS" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="8" /> <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.32791588" order="7" /> - <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="true" weight="0.20954692" order="0" /> + <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="true" weight="0.21278317" order="0" /> <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.34367815" order="1" /> <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="1" /> <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.32413793" order="8" /> Deleted: trunk/build/intellij/Resources.iml =================================================================== --- trunk/build/intellij/Resources.iml 2006-12-03 04:04:39 UTC (rev 61) +++ trunk/build/intellij/Resources.iml 2006-12-05 00:36:37 UTC (rev 62) @@ -1,186 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module version="4" relativePaths="true" type="JAVA_MODULE"> - <component name="ModuleRootManager" /> - <component name="NewModuleRootManager"> - <output url="file://$MODULE_DIR$/../../output/resources/classes" /> - <exclude-output /> - <content url="file://$MODULE_DIR$/../../resources" /> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - <orderEntryProperties /> - </component> - <component name="copyright"> - <Base> - <setting name="state" value="1" /> - </Base> - <LanguageOptions name="$TEMPLATE$"> - <option name="templateOptions"> - <value> - <option name="block" value="true" /> - <option name="separateBefore" value="false" /> - <option name="separateAfter" value="false" /> - <option name="prefixLines" value="true" /> - <option name="lenBefore" value="80" /> - <option name="lenAfter" value="80" /> - <option name="box" value="false" /> - <option name="filler" value=" " /> - </value> - </option> - <option name="notice" value="Copyright (c) &#36;today.year, Michael Newcomb Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License." /> - <option name="keyword" value="Copyright" /> - <option name="fileTypeOverride" value="4" /> - <option name="relativeBefore" value="true" /> - <option name="addBlankAfter" value="true" /> - <option name="fileLocation" value="1" /> - <option name="useAlternate" value="false" /> - </LanguageOptions> - <LanguageOptions name="CSS"> - <option name="templateOptions"> - <value> - <option name="block" value="true" /> - <option name="separateBefore" value="false" /> - <option name="separateAfter" value="false" /> - <option name="prefixLines" value="true" /> - <option name="lenBefore" value="80" /> - <option name="lenAfter" value="80" /> - <option name="box" value="false" /> - <option name="filler" value=" " /> - </value> - </option> - <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> - <option name="keyword" value="Copyright" /> - <option name="fileTypeOverride" value="2" /> - <option name="relativeBefore" value="true" /> - <option name="addBlankAfter" value="true" /> - <option name="fileLocation" value="1" /> - <option name="useAlternate" value="false" /> - </LanguageOptions> - <LanguageOptions name="HTML"> - <option name="templateOptions"> - <value> - <option name="block" value="true" /> - <option name="separateBefore" value="false" /> - <option name="separateAfter" value="false" /> - <option name="prefixLines" value="true" /> - <option name="lenBefore" value="80" /> - <option name="lenAfter" value="80" /> - <option name="box" value="false" /> - <option name="filler" value=" " /> - </value> - </option> - <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> - <option name="keyword" value="Copyright" /> - <option name="fileTypeOverride" value="2" /> - <option name="relativeBefore" value="true" /> - <option name="addBlankAfter" value="true" /> - <option name="fileLocation" value="1" /> - <option name="useAlternate" value="false" /> - </LanguageOptions> - <LanguageOptions name="JAVA"> - <option name="templateOptions"> - <value> - <option name="block" value="true" /> - <option name="separateBefore" value="false" /> - <option name="separateAfter" value="false" /> - <option name="prefixLines" value="true" /> - <option name="lenBefore" value="80" /> - <option name="lenAfter" value="80" /> - <option name="box" value="false" /> - <option name="filler" value=" " /> - </value> - </option> - <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> - <option name="keyword" value="Copyright" /> - <option name="fileTypeOverride" value="2" /> - <option name="relativeBefore" value="true" /> - <option name="addBlankAfter" value="true" /> - <option name="fileLocation" value="1" /> - <option name="useAlternate" value="false" /> - </LanguageOptions> - <LanguageOptions name="JSP"> - <option name="templateOptions"> - <value> - <option name="block" value="true" /> - <option name="separateBefore" value="false" /> - <option name="separateAfter" value="false" /> - <option name="prefixLines" value="true" /> - <option name="lenBefore" value="80" /> - <option name="lenAfter" value="80" /> - <option name="box" value="false" /> - <option name="filler" value=" " /> - </value> - </option> - <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> - <option name="keyword" value="Copyright" /> - <option name="fileTypeOverride" value="2" /> - <option name="relativeBefore" value="true" /> - <option name="addBlankAfter" value="true" /> - <option name="fileLocation" value="1" /> - <option name="useAlternate" value="false" /> - </LanguageOptions> - <LanguageOptions name="JavaScript"> - <option name="templateOptions"> - <value> - <option name="block" value="true" /> - <option name="separateBefore" value="false" /> - <option name="separateAfter" value="false" /> - <option name="prefixLines" value="true" /> - <option name="lenBefore" value="80" /> - <option name="lenAfter" value="80" /> - <option name="box" value="false" /> - <option name="filler" value=" " /> - </value> - </option> - <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> - <option name="keyword" value="Copyright" /> - <option name="fileTypeOverride" value="2" /> - <option name="relativeBefore" value="true" /> - <option name="addBlankAfter" value="true" /> - <option name="fileLocation" value="1" /> - <option name="useAlternate" value="false" /> - </LanguageOptions> - <LanguageOptions name="Properties"> - <option name="templateOptions"> - <value> - <option name="block" value="true" /> - <option name="separateBefore" value="false" /> - <option name="separateAfter" value="false" /> - <option name="prefixLines" value="true" /> - <option name="lenBefore" value="80" /> - <option name="lenAfter" value="80" /> - <option name="box" value="false" /> - <option name="filler" value=" " /> - </value> - </option> - <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> - <option name="keyword" value="Copyright" /> - <option name="fileTypeOverride" value="2" /> - <option name="relativeBefore" value="true" /> - <option name="addBlankAfter" value="true" /> - <option name="fileLocation" value="1" /> - <option name="useAlternate" value="false" /> - </LanguageOptions> - <LanguageOptions name="XML"> - <option name="templateOptions"> - <value> - <option name="block" value="true" /> - <option name="separateBefore" value="false" /> - <option name="separateAfter" value="false" /> - <option name="prefixLines" value="true" /> - <option name="lenBefore" value="80" /> - <option name="lenAfter" value="80" /> - <option name="box" value="false" /> - <option name="filler" value=" " /> - </value> - </option> - <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> - <option name="keyword" value="Copyright" /> - <option name="fileTypeOverride" value="2" /> - <option name="relativeBefore" value="true" /> - <option name="addBlankAfter" value="true" /> - <option name="fileLocation" value="1" /> - <option name="useAlternate" value="false" /> - </LanguageOptions> - </component> -</module> - Deleted: trunk/build/intellij/Toolkit.iml =================================================================== --- trunk/build/intellij/Toolkit.iml 2006-12-03 04:04:39 UTC (rev 61) +++ trunk/build/intellij/Toolkit.iml 2006-12-05 00:36:37 UTC (rev 62) @@ -1,198 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module version="4" relativePaths="true" type="JAVA_MODULE"> - <component name="ModuleRootManager" /> - <component name="NewModuleRootManager"> - <output url="file://$MODULE_DIR$/../output/toolkit/classes" /> - <exclude-output /> - <content url="file://$MODULE_DIR$/../../toolkit"> - <sourceFolder url="file://$MODULE_DIR$/../../toolkit/src/main/java" isTestSource="false" /> - </content> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="module" module-name="HLA 1.3" /> - <orderEntry type="module" module-name="IEEE 1516" /> - <orderEntry type="library" name="resources" level="project" /> - <orderEntry type="library" name="ant" level="project" /> - <orderEntry type="library" name="velocity" level="project" /> - <orderEntry type="library" name="log4j-1.2.14" level="project" /> - <orderEntry type="library" name="slf4j-log4j12" level="project" /> - <orderEntry type="library" name="dom4j" level="project" /> - <orderEntry type="library" name="bsf" level="project" /> - <orderEntry type="library" name="bsh" level="project" /> - <orderEntryProperties /> - </component> - <component name="copyright"> - <Base> - <setting name="state" value="1" /> - </Base> - <LanguageOptions name="$TEMPLATE$"> - <option name="templateOptions"> - <value> - <option name="block" value="true" /> - <option name="separateBefore" value="false" /> - <option name="separateAfter" value="false" /> - <option name="prefixLines" value="true" /> - <option name="lenBefore" value="80" /> - <option name="lenAfter" value="80" /> - <option name="box" value="false" /> - <option name="filler" value=" " /> - </value> - </option> - <option name="notice" value="Copyright (c) &#36;today.year, Michael Newcomb Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License." /> - <option name="keyword" value="Copyright" /> - <option name="fileTypeOverride" value="4" /> - <option name="relativeBefore" value="true" /> - <option name="addBlankAfter" value="true" /> - <option name="fileLocation" value="1" /> - <option name="useAlternate" value="false" /> - </LanguageOptions> - <LanguageOptions name="CSS"> - <option name="templateOptions"> - <value> - <option name="block" value="true" /> - <option name="separateBefore" value="false" /> - <option name="separateAfter" value="false" /> - <option name="prefixLines" value="true" /> - <option name="lenBefore" value="80" /> - <option name="lenAfter" value="80" /> - <option name="box" value="false" /> - <option name="filler" value=" " /> - </value> - </option> - <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> - <option name="keyword" value="Copyright" /> - <option name="fileTypeOverride" value="2" /> - <option name="relativeBefore" value="true" /> - <option name="addBlankAfter" value="true" /> - <option name="fileLocation" value="1" /> - <option name="useAlternate" value="false" /> - </LanguageOptions> - <LanguageOptions name="HTML"> - <option name="templateOptions"> - <value> - <option name="block" value="true" /> - <option name="separateBefore" value="false" /> - <option name="separateAfter" value="false" /> - <option name="prefixLines" value="true" /> - <option name="lenBefore" value="80" /> - <option name="lenAfter" value="80" /> - <option name="box" value="false" /> - <option name="filler" value=" " /> - </value> - </option> - <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> - <option name="keyword" value="Copyright" /> - <option name="fileTypeOverride" value="2" /> - <option name="relativeBefore" value="true" /> - <option name="addBlankAfter" value="true" /> - <option name="fileLocation" value="1" /> - <option name="useAlternate" value="false" /> - </LanguageOptions> - <LanguageOptions name="JAVA"> - <option name="templateOptions"> - <value> - <option name="block" value="true" /> - <option name="separateBefore" value="false" /> - <option name="separateAfter" value="false" /> - <option name="prefixLines" value="true" /> - <option name="lenBefore" value="80" /> - <option name="lenAfter" value="80" /> - <option name="box" value="false" /> - <option name="filler" value=" " /> - </value> - </option> - <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> - <option name="keyword" value="Copyright" /> - <option name="fileTypeOverride" value="2" /> - <option name="relativeBefore" value="true" /> - <option name="addBlankAfter" value="true" /> - <option name="fileLocation" value="1" /> - <option name="useAlternate" value="false" /> - </LanguageOptions> - <LanguageOptions name="JSP"> - <option name="templateOptions"> - <value> - <option name="block" value="true" /> - <option name="separateBefore" value="false" /> - <option name="separateAfter" value="false" /> - <option name="prefixLines" value="true" /> - <option name="lenBefore" value="80" /> - <option name="lenAfter" value="80" /> - <option name="box" value="false" /> - <option name="filler" value=" " /> - </value> - </option> - <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> - <option name="keyword" value="Copyright" /> - <option name="fileTypeOverride" value="2" /> - <option name="relativeBefore" value="true" /> - <option name="addBlankAfter" value="true" /> - <option name="fileLocation" value="1" /> - <option name="useAlternate" value="false" /> - </LanguageOptions> - <LanguageOptions name="JavaScript"> - <option name="templateOptions"> - <value> - <option name="block" value="true" /> - <option name="separateBefore" value="false" /> - <option name="separateAfter" value="false" /> - <option name="prefixLines" value="true" /> - <option name="lenBefore" value="80" /> - <option name="lenAfter" value="80" /> - <option name="box" value="false" /> - <option name="filler" value=" " /> - </value> - </option> - <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> - <option name="keyword" value="Copyright" /> - <option name="fileTypeOverride" value="2" /> - <option name="relativeBefore" value="true" /> - <option name="addBlankAfter" value="true" /> - <option name="fileLocation" value="1" /> - <option name="useAlternate" value="false" /> - </LanguageOptions> - <LanguageOptions name="Properties"> - <option name="templateOptions"> - <value> - <option name="block" value="true" /> - <option name="separateBefore" value="false" /> - <option name="separateAfter" value="false" /> - <option name="prefixLines" value="true" /> - <option name="lenBefore" value="80" /> - <option name="lenAfter" value="80" /> - <option name="box" value="false" /> - <option name="filler" value=" " /> - </value> - </option> - <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> - <option name="keyword" value="Copyright" /> - <option name="fileTypeOverride" value="2" /> - <option name="relativeBefore" value="true" /> - <option name="addBlankAfter" value="true" /> - <option name="fileLocation" value="1" /> - <option name="useAlternate" value="false" /> - </LanguageOptions> - <LanguageOptions name="XML"> - <option name="templateOptions"> - <value> - <option name="block" value="true" /> - <option name="separateBefore" value="false" /> - <option name="separateAfter" value="false" /> - <option name="prefixLines" value="true" /> - <option name="lenBefore" value="80" /> - <option name="lenAfter" value="80" /> - <option name="box" value="false" /> - <option name="filler" value=" " /> - </value> - </option> - <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> - <option name="keyword" value="Copyright" /> - <option name="fileTypeOverride" value="2" /> - <option name="relativeBefore" value="true" /> - <option name="addBlankAfter" value="true" /> - <option name="fileLocation" value="1" /> - <option name="useAlternate" value="false" /> - </LanguageOptions> - </component> -</module> - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mne...@us...> - 2006-12-01 15:55:54
|
Revision: 58 http://svn.sourceforge.net/ohla/?rev=58&view=rev Author: mnewcomb Date: 2006-12-01 07:55:52 -0800 (Fri, 01 Dec 2006) Log Message: ----------- removed invalid run target Modified Paths: -------------- trunk/build/intellij/OHLA.iws Modified: trunk/build/intellij/OHLA.iws =================================================================== --- trunk/build/intellij/OHLA.iws 2006-12-01 15:11:57 UTC (rev 57) +++ trunk/build/intellij/OHLA.iws 2006-12-01 15:55:52 UTC (rev 58) @@ -302,6 +302,70 @@ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" /> </PATH_ELEMENT> </PATH> + <PATH> + <PATH_ELEMENT> + <option name="myItemId" value="OHLA.ipr" /> + <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" /> + </PATH_ELEMENT> + <PATH_ELEMENT> + <option name="myItemId" value="OHLA" /> + <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" /> + </PATH_ELEMENT> + </PATH> + <PATH> + <PATH_ELEMENT> + <option name="myItemId" value="OHLA.ipr" /> + <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" /> + </PATH_ELEMENT> + <PATH_ELEMENT> + <option name="myItemId" value="OHLA" /> + <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" /> + </PATH_ELEMENT> + <PATH_ELEMENT> + <option name="myItemId" value="PsiDirectory:D:\projects\ohla-0.4" /> + <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> + </PATH_ELEMENT> + </PATH> + <PATH> + <PATH_ELEMENT> + <option name="myItemId" value="OHLA.ipr" /> + <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" /> + </PATH_ELEMENT> + <PATH_ELEMENT> + <option name="myItemId" value="OHLA" /> + <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" /> + </PATH_ELEMENT> + <PATH_ELEMENT> + <option name="myItemId" value="PsiDirectory:D:\projects\ohla-0.4" /> + <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> + </PATH_ELEMENT> + <PATH_ELEMENT> + <option name="myItemId" value="PsiDirectory:D:\projects\ohla-0.4\build" /> + <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> + </PATH_ELEMENT> + </PATH> + <PATH> + <PATH_ELEMENT> + <option name="myItemId" value="OHLA.ipr" /> + <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" /> + </PATH_ELEMENT> + <PATH_ELEMENT> + <option name="myItemId" value="OHLA" /> + <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" /> + </PATH_ELEMENT> + <PATH_ELEMENT> + <option name="myItemId" value="PsiDirectory:D:\projects\ohla-0.4" /> + <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> + </PATH_ELEMENT> + <PATH_ELEMENT> + <option name="myItemId" value="PsiDirectory:D:\projects\ohla-0.4\build" /> + <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> + </PATH_ELEMENT> + <PATH_ELEMENT> + <option name="myItemId" value="PsiDirectory:D:\projects\ohla-0.4\build\intellij" /> + <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> + </PATH_ELEMENT> + </PATH> </component> <component name="ProjectReloadState"> <option name="STATE" value="0" /> @@ -314,7 +378,7 @@ <showLibraryContents /> <hideEmptyPackages ProjectPane="true" /> <abbreviatePackageNames /> - <showStructure PackagesPane="false" Favorites="false" ProjectPane="false" Scope="false" /> + <showStructure PackagesPane="false" ProjectPane="false" Favorites="false" Scope="false" /> <autoscrollToSource /> <autoscrollFromSource /> <sortByType /> @@ -333,8 +397,8 @@ <property name="cvs_file_history_flatOrder1" value="1" /> <property name="cvs_file_history_flatWidth1" value="299" /> <property name="cvs_file_history_treeWidth1" value="299" /> + <property name="cvs_file_history_treeOrder2" value="2" /> <property name="cvs_file_history_treeWidth3" value="298" /> - <property name="cvs_file_history_treeOrder2" value="2" /> <property name="GoToClass.includeLibraries" value="false" /> <property name="cvs_file_history_flatOrder2" value="2" /> <property name="MemberChooser.showClasses" value="true" /> @@ -343,8 +407,8 @@ <property name="cvs_file_history_treeWidth2" value="299" /> <property name="cvs_file_history_flatOrder3" value="3" /> <property name="GoToClass.toSaveIncludeLibraries" value="false" /> + <property name="RunManagerConfig.showSettingsBeforeRunnig" value="true" /> <property name="cvs_file_history_treeOrder0" value="0" /> - <property name="RunManagerConfig.showSettingsBeforeRunnig" value="true" /> </component> <component name="ReadonlyStatusHandler"> <option name="SHOW_DIALOG" value="true" /> @@ -361,38 +425,22 @@ <component name="RestoreUpdateTree" /> <component name="RunManager"> <activeType name="Application" /> - <configuration selected="false" default="true" type="TestNG" factoryName="TestNG"> + <configuration selected="false" default="true" type="JUnit" factoryName="JUnit"> <module name="" /> <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> <option name="ALTERNATIVE_JRE_PATH" /> - <option name="SUITE_NAME" /> <option name="PACKAGE_NAME" /> <option name="MAIN_CLASS_NAME" /> <option name="METHOD_NAME" /> - <option name="GROUP_NAME" /> - <option name="TEST_OBJECT" value="CLASS" /> + <option name="TEST_OBJECT" value="class" /> <option name="VM_PARAMETERS" /> <option name="PARAMETERS" /> - <option name="WORKING_DIRECTORY" /> + <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> <option name="ADDITIONAL_CLASS_PATH" /> <option name="TEST_SEARCH_SCOPE"> <value defaultName="wholeProject" /> </option> - <option name="PROPERTIES_FILE" /> - <properties /> </configuration> - <configuration selected="false" default="true" type="Applet" factoryName="Applet"> - <module name="" /> - <option name="MAIN_CLASS_NAME" /> - <option name="HTML_FILE_NAME" /> - <option name="HTML_USED" value="false" /> - <option name="WIDTH" value="400" /> - <option name="HEIGHT" value="300" /> - <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" /> - <option name="VM_PARAMETERS" /> - <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> - <option name="ALTERNATIVE_JRE_PATH" /> - </configuration> <configuration selected="false" default="true" type="Remote" factoryName="Remote"> <option name="USE_SOCKET_TRANSPORT" value="true" /> <option name="SERVER_MODE" value="false" /> @@ -409,50 +457,38 @@ <option name="ALTERNATIVE_JRE_PATH" /> <module name="" /> </configuration> - <configuration selected="false" default="true" type="JUnit" factoryName="JUnit"> + <configuration selected="false" default="true" type="Applet" factoryName="Applet"> <module name="" /> + <option name="MAIN_CLASS_NAME" /> + <option name="HTML_FILE_NAME" /> + <option name="HTML_USED" value="false" /> + <option name="WIDTH" value="400" /> + <option name="HEIGHT" value="300" /> + <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" /> + <option name="VM_PARAMETERS" /> <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> <option name="ALTERNATIVE_JRE_PATH" /> + </configuration> + <configuration selected="false" default="true" type="TestNG" factoryName="TestNG"> + <module name="" /> + <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> + <option name="ALTERNATIVE_JRE_PATH" /> + <option name="SUITE_NAME" /> <option name="PACKAGE_NAME" /> <option name="MAIN_CLASS_NAME" /> <option name="METHOD_NAME" /> - <option name="TEST_OBJECT" value="class" /> + <option name="GROUP_NAME" /> + <option name="TEST_OBJECT" value="CLASS" /> <option name="VM_PARAMETERS" /> <option name="PARAMETERS" /> - <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> + <option name="WORKING_DIRECTORY" /> <option name="ADDITIONAL_CLASS_PATH" /> <option name="TEST_SEARCH_SCOPE"> <value defaultName="wholeProject" /> </option> + <option name="PROPERTIES_FILE" /> + <properties /> </configuration> - <configuration selected="false" default="false" name="RTI" type="Application" factoryName="Application"> - <option name="MAIN_CLASS_NAME" value="net.sf.ohla.rti1516.RTI" /> - <option name="VM_PARAMETERS" value="-Dohla.rti.host=localhost -Dohla.rti.port=5000 -ea -server" /> - <option name="PROGRAM_PARAMETERS" value="" /> - <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" /> - <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> - <option name="ALTERNATIVE_JRE_PATH" value="" /> - <module name="RTI" /> - <RunnerSettings RunnerId="Debug"> - <option name="DEBUG_PORT" value="2738" /> - <option name="TRANSPORT" value="0" /> - <option name="LOCAL" value="true" /> - </RunnerSettings> - <RunnerSettings RunnerId="Run" /> - <ConfigurationWrapper RunnerId="Debug" /> - <ConfigurationWrapper RunnerId="Run" /> - </configuration> - <configuration selected="true" default="false" name="TimeKeeper" type="Application" factoryName="Application"> - <option name="MAIN_CLASS_NAME" value="net.sf.ohla.rti1516.federation.TimeKeeper" /> - <option name="VM_PARAMETERS" value="" /> - <option name="PROGRAM_PARAMETERS" value="" /> - <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" /> - <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> - <option name="ALTERNATIVE_JRE_PATH" value="" /> - <module name="RTI" /> - <RunnerSettings RunnerId="Run" /> - <ConfigurationWrapper RunnerId="Run" /> - </configuration> <configuration selected="false" default="false" name="IEEE 1516 Testsuite" type="TestNG" factoryName="TestNG"> <module name="Testsuite" /> <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> @@ -501,6 +537,23 @@ <option name="PROPERTIES_FILE" value="" /> <properties /> </configuration> + <configuration selected="true" default="false" name="RTI" type="Application" factoryName="Application"> + <option name="MAIN_CLASS_NAME" value="net.sf.ohla.rti1516.RTI" /> + <option name="VM_PARAMETERS" value="-Dohla.rti.host=localhost -Dohla.rti.port=5000 -ea -server" /> + <option name="PROGRAM_PARAMETERS" value="" /> + <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" /> + <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" /> + <option name="ALTERNATIVE_JRE_PATH" value="" /> + <module name="RTI" /> + <RunnerSettings RunnerId="Debug"> + <option name="DEBUG_PORT" value="2738" /> + <option name="TRANSPORT" value="0" /> + <option name="LOCAL" value="true" /> + </RunnerSettings> + <RunnerSettings RunnerId="Run" /> + <ConfigurationWrapper RunnerId="Debug" /> + <ConfigurationWrapper RunnerId="Run" /> + </configuration> </component> <component name="ScopeViewComponent"> <subPane subId="Project"> @@ -572,11 +625,11 @@ </component> <component name="ToolWindowManager"> <frame x="-4" y="-4" width="1288" height="998" extended-state="6" /> - <editor active="true" /> + <editor active="false" /> <layout> <window_info id="CVS" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="8" /> <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.32791588" order="7" /> - <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="true" weight="0.33333334" order="0" /> + <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="true" weight="0.20954692" order="0" /> <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.34367815" order="1" /> <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="1" /> <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.32413793" order="8" /> @@ -586,7 +639,7 @@ <window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.32988507" order="8" /> <window_info id="Metrics" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="8" /> <window_info id="Favorites" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.32928804" order="3" /> - <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="true" weight="0.10760518" order="1" /> + <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="true" weight="0.1553398" order="1" /> <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.27816093" order="2" /> <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="2" /> <window_info id="File View" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="3" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mne...@us...> - 2006-11-28 03:58:25
|
Revision: 56 http://svn.sourceforge.net/ohla/?rev=56&view=rev Author: mnewcomb Date: 2006-11-27 19:58:24 -0800 (Mon, 27 Nov 2006) Log Message: ----------- galt is delivered in the join response now Modified Paths: -------------- trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java trunk/rti/src/java/net/sf/ohla/rti1516/federate/time/TimeManager.java trunk/rti/src/java/net/sf/ohla/rti1516/federation/FederationExecution.java trunk/rti/src/java/net/sf/ohla/rti1516/federation/time/TimeKeeper.java trunk/rti/src/java/net/sf/ohla/rti1516/messages/JoinFederationExecutionResponse.java Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java 2006-11-28 03:44:53 UTC (rev 55) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java 2006-11-28 03:58:24 UTC (rev 56) @@ -356,8 +356,6 @@ this.mobileFederateServices = mobileFederateServices; this.rtiSession = rtiSession; - timeManager = new TimeManager(this, mobileFederateServices); - startPeerAcceptor(federateType); JoinFederationExecution joinFederationExecution = @@ -388,6 +386,9 @@ federateHandle = joinFederationExecutionResponse.getFederateHandle(); fdd = joinFederationExecutionResponse.getFdd(); + LogicalTime galt = joinFederationExecutionResponse.getGALT(); + timeManager = new TimeManager(this, mobileFederateServices, galt); + SocketConnector peerConnector = new SocketConnector(); peerConnector.setHandler(peerIoHandler); Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federate/time/TimeManager.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federate/time/TimeManager.java 2006-11-28 03:44:53 UTC (rev 55) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federate/time/TimeManager.java 2006-11-28 03:58:24 UTC (rev 56) @@ -77,10 +77,12 @@ protected TimeAdvanceType advanceRequestTimeType; public TimeManager(Federate federate, - MobileFederateServices mobileFederateServices) + MobileFederateServices mobileFederateServices, + LogicalTime galt) { this.federate = federate; this.mobileFederateServices = mobileFederateServices; + this.galt = galt; federateTime = mobileFederateServices.timeFactory.makeInitial(); } Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federation/FederationExecution.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federation/FederationExecution.java 2006-11-28 03:44:53 UTC (rev 55) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federation/FederationExecution.java 2006-11-28 03:58:24 UTC (rev 56) @@ -1537,7 +1537,7 @@ WriteFuture writeFuture = session.write(new DefaultResponse( joinFederationExecution.getId(), new JoinFederationExecutionResponse( - federateHandle, fdd, peerSocketAddresses))); + federateHandle, fdd, timeKeeper.getGALT(), peerSocketAddresses))); // TODO: set timeout // Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federation/time/TimeKeeper.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federation/time/TimeKeeper.java 2006-11-28 03:44:53 UTC (rev 55) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federation/time/TimeKeeper.java 2006-11-28 03:58:24 UTC (rev 56) @@ -49,6 +49,11 @@ galt = mobileFederateServices.timeFactory.makeInitial(); } + public LogicalTime getGALT() + { + return galt; + } + public void enableTimeRegulation(IoSession session, FederateHandle federateHandle, LogicalTimeInterval lookahead) Modified: trunk/rti/src/java/net/sf/ohla/rti1516/messages/JoinFederationExecutionResponse.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/messages/JoinFederationExecutionResponse.java 2006-11-28 03:44:53 UTC (rev 55) +++ trunk/rti/src/java/net/sf/ohla/rti1516/messages/JoinFederationExecutionResponse.java 2006-11-28 03:58:24 UTC (rev 56) @@ -23,21 +23,24 @@ import net.sf.ohla.rti1516.fdd.FDD; import hla.rti1516.FederateHandle; +import hla.rti1516.LogicalTime; public class JoinFederationExecutionResponse implements Message { protected FederateHandle federateHandle; protected FDD fdd; + protected LogicalTime galt; protected Map<FederateHandle, SocketAddress> peerConnectionInfo; public JoinFederationExecutionResponse( - FederateHandle federateHandle, FDD fdd, + FederateHandle federateHandle, FDD fdd, LogicalTime galt, Map<FederateHandle, SocketAddress> peerConnectionInfo) { this.federateHandle = federateHandle; this.fdd = fdd; + this.galt = galt; this.peerConnectionInfo = peerConnectionInfo; } @@ -51,6 +54,11 @@ return fdd; } + public LogicalTime getGALT() + { + return galt; + } + public Map<FederateHandle, SocketAddress> getPeerConnectionInfo() { return peerConnectionInfo; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mne...@us...> - 2006-11-28 03:44:54
|
Revision: 55 http://svn.sourceforge.net/ohla/?rev=55&view=rev Author: mnewcomb Date: 2006-11-27 19:44:53 -0800 (Mon, 27 Nov 2006) Log Message: ----------- added GALT advanced message Modified Paths: -------------- trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java trunk/rti/src/java/net/sf/ohla/rti1516/federate/time/TimeManager.java trunk/rti/src/java/net/sf/ohla/rti1516/federation/time/TimeConstrainedFederate.java trunk/rti/src/java/net/sf/ohla/rti1516/federation/time/TimeKeeper.java trunk/rti/src/java/net/sf/ohla/rti1516/federation/time/TimeRegulatingFederate.java Added Paths: ----------- trunk/rti/src/java/net/sf/ohla/rti1516/messages/GALTAdvanced.java Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java 2006-11-28 02:58:18 UTC (rev 54) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java 2006-11-28 03:44:53 UTC (rev 55) @@ -89,6 +89,7 @@ import net.sf.ohla.rti1516.messages.SubscribeObjectClassAttributes; import net.sf.ohla.rti1516.messages.SynchronizationPointAchieved; import net.sf.ohla.rti1516.messages.UnsubscribeObjectClassAttributes; +import net.sf.ohla.rti1516.messages.GALTAdvanced; import org.apache.mina.common.ConnectFuture; import org.apache.mina.common.IoHandlerAdapter; @@ -610,6 +611,40 @@ objectInstanceNameReserved.getName(), objectInstanceNameReserved.getObjectInstanceHandle()); } + else if (message instanceof GALTAdvanced) + { + GALTAdvanced galtAdvanced = (GALTAdvanced) message; + + LogicalTime galt = galtAdvanced.getGALT(); + log.debug("GALT advanced: {}", galt); + + timeManager.galtAdvanced(galt); + + futureTasksLock.lock(); + try + { + TimestampedFutureTask timestampedFutureTask = futureTasks.peek(); + while (timestampedFutureTask != null && + timestampedFutureTask.getTime().compareTo(galt) <= 0) + { + try + { + timestampedFutureTask.run(); + } + catch (Throwable t) + { + log.error(String.format("unable to execute scheduled task: %s", + timestampedFutureTask), t); + } + + futureTasks.poll(); + } + } + finally + { + futureTasksLock.unlock(); + } + } else { processed = false; @@ -3363,13 +3398,8 @@ public int compareTo(Object rhs) { - return compareTo((TimestampedFutureTask) rhs); + return time.compareTo(((TimestampedFutureTask) rhs).time); } - - public int compareTo(TimestampedFutureTask rhs) - { - return time.compareTo(rhs.time); - } } protected class AddCallback Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federate/time/TimeManager.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federate/time/TimeManager.java 2006-11-28 02:58:18 UTC (rev 54) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federate/time/TimeManager.java 2006-11-28 03:44:53 UTC (rev 55) @@ -671,6 +671,19 @@ } } + public void galtAdvanced(LogicalTime galt) + { + timeLock.writeLock().lock(); + try + { + this.galt = galt; + } + finally + { + timeLock.writeLock().unlock(); + } + } + public void checkIfInTimeAdvancingState() throws InTimeAdvancingState { Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federation/time/TimeConstrainedFederate.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federation/time/TimeConstrainedFederate.java 2006-11-28 02:58:18 UTC (rev 54) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federation/time/TimeConstrainedFederate.java 2006-11-28 03:44:53 UTC (rev 55) @@ -31,8 +31,6 @@ { this.federateHandle = federateHandle; this.federateTime = federateTime; - - timeAdvanceRequest = federateTime; } public FederateHandle getFederateHandle() Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federation/time/TimeKeeper.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federation/time/TimeKeeper.java 2006-11-28 02:58:18 UTC (rev 54) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federation/time/TimeKeeper.java 2006-11-28 03:44:53 UTC (rev 55) @@ -9,6 +9,7 @@ import net.sf.ohla.rti1516.federate.callbacks.TimeConstrainedEnabled; import net.sf.ohla.rti1516.federate.callbacks.TimeRegulationEnabled; import net.sf.ohla.rti1516.federation.FederationExecution; +import net.sf.ohla.rti1516.messages.GALTAdvanced; import org.apache.mina.common.IoSession; @@ -139,6 +140,8 @@ TimeConstrainedFederate timeConstrainedFederate = timeConstrainedFederates.get(federateHandle); + boolean galtAdvanced = false; + if (timeRegulatingFederate != null) { try @@ -156,7 +159,8 @@ newGALT = min(newGALT, trf.getLITS()); } - if (galt.compareTo(newGALT) < 0) + galtAdvanced = galt.compareTo(newGALT) < 0; + if (galtAdvanced) { galt = newGALT; } @@ -171,6 +175,11 @@ } } + if (galtAdvanced) + { + federationExecution.send(new GALTAdvanced(galt)); + } + if (timeConstrainedFederate != null) { timeConstrainedFederate.timeAdvanceRequest(time); @@ -195,6 +204,8 @@ timeRegulatingFederate.getFederateTime()); } + log.debug("advancing federates: {}", advancingFederates); + for (Map.Entry<FederateHandle, LogicalTime> entry : advancingFederates.entrySet()) { Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federation/time/TimeRegulatingFederate.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federation/time/TimeRegulatingFederate.java 2006-11-28 02:58:18 UTC (rev 54) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federation/time/TimeRegulatingFederate.java 2006-11-28 03:44:53 UTC (rev 55) @@ -39,7 +39,6 @@ this.federateTime = federateTime; this.lookahead = lookahead; - timeAdvanceRequest = federateTime; lits = federateTime.add(lookahead); } Added: trunk/rti/src/java/net/sf/ohla/rti1516/messages/GALTAdvanced.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/messages/GALTAdvanced.java (rev 0) +++ trunk/rti/src/java/net/sf/ohla/rti1516/messages/GALTAdvanced.java 2006-11-28 03:44:53 UTC (rev 55) @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2006, Michael Newcomb + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package net.sf.ohla.rti1516.messages; + +import hla.rti1516.LogicalTime; + +public class GALTAdvanced + implements Message +{ + protected LogicalTime galt; + + public GALTAdvanced(LogicalTime galt) + { + this.galt = galt; + } + + public LogicalTime getGALT() + { + return galt; + } + + @Override + public String toString() + { + return String.format("GALT advanced: %s", galt); + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mne...@us...> - 2006-11-28 02:58:17
|
Revision: 54 http://svn.sourceforge.net/ohla/?rev=54&view=rev Author: mnewcomb Date: 2006-11-27 18:58:18 -0800 (Mon, 27 Nov 2006) Log Message: ----------- - made send() methods public - fixed some compilation warnings Modified Paths: -------------- trunk/rti/src/java/net/sf/ohla/rti1516/federation/FederationExecution.java Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federation/FederationExecution.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federation/FederationExecution.java 2006-11-28 02:30:56 UTC (rev 53) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federation/FederationExecution.java 2006-11-28 02:58:18 UTC (rev 54) @@ -163,6 +163,11 @@ String.format("%s.%s", FederationExecution.class, name)); } + public void destroy() + throws FederatesCurrentlyJoined + { + } + public IoSession getFederateSession(FederateHandle federateHandle) { federatesLock.lock(); @@ -176,11 +181,22 @@ } } - public void destroy() - throws FederatesCurrentlyJoined + public void send(Message message) { + send(message, null); } + public void send(Message message, IoSession sender) + { + for (IoSession federateSession : federateSessions.values()) + { + if (federateSession != sender) + { + federateSession.write(message); + } + } + } + public boolean process(IoSession session, Object message) { boolean processed = true; @@ -382,7 +398,7 @@ ObjectInstanceRegistered objectInstanceRegistered = new ObjectInstanceRegistered(objectInstanceHandle, name); - WriteFuture writeFuture = session.write(new RequestResponse( + session.write(new RequestResponse( registerObjectInstance.getId(), objectInstanceRegistered)); ownershipManager.registerObjectInstance( @@ -1614,22 +1630,6 @@ return (SocketAddress) session.getAttribute(CONNECTION_INFO); } - protected void send(Message message) - { - send(message, null); - } - - protected void send(Message message, IoSession sender) - { - for (IoSession federateSession : federateSessions.values()) - { - if (federateSession != sender) - { - federateSession.write(message); - } - } - } - protected FederateHandle nextFederateHandle() { return new OHLAFederateHandle(federateCount.incrementAndGet()); @@ -1646,7 +1646,7 @@ } protected class WaitForObjectInstanceRegisteredConfirmation - implements Callable + implements Callable<Object> { protected ObjectInstanceRegistered objectInstanceRegistered; protected DiscoverObjectInstance discoverObjectInstance; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mne...@us...> - 2006-11-28 02:30:59
|
Revision: 53 http://svn.sourceforge.net/ohla/?rev=53&view=rev Author: mnewcomb Date: 2006-11-27 18:30:56 -0800 (Mon, 27 Nov 2006) Log Message: ----------- reflected attributes and received interactions now obtain a read lock on the time lock before checking if the federate is constrained (to determine order type of the received message) Modified Paths: -------------- trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java 2006-11-28 02:21:13 UTC (rev 52) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federate/Federate.java 2006-11-28 02:30:56 UTC (rev 53) @@ -3463,72 +3463,88 @@ ReflectAttributeValues reflectAttributeValues = (ReflectAttributeValues) message; - OrderType receivedOrderType = - reflectAttributeValues.getSentOrderType() == OrderType.TIMESTAMP && - timeManager.isTimeConstrained() ? OrderType.TIMESTAMP : - OrderType.RECEIVE; - reflectAttributeValues.setReceivedOrderType(receivedOrderType); - - if (receivedOrderType == OrderType.RECEIVE) + timeManager.getTimeLock().readLock().lock(); + try { - // receive order callbacks need to be held until released if we are - // constrained and in the time granted state if asynchronous delivery is - // disabled - // - boolean hold = timeManager.isTimeConstrainedAndTimeGranted() && - !isAsynchronousDeliveryEnabled(); + OrderType receivedOrderType = + reflectAttributeValues.getSentOrderType() == OrderType.TIMESTAMP && + timeManager.isTimeConstrained() ? OrderType.TIMESTAMP : + OrderType.RECEIVE; + reflectAttributeValues.setReceivedOrderType(receivedOrderType); - callbackManager.add(reflectAttributeValues, hold); + if (receivedOrderType == OrderType.RECEIVE) + { + // receive order callbacks need to be held until released if we are + // constrained and in the time granted state if asynchronous delivery is + // disabled + // + boolean hold = timeManager.isTimeConstrainedAndTimeGranted() && + !isAsynchronousDeliveryEnabled(); + + callbackManager.add(reflectAttributeValues, hold); + } + else + { + // schedule the callback for the appropriate time + // + Future future = schedule( + reflectAttributeValues.getUpdateTime(), + new AddCallback(reflectAttributeValues)); + + // register the message retraction handle + // + messageRetractionManager.add( + reflectAttributeValues.getUpdateTime(), future, + reflectAttributeValues.getMessageRetractionHandle()); + } } - else + finally { - // schedule the callback for the appropriate time - // - Future future = schedule( - reflectAttributeValues.getUpdateTime(), - new AddCallback(reflectAttributeValues)); - - // register the message retraction handle - // - messageRetractionManager.add( - reflectAttributeValues.getUpdateTime(), future, - reflectAttributeValues.getMessageRetractionHandle()); + timeManager.getTimeLock().readLock().unlock(); } } else if (message instanceof ReceiveInteraction) { ReceiveInteraction receiveInteraction = (ReceiveInteraction) message; - OrderType receivedOrderType = - receiveInteraction.getSentOrderType() == OrderType.TIMESTAMP && - timeManager.isTimeConstrained() ? OrderType.TIMESTAMP : - OrderType.RECEIVE; + timeManager.getTimeLock().readLock().lock(); + try + { + OrderType receivedOrderType = + receiveInteraction.getSentOrderType() == OrderType.TIMESTAMP && + timeManager.isTimeConstrained() ? OrderType.TIMESTAMP : + OrderType.RECEIVE; - receiveInteraction.setReceivedOrderType(receivedOrderType); + receiveInteraction.setReceivedOrderType(receivedOrderType); - if (receivedOrderType == OrderType.RECEIVE) - { - // receive order callbacks need to be held until released if we are - // constrained and in the time granted state, if asynchronous delivery is - // disabled - // - boolean hold = timeManager.isTimeConstrainedAndTimeGranted() && - !isAsynchronousDeliveryEnabled(); + if (receivedOrderType == OrderType.RECEIVE) + { + // receive order callbacks need to be held until released if we are + // constrained and in the time granted state, if asynchronous delivery is + // disabled + // + boolean hold = timeManager.isTimeConstrainedAndTimeGranted() && + !isAsynchronousDeliveryEnabled(); - callbackManager.add(receiveInteraction, hold); + callbackManager.add(receiveInteraction, hold); + } + else + { + // schedule the callback for the appropriate time + // + Future future = schedule(receiveInteraction.getSendTime(), + new AddCallback(receiveInteraction)); + + // register the message retraction handle + // + messageRetractionManager.add( + receiveInteraction.getSendTime(), future, + receiveInteraction.getMessageRetractionHandle()); + } } - else + finally { - // schedule the callback for the appropriate time - // - Future future = schedule(receiveInteraction.getSendTime(), - new AddCallback(receiveInteraction)); - - // register the message retraction handle - // - messageRetractionManager.add( - receiveInteraction.getSendTime(), future, - receiveInteraction.getMessageRetractionHandle()); + timeManager.getTimeLock().readLock().unlock(); } } else if (message instanceof FederateSaveInitiated) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mne...@us...> - 2006-11-28 02:21:15
|
Revision: 52 http://svn.sourceforge.net/ohla/?rev=52&view=rev Author: mnewcomb Date: 2006-11-27 18:21:13 -0800 (Mon, 27 Nov 2006) Log Message: ----------- federation time cannot go backwards Modified Paths: -------------- trunk/rti/src/java/net/sf/ohla/rti1516/federation/time/TimeKeeper.java Modified: trunk/rti/src/java/net/sf/ohla/rti1516/federation/time/TimeKeeper.java =================================================================== --- trunk/rti/src/java/net/sf/ohla/rti1516/federation/time/TimeKeeper.java 2006-11-27 03:52:52 UTC (rev 51) +++ trunk/rti/src/java/net/sf/ohla/rti1516/federation/time/TimeKeeper.java 2006-11-28 02:21:13 UTC (rev 52) @@ -78,13 +78,6 @@ try { timeRegulatingFederates.remove(federateHandle); - - if (timeRegulatingFederates.isEmpty()) - { - // TODO: is this correct? - // - galt = mobileFederateServices.timeFactory.makeInitial(); - } } finally { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |