Package com.github.dandelion.core

Examples of com.github.dandelion.core.DandelionException


    }
    catch (IOException e) {
      StringBuilder sb = new StringBuilder("The content pointed by the url ");
      sb.append(url);
      sb.append(" can't be read.");
      throw new DandelionException(sb.toString(), e);
    }
  }
View Full Code Here


    }
    catch (IOException e) {
      StringBuilder sb = new StringBuilder("The content pointed by the url ");
      sb.append(url);
      sb.append(" can't be read.");
      throw new DandelionException(sb.toString(), e);
    }
  }
View Full Code Here

    if (cycle != null) {
      StringBuilder sb = new StringBuilder("A cycle has been detected in the asset graph for the bundle ");
      sb.append(from.getName());
      sb.append(".");
      throw new DandelionException(sb.toString());
    }
  }
View Full Code Here

      StringBuilder sb = new StringBuilder("The asset ");
      sb.append(asu.toLog());
      sb.append(" configured with a '");
      sb.append(getLocationKey());
      sb.append("' location key has a blank location. Please correct this location in the corresponding JSON file.");
      throw new DandelionException(sb.toString());
    }

    return doGetLocation(asu, request);
  }
View Full Code Here

    // no available locations = no locations
    if (asu.getLocations() == null || asu.getLocations().isEmpty()) {
      StringBuilder msg = new StringBuilder("No location is configured for the asset ");
      msg.append(asu.toLog());
      msg.append(". Please add at least one location in the corresponding JSON file.");
      throw new DandelionException(msg.toString());
    }

    // Selecting location key
    String locationKey = null;

    if (asu.getLocations().size() == 1) {
      // use the unique location if needed
      locationKey = asu.getLocations().entrySet().iterator().next().getKey();
    }
    else {
      // otherwise search for the first matching location key among the
      // configured ones
      for (String searchedLocationKey : context.getConfiguration().getAssetLocationsResolutionStrategy()) {
        if (asu.getLocations().containsKey(searchedLocationKey)) {
          String location = asu.getLocations().get(searchedLocationKey);
          if (location != null && !location.isEmpty()) {
            locationKey = searchedLocationKey;
            break;
          }
        }
      }
    }
    LOG.trace("Location key '{}' selected for the asset {}", locationKey, asu.toString());
   
    Map<String, AssetLocator> locators = context.getAssetLocatorsMap();
    if (!locators.containsKey(locationKey)) {
      StringBuilder msg = new StringBuilder("The location key '");
      msg.append(locationKey);
      msg.append("' is not valid. Please choose a valid one among ");
      msg.append(locators.keySet());
      msg.append(".");
      throw new DandelionException(msg.toString());
    }

    // Otherwise check for the locator
    String location = null;
    AssetLocator locator = locators.get(locationKey);
View Full Code Here

      }
      else {
        StringBuilder sb = new StringBuilder("The protocol ");
        sb.append(url.getProtocol());
        sb.append(" is not supported.");
        throw new DandelionException(sb.toString());
      }
    }

    LOG.trace("{} resources found before filtering", resourcePaths.size());
    return filterResourcePaths(location, resourcePaths, excludedPaths, nameFilter, prefixFilter, suffixFilter);
View Full Code Here

    }
    catch (IOException e) {
      StringBuilder sb = new StringBuilder("The content pointed by the path ");
      sb.append(pathToFile);
      sb.append(" can't be read from an inputStream.");
      throw new DandelionException(sb.toString(), e);
    }
  }
View Full Code Here

      }
     
      StringBuilder sb = new StringBuilder("The content pointed by the url ");
      sb.append(url);
      sb.append(" can't be read.");
      throw new DandelionException(sb.toString(), e);
    }
  }
View Full Code Here

    try {
      resourcePaths = ResourceScanner.findResourcePaths(getPath(), getExcludedPaths(), null, ".json",
          isRecursive());
    }
    catch (IOException e) {
      throw new DandelionException("Something went wrong when scanning files in " + getPath(), e);
    }

    getLogger().debug("{} resources scanned inside the folder '{}'. Parsing to bundle...", resourcePaths.size(),
        getPath());

    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();

    for (String resourcePath : resourcePaths) {
      try {
        InputStream configFileStream = classLoader.getResourceAsStream(resourcePath);
        BundleStorageUnit bsu = mapper.readValue(configFileStream, BundleStorageUnit.class);
        getLogger().debug("Parsed {}", bsu);
        bundles.add(bsu);
      }
      catch (IOException e) {
        StringBuilder sb = new StringBuilder("The file '");
        sb.append(resourcePath);
        sb.append("' is wrongly formatted. Please correct it before continuing.");
        throw new DandelionException(sb.toString(), e);
      }
    }

    return bundles;
  }
View Full Code Here

    catch (Exception e) {
      StringBuilder sb = new StringBuilder("An exception occurred while applying the processor ");
      sb.append(getProcessorKey());
      sb.append(" on the asset ");
      sb.append(processingContext.getAsset().toLog());
      throw new DandelionException(sb.toString(), e);
    }
  }
View Full Code Here

TOP

Related Classes of com.github.dandelion.core.DandelionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.