Package juzu.impl.asset

Examples of juzu.impl.asset.AssetDeployment


    }
  }

  private LinkedHashMap<String, Chunk.Property<String>> process(List<AssetMetaData> data) throws Exception {
    LinkedHashMap<String, Chunk.Property<String>> assets = new LinkedHashMap<String, Chunk.Property<String>>();
    AssetDeployment deployment = assetManager.createDeployment();
    for (AssetMetaData script : data) {

      // Validate and resolve asset resources
      String[] a = new String[] { script.getValue(), script.getMinified() };
      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 {
              resource = url;
            }
          } else if (location == AssetLocation.SERVER) {
            if (!value.startsWith("/")) {
              URL url = resolve(AssetLocation.SERVER, "/" + value);
              if (url == null) {
                throw new Exception("Could not resolve server asset " + value);
              }
            }
            resource = null;
          } else {
            resource = null;
          }
        } else {
          resource = null;
        }
        resources[i] = resource;
      }


      //
      deployment.addAsset(script.getId(), script.getType(), script.getLocation(), a[0], script.getHeader(), a[1], script.getMaxAge(), resources[0], script.getDependencies());
      assets.put(script.getId(), new Chunk.Property<String>(script.getId(), PropertyType.ASSET));
    }

    // Should be true
    deployment.deploy();

    //
    return assets;
  }
View Full Code Here

TOP

Related Classes of juzu.impl.asset.AssetDeployment

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.