I am thinking of adding dbus function to a java program that uses swing, so scripts can be used to perform some functions. This thing must run on windows too, where dbus is not available.
So i was thinking of doing the following:
dbus.java:
import dbus; //Whatever the module is called
class dbus implements some_interface {
//blah blah
}
dbus_fake.java
class dbus_fake implements some_interface {
//full of empty methods
}
dbus_manager.java
class dbus_manager {
static some_interface get_dbus() {
try {
return new dbus(); //This should fail when loading the class, because the imports are not satisfied.
} except {
return new fake_dbus();
}
}
}
Do you think it's a good idea? Would it work? Is there a better way of doing it?