Android Open Source - wolPi Settings Provider






From Project

Back to project page wolPi.

License

The source code is released under:

Apache License

If you think the Android project wolPi listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package de.matthesrieke.wolpi.settings;
/*from   w  w w  . j a  v  a2  s.  c  o  m*/
import java.util.List;

import de.matthesrieke.wolpi.util.AndroidServiceLoader;

/**
 * Settings provider interface.
 * Implementations manage the available {@link HostConfiguration}s.
 * 
 * @author matthes rieke
 *
 */
public interface SettingsProvider {
  
  /**
   * @return all available hosts
   */
  public List<HostConfiguration> getHosts();

  /**
   * @param value the id equivalent to {@link HostConfiguration#getId()}
   * @return the host for the specified id
   */
  public HostConfiguration getHostForId(String value);
  
  /**
   * trigger a configuration reload
   */
  public void reloadConfiguration();
  
  /**
   * trigger a storage of the current configuration
   */
  public void saveConfiguration();

  public void addHost(HostConfiguration host);

  public void deleteHost(HostConfiguration host);
  
  /**
   * Provide access to the register {@link SettingsProvider}
   * implementations.
   * 
   * @author matthes rieke
   *
   */
  public static class Instance {
    
    static SettingsProvider provider;
    
    /**
     * @return the registered provider (first available, see
     * {@link AndroidServiceLoader})
     */
    public static synchronized SettingsProvider getProvider() {
      if (provider == null)
        provider = resolveProvider();
      
      return provider;
    }

    private static SettingsProvider resolveProvider() {
      AndroidServiceLoader<SettingsProvider> loader = AndroidServiceLoader.load(SettingsProvider.class);
      for (SettingsProvider settingsProvider : loader.implementations()) {
        return settingsProvider;
      }
      throw new IllegalStateException("No SettingsProvider available!");
    }
    
  }


}




Java Source Code List

de.matthesrieke.wolpi.CommandResult.java
de.matthesrieke.wolpi.Interactor.java
de.matthesrieke.wolpi.SysoutInteractor.java
de.matthesrieke.wolpi.UserInfoImpl.java
de.matthesrieke.wolpi.WolPiException.java
de.matthesrieke.wolpi.WolPi.java
de.matthesrieke.wolpi.dao.SQLiteSettingsProvider.java
de.matthesrieke.wolpi.settings.HostConfiguration.java
de.matthesrieke.wolpi.settings.SSHConnection.java
de.matthesrieke.wolpi.settings.SettingsProvider.java
de.matthesrieke.wolpi.settings.WolSettings.java
de.matthesrieke.wolpi.ui.ConfirmationDialog.java
de.matthesrieke.wolpi.ui.HostListActivity.java
de.matthesrieke.wolpi.ui.HostManagementActivity.java
de.matthesrieke.wolpi.ui.MainActivity.java
de.matthesrieke.wolpi.ui.TextViewInteractor.java
de.matthesrieke.wolpi.util.AndroidServiceLoader.java