Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/CollectionMonitor.java @ 7482:f8e1af4e2f69
Datacage recommendations: Sort outs to to generate consistent cache keys.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 31 Oct 2013 18:25:26 +0100 |
parents | fff862f4ef76 |
children | 5e38e2924c07 |
comparison
equal
deleted
inserted
replaced
7480:2a2e89c01588 | 7482:f8e1af4e2f69 |
---|---|
6 * documentation coming with Dive4Elements River for details. | 6 * documentation coming with Dive4Elements River for details. |
7 */ | 7 */ |
8 | 8 |
9 package org.dive4elements.river.artifacts; | 9 package org.dive4elements.river.artifacts; |
10 | 10 |
11 import java.util.Arrays; | |
11 import java.util.HashMap; | 12 import java.util.HashMap; |
12 import java.util.List; | 13 import java.util.List; |
13 import java.util.Map; | 14 import java.util.Map; |
14 | 15 |
15 import net.sf.ehcache.Cache; | 16 import net.sf.ehcache.Cache; |
132 * Get outputnames from current state (only the ones for which | 133 * Get outputnames from current state (only the ones for which |
133 * facets exist). | 134 * facets exist). |
134 */ | 135 */ |
135 private static final String [] extractOutputNames( | 136 private static final String [] extractOutputNames( |
136 D4EArtifact flys, | 137 D4EArtifact flys, |
137 CallContext context) | 138 CallContext context |
138 { | 139 ) { |
139 if (flys instanceof ChartArtifact) { | 140 if (flys instanceof ChartArtifact) { |
140 return new String[0]; | 141 return new String[0]; |
141 } | 142 } |
142 | 143 |
143 List<Output> outs = flys.getCurrentOutputs(context); | 144 List<Output> outs = flys.getCurrentOutputs(context); |
147 String[] names = new String[num]; | 148 String[] names = new String[num]; |
148 | 149 |
149 for (int i = 0; i < num; i++) { | 150 for (int i = 0; i < num; i++) { |
150 names[i] = outs.get(i).getName(); | 151 names[i] = outs.get(i).getName(); |
151 } | 152 } |
153 | |
154 // Sort them to make cache key generation consistent. | |
155 Arrays.sort(names); | |
152 | 156 |
153 return names; | 157 return names; |
154 } | 158 } |
155 | 159 |
156 | 160 |