// Path: src/com/nixus/raop/core/Service.java
// public interface Service {
// 
//     /**
//      * Start the Service
//      * @param context the ServiceContext for this Service
//      */
//     public void startService(ServiceContext context);
// 
//     /**
//      * Stop the Service
//      * @param context the ServiceContext for this Service (same as was passed into start)
//      */
//     public void stopService(ServiceContext context);
// 
//     /**
//      * Return the ServiceContext that was passed into {@link #startService}
//      */
//     public ServiceContext getContext();
// 
//     /**
//      * Return a Map describing the state of this Service, for serialization back to any
//      * client that needs to know (eg webplayer) - so values should be serializable objects,
//      * eg Lists, Maps or simple objects. If no useful state, return null.
//      */
//     public Map<String,Object> reportState();
// 
// }
// 
// Path: src/com/nixus/raop/core/ServiceContext.java
// public interface ServiceContext {
// 
//     public void debug(String message, Throwable e);
// 
//     public void debug(String message);
// 
//     public void info(String message);
// 
//     public void warn(String message, Throwable e);
// 
//     public void error(String message, Throwable e);
// 
//     /**
//      * Return the name and version of the Software
//      */
//     public String getSoftwareName();
// 
//     /**
//      * Return the logical name of the Server 
//      */
//     public String getServerName();
// 
//     /**
//      * Return the build date of the Server
//      */
//     public Date getServerBuildDate();
// 
//     /**
//      * Return the unique logical name of this Service 
//      */
//     public String getServiceName();
// 
//     /**
//      * Get the Service for this ServiceContext
//      */
//     public Service getService();
// 
//     /**
//      * Get the first {@link Service} object of the specified type
//      */
//     public <E extends Service> E getService(Class<E> type);
// 
//     /**
//      * Get the first {@link Service} object of the specified type
//      */
// 
//     public <E extends Service> E getService(Class<E> type, String criteria);
// 
//     /**
//      * Get a list of all {@link Service} objects of the specified type
//      */
// 
//     public <E extends Service> E[] getServices(Class<E> type, String criteria);
// 
//     /**
//      * Add a {@link Listener} to the Server, it will be notified of events
//      */
//     public void addListener(Listener listener);
// 
//     /**
//      * Remove a {@link Listener} to the Server, it will be notified of events
//      */
//     public void removeListener(Listener listener);
// 
//     /**
//      * Fire an event - the Listeners registered with the server will be notified.
//      * Properties can be specified easily with the second parameter, which is a sequence
//      * of [key, value] entries - eg
//      * <pre>
//      *  qtunes.fireEvent("player.add, new Object[] { "track", track, "user", user });
//      * </pre>
//      * @param o an array of [key, value]
//      */
//     public void fireEvent(String name, Object[] o);
// 
//     /**
//      * Return a list of properties of this Service
//      */
//     public String[] getPropertyNames();
// 
//     /**
//      * Get a system-wide property
//      */
//     public String getGlobalProperty(String key);
// 
//     /**
//      * Get a property of this Service
//      */
//     public String getProperty(String key);
// 
//     /**
//      * Set a property of this Service
//      */
//     public void putProperty(String key, String value);
// 
//     public void start();
// 
//     public void stop();
// 
//     /**
//      * Add a service
//      */
//     public ServiceContext addService(Class<?>[] classes, Service service, Map<String,String> properties, boolean permanent);
// 
//     /**
//      * Remove a service
//      */
//     public void removeService();
// 
//     /**
//      * Return the list of Service names
//      */
//     public String[] getServiceNames();
// 
//     /**
//      * Return true if the Service has been started
//      */
//     public boolean isActive();
// 
// }


import java.util.ArrayList;
import java.util.Map;
import com.nixus.raop.core.Service;
import com.nixus.raop.core.ServiceContext;
package com.nixus.raop.speaker.airport;



public class AirtunesManagerService implements Service {

    private ServiceContext context;
    private ArrayList<SpeakerImpl> speakers;
    private AirtunesManager manager;

    AirtunesManagerService() {
    }

    public void startService(ServiceContext context) {
        this.context = context;
        speakers = new ArrayList<SpeakerImpl>();
        manager = new AirtunesManager(context.getProperty("playername"), context);
    }

    public void stopService(ServiceContext context) {
    }

    public ServiceContext getContext() {
        return context;
    }

    AirtunesManager getManager() {
        return manager;
    }

    void add(SpeakerImpl speaker) {
        synchronized(speakers) {
            if (!speakers.contains(speaker)) {
                speakers.add(speaker);
            }
        }
    }

