use of com.gpcoder.context.MyContext in project Java-Tutorial by gpcodervn.
the class ChainStart1 method main.
public static void main(String[] args) throws Exception {
// Create context
MyContext context = new MyContext();
context.setProperty("property-value");
context.put("custom-key", "custom-value");
// Get the command
Command command = new MyChain();
command.execute(context);
}
use of com.gpcoder.context.MyContext in project Java-Tutorial by gpcodervn.
the class ChainStart2 method main.
public static void main(String[] args) throws Exception {
// Create context
MyContext ctx = new MyContext();
ctx.setProperty("property-value");
ctx.put("custom-key", "custom-value");
// Get the catalog
Catalog catalog = new MyCatalog();
// Get the command
System.out.println("Execute the specific command: CMD_1");
Command command1 = catalog.getCommand(MyCommandNamed.CMD_1.name());
command1.execute(ctx);
System.out.println("\nExecute the specific chain: CHAIN_1");
Command chain1 = catalog.getCommand(MyCommandNamed.CHAIN_1.name());
chain1.execute(ctx);
}
use of com.gpcoder.context.MyContext in project Java-Tutorial by gpcodervn.
the class ChainStart3 method main.
public static void main(String[] args) throws Exception {
Command chain = new MyChain3();
chain.execute(new MyContext());
}
use of com.gpcoder.context.MyContext in project Java-Tutorial by gpcodervn.
the class ChainStart4 method main.
public static void main(String[] args) throws Exception {
// Create context
MyContext ctx = new MyContext();
ctx.setProperty("property-value");
ctx.put("custom-key", "custom-value");
// Get the catalog
Catalog catalog = new MyXMLCatalog().getCatalog();
// Get the command
System.out.println("Execute the specific command: CMD_1");
Command command1 = catalog.getCommand(MyCommandNamed.CMD_1.name());
command1.execute(ctx);
System.out.println("\nExecute the specific chain: CHAIN_1");
Command chain1 = catalog.getCommand(MyCommandNamed.CHAIN_1.name());
chain1.execute(ctx);
}