Examples of JaxbHelper


Examples of org.platformlayer.xml.JaxbHelper

    return out;
  }

  private Action deserializeAction(String xml) throws OpsException {
    try {
      JaxbHelper jaxbHelper = JaxbHelper.get(Action.class);
      return (Action) jaxbHelper.unmarshal(xml);
    } catch (JAXBException e) {
      throw new OpsException("Error deserializing action", e);
    }
  }
View Full Code Here

Examples of org.platformlayer.xml.JaxbHelper

    return findItem(key, itemClass);
  }

  public <T> PlatformLayerKey toKey(Class<T> itemClass, String id) throws PlatformLayerClientException {
    JaxbHelper jaxbHelper = PlatformLayerClientBase.toJaxbHelper(itemClass, new Class[0]);
    ManagedItemId itemId = new ManagedItemId(id);

    PlatformLayerKey key = PlatformLayerClientBase.toKey(jaxbHelper, itemId, itemClass,
        platformLayerClient.listServices(true));
    return key;
View Full Code Here

Examples of org.platformlayer.xml.JaxbHelper

    if (links == null) {
      Node element = XmlHelper.findUniqueChild(root, "links", false);
      if (element == null) {
        links = new Links();
      } else {
        JaxbHelper helper = JaxbHelper.get(Links.class);
        try {
          links = (Links) helper.unmarshal(element);
        } catch (JAXBException e) {
          throw new IllegalStateException("Error parsing tags data", e);
        }
      }
    }
View Full Code Here

Examples of org.platformlayer.xml.JaxbHelper

  }

  public void setTags(Tags tags) {
    Document document;

    JaxbHelper helper = JaxbHelper.get(Tags.class);
    try {
      document = helper.marshalToDom(tags);
    } catch (JAXBException e) {
      throw new IllegalStateException("Error parsing tags data", e);
    }

    replaceNode("tags", document.getDocumentElement());
View Full Code Here

Examples of org.platformlayer.xml.JaxbHelper

    ItemBase item = new ItemBase();
    item.links = links;

    Document document;

    JaxbHelper helper = JaxbHelper.get(ItemBase.class);
    try {
      document = helper.marshalToDom(item);
    } catch (JAXBException e) {
      throw new IllegalStateException("Error serializing data", e);
    }

    replaceNode("links", XmlHelper.findUniqueChild(document.getDocumentElement(), "links", false));
View Full Code Here

Examples of org.platformlayer.xml.JaxbHelper

        httpResponse.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
        return;
      }
    } else {
      try {
        JaxbHelper jaxb = JaxbHelper.get(response.getClass());
        boolean formatted = false;
        jaxb.marshal(response, formatted, baos);
      } catch (Exception e) {
        log.error("Error serializing value", e);
        httpResponse.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
        return;
      }
View Full Code Here

Examples of org.platformlayer.xml.JaxbHelper

      if (c == Void.class) {
        return null;
      } else {
        String xml = result.getBody();

        JaxbHelper jaxb = JaxbHelper.get(c);
        try {
          return (T) jaxb.unmarshal(xml);
        } catch (JAXBException e) {
          throw new OpenstackException("Error deserializing response", e);
        }
      }
    }
View Full Code Here

Examples of org.platformlayer.xml.JaxbHelper

    }

    public CurlRequest toCurlRequest() {
      CurlRequest request = new CurlRequest(resourceUrl);
      if (body != null) {
        JaxbHelper jaxb = JaxbHelper.get(body.getClass());
        String xml;
        try {
          xml = jaxb.marshal(body, false);
        } catch (JAXBException e) {
          throw new OpenstackException("Error serializing request body", e);
        }
        request.body = xml;
      }
View Full Code Here

Examples of org.platformlayer.xml.JaxbHelper

    return executions;
  }

  @Override
  public <T extends ItemBase> T putItem(T item) throws OpsException {
    JaxbHelper jaxbHelper = PlatformLayerClientBase.toJaxbHelper(item);

    String xml = PlatformLayerClientBase.serialize(jaxbHelper, item);

    PlatformLayerKey key = PlatformLayerClientBase.toKey(jaxbHelper, item, listServices(true));
View Full Code Here

Examples of org.platformlayer.xml.JaxbHelper

    }
  }

  @Override
  public <T> List<T> listItems(Class<T> clazz) throws OpsException {
    JaxbHelper jaxbHelper = PlatformLayerClientBase.toJaxbHelper(clazz, ManagedItemCollection.class);
    PlatformLayerKey path = PlatformLayerClientBase.toKey(jaxbHelper, null, listServices(true));

    UntypedItemCollection untypedItems = listItemsUntyped(path);

    List<T> items = Lists.newArrayList();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.