Commit f26eb49e authored by Roland Kluge's avatar Roland Kluge
Browse files

Get rid of all compiler errors by adding the original transition

framework
parent 52a4a68e
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
package de.tudarmstadt.maki.simonstrator.api.component.topology; package de.tudarmstadt.maki.simonstrator.api.component.topology;
import de.tudarmstadt.maki.simonstrator.api.component.topology.event.DeltaBasedTopologyChangeObserver;
/** /**
* *
* @author michael.stein * @author michael.stein
...@@ -30,5 +32,5 @@ public interface ObservableTopologyProvider extends TopologyProvider { ...@@ -30,5 +32,5 @@ public interface ObservableTopologyProvider extends TopologyProvider {
public void addTopologyObserver(TopologyObserver observer); public void addTopologyObserver(TopologyObserver observer);
// TODO@rkluge: addDeltaBased... public void addDeltaBasedTopologyEventObserver(DeltaBasedTopologyChangeObserver deltaBasedTopologyChangeObserver);
} }
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of Simonstrator.KOM.
*
* Simonstrator.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package de.tudarmstadt.maki.simonstrator.api.component.transitionFull;
import java.io.Serializable;
/**
* Classes implementing this interface define an AtomicTransition from F to T
* (with the respective transition lifecycle).
*
* @author Bjoern Richerzhagen, Alex Froemmgen
*
* TODO Annotation Flip/Flip vs. Run/Run
*
* @param <F>
* From
* @param <T>
* To
*/
public interface AtomicTransitionStrategy<F extends TransitionEnabled, T extends TransitionEnabled>
extends Serializable {
/**
* The Transition is in the startup-phase
*
* @param from
* @param to
*/
public void inStartup(F from, T to);
/**
* Now, both F and T are active, but T is preparing its shutdown.
* (F.runnning, T.shutdown)
*
* FIXME: this callback is currently not triggered within the RunRun
* Transition. Do we require it at all?
*
* @param from
* @param to
*/
@Deprecated
public void inParallelActive(F from, T to);
/**
* The Run/Run-Transition is currently in its rollback-state. Note the
* reversed meaning of from and to in this context!!
*
* @param from
* source of the transition (NOT source of the rollback!)
* @param to
* target of the transition (NOT target of the rollback!)
*/
public void inRollback(F from, T to);
/**
* Last call to the transition-object (after the components did their
* cleanup)
*
* @param from
* @param to
*/
public void inCleanup(F from, T to);
}
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of Simonstrator.KOM.
*
* Simonstrator.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package de.tudarmstadt.maki.simonstrator.api.component.transitionFull;
public interface CallbackTarget {
public void success(TransitionEnabled component, boolean isSource,
boolean isTarget);
public void fail(TransitionEnabled component, boolean isSource,
boolean isTarget, Exception e);
}
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of Simonstrator.KOM.
*
* Simonstrator.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package de.tudarmstadt.maki.simonstrator.api.component.transitionFull;
/**
*
* @author Alexander Froemmgen
*
*/
public interface ParallelActiveCallback {
public void finishTransition();
public void rollbackTransition();
}
package de.tudarmstadt.maki.simonstrator.api.component.transitionFull;
public final class StateCallback {
private final TransitionEnabled component;
private final CallbackTarget target;
private final boolean isSource;
private final boolean isTarget;
private boolean called = false;
public StateCallback(TransitionEnabled component, CallbackTarget target,
boolean isSource, boolean isTarget) {
this.component = component;
this.target = target;
this.isSource = isSource;
this.isTarget = isTarget;
assert isSource != isTarget;
}
public void success() {
if (called)
throw new RuntimeException(
"Transition StateCallback invoked twice.");
called = true;
target.success(component, isSource, isTarget);
}
public void fail(Exception e) {
if (called)
throw new RuntimeException(
"Transition StateCallback invoked twice.");
called = true;
target.fail(component, isSource, isTarget, e);
}
}
\ No newline at end of file
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of Simonstrator.KOM.
*
* Simonstrator.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package de.tudarmstadt.maki.simonstrator.api.component.transitionFull;
/**
* A {@link TransitionEnabled} class can be controlled by the Transi
*
* @author bjoern
*
*/
public interface TransitionEnabled {
/**
* Prepare internal state / datastructures, no communication
*
* @param cb
*/
public void onInit(StateCallback cb);
// FIXME Future Work public void onStartup(StateCallback cb);
/**
* "Start" the overlay: join, and on join successful call cb.finished
*
* @param cb
*/
public void onRunning(StateCallback cb);
public void onShutdown(StateCallback cb, ParallelActiveCallback paC);
public void onCleanup(StateCallback cb);
// public void onFinished(StateCallback cb);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment