Examples of Asset


Examples of com.day.cq.dam.api.Asset

    @SuppressWarnings("PMD.CollapsibleIfStatements")
    public final void execute(WorkItem workItem, WorkflowSession wfSession, MetaDataMap metaData)
            throws WorkflowException {

        final Asset asset = getAssetFromPayload(workItem, wfSession.getSession());

        if (asset == null) {
            String wfPayload = workItem.getWorkflowData().getPayload().toString();
            String message = "execute: cannot process audio, asset [{" + wfPayload
                    + "}] in payload doesn't exist for workflow [{" + workItem.getId() + "}].";
            throw new WorkflowException(message);
        }

        final String assetMimeType = asset.getMimeType();
        if (assetMimeType == null || !assetMimeType.startsWith("audio/")) {
            if (!asset.getName().endsWith(".wav") || !asset.getName().endsWith(".mp3")
                    || !asset.getName().endsWith(".ogg")) {
                log.info("execute: asset [{}] is not of a audio mime type, asset ignored.", asset.getPath());
                return;
            }
        }

        File tmpDir = null;
        File tmpWorkingDir = null;
        FileOutputStream fos = null;
        InputStream is = null;
        FFMpegWrapper wrapper = null;
        try {
            // creating temp directory
            tmpDir = createTempDir(null);

            // creating temp working directory for ffmpeg
            tmpWorkingDir = createTempDir(getWorkingDir());

            // streaming file to temp directory
            final File tmpFile = new File(tmpDir, asset.getName().replace(' ', '_'));
            fos = new FileOutputStream(tmpFile);
            is = asset.getOriginal().getStream();
            IOUtils.copy(is, fos);

            processAudio(metaData, asset, tmpFile, wfSession);

            // get information about original audio file (size, video length,
            // ...)
            wrapper = new FFMpegWrapper(tmpFile, tmpWorkingDir);
            wrapper.setExecutableLocator(locator);

            final ResourceResolver resolver = getResourceResolver(wfSession.getSession());
            final Resource assetResource = asset.adaptTo(Resource.class);
            final Resource metadata = resolver.getResource(assetResource, JCR_CONTENT + "/" + METADATA_FOLDER);

            if (null != metadata) {

                final Node metadataNode = metadata.adaptTo(Node.class);
                metadataNode.setProperty(DC_EXTENT, wrapper.getInputDuration());

                metadataNode.getSession().save();
            } else {
                log.warn("execute: failed setting metdata for asset [{}] in workflow [{}], no metdata node found.",
                        asset.getPath(), workItem.getId());
            }

        } catch (IOException e) {
            throw new WorkflowException(e);
        } catch (RepositoryException e) {
View Full Code Here

Examples of com.day.cq.dam.api.Asset

    public static Map<String, Object> buildGenericResult(final Hit hit) throws RepositoryException {
        Map<String, Object> map = new LinkedHashMap<String, Object>();

        final Resource resource = hit.getResource();

        /**
         * Apply custom properties based on the "type"
         */

        // Assets
        final Asset asset = DamUtil.resolveToAsset(resource);
View Full Code Here

Examples of com.day.cq.dam.api.Asset

        if (DamUtil.isAsset(resource)) {
            // For assets, pick the configured rendition if it exists
            // If rendition does not exist, use original

            final Asset asset = DamUtil.resolveToAsset(resource);
            Rendition rendition = asset.getRendition(renditionPatternPicker);

            if (rendition == null) {
                log.warn("Could not find rendition [ {} ] for [ {} ]", renditionPatternPicker.toString(),
                        resource.getPath());
                rendition = asset.getOriginal();
            }

            final Resource renditionResource = request.getResourceResolver().getResource(rendition.getPath());

            final Image image = new Image(resource);
View Full Code Here

Examples of com.day.cq.dam.api.Asset

            for (final String path : paths) {
                // For each item in the WF Package, or if not a WF Package, path = payloadPath

                final Page page = pageManager.getContainingPage(path);
                final Asset asset = DamUtil.resolveToAsset(resourceResolver.getResource(path));

                Resource resource;

                if (page != null) {
                    // Page
                    resource = page.getContentResource();
                    log.trace("Candidate Page for setting replicateBy is [ {} ]", resource.getPath());
                } else if (asset != null) {
                    // DAM Asset
                    final Resource assetResource = resourceResolver.getResource(asset.getPath());
                    resource = assetResource.getChild(JcrConstants.JCR_CONTENT);
                    log.trace("Candidate Asset for setting replicateBy is [ {} ]", resource.getPath());
                } else {
                    // Some other resource
                    resource = resourceResolver.getResource(path);
View Full Code Here

Examples of com.elibom.jogger.asset.Asset

      return;
    }
   
    // load the asset
    requestPath = requestPath.replaceFirst(prefix, "");
    Asset asset = assetLoader.load(URLDecoder.decode(requestPath, "UTF-8"));
    if (asset == null) {
      chain.next();
      return;
    }
   
View Full Code Here

Examples of com.github.dandelion.core.asset.Asset

    }
  }
 
  public String getConfigurationFromPage(String page) {
    AssetCacheManager cacheManager = new AssetCacheManager(null);
    Asset asset = new Asset("dandelion-datatables", "0.10.0", AssetType.js);
    String cacheKey = cacheManager.generateCacheKey("http://" + SERVER_HOST + ":" + SERVER_PORT + "/thymeleaf/" + page, asset);
    String url = "http://" + SERVER_HOST + ":" + SERVER_PORT + DandelionServlet.DANDELION_ASSETS_URL + cacheKey;
    try {
      URL urlLocation = new URL(url);
      return ResourceUtils.getContentFromInputStream(urlLocation.openStream());
View Full Code Here

Examples of com.github.dandelion.core.asset.Asset

    }
  }
 
  public String getConfigurationFromPage(String page) {
    AssetCacheManager cacheManager = new AssetCacheManager(null);
    Asset asset = new Asset("dandelion-datatables", "0.10.0", AssetType.js);
    String cacheKey = cacheManager.generateCacheKey("http://" + SERVER_HOST + ":" + SERVER_PORT + "/" + page + ".jsp", asset);
    String url = "http://" + SERVER_HOST + ":" + SERVER_PORT + DandelionServlet.DANDELION_ASSETS_URL + cacheKey;
    try {
      URL urlLocation = new URL(url);
      return ResourceUtils.getContentFromInputStream(urlLocation.openStream());
View Full Code Here

Examples of com.google.gwt.maeglin89273.game.mengine.asset.Asset

  public JsonFile getJson(String path){
    return (JsonFile)getAsset(path);
  }
  public Asset getAsset(String path){
    path=prefix+path;
    Asset toReturn=assets.get(path);
    if(toReturn==null){
      String key=path.substring(path.lastIndexOf('/')+1, path.lastIndexOf('.'));
      toReturn=assets.get(key);
      if(toReturn==null){
        throw new IllegalArgumentException("The file \""+path+"\" is not found. " +
View Full Code Here

Examples of com.ibm.sbt.playground.assets.Asset

      }
    } else if(node.isAsset()) {
      if(action!=null) {
        action.updateTask(StringUtil.format("Importing Asset: {0}", node.getPath()));
      }
      Asset asset = loadAsset(source, root, (AssetNode) node);
      if(asset!=null && shouldImport(asset)) {
        saveAsset(source, root, (AssetNode)node, asset);
        count++;
      }
    }
View Full Code Here

Examples of com.l2client.asset.Asset

        AmbientLight ambLight = new AmbientLight();
        ambLight.setColor(new ColorRGBA(0.2f, 0.2f, 0.2f, 1f));
        rootNode.addLight(ambLight);
     

        Asset a = new Asset("/tile/121_177/121_177.jnv", "/tile/121_177/121_177.jnv");
        sin.getAssetManager().loadAsset(a, true);
        if(a.getBaseAsset() instanceof TiledNavMesh )
          NavTestHelper.debugShowMesh(assetManager, debugNodes,(TiledNavMesh) a.getBaseAsset());
       
        Asset b = new Asset("/tile/121_177/121_177.j3o", "/tile/121_177/121_177.j3o");
        sin.getAssetManager().loadAsset(b, true);
        if(b.getBaseAsset() instanceof Spatial ) {
          Spatial n = (Spatial)b.getBaseAsset();
//      Material mat = new Material(Singleton.get().getAssetManager().getJmeAssetMan(), "Common/MatDefs/Misc/Unshaded.j3md");
//          mat.setColor("Color", ColorRGBA.randomColor());
        Material mat = new Material(Singleton.get().getAssetManager().getJmeAssetMan(), "Common/MatDefs/Light/Lighting.j3md");
        mat.setBoolean("UseMaterialColors",true);   
        mat.setColor("Diffuse",ColorRGBA.randomColor());
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.