/** * Fetches the <tt>ServerEntityData</tt> representing a given entity. Will create and return a new * dummy element if no element exists. * * <p>Dummy elements are registered and unregistered on demand. If no dummy element is created, * the reference returned by <tt>entity.getData</tt> will be returned. * * @param entity the entity * @return either the same reference that <tt>entity.getData</tt> would return or a newly created * <tt>ServerEntityData</tt> if <tt>entity.getData</tt> would return <tt>null</tt> */ public ServerEntityData getData(SyncEntity entity) { ServerEntityData data = (ServerEntityData) entity.getData(); if (data != null) { return data; } return new ServerEntityData(this, idGenerator.generateAndReserve(), entity); }
/** * Creates a new <tt>ServerCoreModule</tt> that will be managed by a given <tt>SyncAppState</tt>. * * <p>This constructor will be called reflectively by <tt>appState</tt>. * * @param appState the <tt>SyncAppState</tt> that creates this <tt>ServerCoreModule</tt> */ public ServerCoreModule(ServerSyncAppState appState) { super(appState, false); idGenerator = new IdGenerator(); idGenerator.reserve(EntityProvider.NULL_ID); connectionData = new HashMap<MessageConnection, ServerConnectionInfo>(); }