Package org.jnode.driver

Examples of org.jnode.driver.DeviceManager


        maxSector = descr.getSectorsAddressable();

        // Look for partitions
        try {
            // Find the devicemanager
            DeviceManager devMan = InitialNaming.lookup(DeviceManager.NAME);
            // Read the bootsector
            final byte[] bs1 = new byte[SECTOR_SIZE];
            read(0, ByteBuffer.wrap(bs1));

            // Read the bootsector twice, since the first read seems to fail.
View Full Code Here


    protected void stopDevice() throws DriverException {
        final IDEDevice dev = (IDEDevice) getDevice();
        // find mounted partitions on this device and unregister them !
        try {
            DeviceManager devMan = InitialNaming.lookup(DeviceManager.NAME);
            Collection<Device> devices = devMan.getDevices();
            final ArrayList<IDEDiskPartitionDevice> toStop = new ArrayList<IDEDiskPartitionDevice>();

            for (Device device : devices) {
                if (device instanceof IDEDiskPartitionDevice) {
                    IDEDiskPartitionDevice partition = (IDEDiskPartitionDevice) device;
                    if (partition.getParent() == dev) {
                        toStop.add(partition);
                    }
                }

            }

            for (IDEDiskPartitionDevice partition : toStop) {
                devMan.unregister(partition);
            }
        } catch (NameNotFoundException e) {
            throw new DriverException("Problem while stopping this IDE device", e);
        }
View Full Code Here

    @Override
    protected void stopPlugin() throws PluginException {
        log.info("stop RAMFS");
        try {
            FileSystemService fSS = InitialNaming.lookup(FileSystemService.NAME);
            final DeviceManager dm = DeviceUtils.getDeviceManager();
            VirtualDevice dev = (VirtualDevice) dm.getDevice(RAMFileSystemType.VIRTUAL_DEVICE_NAME);
            fSS.unregisterFileSystem(dev);
            log.info("RAMFS unmounted");
            dm.unregister(dev);
            log.info("RAMFS unregistered");
        } catch (NameNotFoundException e) {
            log.error("filsystemservice / filesystemtype not found");
        } catch (DeviceNotFoundException ex) {
            log.info("no ramfs present");
View Full Code Here

    public void install() throws GrubException {
        final String deviceName = device.getId();
        out.println("Installing GRUB to " + deviceName);

        DeviceManager dm;
        try {
            dm = DeviceUtils.getDeviceManager();
        } catch (NameNotFoundException e1) {
            throw new GrubException("can't find device manager", e1);
        }
View Full Code Here

     * @see org.jnode.plugin.Plugin#startPlugin()
     */
    protected void startPlugin() throws PluginException {
        try {
            log.info("Create initrd ramdisk on /jnode");
            final DeviceManager dm = DeviceUtils.getDeviceManager();
            int size = getPreferences().getInt("size", (int) NumberUtils.getSize("100K"));
            final RamDiskDevice dev = new RamDiskDevice(null, "dummy", size);
            dev.setDriver(new RamDiskDriver("jnode"));
            dm.register(dev);

            log.info("Format initrd ramdisk");

            final FatFileSystemFormatter formatter = new FatFileSystemFormatter(FatType.FAT16);
            final FileSystem<?> fs = formatter.format(dev);
            try {
                fs.getRootEntry().getDirectory().addDirectory("tmp");
            } catch (IOException ex) {
                log.error("Cannot create tmp on ramdisk");
            }

            // restart the device
            log.info("Restart initrd ramdisk");
            dm.stop(dev);
            dm.start(dev);

            log.info("/jnode ready.");
        } catch (NameNotFoundException e) {
            throw new PluginException(e);
        } catch (DriverException e) {
View Full Code Here

        private Collection<PointerAPI> pointerList = new HashSet<PointerAPI>();
        private Collection<PointerListener> listenerList = new HashSet<PointerListener>();

        PointerAPIHandler() {
            try {
                DeviceManager dm = DeviceUtils.getDeviceManager();
                dm.addListener(this);
                for (Device device : dm.getDevicesByAPI(PointerAPI.class)) {
                    try {
                        pointerList.add(device.getAPI(PointerAPI.class));
                    } catch (ApiNotFoundException anfe) {
                        //ignore
                    }
View Full Code Here

        private Collection<KeyboardListener> listenerList = new HashSet<KeyboardListener>();
        private KeyboardInterpreter interpreter;

        KeyboardAPIHandler() {
            try {
                DeviceManager dm = DeviceUtils.getDeviceManager();
                dm.addListener(this);
                for (Device device : dm.getDevicesByAPI(KeyboardAPI.class)) {
                    try {
                        keyboardList.add(device.getAPI(KeyboardAPI.class));
                    } catch (ApiNotFoundException anfe) {
                        //ignore
                    }
View Full Code Here

            throw new IllegalArgumentException("The info extension-point cannot be null.");
        }
        this.infoEP = infoEP;
        try {
            FileSystemService fSS = InitialNaming.lookup(FileSystemService.NAME);
            final DeviceManager dm = DeviceUtils.getDeviceManager();
            VirtualDevice dev = (VirtualDevice) dm.getDevice(JIFileSystemType.VIRTUAL_DEVICE_NAME);
            JIFSDirectory rootdir = (JIFSDirectory) fSS.getFileSystem(dev).getRootEntry();
            extdir = (JIFSDirectory) rootdir.getEntry("extended").getDirectory();
        } catch (NameNotFoundException e) {
            log.error("filesystemservice / filesystemtype not found");
        } catch (DeviceNotFoundException ex) {
View Full Code Here

     * @throws NameNotFoundException
     */
    protected void showDevices(PrintWriter out) throws NameNotFoundException {
        // Create a sorted list
        final TreeMap<String, Device> tm = new TreeMap<String, Device>();
        final DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME);

        for (Device dev : dm.getDevices()) {
            tm.put(dev.getId(), dev);
        }
        for (Device dev : tm.values()) {
            out.print(dev.getId());
            final String drvClassName = dev.getDriverClassName();
View Full Code Here

     */
    protected void stopPlugin() {
        log.info("stop jifs");
        try {
            FileSystemService fSS = InitialNaming.lookup(FileSystemService.NAME);
            final DeviceManager dm = DeviceUtils.getDeviceManager();
            VirtualDevice dev = (VirtualDevice) dm.getDevice(JIFileSystemType.VIRTUAL_DEVICE_NAME);
            fSS.unregisterFileSystem(dev);
            log.info("jifs unmounted");
            dm.unregister(dev);
            log.info("jifs unregistered");
        } catch (NameNotFoundException e) {
            log.error("filsystemservice / filesystemtype not found");
        } catch (DeviceNotFoundException ex) {
            log.info("no jifs present");
View Full Code Here

TOP

Related Classes of org.jnode.driver.DeviceManager

Copyright © 2018 www.massapicom. 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.