    void remove(SpeakerImpl speaker) {
        synchronized(speakers) {
// Path: src/com/nixus/raop/core/Service.java
// public interface Service {
// 
//     /**
//      * Start the Service
//      * @param context the ServiceContext for this Service
//      */
//     public void startService(ServiceContext context);
// 
//     /**
//      * Stop the Service
//      * @param context the ServiceContext for this Service (same as was passed into start)
//      */
//     public void stopService(ServiceContext context);
// 
//     /**
//      * Return the ServiceContext that was passed into {@link #startService}
//      */
//     public ServiceContext getContext();
// 
//     /**
//      * Return a Map describing the state of this Service, for serialization back to any
//      * client that needs to know (eg webplayer) - so values should be serializable objects,
//      * eg Lists, Maps or simple objects. If no useful state, return null.
//      */
//     public Map<String,Object> reportState();
// 
// }
// 
// Path: src/com/nixus/raop/core/ServiceContext.java
// public interface ServiceContext {
// 
//     public void debug(String message, Throwable e);
// 
//     public void debug(String message);
// 
//     public void info(String message);
// 
//     public void warn(String message, Throwable e);
// 
//     public void error(String message, Throwable e);
// 
//     /**
//      * Return the name and version of the Software
//      */
//     public String getSoftwareName();
// 
//     /**
//      * Return the logical name of the Server 
//      */
//     public String getServerName();
// 
//     /**
//      * Return the build date of the Server
//      */
//     public Date getServerBuildDate();
// 
//     /**
//      * Return the unique logical name of this Service 
//      */
//     public String getServiceName();
// 
//     /**
//      * Get the Service for this ServiceContext
//      */
//     public Service getService();
// 
//     /**
//      * Get the first {@link Service} object of the specified type
//      */
//     public <E extends Service> E getService(Class<E> type);
// 
//     /**
//      * Get the first {@link Service} object of the specified type
//      */
// 
//     public <E extends Service> E getService(Class<E> type, String criteria);
// 
//     /**
//      * Get a list of all {@link Service} objects of the specified type
//      */
// 
//     public <E extends Service> E[] getServices(Class<E> type, String criteria);
// 
//     /**
//      * Add a {@link Listener} to the Server, it will be notified of events
//      */
//     public void addListener(Listener listener);
// 
//     /**
//      * Remove a {@link Listener} to the Server, it will be notified of events
//      */
//     public void removeListener(Listener listener);
// 
//     /**
//      * Fire an event - the Listeners registered with the server will be notified.
//      * Properties can be specified easily with the second parameter, which is a sequence
//      * of [key, value] entries - eg
//      * <pre>
//      *  qtunes.fireEvent("player.add, new Object[] { "track", track, "user", user });
//      * </pre>
//      * @param o an array of [key, value]
//      */
//     public void fireEvent(String name, Object[] o);
// 
//     /**
//      * Return a list of properties of this Service
//      */
//     public String[] getPropertyNames();
// 
//     /**
//      * Get a system-wide property
//      */
//     public String getGlobalProperty(String key);
// 
//     /**
//      * Get a property of this Service
//      */
//     public String getProperty(String key);
// 
//     /**
//      * Set a property of this Service
//      */
//     public void putProperty(String key, String value);
// 
//     public void start();
// 
//     public void stop();
// 
//     /**
//      * Add a service
//      */
//     public ServiceContext addService(Class<?>[] classes, Service service, Map<String,String> properties, boolean permanent);
// 
//     /**
//      * Remove a service
//      */
//     public void removeService();
// 
//     /**
//      * Return the list of Service names
//      */
//     public String[] getServiceNames();
// 
//     /**
//      * Return true if the Service has been started
//      */
//     public boolean isActive();
// 
// }


// Path: src/com/nixus/raop/speaker/airport/AirtunesManagerService.java
import java.util.ArrayList;
import java.util.Map;
import com.nixus.raop.core.Service;
import com.nixus.raop.core.ServiceContext;

package com.nixus.raop.speaker.airport;



public class AirtunesManagerService implements Service {

    private ServiceContext context;
    private ArrayList<SpeakerImpl> speakers;
    private AirtunesManager manager;

    AirtunesManagerService() {
    }

    public void startService(ServiceContext context) {
        this.context = context;
        speakers = new ArrayList<SpeakerImpl>();
        manager = new AirtunesManager(context.getProperty("playername"), context);
    }

    public void stopService(ServiceContext context) {
    }

    public ServiceContext getContext() {
        return context;
    }

    AirtunesManager getManager() {
        return manager;
    }

    void add(SpeakerImpl speaker) {
        synchronized(speakers) {
            if (!speakers.contains(speaker)) {
                speakers.add(speaker);
            }
        }
    }

    void remove(SpeakerImpl speaker) {
        synchronized(speakers) {
            speakers.remove(speaker);