root/Weektaken2/Weektaak3/ESB/src/hanze/ga/wt3/xml/ESBDOMParser.java

366368
39
			this.buildFTPApp2Q(channelDef);
39
			this.buildFTPApp2Q(channelDef);
40
		}
40
		}
41
	}
41
	}
42
	
43
	/**
44
	 * Zorgt ervoor dat een Channel de juiste bron- en bestemmingsQueue heeft.
45
	 */
46
	private void linkQueueToChannel() {
47
		for (ESBQueue esbQueue : this.queues.values()) {
48
42
49
			// Link receiver
50
			Channel receiver = esbQueue.getqReceiverChannel();
51
			if (receiver instanceof App2Q) {
52
				((App2Q) receiver).setDestinationQueue(esbQueue);
53
			} else if (receiver instanceof Q2App) {
54
				((Q2App) receiver).setSourceQueue(esbQueue);
55
			}
56
57
			// Link sender
58
			Channel sender = esbQueue.getqSenderChannel();
59
			if (sender instanceof App2Q) {
60
				((App2Q) sender).setDestinationQueue(esbQueue);
61
			} else if (sender instanceof Q2App) {
62
				((Q2App) sender).setSourceQueue(esbQueue);
63
			}
64
		}
65
	}
66
67
	private void buildFTPApp2Q(Xml channel) {
68
		FTPApp2QChannel ftp = new FTPApp2QChannel();
69
70
		// Globale settings
71
		ftp.setChannelName(channel.child("name").content());
72
73
		// FTP Adapter waarden
74
		Xml adapterNode = channel.child("adapter");
75
		ftp.setFtpAddress(adapterNode.child("address").content());
76
		ftp.setFtpInitDir(adapterNode.child("init-dir").content());
77
		ftp.setFtpPassword(adapterNode.child("password").content());
78
		ftp.setFtpUserName(adapterNode.child("username").content());
79
		ftp.setChannelPort(adapterNode.child("port").content());
80
81
		// Zet in lijst
82
		this.channels.put(channel.child("name").content(), ftp);
83
	}
84
85
	/**
43
	/**
86
	 * Bouwen van ESB aan de hand van XML-bestand.
44
	 * Bouwen van ESB aan de hand van XML-bestand.
87
	 * 
45
	 * 
...
...
118
		}
76
		}
119
	}
77
	}
120
78
79
	private void buildFTPApp2Q(Xml channel) {
80
		FTPApp2QChannel ftp = new FTPApp2QChannel();
81
82
		// Globale settings
83
		ftp.setChannelName(channel.child("name").content());
84
85
		// FTP Adapter waarden
86
		Xml adapterNode = channel.child("adapter");
87
		ftp.setFtpAddress(adapterNode.child("address").content());
88
		ftp.setFtpInitDir(adapterNode.child("init-dir").content());
89
		ftp.setFtpPassword(adapterNode.child("password").content());
90
		ftp.setFtpUserName(adapterNode.child("username").content());
91
		ftp.setChannelPort(adapterNode.child("port").content());
92
93
		// Zet in lijst
94
		this.channels.put(channel.child("name").content(), ftp);
95
	}
96
121
	private void buildFTPQ2App(Xml channel) {
97
	private void buildFTPQ2App(Xml channel) {
122
		FTPQ2AppChannel ftp = new FTPQ2AppChannel();
98
		FTPQ2AppChannel ftp = new FTPQ2AppChannel();
123
99
...
...
271
		return queues;
247
		return queues;
272
	}
248
	}
273
249
250
	/**
251
	 * Zorgt ervoor dat een Channel de juiste bron- en bestemmingsQueue heeft.
252
	 */
253
	private void linkQueueToChannel() {
254
		for (ESBQueue esbQueue : this.queues.values()) {
255
256
			// Link receiver
257
			Channel receiver = esbQueue.getqReceiverChannel();
258
			if (receiver instanceof App2Q) {
259
				((App2Q) receiver).setDestinationQueue(esbQueue);
260
			} else if (receiver instanceof Q2App) {
261
				((Q2App) receiver).setSourceQueue(esbQueue);
262
			}
263
264
			// Link sender
265
			Channel sender = esbQueue.getqSenderChannel();
266
			if (sender instanceof App2Q) {
267
				((App2Q) sender).setDestinationQueue(esbQueue);
268
			} else if (sender instanceof Q2App) {
269
				((Q2App) sender).setSourceQueue(esbQueue);
270
			}
271
		}
272
	}
273
274
}
274
}