[forge-dev] Firing ResourceEvents before CommandExecuted event?

Jevgeni Zelenkov jevgeni.zelenkov at googlemail.com
Tue Jun 19 19:55:06 EDT 2012


Could you please explain a little more what does "proper ClassLoading
while running in a modular environment" actually mean. Or maybe I
should ask it this way: do you think it's important for me to
understand that?

I want to fire ResourceEvents before CommandExecuted event because
that corresponds to what actually happens (files are modified during
the execution of the forge command, not after). Here is an
illustration of what I mean:
http://i49.tinypic.com/o9o9zd.png

I don't mind introducing another event EnteredWaitState but I don't
think it would make sense to use it, in order to acquire the resources
list. UndoPlugin will have to wait for the EnteredWaitState event and
then use polling of some kind to get the list of resources since there
is no way to know how many events are going to be fired or whether
EventBus has finished firing events. EnteredWaitState event could be
helpful for other uses, e.g. calling "git add --all; git commit" right
after (only if CommandExecuted behavior will not be modified).

Yes, "git add --all; git commit" would work. I was thinking about
tricky scenarios related to "git add all" but it should be fine.

Jevgeni


On Tue, Jun 19, 2012 at 11:08 PM, Lincoln Baxter, III
<lincolnbaxter at gmail.com> wrote:
> That line is to ensure proper ClassLoading while running in a modular
> environment.
>
> Before I answer this, it might be better to ask why you want to fire
> ResourceEvents before CommandExecuted event. I think I agree with the change
> to fire CommandExecuted after, but I just want to know to be sure.
>
> I think that introducing a second event might be useful if what you are
> trying to do is capture all changed resources:
>
> EnteredWaitState to notify when the shell is again waiting for user input.
> There may be an event like this already. Also, is it possible to do what you
> need without the resource events entirely? Just a thought. Doesn't GIT
> already tell you which files have changed somehow?
>
> ~Lincoln
>
> On Tue, Jun 19, 2012 at 3:48 PM, Jevgeni Zelenkov
> <jevgeni.zelenkov at googlemail.com> wrote:
>>
>> Hi guys,
>>
>> I am having an issue with Events in Forge. I would like to get a list
>> of Resources modified by a forge command, after a forge command has
>> been executed.
>>
>> Fortunately, forge fires events when command execution completes
>> (either successfully, or unsuccessfully) and when resources are
>> created/modified/deteled/etc. Sadly, it fires CommandExecuted event
>> before any of ResourceEvents. (EventBusInvoker listens to
>> CommandExecuted event and fires all ResourceEvents queued in the
>> EventBus).
>>
>> I expect ResourceEvents to be fired before the CommandExecuted event
>> (which would correspond to what actually happends). I tried commenting
>> out code inside of EventBusInvoker's fire method and adding
>> "bus.fireAll();" into Execution class (right before firing
>> CommandExecuted event) but that doesn't seem to work.
>>
>> How could I fire ResourceEvents before CommandExecuted event? Or is
>> there another way to get a list of modified resources during forge
>> command exection?
>>
>> What does this line do? Is forge multi-threaded?
>> "Thread.currentThread().setContextClassLoader(current);"
>>
>> Jevgeni
>> _______________________________________________
>> forge-dev mailing list
>> forge-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/forge-dev
>
>
>
>
> --
> Lincoln Baxter, III
> http://ocpsoft.org
> "Simpler is better."
>
> _______________________________________________
> forge-dev mailing list
> forge-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/forge-dev
>


More information about the forge-dev mailing list