Project

General

Profile

« Previous | Next » 

Revision 42175

implemented generation of thumbnail

View differences:

DownloadServiceFeeder.java
104 104
		if (regularExpression != null) {
105 105
			downloadPlugin.setRegularExpression(regularExpression);
106 106
		}
107
		final Function<String, DownloadItem> applyDowunloadPlugin = input -> {
108
			if (input == null) {
109
				log.error("Input is null");
110
				return null;
111
			}
112
			if (input.equals(DownloadIntoObjectStoreAction.END_QUEUE_STRING)) return DownloadIntoObjectStoreAction.END_QUEUE;
107 113

  
108
		for (int i = 0; i < numberOfThreads; i++) {
109
			final Function<String, DownloadItem> applyDowunloadPlugin = input -> {
110
				if (input == null) {
111
					log.error("Input is null");
112
					return null;
114
			DownloadItem di = null;
115
			try {
116
				di = DownloadItem.newObjectfromJSON(input);
117

  
118
				if (downloadPlugin.retrieveUrl(di) == null) {
119
					di.setUrl(null);
120
					di.setOriginalUrl(null);
113 121
				}
114
				if (input.equals(DownloadIntoObjectStoreAction.END_QUEUE_STRING)) return DownloadIntoObjectStoreAction.END_QUEUE;
122
				return di;
123
			} catch (Throwable e) {
124
				reportException(pluginReport, di, e);
125
				log.error("Exception on transform item :" + input, e);
126
				return null;
127
			}
128
		};
115 129

  
116
				DownloadItem di = null;
117
				try {
118
					di = DownloadItem.newObjectfromJSON(input);
119

  
120
					if (downloadPlugin.retrieveUrl(di) == null) {
121
						di.setUrl(null);
122
						di.setOriginalUrl(null);
123
					}
124
					return di;
125
				} catch (Throwable e) {
126
					reportException(pluginReport, di, e);
127
					log.error("Exception on transform item :" + input, e);
128
					return null;
129
				}
130
			};
130
		for (int i = 0; i < numberOfThreads; i++) {
131 131
			responses.add(executor
132 132
					.submit(new DownloadWorker(itemsQueue, objStore, Protocols.valueOf(protocol), mimeType, connectTimeoutMs, readTimeoutMs, sleepTimeMs,
133 133
							applyDowunloadPlugin

Also available in: Unified diff