コード例 #1
0
 public JarDataAndPath(String jarPath, Class<?> anchor, Object... namesAndValues) {
   this.data = Maps.<String, Object>makeMap(namesAndValues);
   this.jar = new ClassPathResource(jarPath, anchor);
   try {
     Assert.assertTrue(jar.getFile().exists());
   } catch (IOException e) {
     throw WrappedException.wrap(e);
   }
 }
 private static void putData(
     IArc4EclipseRepository repository,
     Iterable<Map<String, Object>> maps,
     String urlKey,
     IFunction1<String, String> urlMapper)
     throws IllegalAccessException {
   try {
     System.out.println("Data for " + urlKey);
     for (Map<String, Object> item : maps) {
       String rawUrl = (String) item.get(urlKey);
       if (rawUrl == null)
         throw new NullPointerException(
             MessageFormat.format(Arc4EclipseRepositoryConstants.cannotFindDataFor, urlKey, item));
       String url = urlMapper.apply(rawUrl);
       for (String key : item.keySet()) {
         Object value = item.get(key);
         repository.modifyData(url, key, value, Collections.<String, Object>emptyMap()).get();
       }
     }
   } catch (Exception e) {
     throw WrappedException.wrap(e);
   }
 }