//# 0 errors, 44 messages
//#
/*
    //#DcopMediaSourcePlugin.java:1:1: class: com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin
    //#DcopMediaSourcePlugin.java:1:1: method: com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin.com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin__static_init
 * Copyright (c) 2006-2009 Chris Smith, Shane Mc Cormack, Gregory Holmes
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package com.dmdirc.addons.mediasource_dcop;

import com.dmdirc.addons.nowplaying.MediaSource;
import com.dmdirc.addons.nowplaying.MediaSourceManager;
import com.dmdirc.plugins.Plugin;
import com.dmdirc.plugins.PluginManager;

import java.util.ArrayList;
import java.util.List;

/**
 * Manages all DCOP based media sources.
 */
public class DcopMediaSourcePlugin extends Plugin
        implements MediaSourceManager {
    
    /** Media sources. */
    private final List<MediaSource> sources;
    
    /**
     * Creates a new instance of DcopMediaSourcePlugin.
     */
    public DcopMediaSourcePlugin() {
        super();
    //#DcopMediaSourcePlugin.java:46: method: void com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin.com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin()
    //#DcopMediaSourcePlugin.java:46: Warning: method not available - call not analyzed
    //#    call on void com.dmdirc.plugins.Plugin()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin
    //#    method: void com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin()
    //#    unanalyzed callee: void com.dmdirc.plugins.Plugin()
    //#input(void com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin()): this
    //#output(void com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin()): new ArrayList(DcopMediaSourcePlugin#1) num objects
    //#output(void com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin()): this.sources
    //#new obj(void com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin()): new ArrayList(DcopMediaSourcePlugin#1)
    //#post(void com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin()): this.sources == &new ArrayList(DcopMediaSourcePlugin#1)
    //#post(void com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin()): new ArrayList(DcopMediaSourcePlugin#1) num objects == 1
        sources = new ArrayList<MediaSource>();
        sources.add(new AmarokSource());
        sources.add(new KaffeineSource());
        sources.add(new NoatunSource());
    }
    //#DcopMediaSourcePlugin.java:51: end of method: void com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin.com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin()
    
    /**
     * Get DCOP Result
     *
     * @param query Query to try
     * @return The result of the dcop query, line-by-line
     */
    @SuppressWarnings("unchecked")
    protected static List<String> getDcopResult(final String query) {
        return (List<String>) PluginManager.getPluginManager()
    //#DcopMediaSourcePlugin.java:61: method: List com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin.getDcopResult(String)
    //#DcopMediaSourcePlugin.java:61: Warning: method not available - call not analyzed
    //#    call on PluginManager com.dmdirc.plugins.PluginManager:getPluginManager()
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin
    //#    method: List getDcopResult(String)
    //#    unanalyzed callee: PluginManager com.dmdirc.plugins.PluginManager:getPluginManager()
    //#DcopMediaSourcePlugin.java:61: Warning: method not available - call not analyzed
    //#    call on ExportedService com.dmdirc.plugins.PluginManager:getExportedService(String)
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin
    //#    method: List getDcopResult(String)
    //#    unanalyzed callee: ExportedService com.dmdirc.plugins.PluginManager:getExportedService(String)
    //#DcopMediaSourcePlugin.java:61: Warning: method not available - call not analyzed
    //#    call on Object com.dmdirc.plugins.ExportedService:execute(Object[])
    //#    severity: INFORMATIONAL
    //#    class: com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin
    //#    method: List getDcopResult(String)
    //#    unanalyzed callee: Object com.dmdirc.plugins.ExportedService:execute(Object[])
    //#input(List getDcopResult(String)): query
    //#output(List getDcopResult(String)): return_value
    //#presumption(List getDcopResult(String)): com.dmdirc.plugins.PluginManager:getExportedService(...)@61 != null
    //#presumption(List getDcopResult(String)): com.dmdirc.plugins.PluginManager:getPluginManager(...)@61 != null
    //#post(List getDcopResult(String)): init'ed(return_value)
    //#DcopMediaSourcePlugin.java:61: end of method: List com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin.getDcopResult(String)
                .getExportedService("dcop").execute(query);
    }
    
    /** {@inheritDoc} */
    @Override
    public List<MediaSource> getSources() {
        return sources;
    //#DcopMediaSourcePlugin.java:68: method: List com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin.getSources()
    //#input(List getSources()): this
    //#input(List getSources()): this.sources
    //#output(List getSources()): return_value
    //#post(List getSources()): return_value == this.sources
    //#post(List getSources()): init'ed(return_value)
    //#DcopMediaSourcePlugin.java:68: end of method: List com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin.getSources()
    }
    
    /** {@inheritDoc} */
    @Override
    public void onLoad() {
        // Nothing to do
    }
    //#DcopMediaSourcePlugin.java:75: method: void com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin.onLoad()
    //#DcopMediaSourcePlugin.java:75: end of method: void com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin.onLoad()
    
    /** {@inheritDoc} */
    @Override
    public void onUnload() {
        // Nothing to do
    }
    //#DcopMediaSourcePlugin.java:81: method: void com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin.onUnload()
    //#DcopMediaSourcePlugin.java:81: end of method: void com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin.onUnload()

}
    //#output(com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin__static_init): __Descendant_Table[com/dmdirc/addons/mediasource_dcop/DcopMediaSourcePlugin]
    //#output(com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin__static_init): __Dispatch_Table.getSources()Ljava/util/List;
    //#output(com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin__static_init): __Dispatch_Table.onLoad()V
    //#output(com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin__static_init): __Dispatch_Table.onUnload()V
    //#output(com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin__static_init): com/dmdirc/addons/nowplaying/MediaSourceManager.__Descendant_Table[com/dmdirc/addons/mediasource_dcop/DcopMediaSourcePlugin]
    //#post(com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin__static_init): __Descendant_Table[com/dmdirc/addons/mediasource_dcop/DcopMediaSourcePlugin] == &__Dispatch_Table
    //#post(com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin__static_init): com/dmdirc/addons/nowplaying/MediaSourceManager.__Descendant_Table[com/dmdirc/addons/mediasource_dcop/DcopMediaSourcePlugin] == &__Dispatch_Table
    //#post(com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin__static_init): __Dispatch_Table.getSources()Ljava/util/List; == &getSources
    //#post(com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin__static_init): __Dispatch_Table.onLoad()V == &onLoad
    //#post(com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin__static_init): __Dispatch_Table.onUnload()V == &onUnload
    //#DcopMediaSourcePlugin.java:: end of method: com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin.com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin__static_init
    //#DcopMediaSourcePlugin.java:: end of class: com.dmdirc.addons.mediasource_dcop.DcopMediaSourcePlugin
