|
nSchedulerManager
When you have connected to a realm, and have a reference
to an nRealmNode
object, you can access an object called nSchedulerManager,
which provides you with the ability to add, modify,
delete scheduling scripts. To get access to this object,
you can call the following method from a realm node:
nSchedulerManager sMgr = realm.getSchedulerManager();
Using the nSchedulerManager object you can then obtain
a list of scheduler objects for the realm:
Enumeration schedulers = sMgr.getNodes();
This method returns an enumeration of nScheduler objects.
The nScheduler objects each correspond to a particular
scheduling script.
The following code shows you how to construct a new
scheduler object using a sample script that will log
a message to the realm server log every hour, signified
by the 'every 60' condition: {Please Note: typically
this script would be read from a script file or it could
be entered directly into the realm enterprise
manager GUI.}
String source = "scheduler myScheduler {\n";
String logString = "Sample script : ";
source += "\n";
source += "\n";
source += " initialise{\n";
source += " Logger.setlevel(0);\n";
source += " }\n";
source += " every 60"{\n";
source += " Logger.report(\""+logString+"\");\n";
source += " }\n";
source += "}\n";
sMgr.add(source, "user@localhost", false);
For more information on the Nirvana Administration,
please see the API
documentation, and the administrator
guide. |