Package net.alteiar.newversion.server.document

Examples of net.alteiar.newversion.server.document.IDocument


   * @param propertyName
   * @param newValue
   * @param timestamp
   */
  protected void documentChanged(MessageModifyValue msg) {
    IDocument doc = documents.get(msg.getId());
    doc.remoteValueChanged(msg.getPropertyName(), msg.getNewValue(),
        msg.getTimestamp());
  }
View Full Code Here


   * This method is call when a bean is deleted from server
   *
   * @param msg
   */
  protected void documentClosed(UniqueID guid) {
    IDocument doc = null;
    synchronized (documents) {
      doc = documents.remove(guid);
    }

    if (doc != null) {
      // notify listener that a document is added
      for (DocumentManagerListener listener : getListeners()) {
        listener.beanRemoved(doc.getBeanEncapsulator().getBean());
      }

      // internal notify that a document is received
      getCounterInstance().countDown();
      doc.remoteCloseDocument();
    }
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  public <E extends BasicBean> E getBean(UniqueID id, long timeout) {
    if (id == null) {
      throw new NullPointerException("the unique id must'nt be null");
    }
    IDocument doc = getDocument(id, -1L);

    if (doc == null) {
      // try to find it localy in campaign
      BasicBean bean = searchBean(getSpecificPath(), id);
      if (bean != null) {
        documentAdded(bean);
      } else {
        // try to find it globaly
        bean = searchBean(getGlobalPath(), id);
        if (bean != null) {
          // add to document in order to avoid search agains
          addDocument(new DocumentLocal(bean));
        }
      }
      doc = getDocument(id, timeout);
    }

    return doc == null ? null : (E) doc.getBeanEncapsulator().getBean();
  }
View Full Code Here

  }

  protected IDocument getDocument(UniqueID id, Long timeout) {
    Long begin = System.currentTimeMillis();

    IDocument value = documents.get(id);

    Long current = System.currentTimeMillis();
    while (value == null && (current - begin) < timeout) {
      try {
        if (!getCounterInstance().await((timeout - (current - begin)),
View Full Code Here

TOP

Related Classes of net.alteiar.newversion.server.document.IDocument

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.