acpiplugin.java
来自「纯java操作系统jnode,安装简单和操作简单的个人使用的Java操作系统」· Java 代码 · 共 103 行
JAVA
103 行
/*
* $Id: AcpiPlugin.java,v 1.1 2003/11/25 11:42:14 epr Exp $
*/
package org.jnode.driver.acpi;
import javax.naming.NameNotFoundException;
import org.apache.log4j.Logger;
import org.jnode.driver.Device;
import org.jnode.driver.DeviceListener;
import org.jnode.driver.DeviceUtils;
import org.jnode.driver.firmware.FirmwareAPI;
import org.jnode.plugin.Plugin;
import org.jnode.plugin.PluginDescriptor;
import org.jnode.plugin.PluginException;
import org.jnode.system.ResourceNotFreeException;
/**
* ACPI plugin.
*
* <p>
* Title:
* </p>
* <p>
* Description:
* </p>
* <p>
* Copyright: Copyright (c) 2003
* </p>
* <p>
* Company:
* </p>
*
* @author not attributable
* @version 1.0
*/
public class AcpiPlugin extends Plugin implements DeviceListener {
private final Logger log = Logger.getLogger(getClass());
private Device fwDevice;
private ACPI acpi;
/**
* Initialize this instance.
* @param descriptor
*/
public AcpiPlugin(PluginDescriptor descriptor) {
super(descriptor);
}
/**
* Start the plugin
* @throws PluginException
*/
protected void startPlugin() throws org.jnode.plugin.PluginException {
try {
DeviceUtils.getDeviceManager().addListener(this);
} catch (NameNotFoundException ex) {
throw new PluginException(ex);
}
}
/**
* Stop the plugin
* @throws PluginException
*/
protected void stopPlugin() throws org.jnode.plugin.PluginException {
try {
DeviceUtils.getDeviceManager().addListener(this);
} catch (NameNotFoundException ex) {
throw new PluginException(ex);
}
}
/**
* @param device
* @see org.jnode.driver.DeviceListener#deviceStarted(org.jnode.driver.Device)
*/
public void deviceStarted(Device device) {
if ((acpi == null) && device.implementsAPI(FirmwareAPI.class)) {
try {
acpi = new ACPI();
this.fwDevice = device;
} catch (ResourceNotFreeException ex) {
log.error("Cannot start ACPI", ex);
}
}
}
/**
* @param device
* @see org.jnode.driver.DeviceListener#deviceStop(org.jnode.driver.Device)
*/
public void deviceStop(Device device) {
if (device == fwDevice) {
this.acpi.release();
this.acpi = null;
this.fwDevice = null;
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?