01: package com.jat.integration;
02:
03: import java.util.Random;
04:
05: import com.jat.business.BusinessObjectProperties;
06: import com.jat.business.BusinessObjectPropertyList;
07: import com.jat.business.MultiBusinessObjectProperties;
08: import com.jat.core.log.LogManager;
09: import java.util.Hashtable;
10:
11: /**
12: * <p>Title: JAT</p>
13: * <p>Description: </p>
14: * <p>Copyright: Copyright (c) 2004 -2005 Stefano Fratini (stefano.fratini@gmail.com)</p>
15: * <p>Distributed under the terms of the GNU Lesser General Public License, v2.1 or later</p>
16: * @author stf
17: * @version 1.1
18: */
19: public class DummyDataSource extends GenericDataSource {
20:
21: public void init(String name) throws IntegrationException {
22: }
23:
24: public BusinessObjectPropertyList getData(String name,
25: BusinessObjectProperties parameters)
26: throws IntegrationException {
27: LogManager.sendDebug("DummyObjectFactory::getSource: for "
28: + name);
29: BusinessObjectPropertyList ret = new BusinessObjectPropertyList();
30: BusinessObjectProperties res = null;
31: Random r = new Random();
32: int len = r.nextInt() % 100;
33: if (len < 0)
34: len = len * -1;
35: for (int i = 0; i < len; i++) {
36: res = new BusinessObjectProperties();
37: res.put("NAME", "dummy" + r.nextInt(2)); //+(i%2==0?"":"-")+r.nextLong());
38: res.put("DATE", "" + System.currentTimeMillis());
39: ret.addElement(res);
40: }
41: return ret;
42: }
43:
44: public BusinessObjectProperties execute(String name,
45: BusinessObjectProperties parameters)
46: throws IntegrationException {
47: throw new IntegrationException(this .getClass().getName()
48: + "::execute: method not implemented");
49: }
50:
51: public BusinessObjectPropertyList execute(
52: MultiBusinessObjectProperties multi)
53: throws IntegrationException {
54: throw new IntegrationException(this .getClass().getName()
55: + "::execute: method not implemented");
56: }
57:
58: protected void initDataSource() {
59: }
60:
61: protected Hashtable putInitProperties(Hashtable hash)
62: throws Exception {
63: return hash;
64: }
65:
66: public GenericOperationDefinition getEmptyOperationDefinition() {
67: return null;
68: }
69: }
|