Package org.rzo.yajsw.os

Source Code of org.rzo.yajsw.os.OperatingSystem

/* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* <p/>
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* Lesser General Public License for more details. 
*/
package org.rzo.yajsw.os;

import org.apache.commons.configuration.Configuration;
import org.rzo.yajsw.os.ms.win.w32.OperatingSystemWindowsXP;
import org.rzo.yajsw.os.posix.bsd.OperatingSystemBSD;
import org.rzo.yajsw.os.posix.bsd.macosx.OperatingSystemMacOsX;
import org.rzo.yajsw.os.posix.linux.OperatingSystemLinux;
import org.rzo.yajsw.os.posix.solaris.OperatingSystemSolaris;

// TODO: Auto-generated Javadoc
/**
* The Class OperatingSystem.
*/
public abstract class OperatingSystem
{

  /** The _instance. */
  static OperatingSystem  _instance;

  /** The _os name. */
  static String      _osName;

  /**
   * Instance.
   *
   * @return the operating system
   */
  public static OperatingSystem instance()
  {
    if (_instance != null)
      return _instance;
    _osName = System.getProperty("os.name");
    if (_osName.toLowerCase().startsWith("windows"))
      _instance = new OperatingSystemWindowsXP();
    else if (_osName.toLowerCase().startsWith("mac os x"))
      _instance = new OperatingSystemMacOsX();
    else if (_osName.contains("BSD"))
      _instance = new OperatingSystemBSD();
    else if (_osName.toLowerCase().startsWith("linux"))
      _instance = new OperatingSystemLinux();
    else if (_osName.toLowerCase().contains("sunos"))
      _instance = new OperatingSystemSolaris();
    if (_instance == null)
      System.out.println("OS not supported " + _osName);
    return _instance;

  }

  /**
   * Gets the operating system name.
   *
   * @return the operating system name
   */
  public String getOperatingSystemName()
  {
    return _osName;
  }

  /**
   * Keyboard instance.
   *
   * @return the keyboard
   */
  public abstract Keyboard keyboardInstance();

  /**
   * Process manager instance.
   *
   * @return the process manager
   */
  public abstract ProcessManager processManagerInstance();

  public abstract FileManager fileManagerInstance();

  /**
   * Service manager instance.
   *
   * @return the process manager
   */
  public abstract ServiceManager serviceManagerInstance();

  /**
   * Error handler instance.
   *
   * @return the error handler
   */
  public abstract ErrorHandler errorHandlerInstance();

  public abstract JavaHome getJavaHome(Configuration config);

  public abstract SystemInformation systemInformation();

  public abstract boolean setWorkingDir(String name);

}
TOP

Related Classes of org.rzo.yajsw.os.OperatingSystem

TOP
Copyright © 2018 www.massapi.com. 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.