Package se.despotify.util

Examples of se.despotify.util.XMLElement


    xml = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<playlist>\n" +
        new String(data, Charset.forName("UTF-8")) +
        "\n</playlist>";
    log.debug(xml);
    XMLElement response = XML.load(xml);

    if (response.hasChild("confirm")) {
      // <version>0000000002,0000000001,1326385279,0</version>
      String[] versionTagValues = response.getChild("confirm").getChildText("version").split(",", 4);

      playlist.setRevision(Long.parseLong(versionTagValues[0]));
      playlist.setChecksum(Long.parseLong(versionTagValues[2]));

      if (playlist.size() != Long.parseLong(versionTagValues[1])) {
View Full Code Here


        "\n</playlists>";

    if (log.isDebugEnabled()) {
      log.debug(xml);
    }
    XMLElement response = XML.load(xml);

    Playlist.fromXMLElement(response, store, playlist);

    if (response.hasChild("next-change")) {     
      return true;
    } else {
      playlists.getItems().add(position - 1, playlist);
      throw new RuntimeException("Unknown server response:\n" + xml);
    }
View Full Code Here

    if (log.isDebugEnabled()) {
      log.debug(xml);
    }

    XMLElement reponseElement = XML.load(xml);

    if (reponseElement.hasChild("confirm")) {
      Playlist playlist = store.getPlaylist(requestedPlaylistUUID);
      playlist.setName(playlistName);
      playlist.setCollaborative(collaborative);     
      return true;
    } else {
View Full Code Here

        "\n</playlists>";

    if (log.isDebugEnabled()) {
      log.debug(xml);
    }
    XMLElement response = XML.load(xml);

    Playlist.fromXMLElement(response, store, playlist);

    if (response.hasChild("next-change")) {
      return true;
    } else {
      playlists.getItems().add(position - 1, playlist);
      throw new RuntimeException("Unknown server response:\n" + xml);
    }
View Full Code Here

    if (log.isDebugEnabled()) {
      log.debug(xml);
    }

    XMLElement reponseElement = XML.load(xml);

    if (reponseElement.hasChild("confirm")) {
      Playlist playlist = store.getPlaylist(requestedPlaylistUUID);
      playlist.setName(playlistName);
      playlist.setCollaborative(collaborative);     
      return true;
    } else {
View Full Code Here

    /* Load XML. */
    String xml = "<?xml version=\"1.0\" encoding=\"utf-8\" ?><playlist>" +
        new String(data, Charset.forName("UTF-8")) +
        "</playlist>";
    XMLElement playlistElement = XML.load(xml);
    if (log.isDebugEnabled()) {
      log.debug(xml);
    }
    /* Create and return playlist. */
    Playlist.fromXMLElement(playlistElement, store, playlist);
View Full Code Here

    if (log.isDebugEnabled()) {
      log.debug(xml);
    }

    XMLElement playlistElement = XML.load(xml);

    if (user.getPlaylists() == null) {
      user.setPlaylists(new PlaylistContainer());
    }
    PlaylistContainer.fromXMLElement(playlistElement, store, user.getPlaylists());

    if (playlistElement.hasChild("next-change")) {
      user.getPlaylists().setLoaded(new Date());

      return true;
    } else {
      throw new RuntimeException("Unknown server response:\n" + xml);
View Full Code Here


    if (log.isDebugEnabled()) {
      log.debug(xml);
    }
    XMLElement playlistElement = XML.load(xml);

    if (playlistElement.hasChild("confirm")) {
      /* Split version string into parts. */
      String[] parts = playlistElement.getChild("confirm").getChildText("version").split(",", 4);

      /* Set values. */
      playlist.setRevision(Long.parseLong(parts[0]));
      playlist.setChecksum(Long.parseLong(parts[2]));
      playlist.setCollaborative(Integer.parseInt(parts[3]) == 1);
View Full Code Here

            new String(data, Charset.forName("UTF-8")) +
            "</playlist>";
    if (log.isDebugEnabled()) {
      log.debug(xml);
    }
    XMLElement playlistElement = XML.load(xml);


    if (playlistElement.hasChild("confirm")) {
      /* Split version string into parts. */
      String[] parts = playlistElement.getChild("confirm").getChildText("version").split(",", 4);

      /* Set values. */
      playlist.setRevision(Long.parseLong(parts[0]));
      playlist.setChecksum(Long.parseLong(parts[2]));
      playlist.setCollaborative(Integer.parseInt(parts[3]) == 1);
View Full Code Here

        "\n</playlists>";

    if (log.isDebugEnabled()) {
      log.debug(xml);
    }
    XMLElement response = XML.load(xml);

    final XMLElement versionParentElement;
    if (response.hasChild("confirm")) {
      versionParentElement = response.getChild("confirm");
    } else if (response.hasChild("")) {
      versionParentElement = response;
    } else {
      throw new RuntimeException("Unknown server response:\n" + xml);
    }

    // <version>0000000007,0000000002,3701476273,0</version>
    String[] versionTagValues = versionParentElement.getChildText("version").split(",", 4);

    playlists.setRevision(Long.parseLong(versionTagValues[0]));
    playlists.setChecksum(Long.parseLong(versionTagValues[2]));

    if (playlists.getItems().size() != Long.parseLong(versionTagValues[1])) {
View Full Code Here

TOP

Related Classes of se.despotify.util.XMLElement

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.