1 package org.simantics.scl.commands;
3 import java.util.concurrent.ConcurrentHashMap;
5 import org.simantics.db.ReadGraph;
6 import org.simantics.scl.commands.internal.CommandImpl;
9 public class Commands {
10 private static final ConcurrentHashMap<String, Command> COMMAND_CACHE =
11 new ConcurrentHashMap<String, Command>();
14 * Returns a command object of given type. This method always succeeds,
15 * but may return a command object whose check-method always returns fail
16 * and commit will throw an exception.
18 public static Command get(ReadGraph graph, String name) {
19 Command command = COMMAND_CACHE.get(name);
21 command = CommandImpl.create(graph, name);
22 COMMAND_CACHE.put(name, command);