Package org.bladerunnerjs.model

Examples of org.bladerunnerjs.model.Asset


            if(assetPlugin.canHandleAsset(assetFile, assetLocation)) {
              String assetFilePath = assetFile.getAbsolutePath();
             
              if(!cachedAssets.containsKey(assetFilePath)) {
                try {
                  Asset createdAsset = assetPlugin.createAsset(assetFile, assetLocation);
                  assetLocation.root().logger(this.getClass()).debug("creating new asset for the path '%s'",
                      createdAsset.getAssetPath());
                  String assetPrimaryRequirePath = createdAsset.getPrimaryRequirePath();
                 
                  if (createdAsset instanceof SourceModule && createdAsset.assetLocation().assetContainer().isNamespaceEnforced()) {
                    String relativePathFromAssetContainer = RelativePathUtility.get(assetLocation.root().getFileInfoAccessor(), createdAsset.assetLocation().assetContainer().dir(), createdAsset.dir());
                    String relativeRequirePathPathFromAssetContainer = StringUtils.substringAfter(relativePathFromAssetContainer, "/"); // strip of 'src/' at the start of the relative path
                    String appRequirePrefix = assetLocation.assetContainer().app().getRequirePrefix();
                    String createdAssetContainerRequirePrefix = createdAsset.assetLocation().assetContainer().requirePrefix();
                    if (relativeRequirePathPathFromAssetContainer.startsWith(appRequirePrefix) && !relativeRequirePathPathFromAssetContainer.startsWith(createdAssetContainerRequirePrefix)) {
                      InvalidRequirePathException wrappedRequirePathException = new InvalidRequirePathException(
                          "The source module at '"+createdAsset.getAssetPath()+"' is in an invalid location. "+
                          "It's require path starts with the apps require prefix ('"+appRequirePrefix+"') which suggests it's require path is intended to be '"+createdAssetContainerRequirePrefix+"'. "+
                          "The require path defined by the source modules location is '"+relativeRequirePathPathFromAssetContainer+"'. Either it's package structure should be '"+createdAssetContainerRequirePrefix+"/*' or "+
                          "remove the folders '"+relativeRequirePathPathFromAssetContainer+"' to allow the require prefix to be calculated automatically.");
                      throw new RuntimeException(wrappedRequirePathException);
                    }
                  }
                 
                 
                  if (assetPrimaryRequirePath != null) {
                    assetLocation.root().logger(this.getClass()).debug("asset at '%s' is a '%s' and it's primary require path is '%s'",
                        createdAsset.getAssetPath(), createdAsset.getClass().getSimpleName(), assetPrimaryRequirePath);
                  } else {
                    assetLocation.root().logger(this.getClass()).debug("asset at '%s' is a '%s'",
                        createdAsset.getAssetPath(), createdAsset.getClass().getSimpleName());
                  }
                  cachedAssets.put(assetFilePath, createdAsset);
                }
                catch (AssetFileInstantationException e) {
                  throw new RuntimeException(e);
                }
              }
             
              Asset asset = cachedAssets.get(assetFilePath);
              if(asset instanceof SourceModule) {
                assets.sourceModules.add((SourceModule) asset);
              }
              else if(asset instanceof LinkedAsset) {
                assets.linkedAssets.add((LinkedAsset) asset);
View Full Code Here


          startTag.toString() + "'.  Root element should have " + idMessage + ".");
    }
   
    htmlAsset.assetLocation().assertIdentifierCorrectlyNamespaced(identifier);
   
    Asset assetWithDuplicateId = identifiers.get(identifier);
    if(assetWithDuplicateId == null){
      identifiers.put(identifier, htmlAsset);
    }else{
      throw new NamespaceException("HTML template found with a duplicate identifier: '" +
            identifier + "'. The same identifier is used for the file:\n'"
            + assetWithDuplicateId.getAssetPath()
            + "'.");
    }
  }
View Full Code Here

TOP

Related Classes of org.bladerunnerjs.model.Asset

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.