A new version of Sake-Scheduler was added to project Sake : http://www.squeaksource.com/Sake/Sake-Scheduler-kph.12.mcz
==================== Summary ====================
Name: Sake-Scheduler-kph.12 Author: kph Time: 11 July 2009, 6:47:21 pm UUID: 12ace6d9-a574-4387-8029-1a273db35c6f Ancestors: Sake-Scheduler-kph.11
updated for Sake-SchedulerSeaside
=============== Diff against Sake-Scheduler-kph.11 ===============
Item was added: + ----- Method: Scheduler class>>allServices (in category 'as yet unclassified') ----- + allServices + + ^ ScheduledTask allSubclasses!
Item was changed: Object subclass: #Scheduler instanceVariableNames: 'running tasks accessProtect' classVariableNames: 'Default' poolDictionaries: '' category: 'Sake-Scheduler'!
+ !Scheduler commentStamp: 'kph 7/11/2009 18:43' prior: 0! + This scheduler is based upon "Scheduler" by the following authors - !Scheduler commentStamp: 'kph 8/18/2008 04:10' prior: 0! - This scheduler is based upon Scheduler by the following authors
Creator: John Pierce Admin: Ben Schroeder, John Pierce Developer: Bill Burchfield + Adapted by: Keith Hodges. + + We add the concept of periodic services from gjallar. + + The services which are defined in #services are started on image startUp. + Tasks which are started manually #start/stop are perpetuated across image restarts. + + notes: + Uses Logging + Does not depend upon Sake. - adapted by: Keith Hodges for Bob.
+ There is a basic Seaside UI in Sake-SchedulerSeaside + ! - we add the concept of periodic services.!
Item was changed: ----- Method: Scheduler>>printOn: (in category 'printing') ----- printOn: aStream
aStream + nextPutAll: 'Service scheduler is ', (running ifTrue: ['running'] ifFalse: ['stopped']); - nextPutAll: 'Task scheduler is ', (running ifTrue: ['running'] ifFalse: ['stopped']); nextPutAll: ' with '; nextPutAll: self taskCount asWords; nextPutAll:' task'. self taskCount = 1 ifFalse: [aStream nextPut: $s]
!
Item was added: + ----- Method: ScheduledTask>>workerProcess (in category 'accessing') ----- + workerProcess + "Answer the value of workerProcess" + + ^ workerProcess!
Item was changed: ----- Method: Scheduler class>>stopServices (in category 'as yet unclassified') ----- stopServices + self allServices do: [ :ea | ea stop ]. - ScheduledTask allSubclassesDo: [ :ea | ea unload ]. !
Item was changed: ----- Method: ScheduledTask class>>initialize (in category 'as yet unclassified') ----- initialize
+ ! - self unload. - - "in subclasses place services schedule here - - e.g. - - - self scheduler addTask: (self do: [ ... ] every: '1:00pm'). - self scheduler addTask: (self do: #defaultAction every: '1:00pm'). - method #defaultAction needs to be defined. - " - - !
Item was added: + ----- Method: ScheduledTask>>workerProcess: (in category 'accessing') ----- + workerProcess: anObject + "Set the value of workerProcess" + + workerProcess := anObject!
Item was added: + ----- Method: Scheduler>>isRunning (in category 'initialization') ----- + isRunning + + ^ running!
Item was added: + ----- Method: ScheduledTask>>printLastRunTime (in category 'printing') ----- + printLastRunTime + + ^ (runHistory isEmptyOrNil + ifTrue: [runHistory ifNil: [ '<not logged>' ] ifNotNil: [ '<never run>' ] ] + ifFalse: [runHistory last asString]).!
Item was added: + ----- Method: ScheduledTask>>= (in category 'private') ----- + = other + + ^ self species = other species and: [ self name = other name ] and: [ self description = other description ] !
Item was changed: ----- Method: Scheduler class>>refresh (in category 'as yet unclassified') ----- refresh + | oldTasks | + oldTasks := self default tasks. + + self default tasksDo: [ :ea | ea delete ]. + self default addTasks: oldTasks.! - self stopServices. - self startServices.!
Item was changed: Object subclass: #ScheduledTask + instanceVariableNames: 'name description scheduler task runHistory workerProcess schedule nextRunTime' - instanceVariableNames: 'description scheduler task runHistory workerProcess schedule nextRunTime' classVariableNames: '' poolDictionaries: '' category: 'Sake-Scheduler'!
+ !ScheduledTask commentStamp: 'kph 7/10/2009 03:47' prior: 0! + If your task is to be run automatically on load or startUp, override #initialize (class side) to call #start + + Publish your tasks for #start via #services + + #stop/#unload are synonomous. + + Additional tasks can be added directly. + + self scheduler addTask: (self do: [ ... ] every: '1:00pm'). + self scheduler addTask: (self do: #defaultAction every: '1:00pm'). + method #defaultAction needs to be defined.! - !ScheduledTask commentStamp: 'kph 3/28/2009 17:04' prior: 0! - If your task is to be run automatically on load or startUp, override #initialize (class side). - Otherwise name the method #start. - #stop/#unload are synomonous. - !
Item was changed: ----- Method: ScheduledTask>>printOn: (in category 'printing') ----- printOn: aStream
aStream nextPutAll: (self class name); cr. self description ifNotNil: [aStream nextPutAll: self description; cr]. self isRunning ifTrue: [aStream nextPutAll: 'CURRENTLY RUNNING !!!!']. self isSuspended ifTrue: [aStream nextPutAll: ' (suspended)']. aStream cr; nextPutAll: 'Next Run Time : ', self nextRunTime asString; cr; + nextPutAll: 'Last Run Time : ', self printLastRunTime! - nextPutAll: 'Last Run Time : ', (runHistory isEmptyOrNil - ifTrue: [runHistory ifNil: [ '<not logged>' ] ifNotNil: [ '<never run>' ] ] - ifFalse: [runHistory last asString]).!
Item was added: + ----- Method: ScheduledTask>>name: (in category 'accessing') ----- + name: anObject + "Set the value of name" + + name := anObject!
Item was added: + ----- Method: Scheduler>>tasks (in category 'accessing') ----- + tasks + + | copiedTasks | + accessProtect critical: [copiedTasks := tasks copy]. + + ^ copiedTasks !
Item was added: + ----- Method: Scheduler>>addTasks: (in category 'scheduling') ----- + addTasks: aList + accessProtect critical: [ + aList do: [ :aScheduledTask | tasks add: (aScheduledTask scheduler: self; yourself)] + ]!
Item was changed: ----- Method: ScheduledTask>>description (in category 'accessing') ----- description
+ ^ description ifNil: [ self name ]! - ^ description!
Item was added: + ----- Method: ScheduledTask>>runHistory: (in category 'accessing') ----- + runHistory: anObject + "Set the value of runHistory" + + runHistory := anObject!
Item was added: + ----- Method: ScheduledTask>>name (in category 'accessing') ----- + name + + ^ name ifNil: [ self class name ]!
Item was changed: ----- Method: Scheduler>>addTask: (in category 'scheduling') ----- addTask: aScheduledTask
+ ^ self addTasks: (Array with: aScheduledTask)! - ^ accessProtect critical: [tasks add: (aScheduledTask scheduler: self; yourself)]!
Item was changed: ----- Method: Scheduler class>>startServices (in category 'as yet unclassified') ----- startServices self default start. + self allServices do: [ :ea | ea start ]. - ScheduledTask allSubclasses do: [ :ea | ea initialize ]. !
Item was added: + ----- Method: ScheduledTask>>isScheduled (in category 'executing') ----- + isScheduled + ^ scheduler notNil!
Item was added: + ----- Method: ScheduledTask>>hash (in category 'private') ----- + hash + + ^ self species hash bitXor: self description hash!
Item was added: + ----- Method: ScheduledTask class>>start (in category 'as yet unclassified') ----- + start + self stop. + self scheduler addTasks: self services!
Item was changed: ----- Method: Scheduler>>tasksDo: (in category 'accessing') ----- tasksDo: aOneArgBlock + self tasks do: aOneArgBlock! - | copiedTasks | - accessProtect critical: [copiedTasks := tasks copy]. - - copiedTasks do: aOneArgBlock!
packages@lists.squeakfoundation.org