Examples of DeviceManager


Examples of org.jnode.driver.DeviceManager

    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

Examples of org.jnode.driver.DeviceManager

     * @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

Examples of org.jnode.driver.DeviceManager

        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

Examples of org.jnode.driver.DeviceManager

        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

Examples of org.jnode.driver.DeviceManager

            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

Examples of org.jnode.driver.DeviceManager

     * @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

Examples of org.jnode.driver.DeviceManager

     */
    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

Examples of org.jnode.driver.DeviceManager

    }

    @Override
    protected Device doAccept(Token token, int flags) throws CommandSyntaxException {
        try {
            final DeviceManager devMgr = getDeviceManager();
            final Device device = devMgr.getDevice(token.text);
            if (apiClass == null || device.implementsAPI(apiClass)) {
                return device;
            } else {
                throw new CommandSyntaxException("this device does not implement the " +
                        apiClass.getSimpleName() + " API");
View Full Code Here

Examples of org.jnode.driver.DeviceManager

        }
    }

    @Override
    public void doComplete(CompletionInfo completions, String partial, int flags) {
        final DeviceManager devMgr = getDeviceManager();

        // collect matching devices
        for (Device dev : devMgr.getDevices()) {
            if (apiClass != null && !dev.implementsAPI(apiClass)) {
                continue;
            }
            final String devId = dev.getId();
            if (devId.startsWith(partial)) {
View Full Code Here

Examples of org.jnode.driver.DeviceManager

        final FileSystemService fss = InitialNaming.lookup(FileSystemService.NAME);
        SMBFileSystemType type = fss.getFileSystemType(SMBFileSystemType.ID);
       
        final SMBFSDevice dev = new SMBFSDevice(host, path, user, password);
        dev.setDriver(new SMBFSDriver());
        final DeviceManager dm = DeviceUtils.getDeviceManager();
        dm.register(dev);
       
        // This controls whether we attempt to undo the effects of the command
        // e.g. when the 'mount' step fails.
        boolean ok = false;
        try {
            final SMBFileSystem fs = type.create(dev, true);
            fss.registerFileSystem(fs);
            try {
                fss.mount(mountPoint.toString(), fs, null);
                ok = true;
            } finally {
                if (!ok) {
                    fss.unregisterFileSystem(dev);
                }
            }
        } finally {
            try {
                if (!ok) {
                    dm.unregister(dev);
                }
            } catch (DriverException ex) {
                // ignore
            }
        }
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.