Skip to content

Commit 940da34

Browse files
committed
use standalone setup
1 parent 6ac2b13 commit 940da34

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

ITS-commandline/fr.lip6.move.gal.itscl.application/src/fr/lip6/move/gal/itscl/application/Application.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ public Object start(IApplicationContext context) throws Exception {
102102
spec = SerializationUtil.fileToGalSystem(inputff);
103103
System.out.println("Successfully read input file : " + inputff +" in " + (time - System.currentTimeMillis()) + " ms.");
104104
} else if (ff.getName().endsWith(".ahg")) {
105+
AHGSerializationUtil.setStandalone(true);
105106
AttackHyperGraph ahg = AHGSerializationUtil.fileToAttackHyperGraph(inputff);
106107
spec = AHGToGALTransformer.transformToGAL(ahg, modelName);
107108
System.out.println("Successfully read input file : " + inputff + " and translated to GAL in "

ahg/fr.lip6.move.ahg/src/fr/lip6/move/serialization/AHGSerializationUtil.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,19 @@
1717
import com.google.inject.Injector;
1818

1919
import fr.lip6.move.AhgRuntimeModule;
20+
import fr.lip6.move.AhgStandaloneSetup;
2021
import fr.lip6.move.ahg.AttackHyperGraph;
2122

2223
/**
2324
* Utility class for serialization of gal system
2425
*/
2526
public class AHGSerializationUtil {
2627

28+
private static boolean isStandalone = false;
29+
30+
public static void setStandalone(boolean isStandalone) {
31+
AHGSerializationUtil.isStandalone = isStandalone;
32+
}
2733

2834
/**
2935
* Create a new file and return a Resource from this file.
@@ -46,14 +52,17 @@ private static Resource createResource(String filename)
4652
return null ;
4753
}
4854
}
49-
5055
private static Injector createInjector() {
51-
return Guice.createInjector(new AhgRuntimeModule());
56+
if (isStandalone) {
57+
AhgStandaloneSetup gs = new AhgStandaloneSetup();
58+
return gs.createInjectorAndDoEMFRegistration();
59+
} else {
60+
return Guice.createInjector(new AhgRuntimeModule());
61+
}
5262
}
53-
5463

5564
/**
56-
* This method serialize a Divine System in the file {@code filename}
65+
* This method serialize a AHG System in the file {@code filename}
5766
* @param system The root of Gal system
5867
* @param filename The output filename.
5968
*/

0 commit comments

Comments
 (0)