repo_name
stringlengths
7
104
file_path
stringlengths
13
198
context
stringlengths
67
7.15k
import_statement
stringlengths
16
4.43k
code
stringlengths
40
6.98k
prompt
stringlengths
227
8.27k
next_line
stringlengths
8
795
ollipekka/gdx-soundboard
core/src/com/gdx/musicevents/MusicEventManager.java
// Path: core/src/com/gdx/musicevents/effects/StartEffect.java // public interface StartEffect extends Effect { // public void initialize(MusicState nextState, MusicState previousState); // public void beginStart(); // public void endStart(); // } // // Path: core/src/com/gdx/musicevents/effects/StopEffect.java // public interface StopEffect extends Effect { // // public void initialize(MusicState nextState, MusicState previousState); // public void beginStop(); // // public void endStop(); // }
import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Json; import com.badlogic.gdx.utils.JsonWriter; import com.badlogic.gdx.utils.ObjectMap; import com.gdx.musicevents.effects.StartEffect; import com.gdx.musicevents.effects.StopEffect;
package com.gdx.musicevents; public class MusicEventManager { /** * Container for serialization purposes. */ private static class Container { transient String basePath = "./"; Array<MusicState> states; public Container() { } private Container(Array<MusicState> states) { this.states = states; } } private Container container = new Container(); /** * The events that the manager is able to respond to. */ private final ObjectMap<String, MusicState> states = new ObjectMap<String, MusicState>(); /** * The current event. */ private MusicState currentState; /** * Listeners in the event tool. */ private final Array<MusicEventListener> listeners = new Array<MusicEventListener>(); /** * The transitions in progress. */
// Path: core/src/com/gdx/musicevents/effects/StartEffect.java // public interface StartEffect extends Effect { // public void initialize(MusicState nextState, MusicState previousState); // public void beginStart(); // public void endStart(); // } // // Path: core/src/com/gdx/musicevents/effects/StopEffect.java // public interface StopEffect extends Effect { // // public void initialize(MusicState nextState, MusicState previousState); // public void beginStop(); // // public void endStop(); // } // Path: core/src/com/gdx/musicevents/MusicEventManager.java import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Json; import com.badlogic.gdx.utils.JsonWriter; import com.badlogic.gdx.utils.ObjectMap; import com.gdx.musicevents.effects.StartEffect; import com.gdx.musicevents.effects.StopEffect; package com.gdx.musicevents; public class MusicEventManager { /** * Container for serialization purposes. */ private static class Container { transient String basePath = "./"; Array<MusicState> states; public Container() { } private Container(Array<MusicState> states) { this.states = states; } } private Container container = new Container(); /** * The events that the manager is able to respond to. */ private final ObjectMap<String, MusicState> states = new ObjectMap<String, MusicState>(); /** * The current event. */ private MusicState currentState; /** * Listeners in the event tool. */ private final Array<MusicEventListener> listeners = new Array<MusicEventListener>(); /** * The transitions in progress. */
private final Array<StartEffect> startTransitions = new Array<StartEffect>();
ollipekka/gdx-soundboard
core/src/com/gdx/musicevents/MusicEventManager.java
// Path: core/src/com/gdx/musicevents/effects/StartEffect.java // public interface StartEffect extends Effect { // public void initialize(MusicState nextState, MusicState previousState); // public void beginStart(); // public void endStart(); // } // // Path: core/src/com/gdx/musicevents/effects/StopEffect.java // public interface StopEffect extends Effect { // // public void initialize(MusicState nextState, MusicState previousState); // public void beginStop(); // // public void endStop(); // }
import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Json; import com.badlogic.gdx.utils.JsonWriter; import com.badlogic.gdx.utils.ObjectMap; import com.gdx.musicevents.effects.StartEffect; import com.gdx.musicevents.effects.StopEffect;
package com.gdx.musicevents; public class MusicEventManager { /** * Container for serialization purposes. */ private static class Container { transient String basePath = "./"; Array<MusicState> states; public Container() { } private Container(Array<MusicState> states) { this.states = states; } } private Container container = new Container(); /** * The events that the manager is able to respond to. */ private final ObjectMap<String, MusicState> states = new ObjectMap<String, MusicState>(); /** * The current event. */ private MusicState currentState; /** * Listeners in the event tool. */ private final Array<MusicEventListener> listeners = new Array<MusicEventListener>(); /** * The transitions in progress. */ private final Array<StartEffect> startTransitions = new Array<StartEffect>(); private StartEffect currentStartEffect;
// Path: core/src/com/gdx/musicevents/effects/StartEffect.java // public interface StartEffect extends Effect { // public void initialize(MusicState nextState, MusicState previousState); // public void beginStart(); // public void endStart(); // } // // Path: core/src/com/gdx/musicevents/effects/StopEffect.java // public interface StopEffect extends Effect { // // public void initialize(MusicState nextState, MusicState previousState); // public void beginStop(); // // public void endStop(); // } // Path: core/src/com/gdx/musicevents/MusicEventManager.java import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Json; import com.badlogic.gdx.utils.JsonWriter; import com.badlogic.gdx.utils.ObjectMap; import com.gdx.musicevents.effects.StartEffect; import com.gdx.musicevents.effects.StopEffect; package com.gdx.musicevents; public class MusicEventManager { /** * Container for serialization purposes. */ private static class Container { transient String basePath = "./"; Array<MusicState> states; public Container() { } private Container(Array<MusicState> states) { this.states = states; } } private Container container = new Container(); /** * The events that the manager is able to respond to. */ private final ObjectMap<String, MusicState> states = new ObjectMap<String, MusicState>(); /** * The current event. */ private MusicState currentState; /** * Listeners in the event tool. */ private final Array<MusicEventListener> listeners = new Array<MusicEventListener>(); /** * The transitions in progress. */ private final Array<StartEffect> startTransitions = new Array<StartEffect>(); private StartEffect currentStartEffect;
private final Array<StopEffect> endTransitions = new Array<StopEffect>();
ollipekka/gdx-soundboard
core/src/com/gdx/musicevents/MusicState.java
// Path: core/src/com/gdx/musicevents/effects/Effect.java // public interface Effect { // public void update(float dt); // public boolean isDone(); // } // // Path: core/src/com/gdx/musicevents/effects/Play.java // public class Play implements StartEffect { // // // private MusicState nextState; // // public Play() { // } // // @Override // public void beginStart() { // nextState.play(); // nextState.setVolume(1); // } // // @Override // public void endStart() { // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/StartEffect.java // public interface StartEffect extends Effect { // public void initialize(MusicState nextState, MusicState previousState); // public void beginStart(); // public void endStart(); // } // // Path: core/src/com/gdx/musicevents/effects/Stop.java // public class Stop implements StopEffect { // private MusicState nextState; // // public Stop() { // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // // @Override // public void beginStop() { // nextState.stop(); // } // // @Override // public void endStop() { // // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // } // // Path: core/src/com/gdx/musicevents/effects/StopEffect.java // public interface StopEffect extends Effect { // // public void initialize(MusicState nextState, MusicState previousState); // public void beginStop(); // // public void endStop(); // }
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.audio.Music; import com.badlogic.gdx.audio.Music.OnCompletionListener; import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.ObjectMap; import com.gdx.musicevents.effects.Effect; import com.gdx.musicevents.effects.Play; import com.gdx.musicevents.effects.StartEffect; import com.gdx.musicevents.effects.Stop; import com.gdx.musicevents.effects.StopEffect;
package com.gdx.musicevents; public class MusicState implements OnCompletionListener{ private final String name; private final Array<Track> tracks = new Array<Track>();
// Path: core/src/com/gdx/musicevents/effects/Effect.java // public interface Effect { // public void update(float dt); // public boolean isDone(); // } // // Path: core/src/com/gdx/musicevents/effects/Play.java // public class Play implements StartEffect { // // // private MusicState nextState; // // public Play() { // } // // @Override // public void beginStart() { // nextState.play(); // nextState.setVolume(1); // } // // @Override // public void endStart() { // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/StartEffect.java // public interface StartEffect extends Effect { // public void initialize(MusicState nextState, MusicState previousState); // public void beginStart(); // public void endStart(); // } // // Path: core/src/com/gdx/musicevents/effects/Stop.java // public class Stop implements StopEffect { // private MusicState nextState; // // public Stop() { // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // // @Override // public void beginStop() { // nextState.stop(); // } // // @Override // public void endStop() { // // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // } // // Path: core/src/com/gdx/musicevents/effects/StopEffect.java // public interface StopEffect extends Effect { // // public void initialize(MusicState nextState, MusicState previousState); // public void beginStop(); // // public void endStop(); // } // Path: core/src/com/gdx/musicevents/MusicState.java import com.badlogic.gdx.Gdx; import com.badlogic.gdx.audio.Music; import com.badlogic.gdx.audio.Music.OnCompletionListener; import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.ObjectMap; import com.gdx.musicevents.effects.Effect; import com.gdx.musicevents.effects.Play; import com.gdx.musicevents.effects.StartEffect; import com.gdx.musicevents.effects.Stop; import com.gdx.musicevents.effects.StopEffect; package com.gdx.musicevents; public class MusicState implements OnCompletionListener{ private final String name; private final Array<Track> tracks = new Array<Track>();
private final ObjectMap<String, StartEffect> enterTransitions = new ObjectMap<String, StartEffect>();
ollipekka/gdx-soundboard
core/src/com/gdx/musicevents/MusicState.java
// Path: core/src/com/gdx/musicevents/effects/Effect.java // public interface Effect { // public void update(float dt); // public boolean isDone(); // } // // Path: core/src/com/gdx/musicevents/effects/Play.java // public class Play implements StartEffect { // // // private MusicState nextState; // // public Play() { // } // // @Override // public void beginStart() { // nextState.play(); // nextState.setVolume(1); // } // // @Override // public void endStart() { // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/StartEffect.java // public interface StartEffect extends Effect { // public void initialize(MusicState nextState, MusicState previousState); // public void beginStart(); // public void endStart(); // } // // Path: core/src/com/gdx/musicevents/effects/Stop.java // public class Stop implements StopEffect { // private MusicState nextState; // // public Stop() { // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // // @Override // public void beginStop() { // nextState.stop(); // } // // @Override // public void endStop() { // // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // } // // Path: core/src/com/gdx/musicevents/effects/StopEffect.java // public interface StopEffect extends Effect { // // public void initialize(MusicState nextState, MusicState previousState); // public void beginStop(); // // public void endStop(); // }
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.audio.Music; import com.badlogic.gdx.audio.Music.OnCompletionListener; import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.ObjectMap; import com.gdx.musicevents.effects.Effect; import com.gdx.musicevents.effects.Play; import com.gdx.musicevents.effects.StartEffect; import com.gdx.musicevents.effects.Stop; import com.gdx.musicevents.effects.StopEffect;
package com.gdx.musicevents; public class MusicState implements OnCompletionListener{ private final String name; private final Array<Track> tracks = new Array<Track>(); private final ObjectMap<String, StartEffect> enterTransitions = new ObjectMap<String, StartEffect>();
// Path: core/src/com/gdx/musicevents/effects/Effect.java // public interface Effect { // public void update(float dt); // public boolean isDone(); // } // // Path: core/src/com/gdx/musicevents/effects/Play.java // public class Play implements StartEffect { // // // private MusicState nextState; // // public Play() { // } // // @Override // public void beginStart() { // nextState.play(); // nextState.setVolume(1); // } // // @Override // public void endStart() { // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/StartEffect.java // public interface StartEffect extends Effect { // public void initialize(MusicState nextState, MusicState previousState); // public void beginStart(); // public void endStart(); // } // // Path: core/src/com/gdx/musicevents/effects/Stop.java // public class Stop implements StopEffect { // private MusicState nextState; // // public Stop() { // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // // @Override // public void beginStop() { // nextState.stop(); // } // // @Override // public void endStop() { // // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // } // // Path: core/src/com/gdx/musicevents/effects/StopEffect.java // public interface StopEffect extends Effect { // // public void initialize(MusicState nextState, MusicState previousState); // public void beginStop(); // // public void endStop(); // } // Path: core/src/com/gdx/musicevents/MusicState.java import com.badlogic.gdx.Gdx; import com.badlogic.gdx.audio.Music; import com.badlogic.gdx.audio.Music.OnCompletionListener; import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.ObjectMap; import com.gdx.musicevents.effects.Effect; import com.gdx.musicevents.effects.Play; import com.gdx.musicevents.effects.StartEffect; import com.gdx.musicevents.effects.Stop; import com.gdx.musicevents.effects.StopEffect; package com.gdx.musicevents; public class MusicState implements OnCompletionListener{ private final String name; private final Array<Track> tracks = new Array<Track>(); private final ObjectMap<String, StartEffect> enterTransitions = new ObjectMap<String, StartEffect>();
private final ObjectMap<String, StopEffect> exitTransitions = new ObjectMap<String, StopEffect>();
ollipekka/gdx-soundboard
core/src/com/gdx/musicevents/MusicState.java
// Path: core/src/com/gdx/musicevents/effects/Effect.java // public interface Effect { // public void update(float dt); // public boolean isDone(); // } // // Path: core/src/com/gdx/musicevents/effects/Play.java // public class Play implements StartEffect { // // // private MusicState nextState; // // public Play() { // } // // @Override // public void beginStart() { // nextState.play(); // nextState.setVolume(1); // } // // @Override // public void endStart() { // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/StartEffect.java // public interface StartEffect extends Effect { // public void initialize(MusicState nextState, MusicState previousState); // public void beginStart(); // public void endStart(); // } // // Path: core/src/com/gdx/musicevents/effects/Stop.java // public class Stop implements StopEffect { // private MusicState nextState; // // public Stop() { // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // // @Override // public void beginStop() { // nextState.stop(); // } // // @Override // public void endStop() { // // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // } // // Path: core/src/com/gdx/musicevents/effects/StopEffect.java // public interface StopEffect extends Effect { // // public void initialize(MusicState nextState, MusicState previousState); // public void beginStop(); // // public void endStop(); // }
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.audio.Music; import com.badlogic.gdx.audio.Music.OnCompletionListener; import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.ObjectMap; import com.gdx.musicevents.effects.Effect; import com.gdx.musicevents.effects.Play; import com.gdx.musicevents.effects.StartEffect; import com.gdx.musicevents.effects.Stop; import com.gdx.musicevents.effects.StopEffect;
public void onCompletion(Music music) { if (!loopTrack) { if (randomTrack) { currentTrackIndex = MathUtils.random(0, tracks.size - 1); } else { currentTrackIndex = (currentTrackIndex + 1) % tracks.size; } } Track currentTrack = getCurrentTrack(); if(currentTrack != null){ currentTrack.reset(); currentTrack.play(); } } public void init(String basePath) { for(int i = 0; i < getTracks().size; i++){ Track track = getTracks().get(i); track.init(basePath, this); } } public StartEffect enter(MusicState previousState) { StartEffect effect = null; if(previousState != null){ effect = enterTransitions.get(previousState.getName()); } if(effect == null){
// Path: core/src/com/gdx/musicevents/effects/Effect.java // public interface Effect { // public void update(float dt); // public boolean isDone(); // } // // Path: core/src/com/gdx/musicevents/effects/Play.java // public class Play implements StartEffect { // // // private MusicState nextState; // // public Play() { // } // // @Override // public void beginStart() { // nextState.play(); // nextState.setVolume(1); // } // // @Override // public void endStart() { // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/StartEffect.java // public interface StartEffect extends Effect { // public void initialize(MusicState nextState, MusicState previousState); // public void beginStart(); // public void endStart(); // } // // Path: core/src/com/gdx/musicevents/effects/Stop.java // public class Stop implements StopEffect { // private MusicState nextState; // // public Stop() { // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // // @Override // public void beginStop() { // nextState.stop(); // } // // @Override // public void endStop() { // // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // } // // Path: core/src/com/gdx/musicevents/effects/StopEffect.java // public interface StopEffect extends Effect { // // public void initialize(MusicState nextState, MusicState previousState); // public void beginStop(); // // public void endStop(); // } // Path: core/src/com/gdx/musicevents/MusicState.java import com.badlogic.gdx.Gdx; import com.badlogic.gdx.audio.Music; import com.badlogic.gdx.audio.Music.OnCompletionListener; import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.ObjectMap; import com.gdx.musicevents.effects.Effect; import com.gdx.musicevents.effects.Play; import com.gdx.musicevents.effects.StartEffect; import com.gdx.musicevents.effects.Stop; import com.gdx.musicevents.effects.StopEffect; public void onCompletion(Music music) { if (!loopTrack) { if (randomTrack) { currentTrackIndex = MathUtils.random(0, tracks.size - 1); } else { currentTrackIndex = (currentTrackIndex + 1) % tracks.size; } } Track currentTrack = getCurrentTrack(); if(currentTrack != null){ currentTrack.reset(); currentTrack.play(); } } public void init(String basePath) { for(int i = 0; i < getTracks().size; i++){ Track track = getTracks().get(i); track.init(basePath, this); } } public StartEffect enter(MusicState previousState) { StartEffect effect = null; if(previousState != null){ effect = enterTransitions.get(previousState.getName()); } if(effect == null){
effect = new Play();
ollipekka/gdx-soundboard
core/src/com/gdx/musicevents/MusicState.java
// Path: core/src/com/gdx/musicevents/effects/Effect.java // public interface Effect { // public void update(float dt); // public boolean isDone(); // } // // Path: core/src/com/gdx/musicevents/effects/Play.java // public class Play implements StartEffect { // // // private MusicState nextState; // // public Play() { // } // // @Override // public void beginStart() { // nextState.play(); // nextState.setVolume(1); // } // // @Override // public void endStart() { // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/StartEffect.java // public interface StartEffect extends Effect { // public void initialize(MusicState nextState, MusicState previousState); // public void beginStart(); // public void endStart(); // } // // Path: core/src/com/gdx/musicevents/effects/Stop.java // public class Stop implements StopEffect { // private MusicState nextState; // // public Stop() { // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // // @Override // public void beginStop() { // nextState.stop(); // } // // @Override // public void endStop() { // // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // } // // Path: core/src/com/gdx/musicevents/effects/StopEffect.java // public interface StopEffect extends Effect { // // public void initialize(MusicState nextState, MusicState previousState); // public void beginStop(); // // public void endStop(); // }
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.audio.Music; import com.badlogic.gdx.audio.Music.OnCompletionListener; import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.ObjectMap; import com.gdx.musicevents.effects.Effect; import com.gdx.musicevents.effects.Play; import com.gdx.musicevents.effects.StartEffect; import com.gdx.musicevents.effects.Stop; import com.gdx.musicevents.effects.StopEffect;
currentTrack.play(); } } public void init(String basePath) { for(int i = 0; i < getTracks().size; i++){ Track track = getTracks().get(i); track.init(basePath, this); } } public StartEffect enter(MusicState previousState) { StartEffect effect = null; if(previousState != null){ effect = enterTransitions.get(previousState.getName()); } if(effect == null){ effect = new Play(); } effect.initialize(this, previousState); return effect; } public StopEffect exit(MusicState nextState) { StopEffect effect = exitTransitions.get(nextState.getName()); if(effect == null){
// Path: core/src/com/gdx/musicevents/effects/Effect.java // public interface Effect { // public void update(float dt); // public boolean isDone(); // } // // Path: core/src/com/gdx/musicevents/effects/Play.java // public class Play implements StartEffect { // // // private MusicState nextState; // // public Play() { // } // // @Override // public void beginStart() { // nextState.play(); // nextState.setVolume(1); // } // // @Override // public void endStart() { // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/StartEffect.java // public interface StartEffect extends Effect { // public void initialize(MusicState nextState, MusicState previousState); // public void beginStart(); // public void endStart(); // } // // Path: core/src/com/gdx/musicevents/effects/Stop.java // public class Stop implements StopEffect { // private MusicState nextState; // // public Stop() { // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // // @Override // public void beginStop() { // nextState.stop(); // } // // @Override // public void endStop() { // // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // } // // Path: core/src/com/gdx/musicevents/effects/StopEffect.java // public interface StopEffect extends Effect { // // public void initialize(MusicState nextState, MusicState previousState); // public void beginStop(); // // public void endStop(); // } // Path: core/src/com/gdx/musicevents/MusicState.java import com.badlogic.gdx.Gdx; import com.badlogic.gdx.audio.Music; import com.badlogic.gdx.audio.Music.OnCompletionListener; import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.ObjectMap; import com.gdx.musicevents.effects.Effect; import com.gdx.musicevents.effects.Play; import com.gdx.musicevents.effects.StartEffect; import com.gdx.musicevents.effects.Stop; import com.gdx.musicevents.effects.StopEffect; currentTrack.play(); } } public void init(String basePath) { for(int i = 0; i < getTracks().size; i++){ Track track = getTracks().get(i); track.init(basePath, this); } } public StartEffect enter(MusicState previousState) { StartEffect effect = null; if(previousState != null){ effect = enterTransitions.get(previousState.getName()); } if(effect == null){ effect = new Play(); } effect.initialize(this, previousState); return effect; } public StopEffect exit(MusicState nextState) { StopEffect effect = exitTransitions.get(nextState.getName()); if(effect == null){
effect = new Stop();
ollipekka/gdx-soundboard
desktop/src/com/gdx/musicevents/tool/transitions/EffectDecorator.java
// Path: core/src/com/gdx/musicevents/effects/Effect.java // public interface Effect { // public void update(float dt); // public boolean isDone(); // } // // Path: core/src/com/gdx/musicevents/effects/FadeIn.java // public class FadeIn implements StartEffect { // protected transient float originalVolume; // protected final float totalTime; // protected transient float elapsedTime = 0; // protected final float offset; // protected transient float elapsedOffset; // protected transient boolean started = false; // // protected transient MusicState nextState; // protected transient MusicState previousState; // // public FadeIn() { // this(0, 0); // // } // // public FadeIn(float offset, float totalTime) { // this.offset = offset; // this.totalTime = totalTime; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // this.previousState = previousState; // } // // @Override // public void beginStart() { // this.originalVolume = nextState.getVolume(); // this.elapsedTime = 0; // this.elapsedOffset = 0; // nextState.setVolume(0); // nextState.play(); // // started = true; // // } // // @Override // public void update(float dt) { // // if (elapsedOffset < offset) { // elapsedOffset += dt; // } else { // elapsedTime += dt; // // if (isDone()) { // endStart(); // } else { // nextState.setVolume(originalVolume * (elapsedTime) / totalTime); // } // } // } // // @Override // public void endStart() { // Gdx.app.debug("FadeIn", "Stop"); // } // // @Override // public boolean isDone() { // return elapsedTime >= totalTime; // } // // @Override // public String toString() { // return "Fade in " + nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/FadeOut.java // public class FadeOut implements StopEffect { // protected transient float originalVolume; // protected final float totalTime; // protected transient float elapsedTime = 0; // protected final float offset; // protected transient float elapsedOffset; // protected transient boolean started = false; // // protected transient MusicState nextState; // protected transient MusicState previousState; // // public FadeOut() { // this(0, 0); // } // // public FadeOut(float offset, float totalTime) { // this.offset = offset; // this.totalTime = totalTime; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // this.previousState = previousState; // } // @Override // public void beginStop() { // this.originalVolume = nextState.getVolume(); // this.elapsedTime = 0; // this.elapsedOffset = 0; // // started = true; // } // // @Override // public void update(float dt) { // if (elapsedOffset < offset) { // elapsedOffset += dt; // } else { // elapsedTime += dt; // if (isDone()) { // endStop(); // } else { // nextState.setVolume( // originalVolume * (totalTime - elapsedTime) / totalTime); // Gdx.app.debug("FadeOut", "Volume: " + nextState.getVolume()); // } // } // } // // @Override // public void endStop() { // Gdx.app.debug("FadeOut", "Stop " + previousState.toString()); // nextState.setVolume(originalVolume); // nextState.stop(); // } // // @Override // public boolean isDone() { // return elapsedTime >= totalTime; // } // // // @Override // public String toString() { // return "Fading out " + nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/Play.java // public class Play implements StartEffect { // // // private MusicState nextState; // // public Play() { // } // // @Override // public void beginStart() { // nextState.play(); // nextState.setVolume(1); // } // // @Override // public void endStart() { // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/Stop.java // public class Stop implements StopEffect { // private MusicState nextState; // // public Stop() { // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // // @Override // public void beginStop() { // nextState.stop(); // } // // @Override // public void endStop() { // // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // }
import com.gdx.musicevents.effects.Effect; import com.gdx.musicevents.effects.FadeIn; import com.gdx.musicevents.effects.FadeOut; import com.gdx.musicevents.effects.Play; import com.gdx.musicevents.effects.Stop;
package com.gdx.musicevents.tool.transitions; public class EffectDecorator { String name;
// Path: core/src/com/gdx/musicevents/effects/Effect.java // public interface Effect { // public void update(float dt); // public boolean isDone(); // } // // Path: core/src/com/gdx/musicevents/effects/FadeIn.java // public class FadeIn implements StartEffect { // protected transient float originalVolume; // protected final float totalTime; // protected transient float elapsedTime = 0; // protected final float offset; // protected transient float elapsedOffset; // protected transient boolean started = false; // // protected transient MusicState nextState; // protected transient MusicState previousState; // // public FadeIn() { // this(0, 0); // // } // // public FadeIn(float offset, float totalTime) { // this.offset = offset; // this.totalTime = totalTime; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // this.previousState = previousState; // } // // @Override // public void beginStart() { // this.originalVolume = nextState.getVolume(); // this.elapsedTime = 0; // this.elapsedOffset = 0; // nextState.setVolume(0); // nextState.play(); // // started = true; // // } // // @Override // public void update(float dt) { // // if (elapsedOffset < offset) { // elapsedOffset += dt; // } else { // elapsedTime += dt; // // if (isDone()) { // endStart(); // } else { // nextState.setVolume(originalVolume * (elapsedTime) / totalTime); // } // } // } // // @Override // public void endStart() { // Gdx.app.debug("FadeIn", "Stop"); // } // // @Override // public boolean isDone() { // return elapsedTime >= totalTime; // } // // @Override // public String toString() { // return "Fade in " + nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/FadeOut.java // public class FadeOut implements StopEffect { // protected transient float originalVolume; // protected final float totalTime; // protected transient float elapsedTime = 0; // protected final float offset; // protected transient float elapsedOffset; // protected transient boolean started = false; // // protected transient MusicState nextState; // protected transient MusicState previousState; // // public FadeOut() { // this(0, 0); // } // // public FadeOut(float offset, float totalTime) { // this.offset = offset; // this.totalTime = totalTime; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // this.previousState = previousState; // } // @Override // public void beginStop() { // this.originalVolume = nextState.getVolume(); // this.elapsedTime = 0; // this.elapsedOffset = 0; // // started = true; // } // // @Override // public void update(float dt) { // if (elapsedOffset < offset) { // elapsedOffset += dt; // } else { // elapsedTime += dt; // if (isDone()) { // endStop(); // } else { // nextState.setVolume( // originalVolume * (totalTime - elapsedTime) / totalTime); // Gdx.app.debug("FadeOut", "Volume: " + nextState.getVolume()); // } // } // } // // @Override // public void endStop() { // Gdx.app.debug("FadeOut", "Stop " + previousState.toString()); // nextState.setVolume(originalVolume); // nextState.stop(); // } // // @Override // public boolean isDone() { // return elapsedTime >= totalTime; // } // // // @Override // public String toString() { // return "Fading out " + nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/Play.java // public class Play implements StartEffect { // // // private MusicState nextState; // // public Play() { // } // // @Override // public void beginStart() { // nextState.play(); // nextState.setVolume(1); // } // // @Override // public void endStart() { // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/Stop.java // public class Stop implements StopEffect { // private MusicState nextState; // // public Stop() { // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // // @Override // public void beginStop() { // nextState.stop(); // } // // @Override // public void endStop() { // // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // } // Path: desktop/src/com/gdx/musicevents/tool/transitions/EffectDecorator.java import com.gdx.musicevents.effects.Effect; import com.gdx.musicevents.effects.FadeIn; import com.gdx.musicevents.effects.FadeOut; import com.gdx.musicevents.effects.Play; import com.gdx.musicevents.effects.Stop; package com.gdx.musicevents.tool.transitions; public class EffectDecorator { String name;
Effect effect;
ollipekka/gdx-soundboard
desktop/src/com/gdx/musicevents/tool/transitions/EffectDecorator.java
// Path: core/src/com/gdx/musicevents/effects/Effect.java // public interface Effect { // public void update(float dt); // public boolean isDone(); // } // // Path: core/src/com/gdx/musicevents/effects/FadeIn.java // public class FadeIn implements StartEffect { // protected transient float originalVolume; // protected final float totalTime; // protected transient float elapsedTime = 0; // protected final float offset; // protected transient float elapsedOffset; // protected transient boolean started = false; // // protected transient MusicState nextState; // protected transient MusicState previousState; // // public FadeIn() { // this(0, 0); // // } // // public FadeIn(float offset, float totalTime) { // this.offset = offset; // this.totalTime = totalTime; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // this.previousState = previousState; // } // // @Override // public void beginStart() { // this.originalVolume = nextState.getVolume(); // this.elapsedTime = 0; // this.elapsedOffset = 0; // nextState.setVolume(0); // nextState.play(); // // started = true; // // } // // @Override // public void update(float dt) { // // if (elapsedOffset < offset) { // elapsedOffset += dt; // } else { // elapsedTime += dt; // // if (isDone()) { // endStart(); // } else { // nextState.setVolume(originalVolume * (elapsedTime) / totalTime); // } // } // } // // @Override // public void endStart() { // Gdx.app.debug("FadeIn", "Stop"); // } // // @Override // public boolean isDone() { // return elapsedTime >= totalTime; // } // // @Override // public String toString() { // return "Fade in " + nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/FadeOut.java // public class FadeOut implements StopEffect { // protected transient float originalVolume; // protected final float totalTime; // protected transient float elapsedTime = 0; // protected final float offset; // protected transient float elapsedOffset; // protected transient boolean started = false; // // protected transient MusicState nextState; // protected transient MusicState previousState; // // public FadeOut() { // this(0, 0); // } // // public FadeOut(float offset, float totalTime) { // this.offset = offset; // this.totalTime = totalTime; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // this.previousState = previousState; // } // @Override // public void beginStop() { // this.originalVolume = nextState.getVolume(); // this.elapsedTime = 0; // this.elapsedOffset = 0; // // started = true; // } // // @Override // public void update(float dt) { // if (elapsedOffset < offset) { // elapsedOffset += dt; // } else { // elapsedTime += dt; // if (isDone()) { // endStop(); // } else { // nextState.setVolume( // originalVolume * (totalTime - elapsedTime) / totalTime); // Gdx.app.debug("FadeOut", "Volume: " + nextState.getVolume()); // } // } // } // // @Override // public void endStop() { // Gdx.app.debug("FadeOut", "Stop " + previousState.toString()); // nextState.setVolume(originalVolume); // nextState.stop(); // } // // @Override // public boolean isDone() { // return elapsedTime >= totalTime; // } // // // @Override // public String toString() { // return "Fading out " + nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/Play.java // public class Play implements StartEffect { // // // private MusicState nextState; // // public Play() { // } // // @Override // public void beginStart() { // nextState.play(); // nextState.setVolume(1); // } // // @Override // public void endStart() { // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/Stop.java // public class Stop implements StopEffect { // private MusicState nextState; // // public Stop() { // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // // @Override // public void beginStop() { // nextState.stop(); // } // // @Override // public void endStop() { // // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // }
import com.gdx.musicevents.effects.Effect; import com.gdx.musicevents.effects.FadeIn; import com.gdx.musicevents.effects.FadeOut; import com.gdx.musicevents.effects.Play; import com.gdx.musicevents.effects.Stop;
package com.gdx.musicevents.tool.transitions; public class EffectDecorator { String name; Effect effect; public EffectDecorator(String name, Effect effect) { this.name = name; this.effect = effect; } @Override public String toString() { return name + "(" + getEffectName(effect) + ")"; } private String getEffectName(Effect effect){
// Path: core/src/com/gdx/musicevents/effects/Effect.java // public interface Effect { // public void update(float dt); // public boolean isDone(); // } // // Path: core/src/com/gdx/musicevents/effects/FadeIn.java // public class FadeIn implements StartEffect { // protected transient float originalVolume; // protected final float totalTime; // protected transient float elapsedTime = 0; // protected final float offset; // protected transient float elapsedOffset; // protected transient boolean started = false; // // protected transient MusicState nextState; // protected transient MusicState previousState; // // public FadeIn() { // this(0, 0); // // } // // public FadeIn(float offset, float totalTime) { // this.offset = offset; // this.totalTime = totalTime; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // this.previousState = previousState; // } // // @Override // public void beginStart() { // this.originalVolume = nextState.getVolume(); // this.elapsedTime = 0; // this.elapsedOffset = 0; // nextState.setVolume(0); // nextState.play(); // // started = true; // // } // // @Override // public void update(float dt) { // // if (elapsedOffset < offset) { // elapsedOffset += dt; // } else { // elapsedTime += dt; // // if (isDone()) { // endStart(); // } else { // nextState.setVolume(originalVolume * (elapsedTime) / totalTime); // } // } // } // // @Override // public void endStart() { // Gdx.app.debug("FadeIn", "Stop"); // } // // @Override // public boolean isDone() { // return elapsedTime >= totalTime; // } // // @Override // public String toString() { // return "Fade in " + nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/FadeOut.java // public class FadeOut implements StopEffect { // protected transient float originalVolume; // protected final float totalTime; // protected transient float elapsedTime = 0; // protected final float offset; // protected transient float elapsedOffset; // protected transient boolean started = false; // // protected transient MusicState nextState; // protected transient MusicState previousState; // // public FadeOut() { // this(0, 0); // } // // public FadeOut(float offset, float totalTime) { // this.offset = offset; // this.totalTime = totalTime; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // this.previousState = previousState; // } // @Override // public void beginStop() { // this.originalVolume = nextState.getVolume(); // this.elapsedTime = 0; // this.elapsedOffset = 0; // // started = true; // } // // @Override // public void update(float dt) { // if (elapsedOffset < offset) { // elapsedOffset += dt; // } else { // elapsedTime += dt; // if (isDone()) { // endStop(); // } else { // nextState.setVolume( // originalVolume * (totalTime - elapsedTime) / totalTime); // Gdx.app.debug("FadeOut", "Volume: " + nextState.getVolume()); // } // } // } // // @Override // public void endStop() { // Gdx.app.debug("FadeOut", "Stop " + previousState.toString()); // nextState.setVolume(originalVolume); // nextState.stop(); // } // // @Override // public boolean isDone() { // return elapsedTime >= totalTime; // } // // // @Override // public String toString() { // return "Fading out " + nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/Play.java // public class Play implements StartEffect { // // // private MusicState nextState; // // public Play() { // } // // @Override // public void beginStart() { // nextState.play(); // nextState.setVolume(1); // } // // @Override // public void endStart() { // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/Stop.java // public class Stop implements StopEffect { // private MusicState nextState; // // public Stop() { // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // // @Override // public void beginStop() { // nextState.stop(); // } // // @Override // public void endStop() { // // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // } // Path: desktop/src/com/gdx/musicevents/tool/transitions/EffectDecorator.java import com.gdx.musicevents.effects.Effect; import com.gdx.musicevents.effects.FadeIn; import com.gdx.musicevents.effects.FadeOut; import com.gdx.musicevents.effects.Play; import com.gdx.musicevents.effects.Stop; package com.gdx.musicevents.tool.transitions; public class EffectDecorator { String name; Effect effect; public EffectDecorator(String name, Effect effect) { this.name = name; this.effect = effect; } @Override public String toString() { return name + "(" + getEffectName(effect) + ")"; } private String getEffectName(Effect effect){
if(effect instanceof Play){
ollipekka/gdx-soundboard
desktop/src/com/gdx/musicevents/tool/transitions/EffectDecorator.java
// Path: core/src/com/gdx/musicevents/effects/Effect.java // public interface Effect { // public void update(float dt); // public boolean isDone(); // } // // Path: core/src/com/gdx/musicevents/effects/FadeIn.java // public class FadeIn implements StartEffect { // protected transient float originalVolume; // protected final float totalTime; // protected transient float elapsedTime = 0; // protected final float offset; // protected transient float elapsedOffset; // protected transient boolean started = false; // // protected transient MusicState nextState; // protected transient MusicState previousState; // // public FadeIn() { // this(0, 0); // // } // // public FadeIn(float offset, float totalTime) { // this.offset = offset; // this.totalTime = totalTime; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // this.previousState = previousState; // } // // @Override // public void beginStart() { // this.originalVolume = nextState.getVolume(); // this.elapsedTime = 0; // this.elapsedOffset = 0; // nextState.setVolume(0); // nextState.play(); // // started = true; // // } // // @Override // public void update(float dt) { // // if (elapsedOffset < offset) { // elapsedOffset += dt; // } else { // elapsedTime += dt; // // if (isDone()) { // endStart(); // } else { // nextState.setVolume(originalVolume * (elapsedTime) / totalTime); // } // } // } // // @Override // public void endStart() { // Gdx.app.debug("FadeIn", "Stop"); // } // // @Override // public boolean isDone() { // return elapsedTime >= totalTime; // } // // @Override // public String toString() { // return "Fade in " + nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/FadeOut.java // public class FadeOut implements StopEffect { // protected transient float originalVolume; // protected final float totalTime; // protected transient float elapsedTime = 0; // protected final float offset; // protected transient float elapsedOffset; // protected transient boolean started = false; // // protected transient MusicState nextState; // protected transient MusicState previousState; // // public FadeOut() { // this(0, 0); // } // // public FadeOut(float offset, float totalTime) { // this.offset = offset; // this.totalTime = totalTime; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // this.previousState = previousState; // } // @Override // public void beginStop() { // this.originalVolume = nextState.getVolume(); // this.elapsedTime = 0; // this.elapsedOffset = 0; // // started = true; // } // // @Override // public void update(float dt) { // if (elapsedOffset < offset) { // elapsedOffset += dt; // } else { // elapsedTime += dt; // if (isDone()) { // endStop(); // } else { // nextState.setVolume( // originalVolume * (totalTime - elapsedTime) / totalTime); // Gdx.app.debug("FadeOut", "Volume: " + nextState.getVolume()); // } // } // } // // @Override // public void endStop() { // Gdx.app.debug("FadeOut", "Stop " + previousState.toString()); // nextState.setVolume(originalVolume); // nextState.stop(); // } // // @Override // public boolean isDone() { // return elapsedTime >= totalTime; // } // // // @Override // public String toString() { // return "Fading out " + nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/Play.java // public class Play implements StartEffect { // // // private MusicState nextState; // // public Play() { // } // // @Override // public void beginStart() { // nextState.play(); // nextState.setVolume(1); // } // // @Override // public void endStart() { // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/Stop.java // public class Stop implements StopEffect { // private MusicState nextState; // // public Stop() { // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // // @Override // public void beginStop() { // nextState.stop(); // } // // @Override // public void endStop() { // // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // }
import com.gdx.musicevents.effects.Effect; import com.gdx.musicevents.effects.FadeIn; import com.gdx.musicevents.effects.FadeOut; import com.gdx.musicevents.effects.Play; import com.gdx.musicevents.effects.Stop;
package com.gdx.musicevents.tool.transitions; public class EffectDecorator { String name; Effect effect; public EffectDecorator(String name, Effect effect) { this.name = name; this.effect = effect; } @Override public String toString() { return name + "(" + getEffectName(effect) + ")"; } private String getEffectName(Effect effect){ if(effect instanceof Play){ return "Play";
// Path: core/src/com/gdx/musicevents/effects/Effect.java // public interface Effect { // public void update(float dt); // public boolean isDone(); // } // // Path: core/src/com/gdx/musicevents/effects/FadeIn.java // public class FadeIn implements StartEffect { // protected transient float originalVolume; // protected final float totalTime; // protected transient float elapsedTime = 0; // protected final float offset; // protected transient float elapsedOffset; // protected transient boolean started = false; // // protected transient MusicState nextState; // protected transient MusicState previousState; // // public FadeIn() { // this(0, 0); // // } // // public FadeIn(float offset, float totalTime) { // this.offset = offset; // this.totalTime = totalTime; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // this.previousState = previousState; // } // // @Override // public void beginStart() { // this.originalVolume = nextState.getVolume(); // this.elapsedTime = 0; // this.elapsedOffset = 0; // nextState.setVolume(0); // nextState.play(); // // started = true; // // } // // @Override // public void update(float dt) { // // if (elapsedOffset < offset) { // elapsedOffset += dt; // } else { // elapsedTime += dt; // // if (isDone()) { // endStart(); // } else { // nextState.setVolume(originalVolume * (elapsedTime) / totalTime); // } // } // } // // @Override // public void endStart() { // Gdx.app.debug("FadeIn", "Stop"); // } // // @Override // public boolean isDone() { // return elapsedTime >= totalTime; // } // // @Override // public String toString() { // return "Fade in " + nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/FadeOut.java // public class FadeOut implements StopEffect { // protected transient float originalVolume; // protected final float totalTime; // protected transient float elapsedTime = 0; // protected final float offset; // protected transient float elapsedOffset; // protected transient boolean started = false; // // protected transient MusicState nextState; // protected transient MusicState previousState; // // public FadeOut() { // this(0, 0); // } // // public FadeOut(float offset, float totalTime) { // this.offset = offset; // this.totalTime = totalTime; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // this.previousState = previousState; // } // @Override // public void beginStop() { // this.originalVolume = nextState.getVolume(); // this.elapsedTime = 0; // this.elapsedOffset = 0; // // started = true; // } // // @Override // public void update(float dt) { // if (elapsedOffset < offset) { // elapsedOffset += dt; // } else { // elapsedTime += dt; // if (isDone()) { // endStop(); // } else { // nextState.setVolume( // originalVolume * (totalTime - elapsedTime) / totalTime); // Gdx.app.debug("FadeOut", "Volume: " + nextState.getVolume()); // } // } // } // // @Override // public void endStop() { // Gdx.app.debug("FadeOut", "Stop " + previousState.toString()); // nextState.setVolume(originalVolume); // nextState.stop(); // } // // @Override // public boolean isDone() { // return elapsedTime >= totalTime; // } // // // @Override // public String toString() { // return "Fading out " + nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/Play.java // public class Play implements StartEffect { // // // private MusicState nextState; // // public Play() { // } // // @Override // public void beginStart() { // nextState.play(); // nextState.setVolume(1); // } // // @Override // public void endStart() { // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/Stop.java // public class Stop implements StopEffect { // private MusicState nextState; // // public Stop() { // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // // @Override // public void beginStop() { // nextState.stop(); // } // // @Override // public void endStop() { // // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // } // Path: desktop/src/com/gdx/musicevents/tool/transitions/EffectDecorator.java import com.gdx.musicevents.effects.Effect; import com.gdx.musicevents.effects.FadeIn; import com.gdx.musicevents.effects.FadeOut; import com.gdx.musicevents.effects.Play; import com.gdx.musicevents.effects.Stop; package com.gdx.musicevents.tool.transitions; public class EffectDecorator { String name; Effect effect; public EffectDecorator(String name, Effect effect) { this.name = name; this.effect = effect; } @Override public String toString() { return name + "(" + getEffectName(effect) + ")"; } private String getEffectName(Effect effect){ if(effect instanceof Play){ return "Play";
} else if(effect instanceof Stop){
ollipekka/gdx-soundboard
desktop/src/com/gdx/musicevents/tool/transitions/EffectDecorator.java
// Path: core/src/com/gdx/musicevents/effects/Effect.java // public interface Effect { // public void update(float dt); // public boolean isDone(); // } // // Path: core/src/com/gdx/musicevents/effects/FadeIn.java // public class FadeIn implements StartEffect { // protected transient float originalVolume; // protected final float totalTime; // protected transient float elapsedTime = 0; // protected final float offset; // protected transient float elapsedOffset; // protected transient boolean started = false; // // protected transient MusicState nextState; // protected transient MusicState previousState; // // public FadeIn() { // this(0, 0); // // } // // public FadeIn(float offset, float totalTime) { // this.offset = offset; // this.totalTime = totalTime; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // this.previousState = previousState; // } // // @Override // public void beginStart() { // this.originalVolume = nextState.getVolume(); // this.elapsedTime = 0; // this.elapsedOffset = 0; // nextState.setVolume(0); // nextState.play(); // // started = true; // // } // // @Override // public void update(float dt) { // // if (elapsedOffset < offset) { // elapsedOffset += dt; // } else { // elapsedTime += dt; // // if (isDone()) { // endStart(); // } else { // nextState.setVolume(originalVolume * (elapsedTime) / totalTime); // } // } // } // // @Override // public void endStart() { // Gdx.app.debug("FadeIn", "Stop"); // } // // @Override // public boolean isDone() { // return elapsedTime >= totalTime; // } // // @Override // public String toString() { // return "Fade in " + nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/FadeOut.java // public class FadeOut implements StopEffect { // protected transient float originalVolume; // protected final float totalTime; // protected transient float elapsedTime = 0; // protected final float offset; // protected transient float elapsedOffset; // protected transient boolean started = false; // // protected transient MusicState nextState; // protected transient MusicState previousState; // // public FadeOut() { // this(0, 0); // } // // public FadeOut(float offset, float totalTime) { // this.offset = offset; // this.totalTime = totalTime; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // this.previousState = previousState; // } // @Override // public void beginStop() { // this.originalVolume = nextState.getVolume(); // this.elapsedTime = 0; // this.elapsedOffset = 0; // // started = true; // } // // @Override // public void update(float dt) { // if (elapsedOffset < offset) { // elapsedOffset += dt; // } else { // elapsedTime += dt; // if (isDone()) { // endStop(); // } else { // nextState.setVolume( // originalVolume * (totalTime - elapsedTime) / totalTime); // Gdx.app.debug("FadeOut", "Volume: " + nextState.getVolume()); // } // } // } // // @Override // public void endStop() { // Gdx.app.debug("FadeOut", "Stop " + previousState.toString()); // nextState.setVolume(originalVolume); // nextState.stop(); // } // // @Override // public boolean isDone() { // return elapsedTime >= totalTime; // } // // // @Override // public String toString() { // return "Fading out " + nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/Play.java // public class Play implements StartEffect { // // // private MusicState nextState; // // public Play() { // } // // @Override // public void beginStart() { // nextState.play(); // nextState.setVolume(1); // } // // @Override // public void endStart() { // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/Stop.java // public class Stop implements StopEffect { // private MusicState nextState; // // public Stop() { // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // // @Override // public void beginStop() { // nextState.stop(); // } // // @Override // public void endStop() { // // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // }
import com.gdx.musicevents.effects.Effect; import com.gdx.musicevents.effects.FadeIn; import com.gdx.musicevents.effects.FadeOut; import com.gdx.musicevents.effects.Play; import com.gdx.musicevents.effects.Stop;
package com.gdx.musicevents.tool.transitions; public class EffectDecorator { String name; Effect effect; public EffectDecorator(String name, Effect effect) { this.name = name; this.effect = effect; } @Override public String toString() { return name + "(" + getEffectName(effect) + ")"; } private String getEffectName(Effect effect){ if(effect instanceof Play){ return "Play"; } else if(effect instanceof Stop){ return "Stop";
// Path: core/src/com/gdx/musicevents/effects/Effect.java // public interface Effect { // public void update(float dt); // public boolean isDone(); // } // // Path: core/src/com/gdx/musicevents/effects/FadeIn.java // public class FadeIn implements StartEffect { // protected transient float originalVolume; // protected final float totalTime; // protected transient float elapsedTime = 0; // protected final float offset; // protected transient float elapsedOffset; // protected transient boolean started = false; // // protected transient MusicState nextState; // protected transient MusicState previousState; // // public FadeIn() { // this(0, 0); // // } // // public FadeIn(float offset, float totalTime) { // this.offset = offset; // this.totalTime = totalTime; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // this.previousState = previousState; // } // // @Override // public void beginStart() { // this.originalVolume = nextState.getVolume(); // this.elapsedTime = 0; // this.elapsedOffset = 0; // nextState.setVolume(0); // nextState.play(); // // started = true; // // } // // @Override // public void update(float dt) { // // if (elapsedOffset < offset) { // elapsedOffset += dt; // } else { // elapsedTime += dt; // // if (isDone()) { // endStart(); // } else { // nextState.setVolume(originalVolume * (elapsedTime) / totalTime); // } // } // } // // @Override // public void endStart() { // Gdx.app.debug("FadeIn", "Stop"); // } // // @Override // public boolean isDone() { // return elapsedTime >= totalTime; // } // // @Override // public String toString() { // return "Fade in " + nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/FadeOut.java // public class FadeOut implements StopEffect { // protected transient float originalVolume; // protected final float totalTime; // protected transient float elapsedTime = 0; // protected final float offset; // protected transient float elapsedOffset; // protected transient boolean started = false; // // protected transient MusicState nextState; // protected transient MusicState previousState; // // public FadeOut() { // this(0, 0); // } // // public FadeOut(float offset, float totalTime) { // this.offset = offset; // this.totalTime = totalTime; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // this.previousState = previousState; // } // @Override // public void beginStop() { // this.originalVolume = nextState.getVolume(); // this.elapsedTime = 0; // this.elapsedOffset = 0; // // started = true; // } // // @Override // public void update(float dt) { // if (elapsedOffset < offset) { // elapsedOffset += dt; // } else { // elapsedTime += dt; // if (isDone()) { // endStop(); // } else { // nextState.setVolume( // originalVolume * (totalTime - elapsedTime) / totalTime); // Gdx.app.debug("FadeOut", "Volume: " + nextState.getVolume()); // } // } // } // // @Override // public void endStop() { // Gdx.app.debug("FadeOut", "Stop " + previousState.toString()); // nextState.setVolume(originalVolume); // nextState.stop(); // } // // @Override // public boolean isDone() { // return elapsedTime >= totalTime; // } // // // @Override // public String toString() { // return "Fading out " + nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/Play.java // public class Play implements StartEffect { // // // private MusicState nextState; // // public Play() { // } // // @Override // public void beginStart() { // nextState.play(); // nextState.setVolume(1); // } // // @Override // public void endStart() { // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/Stop.java // public class Stop implements StopEffect { // private MusicState nextState; // // public Stop() { // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // // @Override // public void beginStop() { // nextState.stop(); // } // // @Override // public void endStop() { // // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // } // Path: desktop/src/com/gdx/musicevents/tool/transitions/EffectDecorator.java import com.gdx.musicevents.effects.Effect; import com.gdx.musicevents.effects.FadeIn; import com.gdx.musicevents.effects.FadeOut; import com.gdx.musicevents.effects.Play; import com.gdx.musicevents.effects.Stop; package com.gdx.musicevents.tool.transitions; public class EffectDecorator { String name; Effect effect; public EffectDecorator(String name, Effect effect) { this.name = name; this.effect = effect; } @Override public String toString() { return name + "(" + getEffectName(effect) + ")"; } private String getEffectName(Effect effect){ if(effect instanceof Play){ return "Play"; } else if(effect instanceof Stop){ return "Stop";
} else if(effect instanceof FadeOut){
ollipekka/gdx-soundboard
desktop/src/com/gdx/musicevents/tool/transitions/EffectDecorator.java
// Path: core/src/com/gdx/musicevents/effects/Effect.java // public interface Effect { // public void update(float dt); // public boolean isDone(); // } // // Path: core/src/com/gdx/musicevents/effects/FadeIn.java // public class FadeIn implements StartEffect { // protected transient float originalVolume; // protected final float totalTime; // protected transient float elapsedTime = 0; // protected final float offset; // protected transient float elapsedOffset; // protected transient boolean started = false; // // protected transient MusicState nextState; // protected transient MusicState previousState; // // public FadeIn() { // this(0, 0); // // } // // public FadeIn(float offset, float totalTime) { // this.offset = offset; // this.totalTime = totalTime; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // this.previousState = previousState; // } // // @Override // public void beginStart() { // this.originalVolume = nextState.getVolume(); // this.elapsedTime = 0; // this.elapsedOffset = 0; // nextState.setVolume(0); // nextState.play(); // // started = true; // // } // // @Override // public void update(float dt) { // // if (elapsedOffset < offset) { // elapsedOffset += dt; // } else { // elapsedTime += dt; // // if (isDone()) { // endStart(); // } else { // nextState.setVolume(originalVolume * (elapsedTime) / totalTime); // } // } // } // // @Override // public void endStart() { // Gdx.app.debug("FadeIn", "Stop"); // } // // @Override // public boolean isDone() { // return elapsedTime >= totalTime; // } // // @Override // public String toString() { // return "Fade in " + nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/FadeOut.java // public class FadeOut implements StopEffect { // protected transient float originalVolume; // protected final float totalTime; // protected transient float elapsedTime = 0; // protected final float offset; // protected transient float elapsedOffset; // protected transient boolean started = false; // // protected transient MusicState nextState; // protected transient MusicState previousState; // // public FadeOut() { // this(0, 0); // } // // public FadeOut(float offset, float totalTime) { // this.offset = offset; // this.totalTime = totalTime; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // this.previousState = previousState; // } // @Override // public void beginStop() { // this.originalVolume = nextState.getVolume(); // this.elapsedTime = 0; // this.elapsedOffset = 0; // // started = true; // } // // @Override // public void update(float dt) { // if (elapsedOffset < offset) { // elapsedOffset += dt; // } else { // elapsedTime += dt; // if (isDone()) { // endStop(); // } else { // nextState.setVolume( // originalVolume * (totalTime - elapsedTime) / totalTime); // Gdx.app.debug("FadeOut", "Volume: " + nextState.getVolume()); // } // } // } // // @Override // public void endStop() { // Gdx.app.debug("FadeOut", "Stop " + previousState.toString()); // nextState.setVolume(originalVolume); // nextState.stop(); // } // // @Override // public boolean isDone() { // return elapsedTime >= totalTime; // } // // // @Override // public String toString() { // return "Fading out " + nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/Play.java // public class Play implements StartEffect { // // // private MusicState nextState; // // public Play() { // } // // @Override // public void beginStart() { // nextState.play(); // nextState.setVolume(1); // } // // @Override // public void endStart() { // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/Stop.java // public class Stop implements StopEffect { // private MusicState nextState; // // public Stop() { // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // // @Override // public void beginStop() { // nextState.stop(); // } // // @Override // public void endStop() { // // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // }
import com.gdx.musicevents.effects.Effect; import com.gdx.musicevents.effects.FadeIn; import com.gdx.musicevents.effects.FadeOut; import com.gdx.musicevents.effects.Play; import com.gdx.musicevents.effects.Stop;
package com.gdx.musicevents.tool.transitions; public class EffectDecorator { String name; Effect effect; public EffectDecorator(String name, Effect effect) { this.name = name; this.effect = effect; } @Override public String toString() { return name + "(" + getEffectName(effect) + ")"; } private String getEffectName(Effect effect){ if(effect instanceof Play){ return "Play"; } else if(effect instanceof Stop){ return "Stop"; } else if(effect instanceof FadeOut){ return "Fade out";
// Path: core/src/com/gdx/musicevents/effects/Effect.java // public interface Effect { // public void update(float dt); // public boolean isDone(); // } // // Path: core/src/com/gdx/musicevents/effects/FadeIn.java // public class FadeIn implements StartEffect { // protected transient float originalVolume; // protected final float totalTime; // protected transient float elapsedTime = 0; // protected final float offset; // protected transient float elapsedOffset; // protected transient boolean started = false; // // protected transient MusicState nextState; // protected transient MusicState previousState; // // public FadeIn() { // this(0, 0); // // } // // public FadeIn(float offset, float totalTime) { // this.offset = offset; // this.totalTime = totalTime; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // this.previousState = previousState; // } // // @Override // public void beginStart() { // this.originalVolume = nextState.getVolume(); // this.elapsedTime = 0; // this.elapsedOffset = 0; // nextState.setVolume(0); // nextState.play(); // // started = true; // // } // // @Override // public void update(float dt) { // // if (elapsedOffset < offset) { // elapsedOffset += dt; // } else { // elapsedTime += dt; // // if (isDone()) { // endStart(); // } else { // nextState.setVolume(originalVolume * (elapsedTime) / totalTime); // } // } // } // // @Override // public void endStart() { // Gdx.app.debug("FadeIn", "Stop"); // } // // @Override // public boolean isDone() { // return elapsedTime >= totalTime; // } // // @Override // public String toString() { // return "Fade in " + nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/FadeOut.java // public class FadeOut implements StopEffect { // protected transient float originalVolume; // protected final float totalTime; // protected transient float elapsedTime = 0; // protected final float offset; // protected transient float elapsedOffset; // protected transient boolean started = false; // // protected transient MusicState nextState; // protected transient MusicState previousState; // // public FadeOut() { // this(0, 0); // } // // public FadeOut(float offset, float totalTime) { // this.offset = offset; // this.totalTime = totalTime; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // this.previousState = previousState; // } // @Override // public void beginStop() { // this.originalVolume = nextState.getVolume(); // this.elapsedTime = 0; // this.elapsedOffset = 0; // // started = true; // } // // @Override // public void update(float dt) { // if (elapsedOffset < offset) { // elapsedOffset += dt; // } else { // elapsedTime += dt; // if (isDone()) { // endStop(); // } else { // nextState.setVolume( // originalVolume * (totalTime - elapsedTime) / totalTime); // Gdx.app.debug("FadeOut", "Volume: " + nextState.getVolume()); // } // } // } // // @Override // public void endStop() { // Gdx.app.debug("FadeOut", "Stop " + previousState.toString()); // nextState.setVolume(originalVolume); // nextState.stop(); // } // // @Override // public boolean isDone() { // return elapsedTime >= totalTime; // } // // // @Override // public String toString() { // return "Fading out " + nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/Play.java // public class Play implements StartEffect { // // // private MusicState nextState; // // public Play() { // } // // @Override // public void beginStart() { // nextState.play(); // nextState.setVolume(1); // } // // @Override // public void endStart() { // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // } // // Path: core/src/com/gdx/musicevents/effects/Stop.java // public class Stop implements StopEffect { // private MusicState nextState; // // public Stop() { // } // // @Override // public void initialize(MusicState nextState, MusicState previousState) { // this.nextState = nextState; // } // // @Override // public void beginStop() { // nextState.stop(); // } // // @Override // public void endStop() { // // } // // @Override // public void update(float dt) { // } // // @Override // public boolean isDone() { // return true; // } // } // Path: desktop/src/com/gdx/musicevents/tool/transitions/EffectDecorator.java import com.gdx.musicevents.effects.Effect; import com.gdx.musicevents.effects.FadeIn; import com.gdx.musicevents.effects.FadeOut; import com.gdx.musicevents.effects.Play; import com.gdx.musicevents.effects.Stop; package com.gdx.musicevents.tool.transitions; public class EffectDecorator { String name; Effect effect; public EffectDecorator(String name, Effect effect) { this.name = name; this.effect = effect; } @Override public String toString() { return name + "(" + getEffectName(effect) + ")"; } private String getEffectName(Effect effect){ if(effect instanceof Play){ return "Play"; } else if(effect instanceof Stop){ return "Stop"; } else if(effect instanceof FadeOut){ return "Fade out";
} else if(effect instanceof FadeIn){
adityayadav76/internet_of_things_simulator
AutoSIM-UDP/src/com/automatski/autosim/udp/UDPConnectionFactory.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionFactory.java // public interface IConnectionFactory { // // public IConnection getConnection(); // // } // // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public int ttl; // public String username; // public String password; // // public String connectorClassName; // }
import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionFactory; import com.automatski.autosim.udp.config.AutoSIMConnectionConfig;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.udp; public class UDPConnectionFactory implements IConnectionFactory{ private AutoSIMConnectionConfig connectionConfig = null; public UDPConnectionFactory(AutoSIMConnectionConfig connectionConfig){ this.connectionConfig = connectionConfig; } @Override
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionFactory.java // public interface IConnectionFactory { // // public IConnection getConnection(); // // } // // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public int ttl; // public String username; // public String password; // // public String connectorClassName; // } // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/UDPConnectionFactory.java import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionFactory; import com.automatski.autosim.udp.config.AutoSIMConnectionConfig; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.udp; public class UDPConnectionFactory implements IConnectionFactory{ private AutoSIMConnectionConfig connectionConfig = null; public UDPConnectionFactory(AutoSIMConnectionConfig connectionConfig){ this.connectionConfig = connectionConfig; } @Override
public IConnection getConnection() {
adityayadav76/internet_of_things_simulator
AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/MyMQTTDevice.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // }
import java.util.Random; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class MyMQTTDevice implements IDevice, IConnectionListener { private AutoSIMDeviceConfig config = null;
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // } // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/MyMQTTDevice.java import java.util.Random; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class MyMQTTDevice implements IDevice, IConnectionListener { private AutoSIMDeviceConfig config = null;
private IEnvironments environments = null;
adityayadav76/internet_of_things_simulator
AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/MyMQTTDevice.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // }
import java.util.Random; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class MyMQTTDevice implements IDevice, IConnectionListener { private AutoSIMDeviceConfig config = null; private IEnvironments environments = null;
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // } // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/MyMQTTDevice.java import java.util.Random; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class MyMQTTDevice implements IDevice, IConnectionListener { private AutoSIMDeviceConfig config = null; private IEnvironments environments = null;
private IConnection connection = null;
adityayadav76/internet_of_things_simulator
AutoSIM-CoAP/src/com/automatski/autosim/coap/CoAPConnectionFactory.java
// Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionFactory.java // public interface IConnectionFactory { // // public IConnection getConnection(); // // }
import com.automatski.autosim.coap.config.AutoSIMConnectionConfig; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionFactory;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.coap; public class CoAPConnectionFactory implements IConnectionFactory{ private AutoSIMConnectionConfig connectionConfig = null; public CoAPConnectionFactory(AutoSIMConnectionConfig connectionConfig){ this.connectionConfig = connectionConfig; } @Override
// Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionFactory.java // public interface IConnectionFactory { // // public IConnection getConnection(); // // } // Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/CoAPConnectionFactory.java import com.automatski.autosim.coap.config.AutoSIMConnectionConfig; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionFactory; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.coap; public class CoAPConnectionFactory implements IConnectionFactory{ private AutoSIMConnectionConfig connectionConfig = null; public CoAPConnectionFactory(AutoSIMConnectionConfig connectionConfig){ this.connectionConfig = connectionConfig; } @Override
public IConnection getConnection() {
adityayadav76/internet_of_things_simulator
AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/SmartM2MServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/config/AutoSIMSmartM2MConfig.java // public class AutoSIMSmartM2MConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.smartm2m.config.AutoSIMSmartM2MConfig; import com.automatski.autosim.smartm2m.config.AutoSIMConnectionConfig; import com.automatski.autosim.smartm2m.utils.GsonUtils;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.smartm2m; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class SmartM2MServiceActivator implements BundleActivator {
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/config/AutoSIMSmartM2MConfig.java // public class AutoSIMSmartM2MConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/SmartM2MServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.smartm2m.config.AutoSIMSmartM2MConfig; import com.automatski.autosim.smartm2m.config.AutoSIMConnectionConfig; import com.automatski.autosim.smartm2m.utils.GsonUtils; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.smartm2m; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class SmartM2MServiceActivator implements BundleActivator {
private IEnvironments environments = null;
adityayadav76/internet_of_things_simulator
AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/SmartM2MServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/config/AutoSIMSmartM2MConfig.java // public class AutoSIMSmartM2MConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.smartm2m.config.AutoSIMSmartM2MConfig; import com.automatski.autosim.smartm2m.config.AutoSIMConnectionConfig; import com.automatski.autosim.smartm2m.utils.GsonUtils;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.smartm2m; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class SmartM2MServiceActivator implements BundleActivator { private IEnvironments environments = null;
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/config/AutoSIMSmartM2MConfig.java // public class AutoSIMSmartM2MConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/SmartM2MServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.smartm2m.config.AutoSIMSmartM2MConfig; import com.automatski.autosim.smartm2m.config.AutoSIMConnectionConfig; import com.automatski.autosim.smartm2m.utils.GsonUtils; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.smartm2m; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class SmartM2MServiceActivator implements BundleActivator { private IEnvironments environments = null;
private AutoSIMSmartM2MConfig config = null;
adityayadav76/internet_of_things_simulator
AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/SmartM2MServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/config/AutoSIMSmartM2MConfig.java // public class AutoSIMSmartM2MConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.smartm2m.config.AutoSIMSmartM2MConfig; import com.automatski.autosim.smartm2m.config.AutoSIMConnectionConfig; import com.automatski.autosim.smartm2m.utils.GsonUtils;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.smartm2m; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class SmartM2MServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMSmartM2MConfig config = null; private HashMap<String,SmartM2MConnectionFactory> factories = new HashMap<String,SmartM2MConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/config/AutoSIMSmartM2MConfig.java // public class AutoSIMSmartM2MConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/SmartM2MServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.smartm2m.config.AutoSIMSmartM2MConfig; import com.automatski.autosim.smartm2m.config.AutoSIMConnectionConfig; import com.automatski.autosim.smartm2m.utils.GsonUtils; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.smartm2m; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class SmartM2MServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMSmartM2MConfig config = null; private HashMap<String,SmartM2MConnectionFactory> factories = new HashMap<String,SmartM2MConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config
config = (AutoSIMSmartM2MConfig) GsonUtils.jsonToObject("./conf/autosim-smartm2m.json", AutoSIMSmartM2MConfig.class);
adityayadav76/internet_of_things_simulator
AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/SmartM2MServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/config/AutoSIMSmartM2MConfig.java // public class AutoSIMSmartM2MConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.smartm2m.config.AutoSIMSmartM2MConfig; import com.automatski.autosim.smartm2m.config.AutoSIMConnectionConfig; import com.automatski.autosim.smartm2m.utils.GsonUtils;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.smartm2m; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class SmartM2MServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMSmartM2MConfig config = null; private HashMap<String,SmartM2MConnectionFactory> factories = new HashMap<String,SmartM2MConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config config = (AutoSIMSmartM2MConfig) GsonUtils.jsonToObject("./conf/autosim-smartm2m.json", AutoSIMSmartM2MConfig.class); ServiceReference[] refs = context.getServiceReferences(IEnvironments.class.getName(), "(Language=*)"); environments = (IEnvironments) context.getService(refs[0]);
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/config/AutoSIMSmartM2MConfig.java // public class AutoSIMSmartM2MConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/SmartM2MServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.smartm2m.config.AutoSIMSmartM2MConfig; import com.automatski.autosim.smartm2m.config.AutoSIMConnectionConfig; import com.automatski.autosim.smartm2m.utils.GsonUtils; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.smartm2m; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class SmartM2MServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMSmartM2MConfig config = null; private HashMap<String,SmartM2MConnectionFactory> factories = new HashMap<String,SmartM2MConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config config = (AutoSIMSmartM2MConfig) GsonUtils.jsonToObject("./conf/autosim-smartm2m.json", AutoSIMSmartM2MConfig.class); ServiceReference[] refs = context.getServiceReferences(IEnvironments.class.getName(), "(Language=*)"); environments = (IEnvironments) context.getService(refs[0]);
for (AutoSIMConnectionConfig connectionConfig : config.connections){
adityayadav76/internet_of_things_simulator
AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/SampleDevicesServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDevicesConfig.java // public class AutoSIMDevicesConfig { // // public List<AutoSIMDeviceConfig> devices = new ArrayList<AutoSIMDeviceConfig>(); // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig; import com.automatski.autosim.sampledevices.config.AutoSIMDevicesConfig; import com.automatski.autosim.sampledevices.utils.GsonUtils;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class SampleDevicesServiceActivator implements BundleActivator {
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDevicesConfig.java // public class AutoSIMDevicesConfig { // // public List<AutoSIMDeviceConfig> devices = new ArrayList<AutoSIMDeviceConfig>(); // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/SampleDevicesServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig; import com.automatski.autosim.sampledevices.config.AutoSIMDevicesConfig; import com.automatski.autosim.sampledevices.utils.GsonUtils; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class SampleDevicesServiceActivator implements BundleActivator {
private IEnvironments environments = null;
adityayadav76/internet_of_things_simulator
AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/SampleDevicesServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDevicesConfig.java // public class AutoSIMDevicesConfig { // // public List<AutoSIMDeviceConfig> devices = new ArrayList<AutoSIMDeviceConfig>(); // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig; import com.automatski.autosim.sampledevices.config.AutoSIMDevicesConfig; import com.automatski.autosim.sampledevices.utils.GsonUtils;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class SampleDevicesServiceActivator implements BundleActivator { private IEnvironments environments = null;
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDevicesConfig.java // public class AutoSIMDevicesConfig { // // public List<AutoSIMDeviceConfig> devices = new ArrayList<AutoSIMDeviceConfig>(); // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/SampleDevicesServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig; import com.automatski.autosim.sampledevices.config.AutoSIMDevicesConfig; import com.automatski.autosim.sampledevices.utils.GsonUtils; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class SampleDevicesServiceActivator implements BundleActivator { private IEnvironments environments = null;
private AutoSIMDevicesConfig config = null;
adityayadav76/internet_of_things_simulator
AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/SampleDevicesServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDevicesConfig.java // public class AutoSIMDevicesConfig { // // public List<AutoSIMDeviceConfig> devices = new ArrayList<AutoSIMDeviceConfig>(); // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig; import com.automatski.autosim.sampledevices.config.AutoSIMDevicesConfig; import com.automatski.autosim.sampledevices.utils.GsonUtils;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class SampleDevicesServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMDevicesConfig config = null; private HashMap<String,DevicesConnectionFactory> factories = new HashMap<String,DevicesConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDevicesConfig.java // public class AutoSIMDevicesConfig { // // public List<AutoSIMDeviceConfig> devices = new ArrayList<AutoSIMDeviceConfig>(); // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/SampleDevicesServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig; import com.automatski.autosim.sampledevices.config.AutoSIMDevicesConfig; import com.automatski.autosim.sampledevices.utils.GsonUtils; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class SampleDevicesServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMDevicesConfig config = null; private HashMap<String,DevicesConnectionFactory> factories = new HashMap<String,DevicesConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config
config = (AutoSIMDevicesConfig) GsonUtils.jsonToObject("./conf/autosim-sampledevices.json", AutoSIMDevicesConfig.class);
adityayadav76/internet_of_things_simulator
AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/SampleDevicesServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDevicesConfig.java // public class AutoSIMDevicesConfig { // // public List<AutoSIMDeviceConfig> devices = new ArrayList<AutoSIMDeviceConfig>(); // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig; import com.automatski.autosim.sampledevices.config.AutoSIMDevicesConfig; import com.automatski.autosim.sampledevices.utils.GsonUtils;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class SampleDevicesServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMDevicesConfig config = null; private HashMap<String,DevicesConnectionFactory> factories = new HashMap<String,DevicesConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config config = (AutoSIMDevicesConfig) GsonUtils.jsonToObject("./conf/autosim-sampledevices.json", AutoSIMDevicesConfig.class); ServiceReference[] refs = context.getServiceReferences(IEnvironments.class.getName(), "(Language=*)"); environments = (IEnvironments) context.getService(refs[0]);
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDevicesConfig.java // public class AutoSIMDevicesConfig { // // public List<AutoSIMDeviceConfig> devices = new ArrayList<AutoSIMDeviceConfig>(); // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/SampleDevicesServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig; import com.automatski.autosim.sampledevices.config.AutoSIMDevicesConfig; import com.automatski.autosim.sampledevices.utils.GsonUtils; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class SampleDevicesServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMDevicesConfig config = null; private HashMap<String,DevicesConnectionFactory> factories = new HashMap<String,DevicesConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config config = (AutoSIMDevicesConfig) GsonUtils.jsonToObject("./conf/autosim-sampledevices.json", AutoSIMDevicesConfig.class); ServiceReference[] refs = context.getServiceReferences(IEnvironments.class.getName(), "(Language=*)"); environments = (IEnvironments) context.getService(refs[0]);
for (AutoSIMDeviceConfig deviceConfig : config.devices){
adityayadav76/internet_of_things_simulator
AutoSIM-MQTT/src/com/automatski/autosim/mqtt/SampleMQTTConnection.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // }
import java.util.UUID; import org.eclipse.paho.client.mqttv3.MqttClient; import org.eclipse.paho.client.mqttv3.MqttConnectOptions; import org.eclipse.paho.client.mqttv3.MqttMessage; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.mqtt.config.AutoSIMConnectionConfig;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.mqtt; public class SampleMQTTConnection implements IConnection { private AutoSIMConnectionConfig config = null;
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/SampleMQTTConnection.java import java.util.UUID; import org.eclipse.paho.client.mqttv3.MqttClient; import org.eclipse.paho.client.mqttv3.MqttConnectOptions; import org.eclipse.paho.client.mqttv3.MqttMessage; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.mqtt.config.AutoSIMConnectionConfig; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.mqtt; public class SampleMQTTConnection implements IConnection { private AutoSIMConnectionConfig config = null;
private IConnectionListener listener = null;
adityayadav76/internet_of_things_simulator
AutoSIM-API/src/com/automatski/autosim/api/Environments.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // }
import com.automatski.autosim.environments.IEnvironments;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.api; public class Environments { private static Environments instance;
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // Path: AutoSIM-API/src/com/automatski/autosim/api/Environments.java import com.automatski.autosim.environments.IEnvironments; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.api; public class Environments { private static Environments instance;
private IEnvironments environments = null;
adityayadav76/internet_of_things_simulator
AutoSIM-Rest/src/com/automatski/autosim/rest/RestConnectionFactory.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionFactory.java // public interface IConnectionFactory { // // public IConnection getConnection(); // // } // // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // }
import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionFactory; import com.automatski.autosim.rest.config.AutoSIMConnectionConfig;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.rest; public class RestConnectionFactory implements IConnectionFactory{ private AutoSIMConnectionConfig connectionConfig = null; public RestConnectionFactory(AutoSIMConnectionConfig connectionConfig){ this.connectionConfig = connectionConfig; } @Override
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionFactory.java // public interface IConnectionFactory { // // public IConnection getConnection(); // // } // // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/RestConnectionFactory.java import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionFactory; import com.automatski.autosim.rest.config.AutoSIMConnectionConfig; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.rest; public class RestConnectionFactory implements IConnectionFactory{ private AutoSIMConnectionConfig connectionConfig = null; public RestConnectionFactory(AutoSIMConnectionConfig connectionConfig){ this.connectionConfig = connectionConfig; } @Override
public IConnection getConnection() {
adityayadav76/internet_of_things_simulator
AutoSIM-API/src/com/automatski/autosim/api/APIServiceActivator.java
// Path: AutoSIM-API/src/com/automatski/autosim/api/config/AutoSIMAPIConfig.java // public class AutoSIMAPIConfig { // // public AutoSIMAPIServerConfig server; // // } // // Path: AutoSIM-API/src/com/automatski/autosim/api/config/AutoSIMAPIServerAccessAndSecretKeys.java // public class AutoSIMAPIServerAccessAndSecretKeys { // public String accessKey; // public String secretKey; // } // // Path: AutoSIM-API/src/com/automatski/autosim/api/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // }
import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import org.restlet.Component; import org.restlet.data.Protocol; import com.automatski.autosim.api.config.AutoSIMAPIConfig; import com.automatski.autosim.api.config.AutoSIMAPIServerAccessAndSecretKeys; import com.automatski.autosim.api.utils.GsonUtils; import com.automatski.autosim.environments.IEnvironments;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.api; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ //https://chamibuddhika.wordpress.com/2011/10/02/apache-thrift-quickstart-tutorial/ public class APIServiceActivator implements BundleActivator { /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config
// Path: AutoSIM-API/src/com/automatski/autosim/api/config/AutoSIMAPIConfig.java // public class AutoSIMAPIConfig { // // public AutoSIMAPIServerConfig server; // // } // // Path: AutoSIM-API/src/com/automatski/autosim/api/config/AutoSIMAPIServerAccessAndSecretKeys.java // public class AutoSIMAPIServerAccessAndSecretKeys { // public String accessKey; // public String secretKey; // } // // Path: AutoSIM-API/src/com/automatski/autosim/api/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // Path: AutoSIM-API/src/com/automatski/autosim/api/APIServiceActivator.java import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import org.restlet.Component; import org.restlet.data.Protocol; import com.automatski.autosim.api.config.AutoSIMAPIConfig; import com.automatski.autosim.api.config.AutoSIMAPIServerAccessAndSecretKeys; import com.automatski.autosim.api.utils.GsonUtils; import com.automatski.autosim.environments.IEnvironments; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.api; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ //https://chamibuddhika.wordpress.com/2011/10/02/apache-thrift-quickstart-tutorial/ public class APIServiceActivator implements BundleActivator { /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config
final AutoSIMAPIConfig config = (AutoSIMAPIConfig) GsonUtils.jsonToObject("./conf/autosim-api.json", AutoSIMAPIConfig.class);
adityayadav76/internet_of_things_simulator
AutoSIM-API/src/com/automatski/autosim/api/APIServiceActivator.java
// Path: AutoSIM-API/src/com/automatski/autosim/api/config/AutoSIMAPIConfig.java // public class AutoSIMAPIConfig { // // public AutoSIMAPIServerConfig server; // // } // // Path: AutoSIM-API/src/com/automatski/autosim/api/config/AutoSIMAPIServerAccessAndSecretKeys.java // public class AutoSIMAPIServerAccessAndSecretKeys { // public String accessKey; // public String secretKey; // } // // Path: AutoSIM-API/src/com/automatski/autosim/api/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // }
import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import org.restlet.Component; import org.restlet.data.Protocol; import com.automatski.autosim.api.config.AutoSIMAPIConfig; import com.automatski.autosim.api.config.AutoSIMAPIServerAccessAndSecretKeys; import com.automatski.autosim.api.utils.GsonUtils; import com.automatski.autosim.environments.IEnvironments;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.api; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ //https://chamibuddhika.wordpress.com/2011/10/02/apache-thrift-quickstart-tutorial/ public class APIServiceActivator implements BundleActivator { /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config
// Path: AutoSIM-API/src/com/automatski/autosim/api/config/AutoSIMAPIConfig.java // public class AutoSIMAPIConfig { // // public AutoSIMAPIServerConfig server; // // } // // Path: AutoSIM-API/src/com/automatski/autosim/api/config/AutoSIMAPIServerAccessAndSecretKeys.java // public class AutoSIMAPIServerAccessAndSecretKeys { // public String accessKey; // public String secretKey; // } // // Path: AutoSIM-API/src/com/automatski/autosim/api/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // Path: AutoSIM-API/src/com/automatski/autosim/api/APIServiceActivator.java import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import org.restlet.Component; import org.restlet.data.Protocol; import com.automatski.autosim.api.config.AutoSIMAPIConfig; import com.automatski.autosim.api.config.AutoSIMAPIServerAccessAndSecretKeys; import com.automatski.autosim.api.utils.GsonUtils; import com.automatski.autosim.environments.IEnvironments; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.api; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ //https://chamibuddhika.wordpress.com/2011/10/02/apache-thrift-quickstart-tutorial/ public class APIServiceActivator implements BundleActivator { /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config
final AutoSIMAPIConfig config = (AutoSIMAPIConfig) GsonUtils.jsonToObject("./conf/autosim-api.json", AutoSIMAPIConfig.class);
adityayadav76/internet_of_things_simulator
AutoSIM-API/src/com/automatski/autosim/api/APIServiceActivator.java
// Path: AutoSIM-API/src/com/automatski/autosim/api/config/AutoSIMAPIConfig.java // public class AutoSIMAPIConfig { // // public AutoSIMAPIServerConfig server; // // } // // Path: AutoSIM-API/src/com/automatski/autosim/api/config/AutoSIMAPIServerAccessAndSecretKeys.java // public class AutoSIMAPIServerAccessAndSecretKeys { // public String accessKey; // public String secretKey; // } // // Path: AutoSIM-API/src/com/automatski/autosim/api/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // }
import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import org.restlet.Component; import org.restlet.data.Protocol; import com.automatski.autosim.api.config.AutoSIMAPIConfig; import com.automatski.autosim.api.config.AutoSIMAPIServerAccessAndSecretKeys; import com.automatski.autosim.api.utils.GsonUtils; import com.automatski.autosim.environments.IEnvironments;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.api; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ //https://chamibuddhika.wordpress.com/2011/10/02/apache-thrift-quickstart-tutorial/ public class APIServiceActivator implements BundleActivator { /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config final AutoSIMAPIConfig config = (AutoSIMAPIConfig) GsonUtils.jsonToObject("./conf/autosim-api.json", AutoSIMAPIConfig.class);
// Path: AutoSIM-API/src/com/automatski/autosim/api/config/AutoSIMAPIConfig.java // public class AutoSIMAPIConfig { // // public AutoSIMAPIServerConfig server; // // } // // Path: AutoSIM-API/src/com/automatski/autosim/api/config/AutoSIMAPIServerAccessAndSecretKeys.java // public class AutoSIMAPIServerAccessAndSecretKeys { // public String accessKey; // public String secretKey; // } // // Path: AutoSIM-API/src/com/automatski/autosim/api/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // Path: AutoSIM-API/src/com/automatski/autosim/api/APIServiceActivator.java import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import org.restlet.Component; import org.restlet.data.Protocol; import com.automatski.autosim.api.config.AutoSIMAPIConfig; import com.automatski.autosim.api.config.AutoSIMAPIServerAccessAndSecretKeys; import com.automatski.autosim.api.utils.GsonUtils; import com.automatski.autosim.environments.IEnvironments; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.api; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ //https://chamibuddhika.wordpress.com/2011/10/02/apache-thrift-quickstart-tutorial/ public class APIServiceActivator implements BundleActivator { /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config final AutoSIMAPIConfig config = (AutoSIMAPIConfig) GsonUtils.jsonToObject("./conf/autosim-api.json", AutoSIMAPIConfig.class);
for (AutoSIMAPIServerAccessAndSecretKeys keys: config.server.access){
adityayadav76/internet_of_things_simulator
AutoSIM-API/src/com/automatski/autosim/api/APIServiceActivator.java
// Path: AutoSIM-API/src/com/automatski/autosim/api/config/AutoSIMAPIConfig.java // public class AutoSIMAPIConfig { // // public AutoSIMAPIServerConfig server; // // } // // Path: AutoSIM-API/src/com/automatski/autosim/api/config/AutoSIMAPIServerAccessAndSecretKeys.java // public class AutoSIMAPIServerAccessAndSecretKeys { // public String accessKey; // public String secretKey; // } // // Path: AutoSIM-API/src/com/automatski/autosim/api/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // }
import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import org.restlet.Component; import org.restlet.data.Protocol; import com.automatski.autosim.api.config.AutoSIMAPIConfig; import com.automatski.autosim.api.config.AutoSIMAPIServerAccessAndSecretKeys; import com.automatski.autosim.api.utils.GsonUtils; import com.automatski.autosim.environments.IEnvironments;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.api; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ //https://chamibuddhika.wordpress.com/2011/10/02/apache-thrift-quickstart-tutorial/ public class APIServiceActivator implements BundleActivator { /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config final AutoSIMAPIConfig config = (AutoSIMAPIConfig) GsonUtils.jsonToObject("./conf/autosim-api.json", AutoSIMAPIConfig.class); for (AutoSIMAPIServerAccessAndSecretKeys keys: config.server.access){ Authenticator.getInstance().addKeyAndSecret(keys.accessKey, keys.secretKey); }
// Path: AutoSIM-API/src/com/automatski/autosim/api/config/AutoSIMAPIConfig.java // public class AutoSIMAPIConfig { // // public AutoSIMAPIServerConfig server; // // } // // Path: AutoSIM-API/src/com/automatski/autosim/api/config/AutoSIMAPIServerAccessAndSecretKeys.java // public class AutoSIMAPIServerAccessAndSecretKeys { // public String accessKey; // public String secretKey; // } // // Path: AutoSIM-API/src/com/automatski/autosim/api/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // Path: AutoSIM-API/src/com/automatski/autosim/api/APIServiceActivator.java import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import org.restlet.Component; import org.restlet.data.Protocol; import com.automatski.autosim.api.config.AutoSIMAPIConfig; import com.automatski.autosim.api.config.AutoSIMAPIServerAccessAndSecretKeys; import com.automatski.autosim.api.utils.GsonUtils; import com.automatski.autosim.environments.IEnvironments; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.api; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ //https://chamibuddhika.wordpress.com/2011/10/02/apache-thrift-quickstart-tutorial/ public class APIServiceActivator implements BundleActivator { /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config final AutoSIMAPIConfig config = (AutoSIMAPIConfig) GsonUtils.jsonToObject("./conf/autosim-api.json", AutoSIMAPIConfig.class); for (AutoSIMAPIServerAccessAndSecretKeys keys: config.server.access){ Authenticator.getInstance().addKeyAndSecret(keys.accessKey, keys.secretKey); }
ServiceReference[] refs = context.getServiceReferences(IEnvironments.class.getName(), "(Language=*)");
adityayadav76/internet_of_things_simulator
AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/LWM2MConnectionFactory.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionFactory.java // public interface IConnectionFactory { // // public IConnection getConnection(); // // } // // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // }
import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionFactory; import com.automatski.autosim.lwm2m.config.AutoSIMConnectionConfig;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.lwm2m; public class LWM2MConnectionFactory implements IConnectionFactory{ private AutoSIMConnectionConfig connectionConfig = null; public LWM2MConnectionFactory(AutoSIMConnectionConfig connectionConfig){ this.connectionConfig = connectionConfig; } @Override
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionFactory.java // public interface IConnectionFactory { // // public IConnection getConnection(); // // } // // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/LWM2MConnectionFactory.java import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionFactory; import com.automatski.autosim.lwm2m.config.AutoSIMConnectionConfig; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.lwm2m; public class LWM2MConnectionFactory implements IConnectionFactory{ private AutoSIMConnectionConfig connectionConfig = null; public LWM2MConnectionFactory(AutoSIMConnectionConfig connectionConfig){ this.connectionConfig = connectionConfig; } @Override
public IConnection getConnection() {
adityayadav76/internet_of_things_simulator
AutoSIM-AMQP/src/com/automatski/autosim/amqp/AMQPServiceActivator.java
// Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/config/AutoSIMAMQPConfig.java // public class AutoSIMAMQPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.amqp.config.AutoSIMAMQPConfig; import com.automatski.autosim.amqp.config.AutoSIMConnectionConfig; import com.automatski.autosim.amqp.utils.GsonUtils; import com.automatski.autosim.environments.IEnvironments;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.amqp; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class AMQPServiceActivator implements BundleActivator {
// Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/config/AutoSIMAMQPConfig.java // public class AutoSIMAMQPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/AMQPServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.amqp.config.AutoSIMAMQPConfig; import com.automatski.autosim.amqp.config.AutoSIMConnectionConfig; import com.automatski.autosim.amqp.utils.GsonUtils; import com.automatski.autosim.environments.IEnvironments; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.amqp; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class AMQPServiceActivator implements BundleActivator {
private IEnvironments environments = null;
adityayadav76/internet_of_things_simulator
AutoSIM-AMQP/src/com/automatski/autosim/amqp/AMQPServiceActivator.java
// Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/config/AutoSIMAMQPConfig.java // public class AutoSIMAMQPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.amqp.config.AutoSIMAMQPConfig; import com.automatski.autosim.amqp.config.AutoSIMConnectionConfig; import com.automatski.autosim.amqp.utils.GsonUtils; import com.automatski.autosim.environments.IEnvironments;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.amqp; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class AMQPServiceActivator implements BundleActivator { private IEnvironments environments = null;
// Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/config/AutoSIMAMQPConfig.java // public class AutoSIMAMQPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/AMQPServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.amqp.config.AutoSIMAMQPConfig; import com.automatski.autosim.amqp.config.AutoSIMConnectionConfig; import com.automatski.autosim.amqp.utils.GsonUtils; import com.automatski.autosim.environments.IEnvironments; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.amqp; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class AMQPServiceActivator implements BundleActivator { private IEnvironments environments = null;
private AutoSIMAMQPConfig config = null;
adityayadav76/internet_of_things_simulator
AutoSIM-AMQP/src/com/automatski/autosim/amqp/AMQPServiceActivator.java
// Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/config/AutoSIMAMQPConfig.java // public class AutoSIMAMQPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.amqp.config.AutoSIMAMQPConfig; import com.automatski.autosim.amqp.config.AutoSIMConnectionConfig; import com.automatski.autosim.amqp.utils.GsonUtils; import com.automatski.autosim.environments.IEnvironments;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.amqp; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class AMQPServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMAMQPConfig config = null; private HashMap<String,AMQPConnectionFactory> factories = new HashMap<String,AMQPConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config
// Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/config/AutoSIMAMQPConfig.java // public class AutoSIMAMQPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/AMQPServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.amqp.config.AutoSIMAMQPConfig; import com.automatski.autosim.amqp.config.AutoSIMConnectionConfig; import com.automatski.autosim.amqp.utils.GsonUtils; import com.automatski.autosim.environments.IEnvironments; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.amqp; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class AMQPServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMAMQPConfig config = null; private HashMap<String,AMQPConnectionFactory> factories = new HashMap<String,AMQPConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config
config = (AutoSIMAMQPConfig) GsonUtils.jsonToObject("./conf/autosim-amqp.json", AutoSIMAMQPConfig.class);
adityayadav76/internet_of_things_simulator
AutoSIM-AMQP/src/com/automatski/autosim/amqp/AMQPServiceActivator.java
// Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/config/AutoSIMAMQPConfig.java // public class AutoSIMAMQPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.amqp.config.AutoSIMAMQPConfig; import com.automatski.autosim.amqp.config.AutoSIMConnectionConfig; import com.automatski.autosim.amqp.utils.GsonUtils; import com.automatski.autosim.environments.IEnvironments;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.amqp; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class AMQPServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMAMQPConfig config = null; private HashMap<String,AMQPConnectionFactory> factories = new HashMap<String,AMQPConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config config = (AutoSIMAMQPConfig) GsonUtils.jsonToObject("./conf/autosim-amqp.json", AutoSIMAMQPConfig.class); ServiceReference[] refs = context.getServiceReferences(IEnvironments.class.getName(), "(Language=*)"); environments = (IEnvironments) context.getService(refs[0]);
// Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/config/AutoSIMAMQPConfig.java // public class AutoSIMAMQPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/AMQPServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.amqp.config.AutoSIMAMQPConfig; import com.automatski.autosim.amqp.config.AutoSIMConnectionConfig; import com.automatski.autosim.amqp.utils.GsonUtils; import com.automatski.autosim.environments.IEnvironments; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.amqp; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class AMQPServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMAMQPConfig config = null; private HashMap<String,AMQPConnectionFactory> factories = new HashMap<String,AMQPConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config config = (AutoSIMAMQPConfig) GsonUtils.jsonToObject("./conf/autosim-amqp.json", AutoSIMAMQPConfig.class); ServiceReference[] refs = context.getServiceReferences(IEnvironments.class.getName(), "(Language=*)"); environments = (IEnvironments) context.getService(refs[0]);
for (AutoSIMConnectionConfig connectionConfig : config.connections){
adityayadav76/internet_of_things_simulator
AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/SampleLWM2MConnection.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // }
import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.lwm2m.config.AutoSIMConnectionConfig;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.lwm2m; public class SampleLWM2MConnection implements IConnection { private AutoSIMConnectionConfig config = null;
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/SampleLWM2MConnection.java import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.lwm2m.config.AutoSIMConnectionConfig; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.lwm2m; public class SampleLWM2MConnection implements IConnection { private AutoSIMConnectionConfig config = null;
private IConnectionListener listener = null;
adityayadav76/internet_of_things_simulator
AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/DevicesConnectionFactory.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDeviceFactory.java // public interface IDeviceFactory { // // public IDevice getDevice() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // }
import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IDeviceFactory; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class DevicesConnectionFactory implements IDeviceFactory{ private AutoSIMDeviceConfig connectionConfig = null;
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDeviceFactory.java // public interface IDeviceFactory { // // public IDevice getDevice() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // } // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/DevicesConnectionFactory.java import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IDeviceFactory; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class DevicesConnectionFactory implements IDeviceFactory{ private AutoSIMDeviceConfig connectionConfig = null;
private IEnvironments environments = null;
adityayadav76/internet_of_things_simulator
AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/DevicesConnectionFactory.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDeviceFactory.java // public interface IDeviceFactory { // // public IDevice getDevice() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // }
import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IDeviceFactory; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class DevicesConnectionFactory implements IDeviceFactory{ private AutoSIMDeviceConfig connectionConfig = null; private IEnvironments environments = null; public DevicesConnectionFactory(AutoSIMDeviceConfig connectionConfig, IEnvironments environments){ this.connectionConfig = connectionConfig; this.environments = environments; } @Override
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDeviceFactory.java // public interface IDeviceFactory { // // public IDevice getDevice() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // } // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/DevicesConnectionFactory.java import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IDeviceFactory; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class DevicesConnectionFactory implements IDeviceFactory{ private AutoSIMDeviceConfig connectionConfig = null; private IEnvironments environments = null; public DevicesConnectionFactory(AutoSIMDeviceConfig connectionConfig, IEnvironments environments){ this.connectionConfig = connectionConfig; this.environments = environments; } @Override
public IDevice getDevice() throws Exception {
adityayadav76/internet_of_things_simulator
AutoSIM-Rest/src/com/automatski/autosim/rest/SampleRestConnection.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // }
import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.DefaultHttpClient; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.rest.config.AutoSIMConnectionConfig;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.rest; public class SampleRestConnection implements IConnection { private AutoSIMConnectionConfig config = null;
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/SampleRestConnection.java import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.DefaultHttpClient; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.rest.config.AutoSIMConnectionConfig; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.rest; public class SampleRestConnection implements IConnection { private AutoSIMConnectionConfig config = null;
private IConnectionListener listener = null;
adityayadav76/internet_of_things_simulator
AutoSIM-MQTT/src/com/automatski/autosim/mqtt/MQTTServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/config/AutoSIMMQTTConfig.java // public class AutoSIMMQTTConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.mqtt.config.AutoSIMConnectionConfig; import com.automatski.autosim.mqtt.config.AutoSIMMQTTConfig; import com.automatski.autosim.mqtt.utils.GsonUtils;
package com.automatski.autosim.mqtt; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class MQTTServiceActivator implements BundleActivator {
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/config/AutoSIMMQTTConfig.java // public class AutoSIMMQTTConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/MQTTServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.mqtt.config.AutoSIMConnectionConfig; import com.automatski.autosim.mqtt.config.AutoSIMMQTTConfig; import com.automatski.autosim.mqtt.utils.GsonUtils; package com.automatski.autosim.mqtt; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class MQTTServiceActivator implements BundleActivator {
private IEnvironments environments = null;
adityayadav76/internet_of_things_simulator
AutoSIM-MQTT/src/com/automatski/autosim/mqtt/MQTTServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/config/AutoSIMMQTTConfig.java // public class AutoSIMMQTTConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.mqtt.config.AutoSIMConnectionConfig; import com.automatski.autosim.mqtt.config.AutoSIMMQTTConfig; import com.automatski.autosim.mqtt.utils.GsonUtils;
package com.automatski.autosim.mqtt; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class MQTTServiceActivator implements BundleActivator { private IEnvironments environments = null;
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/config/AutoSIMMQTTConfig.java // public class AutoSIMMQTTConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/MQTTServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.mqtt.config.AutoSIMConnectionConfig; import com.automatski.autosim.mqtt.config.AutoSIMMQTTConfig; import com.automatski.autosim.mqtt.utils.GsonUtils; package com.automatski.autosim.mqtt; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class MQTTServiceActivator implements BundleActivator { private IEnvironments environments = null;
private AutoSIMMQTTConfig config = null;
adityayadav76/internet_of_things_simulator
AutoSIM-MQTT/src/com/automatski/autosim/mqtt/MQTTServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/config/AutoSIMMQTTConfig.java // public class AutoSIMMQTTConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.mqtt.config.AutoSIMConnectionConfig; import com.automatski.autosim.mqtt.config.AutoSIMMQTTConfig; import com.automatski.autosim.mqtt.utils.GsonUtils;
package com.automatski.autosim.mqtt; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class MQTTServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMMQTTConfig config = null; private HashMap<String,MQTTConnectionFactory> factories = new HashMap<String,MQTTConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/config/AutoSIMMQTTConfig.java // public class AutoSIMMQTTConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/MQTTServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.mqtt.config.AutoSIMConnectionConfig; import com.automatski.autosim.mqtt.config.AutoSIMMQTTConfig; import com.automatski.autosim.mqtt.utils.GsonUtils; package com.automatski.autosim.mqtt; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class MQTTServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMMQTTConfig config = null; private HashMap<String,MQTTConnectionFactory> factories = new HashMap<String,MQTTConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config
config = (AutoSIMMQTTConfig) GsonUtils.jsonToObject("./conf/autosim-mqtt.json", AutoSIMMQTTConfig.class);
adityayadav76/internet_of_things_simulator
AutoSIM-MQTT/src/com/automatski/autosim/mqtt/MQTTServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/config/AutoSIMMQTTConfig.java // public class AutoSIMMQTTConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.mqtt.config.AutoSIMConnectionConfig; import com.automatski.autosim.mqtt.config.AutoSIMMQTTConfig; import com.automatski.autosim.mqtt.utils.GsonUtils;
package com.automatski.autosim.mqtt; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class MQTTServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMMQTTConfig config = null; private HashMap<String,MQTTConnectionFactory> factories = new HashMap<String,MQTTConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config config = (AutoSIMMQTTConfig) GsonUtils.jsonToObject("./conf/autosim-mqtt.json", AutoSIMMQTTConfig.class); ServiceReference[] refs = context.getServiceReferences(IEnvironments.class.getName(), "(Language=*)"); environments = (IEnvironments) context.getService(refs[0]);
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/config/AutoSIMMQTTConfig.java // public class AutoSIMMQTTConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/MQTTServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.mqtt.config.AutoSIMConnectionConfig; import com.automatski.autosim.mqtt.config.AutoSIMMQTTConfig; import com.automatski.autosim.mqtt.utils.GsonUtils; package com.automatski.autosim.mqtt; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class MQTTServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMMQTTConfig config = null; private HashMap<String,MQTTConnectionFactory> factories = new HashMap<String,MQTTConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config config = (AutoSIMMQTTConfig) GsonUtils.jsonToObject("./conf/autosim-mqtt.json", AutoSIMMQTTConfig.class); ServiceReference[] refs = context.getServiceReferences(IEnvironments.class.getName(), "(Language=*)"); environments = (IEnvironments) context.getService(refs[0]);
for (AutoSIMConnectionConfig connectionConfig : config.connections){
adityayadav76/internet_of_things_simulator
AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/MyAMQPDevice.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // }
import java.util.Random; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class MyAMQPDevice implements IDevice, IConnectionListener { private AutoSIMDeviceConfig config = null;
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // } // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/MyAMQPDevice.java import java.util.Random; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class MyAMQPDevice implements IDevice, IConnectionListener { private AutoSIMDeviceConfig config = null;
private IEnvironments environments = null;
adityayadav76/internet_of_things_simulator
AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/MyAMQPDevice.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // }
import java.util.Random; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class MyAMQPDevice implements IDevice, IConnectionListener { private AutoSIMDeviceConfig config = null; private IEnvironments environments = null;
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // } // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/MyAMQPDevice.java import java.util.Random; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class MyAMQPDevice implements IDevice, IConnectionListener { private AutoSIMDeviceConfig config = null; private IEnvironments environments = null;
private IConnection connection = null;
adityayadav76/internet_of_things_simulator
AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/SampleSmartM2MConnection.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // }
import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.smartm2m.config.AutoSIMConnectionConfig;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.smartm2m; public class SampleSmartM2MConnection implements IConnection { private AutoSIMConnectionConfig config = null;
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/SampleSmartM2MConnection.java import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.smartm2m.config.AutoSIMConnectionConfig; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.smartm2m; public class SampleSmartM2MConnection implements IConnection { private AutoSIMConnectionConfig config = null;
private IConnectionListener listener = null;
adityayadav76/internet_of_things_simulator
AutoSIM-CoAP/src/com/automatski/autosim/coap/CoAPServiceActivator.java
// Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/config/AutoSIMCoAPConfig.java // public class AutoSIMCoAPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.coap.config.AutoSIMConnectionConfig; import com.automatski.autosim.coap.config.AutoSIMCoAPConfig; import com.automatski.autosim.coap.utils.GsonUtils; import com.automatski.autosim.environments.IEnvironments;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.coap; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class CoAPServiceActivator implements BundleActivator {
// Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/config/AutoSIMCoAPConfig.java // public class AutoSIMCoAPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/CoAPServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.coap.config.AutoSIMConnectionConfig; import com.automatski.autosim.coap.config.AutoSIMCoAPConfig; import com.automatski.autosim.coap.utils.GsonUtils; import com.automatski.autosim.environments.IEnvironments; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.coap; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class CoAPServiceActivator implements BundleActivator {
private IEnvironments environments = null;
adityayadav76/internet_of_things_simulator
AutoSIM-CoAP/src/com/automatski/autosim/coap/CoAPServiceActivator.java
// Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/config/AutoSIMCoAPConfig.java // public class AutoSIMCoAPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.coap.config.AutoSIMConnectionConfig; import com.automatski.autosim.coap.config.AutoSIMCoAPConfig; import com.automatski.autosim.coap.utils.GsonUtils; import com.automatski.autosim.environments.IEnvironments;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.coap; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class CoAPServiceActivator implements BundleActivator { private IEnvironments environments = null;
// Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/config/AutoSIMCoAPConfig.java // public class AutoSIMCoAPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/CoAPServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.coap.config.AutoSIMConnectionConfig; import com.automatski.autosim.coap.config.AutoSIMCoAPConfig; import com.automatski.autosim.coap.utils.GsonUtils; import com.automatski.autosim.environments.IEnvironments; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.coap; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class CoAPServiceActivator implements BundleActivator { private IEnvironments environments = null;
private AutoSIMCoAPConfig config = null;
adityayadav76/internet_of_things_simulator
AutoSIM-CoAP/src/com/automatski/autosim/coap/CoAPServiceActivator.java
// Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/config/AutoSIMCoAPConfig.java // public class AutoSIMCoAPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.coap.config.AutoSIMConnectionConfig; import com.automatski.autosim.coap.config.AutoSIMCoAPConfig; import com.automatski.autosim.coap.utils.GsonUtils; import com.automatski.autosim.environments.IEnvironments;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.coap; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class CoAPServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMCoAPConfig config = null; private HashMap<String,CoAPConnectionFactory> factories = new HashMap<String,CoAPConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config
// Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/config/AutoSIMCoAPConfig.java // public class AutoSIMCoAPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/CoAPServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.coap.config.AutoSIMConnectionConfig; import com.automatski.autosim.coap.config.AutoSIMCoAPConfig; import com.automatski.autosim.coap.utils.GsonUtils; import com.automatski.autosim.environments.IEnvironments; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.coap; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class CoAPServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMCoAPConfig config = null; private HashMap<String,CoAPConnectionFactory> factories = new HashMap<String,CoAPConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config
config = (AutoSIMCoAPConfig) GsonUtils.jsonToObject("./conf/autosim-coap.json", AutoSIMCoAPConfig.class);
adityayadav76/internet_of_things_simulator
AutoSIM-CoAP/src/com/automatski/autosim/coap/CoAPServiceActivator.java
// Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/config/AutoSIMCoAPConfig.java // public class AutoSIMCoAPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.coap.config.AutoSIMConnectionConfig; import com.automatski.autosim.coap.config.AutoSIMCoAPConfig; import com.automatski.autosim.coap.utils.GsonUtils; import com.automatski.autosim.environments.IEnvironments;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.coap; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class CoAPServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMCoAPConfig config = null; private HashMap<String,CoAPConnectionFactory> factories = new HashMap<String,CoAPConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config config = (AutoSIMCoAPConfig) GsonUtils.jsonToObject("./conf/autosim-coap.json", AutoSIMCoAPConfig.class); ServiceReference[] refs = context.getServiceReferences(IEnvironments.class.getName(), "(Language=*)"); environments = (IEnvironments) context.getService(refs[0]);
// Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/config/AutoSIMCoAPConfig.java // public class AutoSIMCoAPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/CoAPServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.coap.config.AutoSIMConnectionConfig; import com.automatski.autosim.coap.config.AutoSIMCoAPConfig; import com.automatski.autosim.coap.utils.GsonUtils; import com.automatski.autosim.environments.IEnvironments; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.coap; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class CoAPServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMCoAPConfig config = null; private HashMap<String,CoAPConnectionFactory> factories = new HashMap<String,CoAPConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config config = (AutoSIMCoAPConfig) GsonUtils.jsonToObject("./conf/autosim-coap.json", AutoSIMCoAPConfig.class); ServiceReference[] refs = context.getServiceReferences(IEnvironments.class.getName(), "(Language=*)"); environments = (IEnvironments) context.getService(refs[0]);
for (AutoSIMConnectionConfig connectionConfig : config.connections){
adityayadav76/internet_of_things_simulator
AutoSIM-CoAP/src/com/automatski/autosim/coap/SampleCoAPConnection.java
// Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // }
import java.net.InetAddress; import org.ws4d.coap.connection.BasicCoapChannelManager; import org.ws4d.coap.interfaces.CoapChannelManager; import org.ws4d.coap.interfaces.CoapClient; import org.ws4d.coap.interfaces.CoapClientChannel; import org.ws4d.coap.interfaces.CoapRequest; import org.ws4d.coap.interfaces.CoapResponse; import org.ws4d.coap.messages.CoapRequestCode; import com.automatski.autosim.coap.config.AutoSIMConnectionConfig; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.coap; public class SampleCoAPConnection implements IConnection, CoapClient { private AutoSIMConnectionConfig config = null;
// Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // Path: AutoSIM-CoAP/src/com/automatski/autosim/coap/SampleCoAPConnection.java import java.net.InetAddress; import org.ws4d.coap.connection.BasicCoapChannelManager; import org.ws4d.coap.interfaces.CoapChannelManager; import org.ws4d.coap.interfaces.CoapClient; import org.ws4d.coap.interfaces.CoapClientChannel; import org.ws4d.coap.interfaces.CoapRequest; import org.ws4d.coap.interfaces.CoapResponse; import org.ws4d.coap.messages.CoapRequestCode; import com.automatski.autosim.coap.config.AutoSIMConnectionConfig; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.coap; public class SampleCoAPConnection implements IConnection, CoapClient { private AutoSIMConnectionConfig config = null;
private IConnectionListener listener = null;
adityayadav76/internet_of_things_simulator
AutoSIM-UDP/src/com/automatski/autosim/udp/SampleUDPConnection.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public int ttl; // public String username; // public String password; // // public String connectorClassName; // }
import java.net.DatagramPacket; import java.net.InetAddress; import java.net.MulticastSocket; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.udp.config.AutoSIMConnectionConfig;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.udp; public class SampleUDPConnection implements IConnection { private AutoSIMConnectionConfig config = null;
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public int ttl; // public String username; // public String password; // // public String connectorClassName; // } // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/SampleUDPConnection.java import java.net.DatagramPacket; import java.net.InetAddress; import java.net.MulticastSocket; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.udp.config.AutoSIMConnectionConfig; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.udp; public class SampleUDPConnection implements IConnection { private AutoSIMConnectionConfig config = null;
private IConnectionListener listener = null;
adityayadav76/internet_of_things_simulator
AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/MyUDPDevice.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // }
import java.util.Random; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class MyUDPDevice implements IDevice, IConnectionListener { private AutoSIMDeviceConfig config = null;
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // } // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/MyUDPDevice.java import java.util.Random; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class MyUDPDevice implements IDevice, IConnectionListener { private AutoSIMDeviceConfig config = null;
private IEnvironments environments = null;
adityayadav76/internet_of_things_simulator
AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/MyUDPDevice.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // }
import java.util.Random; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class MyUDPDevice implements IDevice, IConnectionListener { private AutoSIMDeviceConfig config = null; private IEnvironments environments = null;
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // } // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/MyUDPDevice.java import java.util.Random; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class MyUDPDevice implements IDevice, IConnectionListener { private AutoSIMDeviceConfig config = null; private IEnvironments environments = null;
private IConnection connection = null;
adityayadav76/internet_of_things_simulator
AutoSIM-XMPP/src/com/automatski/autosim/xmpp/SampleXMPPConnection.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // public String servicename; // // public String connectorClassName; // }
import org.jivesoftware.smack.AbstractXMPPConnection; import org.jivesoftware.smack.chat.Chat; import org.jivesoftware.smack.chat.ChatManager; import org.jivesoftware.smack.chat.ChatMessageListener; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.tcp.XMPPTCPConnection; import org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.xmpp.config.AutoSIMConnectionConfig;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.xmpp; public class SampleXMPPConnection implements IConnection { private AutoSIMConnectionConfig config = null;
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // public String servicename; // // public String connectorClassName; // } // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/SampleXMPPConnection.java import org.jivesoftware.smack.AbstractXMPPConnection; import org.jivesoftware.smack.chat.Chat; import org.jivesoftware.smack.chat.ChatManager; import org.jivesoftware.smack.chat.ChatMessageListener; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.tcp.XMPPTCPConnection; import org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.xmpp.config.AutoSIMConnectionConfig; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.xmpp; public class SampleXMPPConnection implements IConnection { private AutoSIMConnectionConfig config = null;
private IConnectionListener listener = null;
adityayadav76/internet_of_things_simulator
AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/MyXMPPDevice.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // }
import java.util.Random; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class MyXMPPDevice implements IDevice, IConnectionListener { private AutoSIMDeviceConfig config = null;
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // } // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/MyXMPPDevice.java import java.util.Random; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class MyXMPPDevice implements IDevice, IConnectionListener { private AutoSIMDeviceConfig config = null;
private IEnvironments environments = null;
adityayadav76/internet_of_things_simulator
AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/MyXMPPDevice.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // }
import java.util.Random; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class MyXMPPDevice implements IDevice, IConnectionListener { private AutoSIMDeviceConfig config = null; private IEnvironments environments = null;
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // } // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/MyXMPPDevice.java import java.util.Random; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class MyXMPPDevice implements IDevice, IConnectionListener { private AutoSIMDeviceConfig config = null; private IEnvironments environments = null;
private IConnection connection = null;
adityayadav76/internet_of_things_simulator
AutoSIM-Environments/src/com/automatski/autosim/environments/config/EnvironmentThread.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // }
import java.util.ArrayList; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.environments.config; public class EnvironmentThread{ public String name; public int count; public String device; public int delayInMilliSeconds; public int threads;
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/config/EnvironmentThread.java import java.util.ArrayList; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.environments.config; public class EnvironmentThread{ public String name; public int count; public String device; public int delayInMilliSeconds; public int threads;
private List<IDevice> devices = new ArrayList<IDevice>();
adityayadav76/internet_of_things_simulator
AutoSIM-Environments/src/com/automatski/autosim/environments/config/EnvironmentThread.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // }
import java.util.ArrayList; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.environments.config; public class EnvironmentThread{ public String name; public int count; public String device; public int delayInMilliSeconds; public int threads; private List<IDevice> devices = new ArrayList<IDevice>();
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/config/EnvironmentThread.java import java.util.ArrayList; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.environments.config; public class EnvironmentThread{ public String name; public int count; public String device; public int delayInMilliSeconds; public int threads; private List<IDevice> devices = new ArrayList<IDevice>();
private IEnvironments environments = null;
adityayadav76/internet_of_things_simulator
AutoSIM-AMQP/src/com/automatski/autosim/amqp/AMQPConnectionFactory.java
// Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionFactory.java // public interface IConnectionFactory { // // public IConnection getConnection(); // // }
import com.automatski.autosim.amqp.config.AutoSIMConnectionConfig; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionFactory;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.amqp; public class AMQPConnectionFactory implements IConnectionFactory{ private AutoSIMConnectionConfig connectionConfig = null; public AMQPConnectionFactory(AutoSIMConnectionConfig connectionConfig){ this.connectionConfig = connectionConfig; } @Override
// Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionFactory.java // public interface IConnectionFactory { // // public IConnection getConnection(); // // } // Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/AMQPConnectionFactory.java import com.automatski.autosim.amqp.config.AutoSIMConnectionConfig; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionFactory; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.amqp; public class AMQPConnectionFactory implements IConnectionFactory{ private AutoSIMConnectionConfig connectionConfig = null; public AMQPConnectionFactory(AutoSIMConnectionConfig connectionConfig){ this.connectionConfig = connectionConfig; } @Override
public IConnection getConnection() {
adityayadav76/internet_of_things_simulator
AutoSIM-UDP/src/com/automatski/autosim/udp/UDPServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public int ttl; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/config/AutoSIMUDPConfig.java // public class AutoSIMUDPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.udp.config.AutoSIMConnectionConfig; import com.automatski.autosim.udp.config.AutoSIMUDPConfig; import com.automatski.autosim.udp.utils.GsonUtils;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.udp; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class UDPServiceActivator implements BundleActivator {
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public int ttl; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/config/AutoSIMUDPConfig.java // public class AutoSIMUDPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/UDPServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.udp.config.AutoSIMConnectionConfig; import com.automatski.autosim.udp.config.AutoSIMUDPConfig; import com.automatski.autosim.udp.utils.GsonUtils; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.udp; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class UDPServiceActivator implements BundleActivator {
private IEnvironments environments = null;
adityayadav76/internet_of_things_simulator
AutoSIM-UDP/src/com/automatski/autosim/udp/UDPServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public int ttl; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/config/AutoSIMUDPConfig.java // public class AutoSIMUDPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.udp.config.AutoSIMConnectionConfig; import com.automatski.autosim.udp.config.AutoSIMUDPConfig; import com.automatski.autosim.udp.utils.GsonUtils;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.udp; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class UDPServiceActivator implements BundleActivator { private IEnvironments environments = null;
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public int ttl; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/config/AutoSIMUDPConfig.java // public class AutoSIMUDPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/UDPServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.udp.config.AutoSIMConnectionConfig; import com.automatski.autosim.udp.config.AutoSIMUDPConfig; import com.automatski.autosim.udp.utils.GsonUtils; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.udp; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class UDPServiceActivator implements BundleActivator { private IEnvironments environments = null;
private AutoSIMUDPConfig config = null;
adityayadav76/internet_of_things_simulator
AutoSIM-UDP/src/com/automatski/autosim/udp/UDPServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public int ttl; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/config/AutoSIMUDPConfig.java // public class AutoSIMUDPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.udp.config.AutoSIMConnectionConfig; import com.automatski.autosim.udp.config.AutoSIMUDPConfig; import com.automatski.autosim.udp.utils.GsonUtils;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.udp; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class UDPServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMUDPConfig config = null; private HashMap<String,UDPConnectionFactory> factories = new HashMap<String,UDPConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public int ttl; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/config/AutoSIMUDPConfig.java // public class AutoSIMUDPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/UDPServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.udp.config.AutoSIMConnectionConfig; import com.automatski.autosim.udp.config.AutoSIMUDPConfig; import com.automatski.autosim.udp.utils.GsonUtils; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.udp; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class UDPServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMUDPConfig config = null; private HashMap<String,UDPConnectionFactory> factories = new HashMap<String,UDPConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config
config = (AutoSIMUDPConfig) GsonUtils.jsonToObject("./conf/autosim-udp.json", AutoSIMUDPConfig.class);
adityayadav76/internet_of_things_simulator
AutoSIM-UDP/src/com/automatski/autosim/udp/UDPServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public int ttl; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/config/AutoSIMUDPConfig.java // public class AutoSIMUDPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.udp.config.AutoSIMConnectionConfig; import com.automatski.autosim.udp.config.AutoSIMUDPConfig; import com.automatski.autosim.udp.utils.GsonUtils;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.udp; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class UDPServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMUDPConfig config = null; private HashMap<String,UDPConnectionFactory> factories = new HashMap<String,UDPConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config config = (AutoSIMUDPConfig) GsonUtils.jsonToObject("./conf/autosim-udp.json", AutoSIMUDPConfig.class); ServiceReference[] refs = context.getServiceReferences(IEnvironments.class.getName(), "(Language=*)"); environments = (IEnvironments) context.getService(refs[0]);
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public int ttl; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/config/AutoSIMUDPConfig.java // public class AutoSIMUDPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-UDP/src/com/automatski/autosim/udp/UDPServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.udp.config.AutoSIMConnectionConfig; import com.automatski.autosim.udp.config.AutoSIMUDPConfig; import com.automatski.autosim.udp.utils.GsonUtils; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.udp; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class UDPServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMUDPConfig config = null; private HashMap<String,UDPConnectionFactory> factories = new HashMap<String,UDPConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config config = (AutoSIMUDPConfig) GsonUtils.jsonToObject("./conf/autosim-udp.json", AutoSIMUDPConfig.class); ServiceReference[] refs = context.getServiceReferences(IEnvironments.class.getName(), "(Language=*)"); environments = (IEnvironments) context.getService(refs[0]);
for (AutoSIMConnectionConfig connectionConfig : config.connections){
adityayadav76/internet_of_things_simulator
AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/LWM2MServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/config/AutoSIMMQTTConfig.java // public class AutoSIMMQTTConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.lwm2m.config.AutoSIMConnectionConfig; import com.automatski.autosim.lwm2m.config.AutoSIMMQTTConfig; import com.automatski.autosim.lwm2m.utils.GsonUtils;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.lwm2m; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class LWM2MServiceActivator implements BundleActivator {
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/config/AutoSIMMQTTConfig.java // public class AutoSIMMQTTConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/LWM2MServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.lwm2m.config.AutoSIMConnectionConfig; import com.automatski.autosim.lwm2m.config.AutoSIMMQTTConfig; import com.automatski.autosim.lwm2m.utils.GsonUtils; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.lwm2m; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class LWM2MServiceActivator implements BundleActivator {
private IEnvironments environments = null;
adityayadav76/internet_of_things_simulator
AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/LWM2MServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/config/AutoSIMMQTTConfig.java // public class AutoSIMMQTTConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.lwm2m.config.AutoSIMConnectionConfig; import com.automatski.autosim.lwm2m.config.AutoSIMMQTTConfig; import com.automatski.autosim.lwm2m.utils.GsonUtils;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.lwm2m; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class LWM2MServiceActivator implements BundleActivator { private IEnvironments environments = null;
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/config/AutoSIMMQTTConfig.java // public class AutoSIMMQTTConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/LWM2MServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.lwm2m.config.AutoSIMConnectionConfig; import com.automatski.autosim.lwm2m.config.AutoSIMMQTTConfig; import com.automatski.autosim.lwm2m.utils.GsonUtils; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.lwm2m; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class LWM2MServiceActivator implements BundleActivator { private IEnvironments environments = null;
private AutoSIMMQTTConfig config = null;
adityayadav76/internet_of_things_simulator
AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/LWM2MServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/config/AutoSIMMQTTConfig.java // public class AutoSIMMQTTConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.lwm2m.config.AutoSIMConnectionConfig; import com.automatski.autosim.lwm2m.config.AutoSIMMQTTConfig; import com.automatski.autosim.lwm2m.utils.GsonUtils;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.lwm2m; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class LWM2MServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMMQTTConfig config = null; private HashMap<String,LWM2MConnectionFactory> factories = new HashMap<String,LWM2MConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/config/AutoSIMMQTTConfig.java // public class AutoSIMMQTTConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/LWM2MServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.lwm2m.config.AutoSIMConnectionConfig; import com.automatski.autosim.lwm2m.config.AutoSIMMQTTConfig; import com.automatski.autosim.lwm2m.utils.GsonUtils; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.lwm2m; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class LWM2MServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMMQTTConfig config = null; private HashMap<String,LWM2MConnectionFactory> factories = new HashMap<String,LWM2MConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config
config = (AutoSIMMQTTConfig) GsonUtils.jsonToObject("./conf/autosim-lwm2m.json", AutoSIMMQTTConfig.class);
adityayadav76/internet_of_things_simulator
AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/LWM2MServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/config/AutoSIMMQTTConfig.java // public class AutoSIMMQTTConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.lwm2m.config.AutoSIMConnectionConfig; import com.automatski.autosim.lwm2m.config.AutoSIMMQTTConfig; import com.automatski.autosim.lwm2m.utils.GsonUtils;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.lwm2m; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class LWM2MServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMMQTTConfig config = null; private HashMap<String,LWM2MConnectionFactory> factories = new HashMap<String,LWM2MConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config config = (AutoSIMMQTTConfig) GsonUtils.jsonToObject("./conf/autosim-lwm2m.json", AutoSIMMQTTConfig.class); ServiceReference[] refs = context.getServiceReferences(IEnvironments.class.getName(), "(Language=*)"); environments = (IEnvironments) context.getService(refs[0]);
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/config/AutoSIMMQTTConfig.java // public class AutoSIMMQTTConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-LWM2M/src/com/automatski/autosim/lwm2m/LWM2MServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.lwm2m.config.AutoSIMConnectionConfig; import com.automatski.autosim.lwm2m.config.AutoSIMMQTTConfig; import com.automatski.autosim.lwm2m.utils.GsonUtils; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.lwm2m; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class LWM2MServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMMQTTConfig config = null; private HashMap<String,LWM2MConnectionFactory> factories = new HashMap<String,LWM2MConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config config = (AutoSIMMQTTConfig) GsonUtils.jsonToObject("./conf/autosim-lwm2m.json", AutoSIMMQTTConfig.class); ServiceReference[] refs = context.getServiceReferences(IEnvironments.class.getName(), "(Language=*)"); environments = (IEnvironments) context.getService(refs[0]);
for (AutoSIMConnectionConfig connectionConfig : config.connections){
adityayadav76/internet_of_things_simulator
AutoSIM-XMPP/src/com/automatski/autosim/xmpp/XMPPServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/config/AutoSIMXMPPConfig.java // public class AutoSIMXMPPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // public String servicename; // // public String connectorClassName; // } // // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.xmpp.config.AutoSIMXMPPConfig; import com.automatski.autosim.xmpp.config.AutoSIMConnectionConfig; import com.automatski.autosim.xmpp.utils.GsonUtils;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.xmpp; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class XMPPServiceActivator implements BundleActivator {
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/config/AutoSIMXMPPConfig.java // public class AutoSIMXMPPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // public String servicename; // // public String connectorClassName; // } // // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/XMPPServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.xmpp.config.AutoSIMXMPPConfig; import com.automatski.autosim.xmpp.config.AutoSIMConnectionConfig; import com.automatski.autosim.xmpp.utils.GsonUtils; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.xmpp; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class XMPPServiceActivator implements BundleActivator {
private IEnvironments environments = null;
adityayadav76/internet_of_things_simulator
AutoSIM-XMPP/src/com/automatski/autosim/xmpp/XMPPServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/config/AutoSIMXMPPConfig.java // public class AutoSIMXMPPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // public String servicename; // // public String connectorClassName; // } // // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.xmpp.config.AutoSIMXMPPConfig; import com.automatski.autosim.xmpp.config.AutoSIMConnectionConfig; import com.automatski.autosim.xmpp.utils.GsonUtils;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.xmpp; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class XMPPServiceActivator implements BundleActivator { private IEnvironments environments = null;
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/config/AutoSIMXMPPConfig.java // public class AutoSIMXMPPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // public String servicename; // // public String connectorClassName; // } // // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/XMPPServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.xmpp.config.AutoSIMXMPPConfig; import com.automatski.autosim.xmpp.config.AutoSIMConnectionConfig; import com.automatski.autosim.xmpp.utils.GsonUtils; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.xmpp; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class XMPPServiceActivator implements BundleActivator { private IEnvironments environments = null;
private AutoSIMXMPPConfig config = null;
adityayadav76/internet_of_things_simulator
AutoSIM-XMPP/src/com/automatski/autosim/xmpp/XMPPServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/config/AutoSIMXMPPConfig.java // public class AutoSIMXMPPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // public String servicename; // // public String connectorClassName; // } // // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.xmpp.config.AutoSIMXMPPConfig; import com.automatski.autosim.xmpp.config.AutoSIMConnectionConfig; import com.automatski.autosim.xmpp.utils.GsonUtils;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.xmpp; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class XMPPServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMXMPPConfig config = null; private HashMap<String,XMPPConnectionFactory> factories = new HashMap<String,XMPPConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/config/AutoSIMXMPPConfig.java // public class AutoSIMXMPPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // public String servicename; // // public String connectorClassName; // } // // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/XMPPServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.xmpp.config.AutoSIMXMPPConfig; import com.automatski.autosim.xmpp.config.AutoSIMConnectionConfig; import com.automatski.autosim.xmpp.utils.GsonUtils; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.xmpp; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class XMPPServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMXMPPConfig config = null; private HashMap<String,XMPPConnectionFactory> factories = new HashMap<String,XMPPConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config
config = (AutoSIMXMPPConfig) GsonUtils.jsonToObject("./conf/autosim-xmpp.json", AutoSIMXMPPConfig.class);
adityayadav76/internet_of_things_simulator
AutoSIM-XMPP/src/com/automatski/autosim/xmpp/XMPPServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/config/AutoSIMXMPPConfig.java // public class AutoSIMXMPPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // public String servicename; // // public String connectorClassName; // } // // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.xmpp.config.AutoSIMXMPPConfig; import com.automatski.autosim.xmpp.config.AutoSIMConnectionConfig; import com.automatski.autosim.xmpp.utils.GsonUtils;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.xmpp; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class XMPPServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMXMPPConfig config = null; private HashMap<String,XMPPConnectionFactory> factories = new HashMap<String,XMPPConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config config = (AutoSIMXMPPConfig) GsonUtils.jsonToObject("./conf/autosim-xmpp.json", AutoSIMXMPPConfig.class); ServiceReference[] refs = context.getServiceReferences(IEnvironments.class.getName(), "(Language=*)"); environments = (IEnvironments) context.getService(refs[0]);
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/config/AutoSIMXMPPConfig.java // public class AutoSIMXMPPConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // public String servicename; // // public String connectorClassName; // } // // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/XMPPServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.xmpp.config.AutoSIMXMPPConfig; import com.automatski.autosim.xmpp.config.AutoSIMConnectionConfig; import com.automatski.autosim.xmpp.utils.GsonUtils; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.xmpp; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class XMPPServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMXMPPConfig config = null; private HashMap<String,XMPPConnectionFactory> factories = new HashMap<String,XMPPConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config config = (AutoSIMXMPPConfig) GsonUtils.jsonToObject("./conf/autosim-xmpp.json", AutoSIMXMPPConfig.class); ServiceReference[] refs = context.getServiceReferences(IEnvironments.class.getName(), "(Language=*)"); environments = (IEnvironments) context.getService(refs[0]);
for (AutoSIMConnectionConfig connectionConfig : config.connections){
adityayadav76/internet_of_things_simulator
AutoSIM-Rest/src/com/automatski/autosim/rest/RestServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/config/AutoSIMRestConfig.java // public class AutoSIMRestConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.rest.config.AutoSIMConnectionConfig; import com.automatski.autosim.rest.config.AutoSIMRestConfig; import com.automatski.autosim.rest.utils.GsonUtils;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.rest; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class RestServiceActivator implements BundleActivator {
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/config/AutoSIMRestConfig.java // public class AutoSIMRestConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/RestServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.rest.config.AutoSIMConnectionConfig; import com.automatski.autosim.rest.config.AutoSIMRestConfig; import com.automatski.autosim.rest.utils.GsonUtils; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.rest; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class RestServiceActivator implements BundleActivator {
private IEnvironments environments = null;
adityayadav76/internet_of_things_simulator
AutoSIM-Rest/src/com/automatski/autosim/rest/RestServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/config/AutoSIMRestConfig.java // public class AutoSIMRestConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.rest.config.AutoSIMConnectionConfig; import com.automatski.autosim.rest.config.AutoSIMRestConfig; import com.automatski.autosim.rest.utils.GsonUtils;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.rest; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class RestServiceActivator implements BundleActivator { private IEnvironments environments = null;
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/config/AutoSIMRestConfig.java // public class AutoSIMRestConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/RestServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.rest.config.AutoSIMConnectionConfig; import com.automatski.autosim.rest.config.AutoSIMRestConfig; import com.automatski.autosim.rest.utils.GsonUtils; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.rest; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class RestServiceActivator implements BundleActivator { private IEnvironments environments = null;
private AutoSIMRestConfig config = null;
adityayadav76/internet_of_things_simulator
AutoSIM-Rest/src/com/automatski/autosim/rest/RestServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/config/AutoSIMRestConfig.java // public class AutoSIMRestConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.rest.config.AutoSIMConnectionConfig; import com.automatski.autosim.rest.config.AutoSIMRestConfig; import com.automatski.autosim.rest.utils.GsonUtils;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.rest; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class RestServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMRestConfig config = null; private HashMap<String,RestConnectionFactory> factories = new HashMap<String,RestConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/config/AutoSIMRestConfig.java // public class AutoSIMRestConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/RestServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.rest.config.AutoSIMConnectionConfig; import com.automatski.autosim.rest.config.AutoSIMRestConfig; import com.automatski.autosim.rest.utils.GsonUtils; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.rest; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class RestServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMRestConfig config = null; private HashMap<String,RestConnectionFactory> factories = new HashMap<String,RestConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config
config = (AutoSIMRestConfig) GsonUtils.jsonToObject("./conf/autosim-rest.json", AutoSIMRestConfig.class);
adityayadav76/internet_of_things_simulator
AutoSIM-Rest/src/com/automatski/autosim/rest/RestServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/config/AutoSIMRestConfig.java // public class AutoSIMRestConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.rest.config.AutoSIMConnectionConfig; import com.automatski.autosim.rest.config.AutoSIMRestConfig; import com.automatski.autosim.rest.utils.GsonUtils;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.rest; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class RestServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMRestConfig config = null; private HashMap<String,RestConnectionFactory> factories = new HashMap<String,RestConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config config = (AutoSIMRestConfig) GsonUtils.jsonToObject("./conf/autosim-rest.json", AutoSIMRestConfig.class); ServiceReference[] refs = context.getServiceReferences(IEnvironments.class.getName(), "(Language=*)"); environments = (IEnvironments) context.getService(refs[0]);
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/config/AutoSIMRestConfig.java // public class AutoSIMRestConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-Rest/src/com/automatski/autosim/rest/RestServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.rest.config.AutoSIMConnectionConfig; import com.automatski.autosim.rest.config.AutoSIMRestConfig; import com.automatski.autosim.rest.utils.GsonUtils; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.rest; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class RestServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMRestConfig config = null; private HashMap<String,RestConnectionFactory> factories = new HashMap<String,RestConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config config = (AutoSIMRestConfig) GsonUtils.jsonToObject("./conf/autosim-rest.json", AutoSIMRestConfig.class); ServiceReference[] refs = context.getServiceReferences(IEnvironments.class.getName(), "(Language=*)"); environments = (IEnvironments) context.getService(refs[0]);
for (AutoSIMConnectionConfig connectionConfig : config.connections){
adityayadav76/internet_of_things_simulator
AutoSIM-WebSocket/src/com/automatski/autosim/websocket/WebSocketConnectionFactory.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionFactory.java // public interface IConnectionFactory { // // public IConnection getConnection(); // // } // // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // }
import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionFactory; import com.automatski.autosim.websocket.config.AutoSIMConnectionConfig;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.websocket; public class WebSocketConnectionFactory implements IConnectionFactory{ private AutoSIMConnectionConfig connectionConfig = null; public WebSocketConnectionFactory(AutoSIMConnectionConfig connectionConfig){ this.connectionConfig = connectionConfig; } @Override
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionFactory.java // public interface IConnectionFactory { // // public IConnection getConnection(); // // } // // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/WebSocketConnectionFactory.java import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionFactory; import com.automatski.autosim.websocket.config.AutoSIMConnectionConfig; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.websocket; public class WebSocketConnectionFactory implements IConnectionFactory{ private AutoSIMConnectionConfig connectionConfig = null; public WebSocketConnectionFactory(AutoSIMConnectionConfig connectionConfig){ this.connectionConfig = connectionConfig; } @Override
public IConnection getConnection() {
adityayadav76/internet_of_things_simulator
AutoSIM-XMPP/src/com/automatski/autosim/xmpp/XMPPConnectionFactory.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionFactory.java // public interface IConnectionFactory { // // public IConnection getConnection(); // // } // // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // public String servicename; // // public String connectorClassName; // }
import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionFactory; import com.automatski.autosim.xmpp.config.AutoSIMConnectionConfig;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.xmpp; public class XMPPConnectionFactory implements IConnectionFactory{ private AutoSIMConnectionConfig connectionConfig = null; public XMPPConnectionFactory(AutoSIMConnectionConfig connectionConfig){ this.connectionConfig = connectionConfig; } @Override
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionFactory.java // public interface IConnectionFactory { // // public IConnection getConnection(); // // } // // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // public String servicename; // // public String connectorClassName; // } // Path: AutoSIM-XMPP/src/com/automatski/autosim/xmpp/XMPPConnectionFactory.java import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionFactory; import com.automatski.autosim.xmpp.config.AutoSIMConnectionConfig; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.xmpp; public class XMPPConnectionFactory implements IConnectionFactory{ private AutoSIMConnectionConfig connectionConfig = null; public XMPPConnectionFactory(AutoSIMConnectionConfig connectionConfig){ this.connectionConfig = connectionConfig; } @Override
public IConnection getConnection() {
adityayadav76/internet_of_things_simulator
AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/SmartM2MConnectionFactory.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionFactory.java // public interface IConnectionFactory { // // public IConnection getConnection(); // // } // // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // }
import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionFactory; import com.automatski.autosim.smartm2m.config.AutoSIMConnectionConfig;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.smartm2m; public class SmartM2MConnectionFactory implements IConnectionFactory{ private AutoSIMConnectionConfig connectionConfig = null; public SmartM2MConnectionFactory(AutoSIMConnectionConfig connectionConfig){ this.connectionConfig = connectionConfig; } @Override
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionFactory.java // public interface IConnectionFactory { // // public IConnection getConnection(); // // } // // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // Path: AutoSIM-SmartM2M/src/com/automatski/autosim/smartm2m/SmartM2MConnectionFactory.java import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionFactory; import com.automatski.autosim.smartm2m.config.AutoSIMConnectionConfig; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.smartm2m; public class SmartM2MConnectionFactory implements IConnectionFactory{ private AutoSIMConnectionConfig connectionConfig = null; public SmartM2MConnectionFactory(AutoSIMConnectionConfig connectionConfig){ this.connectionConfig = connectionConfig; } @Override
public IConnection getConnection() {
adityayadav76/internet_of_things_simulator
AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/MyRestDevice.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // }
import java.util.Random; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class MyRestDevice implements IDevice, IConnectionListener { private AutoSIMDeviceConfig config = null;
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // } // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/MyRestDevice.java import java.util.Random; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class MyRestDevice implements IDevice, IConnectionListener { private AutoSIMDeviceConfig config = null;
private IEnvironments environments = null;
adityayadav76/internet_of_things_simulator
AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/MyRestDevice.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // }
import java.util.Random; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class MyRestDevice implements IDevice, IConnectionListener { private AutoSIMDeviceConfig config = null; private IEnvironments environments = null;
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // } // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/MyRestDevice.java import java.util.Random; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class MyRestDevice implements IDevice, IConnectionListener { private AutoSIMDeviceConfig config = null; private IEnvironments environments = null;
private IConnection connection = null;
adityayadav76/internet_of_things_simulator
AutoSIM-MQTT/src/com/automatski/autosim/mqtt/MQTTConnectionFactory.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionFactory.java // public interface IConnectionFactory { // // public IConnection getConnection(); // // } // // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // }
import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionFactory; import com.automatski.autosim.mqtt.config.AutoSIMConnectionConfig;
package com.automatski.autosim.mqtt; public class MQTTConnectionFactory implements IConnectionFactory{ private AutoSIMConnectionConfig connectionConfig = null; public MQTTConnectionFactory(AutoSIMConnectionConfig connectionConfig){ this.connectionConfig = connectionConfig; } @Override
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionFactory.java // public interface IConnectionFactory { // // public IConnection getConnection(); // // } // // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // Path: AutoSIM-MQTT/src/com/automatski/autosim/mqtt/MQTTConnectionFactory.java import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionFactory; import com.automatski.autosim.mqtt.config.AutoSIMConnectionConfig; package com.automatski.autosim.mqtt; public class MQTTConnectionFactory implements IConnectionFactory{ private AutoSIMConnectionConfig connectionConfig = null; public MQTTConnectionFactory(AutoSIMConnectionConfig connectionConfig){ this.connectionConfig = connectionConfig; } @Override
public IConnection getConnection() {
adityayadav76/internet_of_things_simulator
AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/MyCoAPDevice.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // }
import java.util.Random; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class MyCoAPDevice implements IDevice, IConnectionListener { private AutoSIMDeviceConfig config = null;
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // } // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/MyCoAPDevice.java import java.util.Random; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class MyCoAPDevice implements IDevice, IConnectionListener { private AutoSIMDeviceConfig config = null;
private IEnvironments environments = null;
adityayadav76/internet_of_things_simulator
AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/MyCoAPDevice.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // }
import java.util.Random; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class MyCoAPDevice implements IDevice, IConnectionListener { private AutoSIMDeviceConfig config = null; private IEnvironments environments = null;
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // } // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/MyCoAPDevice.java import java.util.Random; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class MyCoAPDevice implements IDevice, IConnectionListener { private AutoSIMDeviceConfig config = null; private IEnvironments environments = null;
private IConnection connection = null;
adityayadav76/internet_of_things_simulator
AutoSIM-WebSocket/src/com/automatski/autosim/websocket/SampleWebSocketConnection.java
// Path: AutoSIM-WebSocket/src/org/eclipse/jetty/websocket/jsr356/ContainerManager.java // public class ContainerManager { // // public static ClientContainer getContainer() throws Exception{ // ClientContainer container = new ClientContainer(); // container.doStart(); // return container; // } // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // }
import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.websocket.config.AutoSIMConnectionConfig; import java.net.URI; import java.nio.ByteBuffer; import javax.websocket.MessageHandler; import javax.websocket.Session; import javax.websocket.WebSocketContainer; import org.eclipse.jetty.util.component.LifeCycle; import org.eclipse.jetty.websocket.jsr356.ClientContainer; import org.eclipse.jetty.websocket.jsr356.ContainerManager; import org.eclipse.jetty.websocket.jsr356.JettyClientContainerProvider;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.websocket; public class SampleWebSocketConnection implements IConnection { private AutoSIMConnectionConfig config = null;
// Path: AutoSIM-WebSocket/src/org/eclipse/jetty/websocket/jsr356/ContainerManager.java // public class ContainerManager { // // public static ClientContainer getContainer() throws Exception{ // ClientContainer container = new ClientContainer(); // container.doStart(); // return container; // } // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/SampleWebSocketConnection.java import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.websocket.config.AutoSIMConnectionConfig; import java.net.URI; import java.nio.ByteBuffer; import javax.websocket.MessageHandler; import javax.websocket.Session; import javax.websocket.WebSocketContainer; import org.eclipse.jetty.util.component.LifeCycle; import org.eclipse.jetty.websocket.jsr356.ClientContainer; import org.eclipse.jetty.websocket.jsr356.ContainerManager; import org.eclipse.jetty.websocket.jsr356.JettyClientContainerProvider; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.websocket; public class SampleWebSocketConnection implements IConnection { private AutoSIMConnectionConfig config = null;
private IConnectionListener listener = null;
adityayadav76/internet_of_things_simulator
AutoSIM-WebSocket/src/com/automatski/autosim/websocket/SampleWebSocketConnection.java
// Path: AutoSIM-WebSocket/src/org/eclipse/jetty/websocket/jsr356/ContainerManager.java // public class ContainerManager { // // public static ClientContainer getContainer() throws Exception{ // ClientContainer container = new ClientContainer(); // container.doStart(); // return container; // } // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // }
import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.websocket.config.AutoSIMConnectionConfig; import java.net.URI; import java.nio.ByteBuffer; import javax.websocket.MessageHandler; import javax.websocket.Session; import javax.websocket.WebSocketContainer; import org.eclipse.jetty.util.component.LifeCycle; import org.eclipse.jetty.websocket.jsr356.ClientContainer; import org.eclipse.jetty.websocket.jsr356.ContainerManager; import org.eclipse.jetty.websocket.jsr356.JettyClientContainerProvider;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.websocket; public class SampleWebSocketConnection implements IConnection { private AutoSIMConnectionConfig config = null; private IConnectionListener listener = null; private WebSocketContainer container = null; private Session session = null; private String sessionId = null; @Override public void connect() throws Exception { URI uri = URI.create(config.url);
// Path: AutoSIM-WebSocket/src/org/eclipse/jetty/websocket/jsr356/ContainerManager.java // public class ContainerManager { // // public static ClientContainer getContainer() throws Exception{ // ClientContainer container = new ClientContainer(); // container.doStart(); // return container; // } // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/SampleWebSocketConnection.java import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.websocket.config.AutoSIMConnectionConfig; import java.net.URI; import java.nio.ByteBuffer; import javax.websocket.MessageHandler; import javax.websocket.Session; import javax.websocket.WebSocketContainer; import org.eclipse.jetty.util.component.LifeCycle; import org.eclipse.jetty.websocket.jsr356.ClientContainer; import org.eclipse.jetty.websocket.jsr356.ContainerManager; import org.eclipse.jetty.websocket.jsr356.JettyClientContainerProvider; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.websocket; public class SampleWebSocketConnection implements IConnection { private AutoSIMConnectionConfig config = null; private IConnectionListener listener = null; private WebSocketContainer container = null; private Session session = null; private String sessionId = null; @Override public void connect() throws Exception { URI uri = URI.create(config.url);
container = ContainerManager.getContainer();
adityayadav76/internet_of_things_simulator
AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/MyWebSocketDevice.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // }
import java.util.Random; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class MyWebSocketDevice implements IDevice, IConnectionListener { private AutoSIMDeviceConfig config = null;
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // } // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/MyWebSocketDevice.java import java.util.Random; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class MyWebSocketDevice implements IDevice, IConnectionListener { private AutoSIMDeviceConfig config = null;
private IEnvironments environments = null;
adityayadav76/internet_of_things_simulator
AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/MyWebSocketDevice.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // }
import java.util.Random; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class MyWebSocketDevice implements IDevice, IConnectionListener { private AutoSIMDeviceConfig config = null; private IEnvironments environments = null;
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IDevice.java // public interface IDevice { // // public void setConfig(Object object); // public void setEnvironments(IEnvironments environments); // // public void setup() throws Exception; // public void start() throws Exception; // public void stop() throws Exception; // public void teardown() throws Exception; // // public void step() throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/config/AutoSIMDeviceConfig.java // public class AutoSIMDeviceConfig { // // public String name; // // public String deviceClassName; // public String connectionName; // } // Path: AutoSIM-SampleDevices/src/com/automatski/autosim/sampledevices/MyWebSocketDevice.java import java.util.Random; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.automatski.autosim.environments.IDevice; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.sampledevices.config.AutoSIMDeviceConfig; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.sampledevices; public class MyWebSocketDevice implements IDevice, IConnectionListener { private AutoSIMDeviceConfig config = null; private IEnvironments environments = null;
private IConnection connection = null;
adityayadav76/internet_of_things_simulator
AutoSIM-WebSocket/src/com/automatski/autosim/websocket/WebSocketServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/config/AutoSIMWebSocketConfig.java // public class AutoSIMWebSocketConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.websocket.config.AutoSIMConnectionConfig; import com.automatski.autosim.websocket.config.AutoSIMWebSocketConfig; import com.automatski.autosim.websocket.utils.GsonUtils;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.websocket; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class WebSocketServiceActivator implements BundleActivator {
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/config/AutoSIMWebSocketConfig.java // public class AutoSIMWebSocketConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/WebSocketServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.websocket.config.AutoSIMConnectionConfig; import com.automatski.autosim.websocket.config.AutoSIMWebSocketConfig; import com.automatski.autosim.websocket.utils.GsonUtils; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.websocket; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class WebSocketServiceActivator implements BundleActivator {
private IEnvironments environments = null;
adityayadav76/internet_of_things_simulator
AutoSIM-WebSocket/src/com/automatski/autosim/websocket/WebSocketServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/config/AutoSIMWebSocketConfig.java // public class AutoSIMWebSocketConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.websocket.config.AutoSIMConnectionConfig; import com.automatski.autosim.websocket.config.AutoSIMWebSocketConfig; import com.automatski.autosim.websocket.utils.GsonUtils;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.websocket; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class WebSocketServiceActivator implements BundleActivator { private IEnvironments environments = null;
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/config/AutoSIMWebSocketConfig.java // public class AutoSIMWebSocketConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/WebSocketServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.websocket.config.AutoSIMConnectionConfig; import com.automatski.autosim.websocket.config.AutoSIMWebSocketConfig; import com.automatski.autosim.websocket.utils.GsonUtils; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.websocket; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class WebSocketServiceActivator implements BundleActivator { private IEnvironments environments = null;
private AutoSIMWebSocketConfig config = null;
adityayadav76/internet_of_things_simulator
AutoSIM-WebSocket/src/com/automatski/autosim/websocket/WebSocketServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/config/AutoSIMWebSocketConfig.java // public class AutoSIMWebSocketConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.websocket.config.AutoSIMConnectionConfig; import com.automatski.autosim.websocket.config.AutoSIMWebSocketConfig; import com.automatski.autosim.websocket.utils.GsonUtils;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.websocket; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class WebSocketServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMWebSocketConfig config = null; private HashMap<String,WebSocketConnectionFactory> factories = new HashMap<String,WebSocketConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/config/AutoSIMWebSocketConfig.java // public class AutoSIMWebSocketConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/WebSocketServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.websocket.config.AutoSIMConnectionConfig; import com.automatski.autosim.websocket.config.AutoSIMWebSocketConfig; import com.automatski.autosim.websocket.utils.GsonUtils; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.websocket; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class WebSocketServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMWebSocketConfig config = null; private HashMap<String,WebSocketConnectionFactory> factories = new HashMap<String,WebSocketConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config
config = (AutoSIMWebSocketConfig) GsonUtils.jsonToObject("./conf/autosim-websocket.json", AutoSIMWebSocketConfig.class);
adityayadav76/internet_of_things_simulator
AutoSIM-WebSocket/src/com/automatski/autosim/websocket/WebSocketServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/config/AutoSIMWebSocketConfig.java // public class AutoSIMWebSocketConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.websocket.config.AutoSIMConnectionConfig; import com.automatski.autosim.websocket.config.AutoSIMWebSocketConfig; import com.automatski.autosim.websocket.utils.GsonUtils;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.websocket; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class WebSocketServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMWebSocketConfig config = null; private HashMap<String,WebSocketConnectionFactory> factories = new HashMap<String,WebSocketConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config config = (AutoSIMWebSocketConfig) GsonUtils.jsonToObject("./conf/autosim-websocket.json", AutoSIMWebSocketConfig.class); ServiceReference[] refs = context.getServiceReferences(IEnvironments.class.getName(), "(Language=*)"); environments = (IEnvironments) context.getService(refs[0]);
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/config/AutoSIMWebSocketConfig.java // public class AutoSIMWebSocketConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-WebSocket/src/com/automatski/autosim/websocket/WebSocketServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.environments.IEnvironments; import com.automatski.autosim.websocket.config.AutoSIMConnectionConfig; import com.automatski.autosim.websocket.config.AutoSIMWebSocketConfig; import com.automatski.autosim.websocket.utils.GsonUtils; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.websocket; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class WebSocketServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMWebSocketConfig config = null; private HashMap<String,WebSocketConnectionFactory> factories = new HashMap<String,WebSocketConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config config = (AutoSIMWebSocketConfig) GsonUtils.jsonToObject("./conf/autosim-websocket.json", AutoSIMWebSocketConfig.class); ServiceReference[] refs = context.getServiceReferences(IEnvironments.class.getName(), "(Language=*)"); environments = (IEnvironments) context.getService(refs[0]);
for (AutoSIMConnectionConfig connectionConfig : config.connections){
adityayadav76/internet_of_things_simulator
AutoSIM-AMQP/src/com/automatski/autosim/amqp/SampleAMQPConnection.java
// Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // }
import com.automatski.autosim.amqp.config.AutoSIMConnectionConfig; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.rabbitmq.client.Channel; import com.rabbitmq.client.Connection; import com.rabbitmq.client.ConnectionFactory;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.amqp; public class SampleAMQPConnection implements IConnection { private AutoSIMConnectionConfig config = null;
// Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String url; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionListener.java // public interface IConnectionListener { // // public void receive(Object object) throws Exception; // } // Path: AutoSIM-AMQP/src/com/automatski/autosim/amqp/SampleAMQPConnection.java import com.automatski.autosim.amqp.config.AutoSIMConnectionConfig; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionListener; import com.rabbitmq.client.Channel; import com.rabbitmq.client.Connection; import com.rabbitmq.client.ConnectionFactory; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.amqp; public class SampleAMQPConnection implements IConnection { private AutoSIMConnectionConfig config = null;
private IConnectionListener listener = null;
adityayadav76/internet_of_things_simulator
AutoSIM-Environments/src/com/automatski/autosim/environments/EnvironmentsServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/config/AutoSIMEnvironmentConfig.java // public class AutoSIMEnvironmentConfig { // public String name; // public int count; // public String device; // public int delayInMilliSeconds; // public int threads; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/config/AutoSIMEnvironmentsConfig.java // public class AutoSIMEnvironmentsConfig { // // public List<AutoSIMEnvironmentConfig> environments = new ArrayList<AutoSIMEnvironmentConfig>(); // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/config/EnvironmentThread.java // public class EnvironmentThread{ // // public String name; // public int count; // public String device; // public int delayInMilliSeconds; // public int threads; // // private List<IDevice> devices = new ArrayList<IDevice>(); // private IEnvironments environments = null; // private boolean running = false; // private Thread thread = null; // // public EnvironmentThread(AutoSIMEnvironmentConfig conf){ // this.name = conf.name; // this.count = conf.count; // this.device = conf.device; // this.delayInMilliSeconds = conf.delayInMilliSeconds; // this.threads = conf.threads; // } // // // public void setEnvironments(IEnvironments environments){ // this.environments = environments; // } // // // public void setup() throws Exception { // for (int i=0; i<count;i++){ // IDevice d = environments.getDevice(device); // d.setup(); // devices.add(d); // } // } // // public void start() throws Exception { // for (IDevice d: devices){ // d.start(); // } // running = true; // thread = new Thread(){ // public void run(){ // while (running){ // ExecutorService executor = Executors.newFixedThreadPool(threads); // for (IDevice d: devices) { // final IDevice device = d; // Runnable worker = new Runnable(){ // public void run(){ // try { // device.step(); // } catch (Exception e){ // System.out.println(e.getMessage()); // } // } // }; // executor.execute(worker); // } // executor.shutdown(); // while (!executor.isTerminated()) {} // // try { // Thread.currentThread().sleep(delayInMilliSeconds); // }catch (Exception e){} // // } // } // }; // thread.start(); // } // // public void stop() throws Exception { // thread = null; // running = false; // for (IDevice d: devices){ // d.stop(); // } // } // // public void teardown() throws Exception { // for (IDevice d: devices){ // d.teardown(); // } // devices.clear(); // } // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.ArrayList; import java.util.Hashtable; import java.util.List; import org.omg.CORBA.Environment; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import com.automatski.autosim.environments.config.AutoSIMEnvironmentConfig; import com.automatski.autosim.environments.config.AutoSIMEnvironmentsConfig; import com.automatski.autosim.environments.config.EnvironmentThread; import com.automatski.autosim.environments.utils.GsonUtils;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.environments; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ //https://chamibuddhika.wordpress.com/2011/10/02/apache-thrift-quickstart-tutorial/ public class EnvironmentsServiceActivator implements BundleActivator { /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { Hashtable<String, String> props = new Hashtable<String, String>(); props.put("Language", "English"); // read the config
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/config/AutoSIMEnvironmentConfig.java // public class AutoSIMEnvironmentConfig { // public String name; // public int count; // public String device; // public int delayInMilliSeconds; // public int threads; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/config/AutoSIMEnvironmentsConfig.java // public class AutoSIMEnvironmentsConfig { // // public List<AutoSIMEnvironmentConfig> environments = new ArrayList<AutoSIMEnvironmentConfig>(); // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/config/EnvironmentThread.java // public class EnvironmentThread{ // // public String name; // public int count; // public String device; // public int delayInMilliSeconds; // public int threads; // // private List<IDevice> devices = new ArrayList<IDevice>(); // private IEnvironments environments = null; // private boolean running = false; // private Thread thread = null; // // public EnvironmentThread(AutoSIMEnvironmentConfig conf){ // this.name = conf.name; // this.count = conf.count; // this.device = conf.device; // this.delayInMilliSeconds = conf.delayInMilliSeconds; // this.threads = conf.threads; // } // // // public void setEnvironments(IEnvironments environments){ // this.environments = environments; // } // // // public void setup() throws Exception { // for (int i=0; i<count;i++){ // IDevice d = environments.getDevice(device); // d.setup(); // devices.add(d); // } // } // // public void start() throws Exception { // for (IDevice d: devices){ // d.start(); // } // running = true; // thread = new Thread(){ // public void run(){ // while (running){ // ExecutorService executor = Executors.newFixedThreadPool(threads); // for (IDevice d: devices) { // final IDevice device = d; // Runnable worker = new Runnable(){ // public void run(){ // try { // device.step(); // } catch (Exception e){ // System.out.println(e.getMessage()); // } // } // }; // executor.execute(worker); // } // executor.shutdown(); // while (!executor.isTerminated()) {} // // try { // Thread.currentThread().sleep(delayInMilliSeconds); // }catch (Exception e){} // // } // } // }; // thread.start(); // } // // public void stop() throws Exception { // thread = null; // running = false; // for (IDevice d: devices){ // d.stop(); // } // } // // public void teardown() throws Exception { // for (IDevice d: devices){ // d.teardown(); // } // devices.clear(); // } // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/EnvironmentsServiceActivator.java import java.util.ArrayList; import java.util.Hashtable; import java.util.List; import org.omg.CORBA.Environment; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import com.automatski.autosim.environments.config.AutoSIMEnvironmentConfig; import com.automatski.autosim.environments.config.AutoSIMEnvironmentsConfig; import com.automatski.autosim.environments.config.EnvironmentThread; import com.automatski.autosim.environments.utils.GsonUtils; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.environments; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ //https://chamibuddhika.wordpress.com/2011/10/02/apache-thrift-quickstart-tutorial/ public class EnvironmentsServiceActivator implements BundleActivator { /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { Hashtable<String, String> props = new Hashtable<String, String>(); props.put("Language", "English"); // read the config
final AutoSIMEnvironmentsConfig config = (AutoSIMEnvironmentsConfig) GsonUtils.jsonToObject("./conf/autosim-environments.json", AutoSIMEnvironmentsConfig.class);
adityayadav76/internet_of_things_simulator
AutoSIM-Environments/src/com/automatski/autosim/environments/EnvironmentsServiceActivator.java
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/config/AutoSIMEnvironmentConfig.java // public class AutoSIMEnvironmentConfig { // public String name; // public int count; // public String device; // public int delayInMilliSeconds; // public int threads; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/config/AutoSIMEnvironmentsConfig.java // public class AutoSIMEnvironmentsConfig { // // public List<AutoSIMEnvironmentConfig> environments = new ArrayList<AutoSIMEnvironmentConfig>(); // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/config/EnvironmentThread.java // public class EnvironmentThread{ // // public String name; // public int count; // public String device; // public int delayInMilliSeconds; // public int threads; // // private List<IDevice> devices = new ArrayList<IDevice>(); // private IEnvironments environments = null; // private boolean running = false; // private Thread thread = null; // // public EnvironmentThread(AutoSIMEnvironmentConfig conf){ // this.name = conf.name; // this.count = conf.count; // this.device = conf.device; // this.delayInMilliSeconds = conf.delayInMilliSeconds; // this.threads = conf.threads; // } // // // public void setEnvironments(IEnvironments environments){ // this.environments = environments; // } // // // public void setup() throws Exception { // for (int i=0; i<count;i++){ // IDevice d = environments.getDevice(device); // d.setup(); // devices.add(d); // } // } // // public void start() throws Exception { // for (IDevice d: devices){ // d.start(); // } // running = true; // thread = new Thread(){ // public void run(){ // while (running){ // ExecutorService executor = Executors.newFixedThreadPool(threads); // for (IDevice d: devices) { // final IDevice device = d; // Runnable worker = new Runnable(){ // public void run(){ // try { // device.step(); // } catch (Exception e){ // System.out.println(e.getMessage()); // } // } // }; // executor.execute(worker); // } // executor.shutdown(); // while (!executor.isTerminated()) {} // // try { // Thread.currentThread().sleep(delayInMilliSeconds); // }catch (Exception e){} // // } // } // }; // thread.start(); // } // // public void stop() throws Exception { // thread = null; // running = false; // for (IDevice d: devices){ // d.stop(); // } // } // // public void teardown() throws Exception { // for (IDevice d: devices){ // d.teardown(); // } // devices.clear(); // } // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // }
import java.util.ArrayList; import java.util.Hashtable; import java.util.List; import org.omg.CORBA.Environment; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import com.automatski.autosim.environments.config.AutoSIMEnvironmentConfig; import com.automatski.autosim.environments.config.AutoSIMEnvironmentsConfig; import com.automatski.autosim.environments.config.EnvironmentThread; import com.automatski.autosim.environments.utils.GsonUtils;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.environments; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ //https://chamibuddhika.wordpress.com/2011/10/02/apache-thrift-quickstart-tutorial/ public class EnvironmentsServiceActivator implements BundleActivator { /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { Hashtable<String, String> props = new Hashtable<String, String>(); props.put("Language", "English"); // read the config
// Path: AutoSIM-Environments/src/com/automatski/autosim/environments/config/AutoSIMEnvironmentConfig.java // public class AutoSIMEnvironmentConfig { // public String name; // public int count; // public String device; // public int delayInMilliSeconds; // public int threads; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/config/AutoSIMEnvironmentsConfig.java // public class AutoSIMEnvironmentsConfig { // // public List<AutoSIMEnvironmentConfig> environments = new ArrayList<AutoSIMEnvironmentConfig>(); // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/config/EnvironmentThread.java // public class EnvironmentThread{ // // public String name; // public int count; // public String device; // public int delayInMilliSeconds; // public int threads; // // private List<IDevice> devices = new ArrayList<IDevice>(); // private IEnvironments environments = null; // private boolean running = false; // private Thread thread = null; // // public EnvironmentThread(AutoSIMEnvironmentConfig conf){ // this.name = conf.name; // this.count = conf.count; // this.device = conf.device; // this.delayInMilliSeconds = conf.delayInMilliSeconds; // this.threads = conf.threads; // } // // // public void setEnvironments(IEnvironments environments){ // this.environments = environments; // } // // // public void setup() throws Exception { // for (int i=0; i<count;i++){ // IDevice d = environments.getDevice(device); // d.setup(); // devices.add(d); // } // } // // public void start() throws Exception { // for (IDevice d: devices){ // d.start(); // } // running = true; // thread = new Thread(){ // public void run(){ // while (running){ // ExecutorService executor = Executors.newFixedThreadPool(threads); // for (IDevice d: devices) { // final IDevice device = d; // Runnable worker = new Runnable(){ // public void run(){ // try { // device.step(); // } catch (Exception e){ // System.out.println(e.getMessage()); // } // } // }; // executor.execute(worker); // } // executor.shutdown(); // while (!executor.isTerminated()) {} // // try { // Thread.currentThread().sleep(delayInMilliSeconds); // }catch (Exception e){} // // } // } // }; // thread.start(); // } // // public void stop() throws Exception { // thread = null; // running = false; // for (IDevice d: devices){ // d.stop(); // } // } // // public void teardown() throws Exception { // for (IDevice d: devices){ // d.teardown(); // } // devices.clear(); // } // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/EnvironmentsServiceActivator.java import java.util.ArrayList; import java.util.Hashtable; import java.util.List; import org.omg.CORBA.Environment; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import com.automatski.autosim.environments.config.AutoSIMEnvironmentConfig; import com.automatski.autosim.environments.config.AutoSIMEnvironmentsConfig; import com.automatski.autosim.environments.config.EnvironmentThread; import com.automatski.autosim.environments.utils.GsonUtils; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.environments; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ //https://chamibuddhika.wordpress.com/2011/10/02/apache-thrift-quickstart-tutorial/ public class EnvironmentsServiceActivator implements BundleActivator { /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { Hashtable<String, String> props = new Hashtable<String, String>(); props.put("Language", "English"); // read the config
final AutoSIMEnvironmentsConfig config = (AutoSIMEnvironmentsConfig) GsonUtils.jsonToObject("./conf/autosim-environments.json", AutoSIMEnvironmentsConfig.class);
adityayadav76/internet_of_things_simulator
AutoSIM-Automatski/src/com/automatski/autosim/automatski/AutomatskiServiceActivator.java
// Path: AutoSIM-Automatski/src/com/automatski/autosim/automatski/api/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Automatski/src/com/automatski/autosim/automatski/config/AutoSIMAutomatskiConfig.java // public class AutoSIMAutomatskiConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-Automatski/src/com/automatski/autosim/automatski/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.automatski.api.utils.GsonUtils; import com.automatski.autosim.automatski.config.AutoSIMAutomatskiConfig; import com.automatski.autosim.automatski.config.AutoSIMConnectionConfig; import com.automatski.autosim.environments.IEnvironments;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.automatski; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class AutomatskiServiceActivator implements BundleActivator {
// Path: AutoSIM-Automatski/src/com/automatski/autosim/automatski/api/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Automatski/src/com/automatski/autosim/automatski/config/AutoSIMAutomatskiConfig.java // public class AutoSIMAutomatskiConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-Automatski/src/com/automatski/autosim/automatski/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // Path: AutoSIM-Automatski/src/com/automatski/autosim/automatski/AutomatskiServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.automatski.api.utils.GsonUtils; import com.automatski.autosim.automatski.config.AutoSIMAutomatskiConfig; import com.automatski.autosim.automatski.config.AutoSIMConnectionConfig; import com.automatski.autosim.environments.IEnvironments; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.automatski; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class AutomatskiServiceActivator implements BundleActivator {
private IEnvironments environments = null;
adityayadav76/internet_of_things_simulator
AutoSIM-Automatski/src/com/automatski/autosim/automatski/AutomatskiServiceActivator.java
// Path: AutoSIM-Automatski/src/com/automatski/autosim/automatski/api/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Automatski/src/com/automatski/autosim/automatski/config/AutoSIMAutomatskiConfig.java // public class AutoSIMAutomatskiConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-Automatski/src/com/automatski/autosim/automatski/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.automatski.api.utils.GsonUtils; import com.automatski.autosim.automatski.config.AutoSIMAutomatskiConfig; import com.automatski.autosim.automatski.config.AutoSIMConnectionConfig; import com.automatski.autosim.environments.IEnvironments;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.automatski; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class AutomatskiServiceActivator implements BundleActivator { private IEnvironments environments = null;
// Path: AutoSIM-Automatski/src/com/automatski/autosim/automatski/api/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Automatski/src/com/automatski/autosim/automatski/config/AutoSIMAutomatskiConfig.java // public class AutoSIMAutomatskiConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-Automatski/src/com/automatski/autosim/automatski/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // Path: AutoSIM-Automatski/src/com/automatski/autosim/automatski/AutomatskiServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.automatski.api.utils.GsonUtils; import com.automatski.autosim.automatski.config.AutoSIMAutomatskiConfig; import com.automatski.autosim.automatski.config.AutoSIMConnectionConfig; import com.automatski.autosim.environments.IEnvironments; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.automatski; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class AutomatskiServiceActivator implements BundleActivator { private IEnvironments environments = null;
private AutoSIMAutomatskiConfig config = null;
adityayadav76/internet_of_things_simulator
AutoSIM-Automatski/src/com/automatski/autosim/automatski/AutomatskiServiceActivator.java
// Path: AutoSIM-Automatski/src/com/automatski/autosim/automatski/api/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Automatski/src/com/automatski/autosim/automatski/config/AutoSIMAutomatskiConfig.java // public class AutoSIMAutomatskiConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-Automatski/src/com/automatski/autosim/automatski/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.automatski.api.utils.GsonUtils; import com.automatski.autosim.automatski.config.AutoSIMAutomatskiConfig; import com.automatski.autosim.automatski.config.AutoSIMConnectionConfig; import com.automatski.autosim.environments.IEnvironments;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.automatski; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class AutomatskiServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMAutomatskiConfig config = null; private HashMap<String,AutomatskiConnectionFactory> factories = new HashMap<String,AutomatskiConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config
// Path: AutoSIM-Automatski/src/com/automatski/autosim/automatski/api/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Automatski/src/com/automatski/autosim/automatski/config/AutoSIMAutomatskiConfig.java // public class AutoSIMAutomatskiConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-Automatski/src/com/automatski/autosim/automatski/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // Path: AutoSIM-Automatski/src/com/automatski/autosim/automatski/AutomatskiServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.automatski.api.utils.GsonUtils; import com.automatski.autosim.automatski.config.AutoSIMAutomatskiConfig; import com.automatski.autosim.automatski.config.AutoSIMConnectionConfig; import com.automatski.autosim.environments.IEnvironments; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.automatski; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class AutomatskiServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMAutomatskiConfig config = null; private HashMap<String,AutomatskiConnectionFactory> factories = new HashMap<String,AutomatskiConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config
config = (AutoSIMAutomatskiConfig) GsonUtils.jsonToObject("./conf/autosim-automatski.json", AutoSIMAutomatskiConfig.class);
adityayadav76/internet_of_things_simulator
AutoSIM-Automatski/src/com/automatski/autosim/automatski/AutomatskiServiceActivator.java
// Path: AutoSIM-Automatski/src/com/automatski/autosim/automatski/api/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Automatski/src/com/automatski/autosim/automatski/config/AutoSIMAutomatskiConfig.java // public class AutoSIMAutomatskiConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-Automatski/src/com/automatski/autosim/automatski/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // }
import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.automatski.api.utils.GsonUtils; import com.automatski.autosim.automatski.config.AutoSIMAutomatskiConfig; import com.automatski.autosim.automatski.config.AutoSIMConnectionConfig; import com.automatski.autosim.environments.IEnvironments;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.automatski; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class AutomatskiServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMAutomatskiConfig config = null; private HashMap<String,AutomatskiConnectionFactory> factories = new HashMap<String,AutomatskiConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config config = (AutoSIMAutomatskiConfig) GsonUtils.jsonToObject("./conf/autosim-automatski.json", AutoSIMAutomatskiConfig.class); ServiceReference[] refs = context.getServiceReferences(IEnvironments.class.getName(), "(Language=*)"); environments = (IEnvironments) context.getService(refs[0]);
// Path: AutoSIM-Automatski/src/com/automatski/autosim/automatski/api/utils/GsonUtils.java // public class GsonUtils { // // private static GsonBuilder builder = null; // // static { // builder = new GsonBuilder(); // builder.setPrettyPrinting().serializeNulls(); // } // // public static String objectToJson(Object obj) throws Exception { // Gson gson = builder.create(); // return gson.toJson(obj); // } // // public static Object jsonToObject(String path, Class clas) throws Exception { // Gson gson = builder.create(); // String json = new String(Files.readAllBytes(Paths.get(path)));//"./albums.json"))); // return gson.fromJson(json, clas); // } // // // } // // Path: AutoSIM-Automatski/src/com/automatski/autosim/automatski/config/AutoSIMAutomatskiConfig.java // public class AutoSIMAutomatskiConfig { // // public List<AutoSIMConnectionConfig> connections = new ArrayList<AutoSIMConnectionConfig>(); // // } // // Path: AutoSIM-Automatski/src/com/automatski/autosim/automatski/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IEnvironments.java // public interface IEnvironments { // // public void setup(String environment) throws Exception; // public void start(String environment) throws Exception; // public void stop(String environment) throws Exception; // public void teardown(String environment) throws Exception; // // // public void registerConnectionFactory(String name, IConnectionFactory factory); // public void deregisterConnectionFactory(String name); // public IConnection getConnection(String name) throws Exception; // // public void registerDeviceFactory(String name, IDeviceFactory factory); // public void deregisterDeviceFactory(String name); // public IDevice getDevice(String name) throws Exception; // // // // } // Path: AutoSIM-Automatski/src/com/automatski/autosim/automatski/AutomatskiServiceActivator.java import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import com.automatski.autosim.automatski.api.utils.GsonUtils; import com.automatski.autosim.automatski.config.AutoSIMAutomatskiConfig; import com.automatski.autosim.automatski.config.AutoSIMConnectionConfig; import com.automatski.autosim.environments.IEnvironments; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.automatski; /** * This class implements a simple bundle that uses the bundle * context to register an English language dictionary service * with the OSGi framework. The dictionary service interface is * defined in a separate class file and is implemented by an * inner class. **/ public class AutomatskiServiceActivator implements BundleActivator { private IEnvironments environments = null; private AutoSIMAutomatskiConfig config = null; private HashMap<String,AutomatskiConnectionFactory> factories = new HashMap<String,AutomatskiConnectionFactory>(); /** * Implements BundleActivator.start(). Registers an * instance of a dictionary service using the bundle context; * attaches properties to the service that can be queried * when performing a service look-up. * @param context the framework context for the bundle. **/ public void start(BundleContext context) throws Exception { //System.out.println(new File(".").getAbsolutePath()); // read the config config = (AutoSIMAutomatskiConfig) GsonUtils.jsonToObject("./conf/autosim-automatski.json", AutoSIMAutomatskiConfig.class); ServiceReference[] refs = context.getServiceReferences(IEnvironments.class.getName(), "(Language=*)"); environments = (IEnvironments) context.getService(refs[0]);
for (AutoSIMConnectionConfig connectionConfig : config.connections){
adityayadav76/internet_of_things_simulator
AutoSIM-Automatski/src/com/automatski/autosim/automatski/AutomatskiConnectionFactory.java
// Path: AutoSIM-Automatski/src/com/automatski/autosim/automatski/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionFactory.java // public interface IConnectionFactory { // // public IConnection getConnection(); // // }
import com.automatski.autosim.automatski.config.AutoSIMConnectionConfig; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionFactory;
/* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.automatski; public class AutomatskiConnectionFactory implements IConnectionFactory{ private AutoSIMConnectionConfig connectionConfig = null; public AutomatskiConnectionFactory(AutoSIMConnectionConfig connectionConfig){ this.connectionConfig = connectionConfig; } @Override
// Path: AutoSIM-Automatski/src/com/automatski/autosim/automatski/config/AutoSIMConnectionConfig.java // public class AutoSIMConnectionConfig { // // public String name; // public String host; // public int port; // public String username; // public String password; // // public String connectorClassName; // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnection.java // public interface IConnection { // // public void setConfig(Object object); // // // public void connect() throws Exception; // public void disconnect() throws Exception; // // public void setListener(IConnectionListener listener); // public Object send(Object object) throws Exception; // // } // // Path: AutoSIM-Environments/src/com/automatski/autosim/environments/IConnectionFactory.java // public interface IConnectionFactory { // // public IConnection getConnection(); // // } // Path: AutoSIM-Automatski/src/com/automatski/autosim/automatski/AutomatskiConnectionFactory.java import com.automatski.autosim.automatski.config.AutoSIMConnectionConfig; import com.automatski.autosim.environments.IConnection; import com.automatski.autosim.environments.IConnectionFactory; /* * AutoSIM - Internet of Things Simulator * Copyright (C) 2014, Aditya Yadav <aditya@automatski.com> * * This program 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 * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ package com.automatski.autosim.automatski; public class AutomatskiConnectionFactory implements IConnectionFactory{ private AutoSIMConnectionConfig connectionConfig = null; public AutomatskiConnectionFactory(AutoSIMConnectionConfig connectionConfig){ this.connectionConfig = connectionConfig; } @Override
public IConnection getConnection() {