Class: Quark::MdkRuntime::Files::Subscription

Inherits:
DatawireQuarkCore::QuarkObject show all
Extended by:
DatawireQuarkCore::Static
Defined in:
lib/mdk_runtime/files.rb

Overview

A specific file notification subscription.

Constant Summary

Constants included from DatawireQuarkCore::Static

DatawireQuarkCore::Static::Unassigned

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DatawireQuarkCore::Static

_lazy_statics, static, unlazy_statics

Methods inherited from DatawireQuarkCore::QuarkObject

#to_s

Constructor Details

#initialize(actor, subscriber, path) ⇒ Subscription

Returns a new instance of Subscription.



471
472
473
474
475
476
477
478
479
# File 'lib/mdk_runtime/files.rb', line 471

def initialize(actor, subscriber, path)
    
    self.__init_fields__
    (self).subscriber = subscriber
    (self).actor = actor
    (self).path = path

    nil
end

Instance Attribute Details

#actorObject

Returns the value of attribute actor.



464
465
466
# File 'lib/mdk_runtime/files.rb', line 464

def actor
  @actor
end

#pathObject

Returns the value of attribute path.



464
465
466
# File 'lib/mdk_runtime/files.rb', line 464

def path
  @path
end

#previous_listingObject

Returns the value of attribute previous_listing.



464
465
466
# File 'lib/mdk_runtime/files.rb', line 464

def previous_listing
  @previous_listing
end

#subscriberObject

Returns the value of attribute subscriber.



464
465
466
# File 'lib/mdk_runtime/files.rb', line 464

def subscriber
  @subscriber
end

Instance Method Details

#__init_fields__Object



559
560
561
562
563
564
565
566
567
# File 'lib/mdk_runtime/files.rb', line 559

def __init_fields__()
    
    self.path = nil
    self.actor = nil
    self.subscriber = nil
    self.previous_listing = ::DatawireQuarkCore::List.new([])

    nil
end

#_getClassObject



515
516
517
518
519
520
# File 'lib/mdk_runtime/files.rb', line 515

def _getClass()
    
    return "mdk_runtime.files._Subscription"

    nil
end

#_getField(name) ⇒ Object



522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
# File 'lib/mdk_runtime/files.rb', line 522

def _getField(name)
    
    if ((name) == ("path"))
        return (self).path
    end
    if ((name) == ("actor"))
        return (self).actor
    end
    if ((name) == ("subscriber"))
        return (self).subscriber
    end
    if ((name) == ("previous_listing"))
        return (self).previous_listing
    end
    return nil

    nil
end

#_setField(name, value) ⇒ Object



541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
# File 'lib/mdk_runtime/files.rb', line 541

def _setField(name, value)
    
    if ((name) == ("path"))
        (self).path = ::DatawireQuarkCore.cast(value) { ::String }
    end
    if ((name) == ("actor"))
        (self).actor = ::DatawireQuarkCore.cast(value) { ::Quark.mdk_runtime.files.FileActorImpl }
    end
    if ((name) == ("subscriber"))
        (self).subscriber = ::DatawireQuarkCore.cast(value) { ::Quark.mdk_runtime.actors.Actor }
    end
    if ((name) == ("previous_listing"))
        (self).previous_listing = ::DatawireQuarkCore.cast(value) { ::DatawireQuarkCore::List }
    end

    nil
end

#pollObject



484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
# File 'lib/mdk_runtime/files.rb', line 484

def poll()
    
    new_listing = []
    idx = 0
    while ((idx) < ((new_listing).size)) do
        (self).actor._send(::Quark.mdk_runtime.files.FileContents.new((new_listing)[idx], ""), (self).subscriber)
        idx = (idx) + (1)
    end
    idx = 0
    jdx = nil
    found = nil
    while ((idx) < ((@previous_listing).size)) do
        jdx = 0
        found = false
        while ((jdx) < ((new_listing).size)) do
            if (((@previous_listing)[idx]) == ((new_listing)[jdx]))
                found = true
                break
            end
            jdx = (jdx) + (1)
        end
        if (!(found))
            (self).actor._send(::Quark.mdk_runtime.files.FileDeleted.new((@previous_listing)[idx]), (self).subscriber)
        end
        idx = (idx) + (1)
    end
    (self).previous_listing = new_listing

    nil
end