// Path: jukebox-se/src/main/java/org/onebeartoe/juke/ui/JukeMain.java
// public class JukeMain extends Application 
// {
//     private static RandomJuke randomJuke;
// 
//     public static boolean isInitiiaized() 
//     {
//         // at this point, so long as the randomjuke object is not null, then it 
//         // is considered initialized
//         
//         return randomJuke != null;
//     }
// 
//     public static String discoverSongLists() 
//     {
//         String result;
//         
//         if(randomJuke == null)
//         {
//             result = "cannot discover media lists while randomJuke is null";
//         }
//         else
//         {
//             List<String> songListUrls = new ArrayList();
//             songListUrls.add("file:///home/roberto/Versioning/world/betoland/music/Unorganized/");
// //            songListUrls.add("file:///Users/lando/Versioning/world/betoland-world/music/Unorganized/");
//             
//             randomJuke.setSongListUrls(songListUrls);
//             
//             result = "song lists discovered";
//         }
//         
//         return result;
//     }
//     
//     @Override
//     public void start(Stage stage) throws Exception 
//     {
//         Parameters parameters = getParameters();
//         List<String> raw = parameters.getRaw();
//         String [] args = raw.toArray( new String[0] );
//         
//         randomJuke = new RandomJuke(args);
//         
//         randomJuke.printStartDescription();
//     }
// 
//     /**
//      * The main() method is ignored in correctly deployed JavaFX application.
//      * main() serves only as fallback in case the application can not be
//      * launched through deployment artifacts, e.g., in IDEs with limited FX
//      * support. NetBeans ignores main().
//      *
//      * @param args the command line arguments
//      */
//     public static void main(String[] args) 
//     {
//         System.out.println("launching...");
//         
//         launch(args);
//         
//         System.out.println("launched!");
//     }
//     
//     public static String nextSong()
//     {
//         String message;
//         
//         try 
//         {
//             randomJuke.playNextSong();
//             
//             message = randomJuke.currentSongTitle;
//         } 
//         catch (EmptyMediaListException ex) 
//         {
//             Logger.getLogger(JukeMain.class.getName()).log(Level.SEVERE, null, ex);
//             
//             message = "ERROR-21720: " + ex.getClass().getSimpleName() + " - " + ex.getMessage();
//         }
//         
//         return message;
//     }
// 
//     public static void shutdown()
//     {
// //TODO: is there anything to do here?
// 
// //        controller.stopThreads();
//     }        
// }


import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.onebeartoe.juke.ui.JukeMain;
import org.onebeartoe.web.PlainTextResponseServlet;

package org.onebeartoe.media.players.randomjuke.ee.controls.current.song;


/**
 * This class process requests to play the next song.
 * 
 * @author Roberto Marquez
 */
@WebServlet(urlPatterns = {"/controls/song/next"})
public class NextSongServlet extends PlainTextResponseServlet
{
    @Override
    protected String buildText(HttpServletRequest request, HttpServletResponse response)
    {
// Path: jukebox-se/src/main/java/org/onebeartoe/juke/ui/JukeMain.java
// public class JukeMain extends Application 
// {
//     private static RandomJuke randomJuke;
// 
//     public static boolean isInitiiaized() 
//     {
//         // at this point, so long as the randomjuke object is not null, then it 
//         // is considered initialized
//         
//         return randomJuke != null;
//     }
// 
//     public static String discoverSongLists() 
//     {
//         String result;
//         
//         if(randomJuke == null)
//         {
//             result = "cannot discover media lists while randomJuke is null";
//         }
//         else
//         {
//             List<String> songListUrls = new ArrayList();
//             songListUrls.add("file:///home/roberto/Versioning/world/betoland/music/Unorganized/");
// //            songListUrls.add("file:///Users/lando/Versioning/world/betoland-world/music/Unorganized/");
//             
//             randomJuke.setSongListUrls(songListUrls);
//             
//             result = "song lists discovered";
//         }
//         
//         return result;
//     }
//     
//     @Override
//     public void start(Stage stage) throws Exception 
//     {
//         Parameters parameters = getParameters();
//         List<String> raw = parameters.getRaw();
//         String [] args = raw.toArray( new String[0] );
//         
//         randomJuke = new RandomJuke(args);
//         
//         randomJuke.printStartDescription();
//     }
// 
//     /**
//      * The main() method is ignored in correctly deployed JavaFX application.
//      * main() serves only as fallback in case the application can not be
//      * launched through deployment artifacts, e.g., in IDEs with limited FX
//      * support. NetBeans ignores main().
//      *
//      * @param args the command line arguments
//      */
//     public static void main(String[] args) 
//     {
//         System.out.println("launching...");
//         
//         launch(args);
//         
//         System.out.println("launched!");
//     }
//     
//     public static String nextSong()
//     {
//         String message;
//         
//         try 
//         {
//             randomJuke.playNextSong();
//             
//             message = randomJuke.currentSongTitle;
//         } 
//         catch (EmptyMediaListException ex) 
//         {
//             Logger.getLogger(JukeMain.class.getName()).log(Level.SEVERE, null, ex);
//             
//             message = "ERROR-21720: " + ex.getClass().getSimpleName() + " - " + ex.getMessage();
//         }
//         
//         return message;
//     }
// 
//     public static void shutdown()
//     {
// //TODO: is there anything to do here?
// 
// //        controller.stopThreads();
//     }        
// }


// Path: jukebox-ee/src/main/java/org/onebeartoe/media/players/randomjuke/ee/controls/current/song/NextSongServlet.java
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.onebeartoe.juke.ui.JukeMain;
import org.onebeartoe.web.PlainTextResponseServlet;


package org.onebeartoe.media.players.randomjuke.ee.controls.current.song;


/**
 * This class process requests to play the next song.
 * 
 * @author Roberto Marquez
 */
@WebServlet(urlPatterns = {"/controls/song/next"})
public class NextSongServlet extends PlainTextResponseServlet
{
    @Override
    protected String buildText(HttpServletRequest request, HttpServletResponse response)
    {
        String message;