Exemplo n.º 1
0
  public Object sendRequest(String oid, Type type, String operation, Object[] params)
      throws Throwable {
    Object result = null;

    checkDisposed();

    ThreadId threadId = _iThreadPool.getThreadId();
    Object handle = _iThreadPool.attach(threadId);
    try {
      boolean sync;
      try {
        sync =
            _iProtocol.writeRequest(
                oid, TypeDescription.getTypeDescription(type), operation, threadId, params);
      } catch (IOException e) {
        dispose(e);
        throw (DisposedException) new DisposedException(e.toString()).initCause(e);
      }
      if (sync && Thread.currentThread() != _messageDispatcher) {
        result = _iThreadPool.enter(handle, threadId);
      }
    } finally {
      _iThreadPool.detach(handle, threadId);
      if (operation.equals("release")) release(); // kill this bridge, if this was the last proxy
    }

    if (DEBUG) System.err.println("##### " + getClass().getName() + ".sendRequest left:" + result);

    // On the wire (at least in URP), the result of queryInterface is
    // transported as an ANY, but in Java it shall be transported as a
    // direct reference to the UNO object (represented as a Java Object),
    // never boxed in a com.sun.star.uno.Any:
    if (operation.equals("queryInterface") && result instanceof Any) {
      Any a = (Any) result;
      if (a.getType().getTypeClass() == TypeClass.INTERFACE) {
        result = a.getObject();
      } else {
        result = null; // should never happen
      }
    }

    return result;
  }
Exemplo n.º 2
0
  /** Redefined method returns object, that contains changed property value. */
  public void _TypeMap() {
    boolean result = false;
    try {
      Any TypeMap = (Any) oObj.getPropertyValue("TypeMap");
      String TypeName = TypeMap.getType().getTypeName();
      String expected = "com.sun.star.container.XNameAccess";
      result = TypeName.equals(expected);
      if (!result) {
        log.println("Expected Type is " + expected);
        log.println("but the returned is " + TypeName);
      }
    } catch (com.sun.star.lang.WrappedTargetException e) {
      log.println("Exception " + e.getMessage());
    } catch (com.sun.star.beans.UnknownPropertyException e) {
      log.println("Exception " + e.getMessage());
    }

    tRes.tested("TypeMap", result);
  }