1 24 25 package org.objectweb.dream.message; 26 27 import java.io.Serializable ; 28 import java.util.Iterator ; 29 30 import org.objectweb.dream.util.EmptyIterator; 31 import org.objectweb.dream.util.Error; 32 33 39 public abstract class AbstractNonExtensibleMessage 40 implements 41 Message, 42 MessageType, 43 MessageReferenceCounter, 44 Cloneable , 45 Serializable 46 { 47 48 49 transient short messageManagerId; 50 51 transient short referenceCounter = 0; 52 53 57 63 public Object getChunk(String name) 64 { 65 return this; 66 } 67 68 73 public Message[] getSubMessages() 74 { 75 return EMPTY_MESSAGE_ARRAY; 76 } 77 78 81 public Iterator getSubMessageIterator() 82 { 83 return EmptyIterator.INSTANCE; 84 } 85 86 89 public MessageType getMessageType() 90 { 91 return this; 92 } 93 94 97 public short getMessageManagerId() 98 { 99 return messageManagerId; 100 } 101 102 105 public void setMessageManagerId(short id) 106 { 107 messageManagerId = id; 108 } 109 110 114 117 public MessageType[] getSubMessageTypes() 118 { 119 Error.error("This method is not implemented", null); 120 return EMPTY_MESSAGE_TYPE_ARRAY; 121 } 122 123 126 public Iterator getSubMessageTypesIterator() 127 { 128 Error.error("This method is not implemented", null); 129 return EmptyIterator.INSTANCE; 130 } 131 132 135 public boolean isEmpty() 136 { 137 Error.error("This method is not implemented", null); 138 return false; 139 } 140 141 144 public boolean isSubTypeOf(MessageType t) 145 { 146 Error.error("This method is not implemented", null); 147 return false; 148 } 149 150 153 public String [] getChunkNames() 154 { 155 Error.error("This method is not implemented", null); 156 return null; 157 } 158 159 162 public Iterator getChunkNamesIterator() 163 { 164 Error.error("This method is not implemented", null); 165 return null; 166 } 167 168 171 public ChunkType getChunkType(String name) 172 { 173 Error.error("This method is not implemented", null); 174 return null; 175 } 176 177 181 184 public void incrementReferenceCounter() 185 { 186 referenceCounter++; 187 } 188 189 192 public boolean decrementReferenceCounter() 193 { 194 synchronized (this) 195 { 196 referenceCounter--; 197 return (referenceCounter == 0); 198 } 199 } 200 } | Popular Tags |