3

I am currently working on a project where I need to bulk import data into a Hadoop cluster. The data that needs to be imported into Hadoop resides on SATA disks. The data that needs to be imported are Encase forensics disks image (E01). I created an application that extract files from these images and import those files into Hadoop, this works fine but I need to start the process by hand.

I want to automate the process by hot-swapping the SATA drives and automatically start the extract process. I wrote my program in Java and it needs to be that way due to some external libraries I use to analyse the images. I searched the internet for a solution where Java is used to detect newly inserted drives but all I found where libraries that can detect usb drive or used udev rules to kick start the a process (I could use that but prefer a Java solution)

Does anyone know if something like what I have described exists? Or does anyone can point me into the right direction? It would be much appreciated!

Almost forgot...I use ubuntu 12.04 Server Edition as my operating system.

Kevin Panko
  • 8,356
  • 19
  • 50
  • 61
Martijn
  • 521
  • 1
  • 8
  • 17
  • 3
    I'm not a Java expert by any means, but the existence of such a mechanism seems very doubtful to me. You'd practically need a Java API to udev, or the kernel itself. Of course, I guess you could just as well do that with JNI... – Daniel Kamil Kozar Sep 30 '13 at 12:42
  • I will have in mind: polling the mount point, JNotify or I think the new Java7 file IO may help. – PeterMmm Sep 30 '13 at 12:43
  • Is the entire server under your control, or are you needing to be able to install this application on someone else's machine? – chrylis -cautiouslyoptimistic- Sep 30 '13 at 12:44

1 Answers1

5

udisks is a D-Bus API that provides information (including notifications) on media insertion and removal, and you could subscribe to the notifications using dbus-java.

Alternatively, you could have your Java application listen on a localhost socket and write a udev rule that sent the appropriate event information over the socket.

chrylis -cautiouslyoptimistic-
  • 75,269
  • 21
  • 115
  • 152
  • The server is fully under my control. I had a quick look at dbus-java and it seems to be something I could use..tnx! – Martijn Sep 30 '13 at 12:58