Example #1
0
 static {
   // load implementations, which will register themselves
   ServiceLoader<Loadable> impls = ServiceLoader.load(Loadable.class);
   for (Loadable loader : impls) {
     // the ServiceLoader is lazy, so this iteration forces service loading
     LOG.debug("Loading: " + loader.getClass().getName());
     try {
       loader.load();
     } catch (Exception e) {
       if (LOG.isDebugEnabled()) {
         LOG.warn("Not loading URI patterns in " + loader.getClass().getName(), e);
       } else {
         LOG.warn("Not loading URI patterns in " + loader.getClass().getName());
       }
     }
   }
   LOG.debug("Registered repository URIs:\n\t" + Joiner.on("\n\t").join(REPO_PATTERNS.keySet()));
   LOG.debug("Registered dataset URIs:\n\t" + Joiner.on("\n\t").join(DATASET_PATTERNS.keySet()));
 }
 @Override
 public void load(Van van) {
   if (this.volume > van.freeVolume)
     System.out.println("This pack is bigger than free Van's volume");
   loader.load(van);
 }