Examples of AssetLocation


Examples of juzu.asset.AssetLocation

    JSON json = descriptor.getConfig().getJSON("config");

    if (json == null)
      return null;

    AssetLocation location = AssetLocation.APPLICATION;
    if (json.get("location") != null) {
      location = AssetLocation.valueOf(json.getString("location"));
    }

    switch (location) {
View Full Code Here

Examples of juzu.asset.AssetLocation

    List<AssetMetaData> abc = Collections.emptyList();
    if (assets != null && assets.getSize() > 0) {
      abc = new ArrayList<AssetMetaData>();
      for (String id : assets.names()) {
        JSON asset = assets.getJSON(id);
        AssetLocation location = AssetLocation.safeValueOf(asset.getString("location"));

        //
        if (location == null) {
          location = AssetLocation.APPLICATION;
        }
View Full Code Here

Examples of juzu.asset.AssetLocation

      URL[] resources = new URL[2];
      for (int i = 0;i < a.length; i++) {
        URL resource;
        String value = a[i];
        if (value != null) {
          AssetLocation location = script.getLocation();
          if (location == AssetLocation.APPLICATION) {
            URL url = resolve(AssetLocation.APPLICATION, value);
            if (url == null) {
              throw new Exception("Could not resolve application  " + value);
            } else {
View Full Code Here

Examples of juzu.asset.AssetLocation

  public Asset(String type, Map<String, Serializable> asset) {
    String id = (String)asset.get("id");
    String value = (String)asset.get("value");
    List<String> depends = (List<String>)asset.get("depends");
    AssetLocation location = AssetLocation.safeValueOf((String)asset.get("location"));
    Integer maxAge = (Integer)asset.get("maxAge");
    String minified = (String)asset.get("minified");
    Boolean header = (Boolean)asset.get("header");
    List<ElementHandle.Type> minifiersTypes = (List<ElementHandle.Type>)asset.get("minifier");
View Full Code Here

Examples of org.bladerunnerjs.model.AssetLocation

   
    try {
      List<Locale> supportedLocales = Arrays.asList(bundleSet.getBundlableNode().app().appConf().getLocales());
     
      for(Asset cssAsset : bundleSet.getResourceFiles(cssAssetPlugin)) {
        AssetLocation cssAssetLocation = cssAsset.assetLocation();
        String themeName = (cssAssetLocation instanceof ThemedAssetLocation) ? ((ThemedAssetLocation) cssAssetLocation).getThemeName() : "common";
       
        Locale assetLocale = Locale.createLocaleFromFilepath(".*_", cssAsset.getAssetName());
       
        if(assetLocale.isEmptyLocale()) {
View Full Code Here

Examples of org.bladerunnerjs.model.AssetLocation

    return seedAssetLocationDirectories;
  }
 
  @Override
  public AssetLocation createAssetLocation(AssetContainer assetContainer, String dirPath, Map<String, AssetLocation> assetLocationsMap) {
    AssetLocation assetLocation;
    File dir = assetContainer.file(dirPath);
   
    switch(dirPath) {
      case "resources":
        assetLocation = new ResourcesAssetLocation(assetContainer.root(), assetContainer, dir, assetLocationsMap.get("."));
        break;
     
      case "tests":
        assetLocation = new TestSourceAssetLocation(assetContainer.root(), assetContainer, dir, assetLocationsMap.get("."), assetLocationsMap.get("resources"), assetLocationsMap.get("src-test"));
        break;
     
      case "src-test":
        assetLocation = new SourceAssetLocation(assetContainer.root(), assetContainer, dir, assetLocationsMap.get("."));
        break;
     
      default:
        String parentLocationPath = RelativePathUtility.get(brjs.getFileInfoAccessor(), assetContainer.dir(), dir.getParentFile());
        AssetLocation parentAssetLocation = assetLocationsMap.get(parentLocationPath);
       
        if((parentAssetLocation instanceof ChildSourceAssetLocation) || (parentAssetLocation instanceof SourceAssetLocation)) {
          assetLocation = new ChildSourceAssetLocation(assetContainer.root(), assetContainer, dir, parentAssetLocation, parentAssetLocation);
        }
        else {
View Full Code Here

Examples of org.bladerunnerjs.model.AssetLocation

    return seedAssetLocationDirectories;
  }
 
  @Override
  public AssetLocation createAssetLocation(AssetContainer assetContainer, String dirPath, Map<String, AssetLocation> assetLocationsMap) {
    AssetLocation assetLocation;
    File dir = assetContainer.file(dirPath);
   
   
    switch(dirPath) {
      case ".":
        assetLocation = (assetContainer instanceof JsLib) ? new BRJSConformantJsLibRootAssetLocation(assetContainer.root(), assetContainer, dir, null) :
          new BRJSConformantRootAssetLocation(assetContainer.root(), assetContainer, dir, null);
        break;
     
      case "resources":
        if (assetContainer instanceof Blade) {
          assetLocation = new BladeResourcesAssetLocation(assetContainer.root(), assetContainer, dir, assetLocationsMap.get("."));
        } else {
          assetLocation = new ResourcesAssetLocation(assetContainer.root(), assetContainer, dir, assetLocationsMap.get("."));
        }
        break;
     
      case "src":
        assetLocation = new SourceAssetLocation(assetContainer.root(), assetContainer, dir, assetLocationsMap.get("."), assetLocationsMap.get("resources"));
        break;
     
      case "src-test":
        assetLocation = new SourceAssetLocation(assetContainer.root(), assetContainer, dir, assetLocationsMap.get("."));
        break;
     
      default:
        if(dirPath.startsWith("themes")){
         
          String themeName = dirPath.substring(7);
          assetLocation = new ResourcesAssetLocation(assetContainer.root(), assetContainer, dir, assetLocationsMap.get("."), themeName);
          break;
        }
       
        String parentLocationPath = RelativePathUtility.get(brjs.getFileInfoAccessor(), assetContainer.dir(), dir.getParentFile());
        AssetLocation parentAssetLocation = assetLocationsMap.get(parentLocationPath);
       
        if((parentAssetLocation instanceof ChildSourceAssetLocation) || (parentAssetLocation instanceof SourceAssetLocation)) {
          assetLocation = new ChildSourceAssetLocation(assetContainer.root(), assetContainer, dir, parentAssetLocation, parentAssetLocation);
        }
        else {
View Full Code Here

Examples of org.bladerunnerjs.model.AssetLocation

 
  private String getTargetPath(File imageFile) throws ContentProcessingException
  {

    Node firstAncestorNode = brjs.locateFirstAncestorNode(imageFile);
    AssetLocation assetLocation  = null;
    AssetContainer assetContainer = null;
    if (firstAncestorNode instanceof AssetLocation){
       assetLocation = (AssetLocation)firstAncestorNode;
       assetContainer = assetLocation.assetContainer();
    } else {
      assetContainer = (AssetContainer) firstAncestorNode;
      assetLocation = assetContainer.assetLocation(".");
    }
    String targetPath = null;
   
    File assetLocationParentDir = assetLocation.dir().getParentFile();
    BRJS root = assetContainer.root();
    try {
      if(assetContainer instanceof Aspect) {
        Aspect aspect = (Aspect) assetContainer;
        if (assetLocation instanceof ThemedAssetLocation && assetLocationParentDir.getName().equals("themes")) {
          ThemedAssetLocation theme = (ThemedAssetLocation) assetLocation;
          String resourcePath = RelativePathUtility.get(root.getFileInfoAccessor(), theme.dir(), imageFile);
          targetPath = cssResourceContentPathParser.createRequest(CssResourceContentPlugin.ASPECT_THEME_REQUEST, ((Aspect) assetContainer).getName(), theme.dir().getName(), resourcePath);
        } else {
          String resourcePath = RelativePathUtility.get(root.getFileInfoAccessor(), assetContainer.dir(), imageFile);
          targetPath = cssResourceContentPathParser.createRequest(CssResourceContentPlugin.ASPECT_RESOURCE_REQUEST, aspect.getName(), resourcePath);
        }
      }
      else if(assetContainer instanceof Bladeset) {
        Bladeset bladeset = (Bladeset) assetContainer;
        if (assetLocation instanceof ThemedAssetLocation && assetLocationParentDir.getName().equals("themes")) {
            ThemedAssetLocation theme = (ThemedAssetLocation) assetLocation;
            String resourcePath = RelativePathUtility.get(root.getFileInfoAccessor(), theme.dir(), imageFile);
           
            targetPath = cssResourceContentPathParser.createRequest(CssResourceContentPlugin.BLADESET_THEME_REQUEST, bladeset.getName(), theme.dir().getName(), resourcePath);
        } else {
          String resourcePath = RelativePathUtility.get(root.getFileInfoAccessor(), bladeset.dir(), imageFile);
          targetPath = cssResourceContentPathParser.createRequest(CssResourceContentPlugin.BLADESET_RESOURCE_REQUEST, bladeset.getName(), resourcePath);
        }
      }
      else if(assetContainer instanceof Blade) {
        Blade blade = (Blade) assetContainer;
        Bladeset bladeset = blade.parent();
        if (assetLocation instanceof ThemedAssetLocation && assetLocationParentDir.getName().equals("themes")) {
            ThemedAssetLocation theme = (ThemedAssetLocation) assetLocation;
            String resourcePath = RelativePathUtility.get(root.getFileInfoAccessor(), theme.dir(), imageFile);
           
            targetPath = cssResourceContentPathParser.createRequest(CssResourceContentPlugin.BLADE_THEME_REQUEST, bladeset.getName(), blade.getName(), theme.dir().getName(), resourcePath);
        } else {
          String resourcePath = RelativePathUtility.get(root.getFileInfoAccessor(), blade.dir(), imageFile);
          targetPath = cssResourceContentPathParser.createRequest(CssResourceContentPlugin.BLADE_RESOURCE_REQUEST, bladeset.getName(), blade.getName(), resourcePath);
        }
      }
      else if(assetContainer instanceof Workbench) {
        Workbench workbench = (Workbench) assetContainer;
        Blade blade = workbench.parent();
        Bladeset bladeset = blade.parent();
       
        if (assetLocation instanceof ThemedAssetLocation && assetLocationParentDir.getName().equals("themes")) {
          String resourcePath = RelativePathUtility.get(root.getFileInfoAccessor(), assetLocation.file("resources"), imageFile);
          targetPath = cssResourceContentPathParser.createRequest(CssResourceContentPlugin.WORKBENCH_RESOURCE_REQUEST, bladeset.getName(), blade.getName(), resourcePath);
        } else {
          String resourcePath = RelativePathUtility.get(root.getFileInfoAccessor(), workbench.dir(), imageFile);
          targetPath = cssResourceContentPathParser.createRequest(CssResourceContentPlugin.WORKBENCH_RESOURCE_REQUEST, bladeset.getName(), blade.getName(), resourcePath);
        }
View Full Code Here

Examples of org.bladerunnerjs.model.AssetLocation

    return verifierChainer;
  }
 
  public VerifierChainer sourceModuleHasAssetLocation(String sourceModulePath, String assetLocationPath) throws Exception {
    SourceModule sourceModule = (SourceModule)aspect.getLinkedAsset(sourceModulePath);
    AssetLocation assetLocation = aspect.assetLocation(assetLocationPath);
   
    assertEquals("Source module '" + sourceModulePath + "' did not have the asset location '" + assetLocationPath + "'.", assetLocation.dir().getPath(), sourceModule.assetLocation().dir().getPath());
   
    return verifierChainer;
  }
View Full Code Here

Examples of org.bladerunnerjs.model.AssetLocation

   
    assertEquals("Asset location '" + assetLocation + "' was not expected to have any dependent asset locations.", 0, dependentAssetLocations.size());
  }
 
  public void assetLocationHasDependencies(String assetLocationPath, String[] expectedAssetLocationDependencies) {
    AssetLocation assetLocation = assetContainer.assetLocation(assetLocationPath);
    if(assetLocation == null) {
      throw new RuntimeException("asset location '" + assetLocationPath + "' does not exist.");
    }
   
    List<AssetLocation> actualDependentAssetLocations = assetLocation.dependentAssetLocations();
   
    assertEquals("Asset location '" + assetLocationPath + "' was expected to have " + expectedAssetLocationDependencies.length + " dependent asset locations.",
      expectedAssetLocationDependencies.length, actualDependentAssetLocations.size());
   
    int i = 0;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.