findAll(connection)
create()
update()
activate()
oneShot()
deactivate()
delete()
getCronId()
getActive()
getBuildClass()
getDescription()
getOwnerId()
getProjectId()
getSelectorId()
getMinute()
getHour()
getDayOfWeek()
getMonth()
getDayOfMonth()
getEnvironmentGroupId()
getEnvGroupId()
getEnvironmentText()
getEnvText()
getFired()
getNextRun()
setActive(active)
setBuildClass(className)
setDescription(desc)
setProjectId(projectId)
setSelectorId(selectorId)
setMinute(minute)
setHour(hour)
setDayOfWeek(dow)
setMonth(month)
setDayOfMonth(dom)
setEnvironmentGroupId(envGroupId)
setEnvGroupId(envGroupId)
setEnvironmentText(envText)
setEnvText(envText)
BuildForge::Services::DBO::Cron
use BuildForge::Services;
$conn = new BuildForge::Services::Connection($hostname); $token = $conn->authUser($user, $pass); # Getting existing schedules $allCrons = BuildForge::Services::DBO::Cron->findAll($conn); $oldCron = BuildForge::Services::DBO::Cron->findById($conn, 2); $anotherCron = BuildForge::Services::DBO::Cron->findByName($conn, 'MyCron');
# Getter / setter functions $id = $cron->getCronId(); $isActive = $cron->getActive(); $class = $cron->getBuildClass(); $description = $cron->getDescription(); $owner = $cron->getOwnerId(); $projectId = $cron->getProjectId(); $selectorId = $cron->getSelectorId(); $minute = $cron->getMinute(); $hour = $cron->getHour(); $dow = $cron->getDayOfWeek(); $month = $cron->getMonth(); $dom = $cron->getDayOfMonth(); $envGroupId = $cron->getEnvironmentGroupId(); $envGroupId = $cron->getEnvGroupId(); $envText = $cron->getEnvironmentText(); $envText = $cron->getEnvText(); $lastFiredTimestamp = $cron->getFired(); $nextFiredTimestamp = $cron->getNextRun(); $cron->setActive('YES'); $cron->setBuildClass('ClassName'); $cron->setDescription('Schedule Description'); $cron->setProjectId($projectId); $cron->setSelectorId($selectorId); $cron->setMinute('5'); $cron->setHour('*'); $cron->setDayOfWeek('1-5'); $cron->setMonth('*/2'); $cron->setDayOfMonth('1-6/3,29'); $cron->setEnvironmentGroupId($envGroupId); $cron->setEnvGroupId($envGroupId); $cron->setEnvText($envText); $cron->setEnvironmentText($envText); $cron->update(); # Schedule creation, modification, deletion $project = new BuildForge::Services::DBO::Project($conn); $project->setName('Test Project'); $project->create(); $newcron = new BuildForge::Services::DBO::Cron($conn); $newcron->setDescription('New Cron'); $newcron->setProjectId($project->getProjectId()); $newcron->create();
$newcron->setDescription('New Cron Description'); $newcron->update(); $newcron->activate(); $newcron->oneShot(); $newcron->deactivate();
$newcron->delete(); BuildForge::Services::DBO::Cron->deleteById($conn, $cron->getCronId()); $conn->logout; $conn->close;
Cron allows you to create, modify, and delete schedules in the BuildForge engine.
Returns a new instance of a Cron object.
A connected BuildForge::Services::Connection object.
An optional reference to a hash containing any or all of the following fields.
Whether the schedule is active ('YES', the default), inactive ('NO'), or run once only ('ONCE').
The class of the build that is run via the schedule, gotten from $class->getName(). If this is left unset or set to an empty string, the class of the scheduled project is used. If this is a class purge schedule, a class must be set.
The description of the schedule.
The project ID of the project to run (from $project->getProjectId()), or 0 to make this a class purge schedule (the default).
The selector ID of the selector (from $selector->getSelectorId())
to run the scheduled
build with. If this is 0 or is not set, the build uses the selector of the project
being scheduled. If this is a class purge schedule, this value is ignored.
The minute(s)
at which to run this schedule in crontab format. Defaults to '0'.
The hour(s)
at which to run this schedule in crontab format. Defaults to '0'.
The day(s)
of the week in which to run this schedule in crontab format. Defaults to '*'.
The month(s)
in which to run this schedule in crontab format. Defaults to '*'.
The day(s)
of the month in which to run this schedule in crontab format. Defaults to '*'.
The environment group ID (from $environment->getEnvironmentGroupId())
to run the scheduled
builds with. The project's environment group is also applied - first the project's environment
group, then the schedule's environment group, so that the schedule's settings override the
project's settings if necessary. Set this to 0 (the default) for no schedule-specific environment group
to be used.
In order to set variables specifically in the schedule rather than in the environment group, set this to a string consisting of newline-delimited S:VARIABLE_NAME:New variable value strings. This is the empty string by default.
findAll(connection)
Returns a reference to an array of BuildForge::Services::DBO::Cron objects corresponding to all schedules in the database that the user has access to.
A connected BuildForge::Services::Connection object.
Returns the BuildForge::Services::DBO::Cron object corresponding to the given schedule ID, or undef if no such object exists.
A connected BuildForge::Services::Connection object.
The schedule ID for the desired schedule, from $cron->getCronId().
Returns the BuildForge::Services::DBO::Cron object corresponding to the given description, or undef if no such object exists.
A connected BuildForge::Services::Connection object.
The schedule description for the desired schedule, from $cron->getDescription().
create()
Creates the cron object within the database.
update()
Updates the database cron object with the current object settings.
activate()
Activates the schedule within the database.
oneShot()
Makes the schedule within the database a run once schedule.
deactivate()
Deactivates the schedule within the database.
delete()
Deletes the schedule from the database.
Deletes the schedule with the given ID from the database.
A connected BuildForge::Services::Connection object.
The schedule ID (from $cron->getCronId())
to delete.
getCronId()
Returns the ID of the schedule.
getActive()
Returns 'YES' if this is an active schedule, 'NO' if this is an inactive schedule, or 'ONCE' if this is a run once schedule.
getBuildClass()
Returns the class of the build being scheduled or '' to use the class of the scheduled project for project schedules or the class of build to purge for class purge schedules.
getDescription()
Returns the description of the schedule.
getOwnerId()
Returns the user ID of the owner of the schedule. Builds kicked off by the schedule will run as if they had been run by that user.
getProjectId()
Returns the project ID of the project that the schedule will create a build of, or 0 for class purge schedules.
getSelectorId()
Returns the selector ID of the selector that builds from this schedule will use. An empty string will cause the builds to use the scheduled project's selector.
getMinute()
Returns the crontab string for the minute(s)
in which the schedule will run.
getHour()
Returns the crontab string for the hour(s)
in which the schedule will run.
getDayOfWeek()
Returns the crontab string for the day(s)
of the week in which the schedule will run.
getMonth()
Returns the crontab string for the month(s)
in which the schedule will run.
getDayOfMonth()
Returns the crontab string for the day(s)
of the month in which the schedule will run.
getEnvironmentGroupId()
Returns the environment group ID for the environment that the schedule will use. The project's environment group is also applied - first the project's environment group, then the schedule's environment group, so that the schedule's settings override the project's settings if necessary.
getEnvGroupId()
An alias for $cron->getEnvironmentGroupId(). Returns the environment group ID for the environment that the schedule will use. The project's environment group is also applied - first the project's environment group, then the schedule's environment group, so that the schedule's settings override the project's settings if necessary.
getEnvironmentText()
Returns the text of the schedule's specific environment. If this is used, it'll consist of a string with newline-delimited S:VARIABLE_NAME:New variable value strings.
getEnvText()
An alias for $cron->getEnvironmentText(). Returns the text of the schedule's specific environment. If this is used, it'll consist of a string with newline-delimited S:VARIABLE_NAME:New variable value strings.
getFired()
Returns the timestamp for the time that the scheduled build was last kicked off.
getNextRun()
Returns the timestamp for the time that the scheduled build will next be kicked off.
This may take 15 seconds or so to update from the time that schedule settings are changed.
A value of 0 means that the next run time has not yet been calculated, -1 means that one or
more of the date / time fields have invalid values, and -2 means that the date / time will never
be matched - for example, if $cron->getMonth()
== 2 and $cron->getDayOfMonth()
== 31.
setActive(active)
Sets whether the schedule is active, inactive, or run once. $cron->update()
must be run
before changes are replicated in the database.
May be 'YES' for active, 'NO' for inactive, or 'ONCE' for run once.
setBuildClass(className)
Sets the class of builds kicked off by this schedule for project schedules or the
class of builds to be purged for class purge schedules. $cron->update()
must be run
before changes are replicated in the database.
The name/ID of the class (from $class->getName()), or '' to use the class of the project being kicked off. This cannot be set to '' for class purge schedules.
setDescription(desc)
Sets the description of the schedule. $cron->update()
must be run
before changes are replicated in the database.
The new schedule description.
setProjectId(projectId)
Sets the project ID of the project to be kicked off by the schedule or
makes this a class purge schedule. $cron->update()
must be run
before changes are replicated in the database.
The project ID for project schedules (from $project->getProjectId()), or 0 to make this a class purge schedule.
setSelectorId(selectorId)
Sets the selector that the kicked off builds will use. This setting is
ignored for class purge schedules. $cron->update()
must be run
before changes are replicated in the database.
The selector ID to use (from $selector->getSelectorId()), or '' to use the selector of the project being scheduled.
setMinute(minute)
Sets the minute(s)
in which to run this schedule. $cron->update()
must be run
before changes are replicated in the database.
The minute in which to run this schedule in crontab format.
setHour(hour)
Sets the hour(s)
in which to run this schedule. $cron->update()
must be run
before changes are replicated in the database.
The hour in which to run this schedule in crontab format.
setDayOfWeek(dow)
Sets the day(s)
of the week in which to run this schedule. $cron->update()
must be run
before changes are replicated in the database.
The day(s)
of the week in which to run this schedule in crontab format.
setMonth(month)
Sets the month(s)
in which to run this schedule. $cron->update()
must be run
before changes are replicated in the database.
The month(s)
in which to run this schedule in crontab format.
setDayOfMonth(dom)
Sets the day(s)
of the month in which to run this schedule. $cron->update()
must be run
before changes are replicated in the database.
The day(s)
of the month in which to run this schedule in crontab format.
setEnvironmentGroupId(envGroupId)
Sets the environment group that the kicked off build will use.
The project's environment group is also applied - first the project's environment
group, then the schedule's environment group, so that the schedule's settings override the
project's settings if necessary. $cron->update()
must be run
before changes are replicated in the database.
The ID of the environment group to use (from $environment->getEnvGroupId()), or 0 to not use a schedule-specific environment group.
setEnvGroupId(envGroupId)
An alias for $cron->setEnvironmentGroupId(envGroupId).
Sets the environment group that the kicked off build will use.
The project's environment group is also applied - first the project's environment
group, then the schedule's environment group, so that the schedule's settings override the
project's settings if necessary. $cron->update()
must be run
before changes are replicated in the database.
The ID of the environment group to use (from $environment->getEnvGroupId()), or 0 to not use a schedule-specific environment group.
setEnvironmentText(envText)
Sets the schedule-specifc environment text of the schedule, if having a schedule-specific
environment is not desired. $cron->update()
must be run
before changes are replicated in the database.
Set this to '' to use the environment group from $cron->getEnvironmentGroupId()). In order to set variables specifically in the schedule rather than in the environment group, set this to a string consisting of newline-delimited S:VARIABLE_NAME:New variable value strings.
setEnvText(envText)
An alias for $cron->setEnvironmentText(envText).
Sets the schedule-specifc environment text of the schedule, if having a schedule-specific
environment is not desired. $cron->update()
must be run
before changes are replicated in the database.
Set this to '' to use the environment group from $cron->getEnvironmentGroupId()). In order to set variables specifically in the schedule rather than in the environment group, set this to a string consisting of newline-delimited S:VARIABLE_NAME:New variable value strings.
Copyright (c)2006-2007 International Business Machines, Inc. All rights reserved.