Révision 3738

TXM/trunk/bundles/org.txm.core/src/java/org/txm/functions/CommandsAPI.java (revision 3738)
80 80
		CommandsAPI.cmds.remove(cmd);
81 81
	}
82 82
	
83
	//FIXME: the source is not used, see if we decide to put it the TXMParameters or not, otherwise define a method TXMResult.setSource() or maybe better a method TXMResult.compute(TXMResul source)
84 83
	public Object call(String cmd, TXMResult source, TXMParameters parameters) {
85 84
		
86 85
		Command command = cmds.get(cmd);
......
94 93
		try {
95 94
			if (command.mandatoryParameters.containsAll(parameters.keySet())) {
96 95
				System.out.println("Computing "+command.cmd+"...");
97
				result = command.clazz.newInstance();
96
				//result = command.clazz.newInstance(null, source);
97
				result = command.clazz.getConstructor(String.class, TXMResult.class).newInstance(null, source);
98 98
				result.setParameters(parameters);
99
				if (result.canCompute())
99
				if (result.canCompute()) {
100 100
					result.compute();
101
				} else {
102
					System.out.println("Cannot compute result with "+cmd+" command and parameters: "+parameters);
103
				}
101 104
				//FIXME: debug
102 105
				System.out.println(result);
103 106
			} else {
104 107
				System.out.println("Failed to compute result with "+cmd+" command: missing some mandatory parameters: "+command.mandatoryParameters);
105 108
			}
106
		} catch (Exception e) {
109
		} catch (Throwable e) {
107 110
			System.out.println("Failed to compute result with "+cmd+" command and "+parameters+" parameters: "+e.getLocalizedMessage());
108 111
			Log.printStackTrace(e);
109 112
		}

Formats disponibles : Unified diff