package org.xwiki.observation.remote.internal;

import org.xwiki.component.annotation.Component;
import org.xwiki.component.annotation.Requirement;
import org.xwiki.context.Execution;
import org.xwiki.observation.remote.RemoteObservationManagerContext;

/**
 * Manager context properties specific to remote events.
 * 
 * @version $Id$
 * @since 2.0M3
 */
@Component
public class DefaultRemoteObservationManagerContext implements RemoteObservationManagerContext
{
    /**
     * The name of the properties containing the sate indicating if the current generated events are remote of local
     * events.
     */
    private static final String REMOTESTATE = "observation.remote.remotestate";

    /**
     * Used to store remote observation manager context properties.
     */
    @Requirement
    private Execution execution;

    /**
     * {@inheritDoc}
     * 
     * @see org.xwiki.observation.remote.RemoteObservationManagerContext#isRemoteState()
     */
    public boolean isRemoteState()
    {
        return this.execution.getContext().getProperty(REMOTESTATE) == Boolean.TRUE;
    }

    /**
     * {@inheritDoc}
     * 
     * @see org.xwiki.observation.remote.RemoteObservationManagerContext#pushRemoteState()
     */
    public void pushRemoteState()
    {
        this.execution.getContext().setProperty(REMOTESTATE, Boolean.TRUE);
    }

    /**
     * {@inheritDoc}
     * 
     * @see org.xwiki.observation.remote.RemoteObservationManagerContext#popRemoteState()
     */
    public void popRemoteState()
    {
        this.execution.getContext().setProperty(REMOTESTATE, Boolean.FALSE);
    }
}

@@ -177,16 +177,59 @@
 cution;%0A
+import org.xwiki.context.ExecutionContext;%0A
 import o
@@ -1051,14 +1051,34 @@
     
-return
+ExecutionContext context =
  thi
@@ -1101,16 +1101,60 @@
 ontext()
+;%0A%0A        return context != null && context
 .getProp

Create event distribution module between Observation Manager and the network * add support for events when there is no ExecutionContext