Package com.kurento.tool.rom.server

Examples of com.kurento.tool.rom.server.ProtocolException


        }

        JsonObject subsObject = (JsonObject) subscription;
        Set<Entry<String, JsonElement>> entries = subsObject.entrySet();
        if (entries.size() != 1) {
          throw new ProtocolException(
              "Error format in response to subscription operation."
                  + "The response should have one property and it has "
                  + entries.size() + ". The response is: "
                  + subscription);
        }
View Full Code Here


      if (result instanceof JsonPrimitive) {
        return result;

      } else if (result instanceof JsonArray) {
        throw new ProtocolException("Json array '" + result
            + " cannot be converted to " + getTypeName(type));
      } else if (result instanceof JsonObject) {
        return extractSimpleValueFromJsonObject((JsonObject) result,
            type);
      } else {
        throw new ProtocolException("Unrecognized json element: "
            + result);
      }

    } else if (isList(type)) {
View Full Code Here

  private JsonElement extractSimpleValueFromJsonObject(JsonObject result,
      Type type) {

    if (!result.has("value")) {
      throw new ProtocolException("Json object " + result
          + " cannot be converted to " + getTypeName(type)
          + " without a 'value' property");
    }

    return result.get("value");
View Full Code Here

  private String getAsString(JsonObject jsonObject, String propName,
      String propertyDescription) {

    if (jsonObject == null) {
      throw new ProtocolException("There are no params in the request");
    }

    JsonElement element = jsonObject.get(propName);
    if (element == null) {
      throw new ProtocolException("It is necessary a property '"
          + propName + "' with " + propertyDescription);
    } else {
      return element.getAsString();
    }
  }
View Full Code Here

      InvocationHandler handler = Proxy.getInvocationHandler(param);
      if (handler instanceof RemoteObjectInvocationHandler) {
        RemoteObjectInvocationHandler roHandler = (RemoteObjectInvocationHandler) handler;
        processedParam = roHandler.getRemoteObject().getObjectRef();
      } else {
        throw new ProtocolException(
            "Only proxies from remote objects are allowed, but found one with InvocationHandler "
                + handler);
      }

    } else if (param instanceof Enum<?>) {
View Full Code Here

        } else if (value instanceof Props) {
          return unflattedComplexType(clazz, (Props) value, manager);

        } else {
          throw new ProtocolException(
              "A objectRef coded with a String or a Props is expected for param type '"
                  + type + "'");
        }
      }

    } else if (type instanceof ParameterizedType) {

      ParameterizedType pType = (ParameterizedType) type;
      if (((Class<?>) pType.getRawType()).isAssignableFrom(List.class)) {
        return unflattenList(paramName, (List<?>) value,
            pType.getActualTypeArguments()[0], manager);
      }
    }

    throw new ProtocolException("Type '" + type + "' is not supported");
  }
View Full Code Here

    }

    try {
      return constructor.newInstance(constParams);
    } catch (Exception e) {
      throw new ProtocolException(
          "Exception while creating an object for the class '"
              + clazz.getSimpleName() + "'", e);
    }
  }
View Full Code Here

        clientManager.registerObject(value, newRemoteObject);
        return newRemoteObject;

      }

      throw new ProtocolException("Remote object with objectRef '"
          + value + "' is not found");

    } else if (remoteObject instanceof RemoteObject) {
      // We are in the client side
      Object wrapper = ((RemoteObject) remoteObject)
View Full Code Here

      if (enumConst.toString().equals(value)) {
        return enumConst;
      }
    }
    // TODO Improve exception reporting
    throw new ProtocolException("Enum '" + value
        + "' not found in enumType '" + type.toString() + "'");
  }
View Full Code Here

      return new GenericListType(
          calculateFlattenType(extractListType(type)));
    case REMOTE_CLASS:
      return String.class;
    default:
      throw new ProtocolException("Unknown type: " + type);
    }

  }
View Full Code Here

TOP

Related Classes of com.kurento.tool.rom.server.ProtocolException

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.