Examples of DeviceManager


Examples of org.jnode.driver.DeviceManager

        Device dev = ARG_DEVICE.getValue();
        Formatter<T> formatter = getFormatter();
        formatter.format(dev);

        // restart the device
        final DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME);
        dm.stop(dev);
        dm.start(dev);
    }
View Full Code Here

Examples of org.jnode.driver.DeviceManager

                READ_ONLY_FLAG.isSet() ? true : READ_WRITE_FLAG.isSet() ? false
                        : (uid == -1 && gid == -1);

        // Now do the work of mounting the file system, taking care to undo as much as
        // we can in the event of a failure.
        final DeviceManager dm = DeviceUtils.getDeviceManager();
        final NFS2Device dev = new NFS2Device(host, remoteDirectory, protocol, uid, gid);
        dev.setDriver(new NFS2Driver());
        dm.register(dev);
        boolean ok = false;
        try {
            final FileSystemService fss = InitialNaming.lookup(FileSystemService.NAME);
            NFS2FileSystemType type = fss.getFileSystemType(NFS2FileSystemType.ID);
            final NFS2FileSystem fs = type.create(dev, readOnly);
            fss.registerFileSystem(fs);
            try {
                fss.mount(mountPoint.getAbsolutePath(), fs, null);
                ok = true;
            } finally {
                if (!ok) {
                    fss.unregisterFileSystem(dev);
                }
            }
        } finally {
            if (!ok) {
                dm.unregister(dev);
            }
        }
    }
View Full Code Here

Examples of org.jnode.driver.DeviceManager

        reloadMBR();

        // restart the device
        try {
            DeviceManager devMan = DeviceUtils.getDeviceManager();
            devMan.stop(current);
            devMan.start(current);
        } catch (DeviceNotFoundException e) {
            throw new Exception("error while restarting device", e);
        } catch (DriverException e) {
            throw new Exception("error while restarting device", e);
        } catch (NameNotFoundException e) {
View Full Code Here

Examples of org.jnode.driver.DeviceManager

            } catch (InterruptedException ex) {
                throw new DriverException("Interrupted while INQUIRY device", ex);
            }
            // Register the generic SCSI device.
            try {
                final DeviceManager dm = usbDevice.getManager();
                dm.rename(scsiDevice, "sg", true);
                dm.register(scsiDevice);
                dm.rename(usbDevice, SCSIHostControllerAPI.DEVICE_PREFIX, true);
            } catch (DeviceAlreadyRegisteredException ex) {
                throw new DriverException(ex);
            }
        } catch (USBException e) {
            throw new DriverException(e);
View Full Code Here

Examples of org.jnode.driver.DeviceManager

        new RamDiskCommand().execute(args);
    }

    public void execute()
        throws NameNotFoundException, DriverException, DeviceAlreadyRegisteredException {
        final DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME);
        if (FLAG_CREATE.isSet()) {
            // Create
            final int size = ARG_SIZE.isSet() ? ARG_SIZE.getValue() : 4 * 4096;
            RamDiskDevice dev = new RamDiskDevice(null, "dummy", size);
            dev.setDriver(new RamDiskDriver(null));
            dm.register(dev);
        }
    }
View Full Code Here

Examples of org.jnode.driver.DeviceManager

     * @see org.jnode.driver.Driver#startDevice()
     */
    protected void startDevice() throws DriverException {
        final Device device = getDevice();
        try {
            final DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME);
            if (renameToDevicePrefixOnly()) {
                dm.rename(device, getDevicePrefix(), true);
            } else {
                final String prefix = getDevicePrefix() + '-';
                if (!device.getId().startsWith(prefix)) {
                    dm.rename(device, getDevicePrefix() + '-' + device.getId(), false);
                }
            }
        } catch (DeviceAlreadyRegisteredException ex) {
            log.error("Cannot rename device", ex);
        } catch (NameNotFoundException ex) {
View Full Code Here

Examples of org.jnode.driver.DeviceManager

     * @throws Exception
     */
    public static void main(String[] args) throws Exception {
        final ARPNetworkLayer arp =
                (ARPNetworkLayer) NetUtils.getNLM().getNetworkLayer(EthernetConstants.ETH_P_ARP);
        final DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME);
        final IPv4Address addr = new IPv4Address(args[0]);
        final IPv4Address myAddr = new IPv4Address(args[1]);
        final Device dev = dm.getDevice(args[2]);
        final long timeout = 5000;

        final HardwareAddress hwAddr;
        hwAddr = arp.getHardwareAddress(addr, myAddr, dev, timeout);

View Full Code Here

Examples of org.jnode.driver.DeviceManager

public class VirtualDeviceFactory {
    public static VirtualDevice createDevice(String name) throws DeviceException {
        try {
            final VirtualDevice dev = new VirtualDevice(name);
            dev.setDriver(new VirtualDeviceDriver());
            final DeviceManager dm = DeviceUtils.getDeviceManager();
            dm.register(dev);
            return dev;
        } catch (Exception x) {
            throw new DeviceException(x);
        }
    }
View Full Code Here

Examples of org.jnode.driver.DeviceManager

    /**
     * @see org.jnode.driver.Driver#startDevice()
     */
    protected final void startDevice() throws DriverException {
        final Device device = getDevice();
        final DeviceManager dm;
        try {
            dm = InitialNaming.lookup(DeviceManager.NAME);
            dm.rename(device, getDevicePrefix(), true);
        } catch (DeviceAlreadyRegisteredException ex) {
            log.error("Cannot rename device", ex);
            throw new DriverException("Cannot rename device", ex);
        } catch (NameNotFoundException ex) {
            throw new DriverException("Cannot find DeviceManager", ex);
View Full Code Here

Examples of org.jnode.driver.DeviceManager

    public FireWireDriver() {
    }

    protected void startDevice() throws DriverException {
        final Device device = getDevice();
        final DeviceManager dm;
        try {
            dm = InitialNaming.lookup(DeviceManager.NAME);
            dm.rename(device, getDevicePrefix(), true);
        } catch (DeviceAlreadyRegisteredException ex) {
            log.error("Cannot rename device", ex);
            throw new DriverException("Cannot rename device", ex);
        } catch (NameNotFoundException ex) {
            throw new DriverException("Cannot find DeviceManager", ex);
View Full Code Here
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.