本文整理汇总了Java中hla.rti1516e.exceptions.ObjectInstanceNameNotReserved类的典型用法代码示例。如果您正苦于以下问题:Java ObjectInstanceNameNotReserved类的具体用法?Java ObjectInstanceNameNotReserved怎么用?Java ObjectInstanceNameNotReserved使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ObjectInstanceNameNotReserved类属于hla.rti1516e.exceptions包,在下文中一共展示了ObjectInstanceNameNotReserved类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: publish
import hla.rti1516e.exceptions.ObjectInstanceNameNotReserved; //导入依赖的package包/类
public void publish(Object element, String name) throws RTIinternalError, NameNotFound, FederateNotExecutionMember, NotConnected, InvalidObjectClassHandle, InstantiationException, IllegalAccessException, AttributeNotDefined, ObjectClassNotDefined, SaveInProgress, RestoreInProgress, IllegalName, ObjectInstanceNameInUse, ObjectInstanceNameNotReserved, ObjectClassNotPublished, AttributeNotOwned, ObjectInstanceNotKnown, UpdateException {
ObjectClassModel ocm = published.get(element.getClass().getAnnotation(ObjectClass.class).name());
if(ocm == null){
ocm = new ObjectClassModel(element.getClass());
ocm.publish();
this.published.put(element.getClass().getAnnotation(ObjectClass.class).name(), ocm);
}
ObjectClassEntity entity = null;
if(name != null)
entity = new ObjectClassEntity(name, element);
else
entity = new ObjectClassEntity(element.getClass().getName()+element.hashCode(), element);
ocm.addEntity(entity);
this.mapInstanceNameObjectClassEntity.put(entity.getInstanceName(), entity);
}
示例2: reserveObjectInstanceName
import hla.rti1516e.exceptions.ObjectInstanceNameNotReserved; //导入依赖的package包/类
private ObjectInstanceHandle reserveObjectInstanceName(ObjectClassEntity entity) throws IllegalName, SaveInProgress, RestoreInProgress,
FederateNotExecutionMember, NotConnected, RTIinternalError,
ObjectInstanceNameInUse, ObjectInstanceNameNotReserved,
ObjectClassNotPublished, ObjectClassNotDefined {
// Reserve the name.
rti_ambassador.reserveObjectInstanceName(entity.getInstanceName());
// Need to wait here until name reservation callback is recieved.
while (entity.getStatus() == NameReservationStatus.UNKNOWN)
Thread.yield();
if (entity.getStatus() == NameReservationStatus.FAILED) {
logger.error("Name Resevation Failed [name= "+entity+" ]");
throw new IllegalName("Name Resevation Failed [name= "+entity+" ]");
}
// If name is reserved then register the instance.
if (entity.getStatus() == NameReservationStatus.SUCCEDED)
return rti_ambassador.registerObjectInstance(objectClassHandle,entity.getInstanceName());
return null;
}
示例3: publishElement
import hla.rti1516e.exceptions.ObjectInstanceNameNotReserved; //导入依赖的package包/类
public void publishElement(Object element, String name) throws NameNotFound, FederateNotExecutionMember, NotConnected,
RTIinternalError, InvalidObjectClassHandle, PublishException, InstantiationException,
IllegalAccessException, AttributeNotDefined, ObjectClassNotDefined, SaveInProgress,
RestoreInProgress, IllegalName, ObjectInstanceNameInUse, ObjectInstanceNameNotReserved,
ObjectClassNotPublished, AttributeNotOwned, ObjectInstanceNotKnown, UpdateException {
if(!fedamb.objectClassEntityIsAlreadyPublished(element)){
fedamb.publishObjectClassEntity(element, name);
logger.info("The Object '"+element+"' has been published.");
}
else{
logger.warn("Object: "+element+", is already published");
throw new PublishException("Object: "+element+", is already published.");
}
}
示例4: updatePublishedObject
import hla.rti1516e.exceptions.ObjectInstanceNameNotReserved; //导入依赖的package包/类
public void updatePublishedObject(ObjectClassEntity element) throws UpdateException, IllegalName, SaveInProgress, RestoreInProgress, FederateNotExecutionMember,
NotConnected, RTIinternalError, ObjectInstanceNameInUse, ObjectInstanceNameNotReserved, ObjectClassNotPublished,
ObjectClassNotDefined, AttributeNotOwned, AttributeNotDefined, ObjectInstanceNotKnown {
ObjectClassEntity entity = entityMap.get(element.getElement());
if(entity == null){
logger.error("Can't find the ' "+element+" ' !");
throw new IllegalStateException("Can't find the ' "+element+" ' !");
}
if(status == ObjectModelStatus.PUBLISHED) {
if(entity.getObjectInstanceHandle() == null)
entity.setObjectInstanceHandle(reserveObjectInstanceName(entity));
Map<String, byte[]> ris = parser.encode(element.getElement());
for(Entry<String, AttributeHandle> entry : mapFieldNameAttributeHandle.entrySet())
attribute_values.put(entry.getValue(), ris.get(entry.getKey()));
rti_ambassador.updateAttributeValues(entity.getObjectInstanceHandle(), attribute_values , null);
}
else{
logger.error("Can't update the Object ' "+element+" ', because it is not published!");
throw new IllegalStateException("Can't update the Object ' "+element+" ', because it is not published!");
}
}
示例5: publishElement
import hla.rti1516e.exceptions.ObjectInstanceNameNotReserved; //导入依赖的package包/类
@Override
public void publishElement(Object element, String name) throws NameNotFound, FederateNotExecutionMember, NotConnected,
RTIinternalError, InvalidObjectClassHandle, AttributeNotDefined,
ObjectClassNotDefined, SaveInProgress, RestoreInProgress, PublishException, InstantiationException, IllegalAccessException, IllegalName, ObjectInstanceNameInUse, ObjectInstanceNameNotReserved, ObjectClassNotPublished, AttributeNotOwned, ObjectInstanceNotKnown, UpdateException {
if(objectClassIsValid(element.getClass()))
this.hlamodule.publishElement(element, name);
else{
logger.error("ObjectElement: '"+ element +"' is not valid!");
throw new PublishException("ObjectElement: '"+ element +"' is not valid!");
}
}
示例6: updateElement
import hla.rti1516e.exceptions.ObjectInstanceNameNotReserved; //导入依赖的package包/类
@Override
public void updateElement(Object element) throws FederateNotExecutionMember, NotConnected, AttributeNotOwned, AttributeNotDefined,
ObjectInstanceNotKnown, SaveInProgress, RestoreInProgress, RTIinternalError, UpdateException,
IllegalName, ObjectInstanceNameInUse, ObjectInstanceNameNotReserved, ObjectClassNotPublished, ObjectClassNotDefined {
if(objectClassIsValid(element.getClass()))
this.hlamodule.updateElementObject(element);
else{
logger.error("ObjectElement: '"+ element +"' is not valid!");
throw new UpdateException("ObjectElement: '"+ element +"' is not valid!");
}
}
示例7: publishElement
import hla.rti1516e.exceptions.ObjectInstanceNameNotReserved; //导入依赖的package包/类
public void publishElement(Object element, String name) throws NameNotFound, FederateNotExecutionMember, NotConnected, RTIinternalError, InvalidObjectClassHandle, PublishException, InstantiationException, IllegalAccessException, AttributeNotDefined, ObjectClassNotDefined, SaveInProgress, RestoreInProgress, IllegalName, ObjectInstanceNameInUse, ObjectInstanceNameNotReserved, ObjectClassNotPublished, AttributeNotOwned, ObjectInstanceNotKnown, UpdateException {
if(!fedamb.objectClassEntityIsAlreadyPublished(element)){
fedamb.publishObjectClassEntity(element, name);
logger.info("The Object ' "+element+" ' has been published.");
}
else{
logger.warn("Object: "+element+", is already published");
throw new PublishException("Object: "+element+", is already published.");
}
}
示例8: updateElementObject
import hla.rti1516e.exceptions.ObjectInstanceNameNotReserved; //导入依赖的package包/类
public void updateElementObject(Object element) throws UpdateException, FederateNotExecutionMember, NotConnected, AttributeNotOwned,
AttributeNotDefined, ObjectInstanceNotKnown, SaveInProgress, RestoreInProgress, RTIinternalError,
IllegalName, ObjectInstanceNameInUse, ObjectInstanceNameNotReserved, ObjectClassNotPublished, ObjectClassNotDefined {
if(fedamb.objectClassEntityIsAlreadyPublished(element)){
fedamb.updateObjectClassEntityOnRTI(element);
logger.info("The Object ' "+element+" ' has been updated on the HLA/RTI platform.");
}
else{
logger.warn("Object: "+element+", is not published. The equal() and hascode() methods must be consistent.");
throw new UpdateException("Object: "+element+", is not published.The equal() and hashcode() methods must be consistent.");
}
}
示例9: updateObjectClassEntityOnRTI
import hla.rti1516e.exceptions.ObjectInstanceNameNotReserved; //导入依赖的package包/类
public void updateObjectClassEntityOnRTI(Object element) throws IllegalName, SaveInProgress, RestoreInProgress, FederateNotExecutionMember,
NotConnected, RTIinternalError, ObjectInstanceNameInUse, ObjectInstanceNameNotReserved,
ObjectClassNotPublished, ObjectClassNotDefined, AttributeNotOwned, AttributeNotDefined,
ObjectInstanceNotKnown, UpdateException {
ObjectClassModel ocm = objectManager.getPublishedMap().get(element.getClass().getAnnotation(ObjectClass.class).name());
ocm.updatePublishedObject(ocm.getEntities().get(element));
}
示例10: updateElementObject
import hla.rti1516e.exceptions.ObjectInstanceNameNotReserved; //导入依赖的package包/类
public void updateElementObject(Object element) throws UpdateException, FederateNotExecutionMember, NotConnected, AttributeNotOwned,
AttributeNotDefined, ObjectInstanceNotKnown, SaveInProgress, RestoreInProgress, RTIinternalError,
IllegalName, ObjectInstanceNameInUse, ObjectInstanceNameNotReserved, ObjectClassNotPublished, ObjectClassNotDefined {
if(fedamb.objectClassEntityIsAlreadyPublished(element)){
fedamb.updateObjectClassEntityOnRTI(element);
logger.info("The Object '"+element+"' has been updated on the HLA/RTI platform.");
}
else{
logger.warn("Object: "+element+", is not published. The equal() and hascode() methods must be consistent.");
throw new UpdateException("Object: "+element+", is not published.The equal() and hashcode() methods must be consistent.");
}
}
示例11: publishElement
import hla.rti1516e.exceptions.ObjectInstanceNameNotReserved; //导入依赖的package包/类
public void publishElement(Object element) throws NameNotFound, FederateNotExecutionMember, NotConnected,
RTIinternalError, InvalidObjectClassHandle, AttributeNotDefined,
ObjectClassNotDefined, SaveInProgress, RestoreInProgress,
InstantiationException, IllegalAccessException, IllegalName,
ObjectInstanceNameInUse, ObjectInstanceNameNotReserved, ObjectClassNotPublished,
AttributeNotOwned, ObjectInstanceNotKnown, PublishException, UpdateException {
publishElement(element, null);
}
示例12: updateElement
import hla.rti1516e.exceptions.ObjectInstanceNameNotReserved; //导入依赖的package包/类
public void updateElement(Object element) throws FederateNotExecutionMember, NotConnected, AttributeNotOwned, AttributeNotDefined,
ObjectInstanceNotKnown, SaveInProgress, RestoreInProgress, RTIinternalError, UpdateException,
IllegalName, ObjectInstanceNameInUse, ObjectInstanceNameNotReserved, ObjectClassNotPublished,
ObjectClassNotDefined {
if(objectClassIsValid(element.getClass()))
this.hlamodule.updateElementObject(element);
else{
logger.error("ObjectElement: '"+ element +"' is not valid!");
throw new UpdateException("ObjectElement: '"+ element +"' is not valid!");
}
}
示例13: releaseObjectInstanceName
import hla.rti1516e.exceptions.ObjectInstanceNameNotReserved; //导入依赖的package包/类
public void releaseObjectInstanceName(final String theObjectInstanceName) throws ObjectInstanceNameNotReserved, SaveInProgress, RestoreInProgress, FederateNotExecutionMember, NotConnected, RTIinternalError {
this.logger.trace("releaseObjectInstanceName theObjectInstanceName=" + theObjectInstanceName);
try {
this._rtiAmbassador.releaseObjectInstanceName(theObjectInstanceName);
} catch (ObjectInstanceNameNotReserved | SaveInProgress | RestoreInProgress | FederateNotExecutionMember | NotConnected | RTIinternalError e) {
this.logger.error("releaseObjectInstanceName exception=" + e.getMessage());
throw e;
}
}
示例14: releaseMultipleObjectInstanceName
import hla.rti1516e.exceptions.ObjectInstanceNameNotReserved; //导入依赖的package包/类
public void releaseMultipleObjectInstanceName(final Set<String> theObjectNames) throws ObjectInstanceNameNotReserved, SaveInProgress, RestoreInProgress, FederateNotExecutionMember, NotConnected, RTIinternalError {
this.logger.trace("releaseMultipleObjectInstanceName theObjectNames=" + theObjectNames.toString());
try {
this._rtiAmbassador.releaseMultipleObjectInstanceName(theObjectNames);
} catch (ObjectInstanceNameNotReserved | SaveInProgress | RestoreInProgress | FederateNotExecutionMember | NotConnected | RTIinternalError e) {
this.logger.error("releaseMultipleObjectInstanceName exception=" + e.getMessage());
throw e;
}
}
示例15: registerObjectInstance
import hla.rti1516e.exceptions.ObjectInstanceNameNotReserved; //导入依赖的package包/类
public ObjectInstanceHandle registerObjectInstance(final ObjectClassHandle theClass, final String theObjectName) throws ObjectInstanceNameInUse, ObjectInstanceNameNotReserved, ObjectClassNotPublished, ObjectClassNotDefined, SaveInProgress, RestoreInProgress, FederateNotExecutionMember, NotConnected, RTIinternalError {
this.logger.trace("registerObjectInstance theClass=" + theClass.toString() + ", theObjectName=" + theObjectName);
try {
final ObjectInstanceHandle objectInstanceHandle = this._rtiAmbassador.registerObjectInstance(theClass, theObjectName);
this.logger.trace("registerObjectInstance return " + objectInstanceHandle.toString());
return objectInstanceHandle;
} catch (ObjectInstanceNameInUse | ObjectInstanceNameNotReserved | ObjectClassNotPublished | ObjectClassNotDefined | SaveInProgress | RestoreInProgress | FederateNotExecutionMember | NotConnected | RTIinternalError e) {
this.logger.error("registerObjectInstance exception=" + e.getMessage());
throw e;
}
}