Call the CreateFileInfos action on the server for the given asset

@param assetId
asset to create file infos for
@return The action operation object to pass to rest proxy.
@throws UnsupportedEncodingException
14479
public static EntityActionOperation createFileInfos(String assetId) {
        String encodedId;
        try {
            encodedId = URLEncoder.encode(assetId, "UTF-8");
        } catch (UnsupportedEncodingException ex) {
            // This can never happen unless JVM is broken
            throw new RuntimeException(ex);
        }
        return new DefaultActionOperation("CreateFileInfos").addQueryParameter(
                "assetid", "'" + encodedId + "'");
    }
32741
public static AssetVersionCreator creator(final String pathServiceSid, 
                                              final String pathAssetSid, 
                                              final String path, 
                                              final AssetVersion.Visibility visibility) {
        return new AssetVersionCreator(pathServiceSid, pathAssetSid, path, visibility);
    }
1127276
void executeAction( Action action ) throws PluginException {

		try {
			switch( action.actionType ) {
			case DELETE:
				this.logger.fine( "Deleting " + action.parameter + "..." );
				File f = new File( action.parameter );
				Utils.deleteFilesRecursively( f );
				break;

			case DOWNLOAD:
				this.logger.fine( "Downloading " + action.parameter + "..." );
				URI uri = UriUtils.urlToUri( action.parameter );
				File targetFile = new File( System.getProperty( "java.io.tmpdir" ), TMP_FILE );
				InputStream in = null;
				try {
					in = uri.toURL().openStream();
					Utils.copyStream( in, targetFile );

				} finally {
					Utils.closeQuietly( in );
				}

				break;

			case MOVE:
				List<String> parts = Utils.splitNicely( action.parameter, "->" );
				if( parts.size() != 2 ) {
					this.logger.warning( "Invalid syntax for 'move' action. " + action.parameter );
				} else {
					File source = new File( parts.get( 0 ));
					File target = new File( parts.get( 1 ));
					this.logger.fine( "Moving " + source + " to " + target + "..." );
					if( ! source.renameTo( target ))
						throw new IOException( source + " could not be moved to " + target );
				}

				break;

			case COPY:
				parts = Utils.splitNicely( action.parameter, "->" );
				if( parts.size() != 2 ) {
					this.logger.warning( "Invalid syntax for 'copy' action. " + action.parameter );
				} else {
					File source = new File( parts.get( 0 ));
					File target = new File( parts.get( 1 ));
					this.logger.fine( "Copying " + source + " to " + target + "..." );
					Utils.copyStream( source, target );
				}

				break;

			default:
				this.logger.fine( "Ignoring the action..." );
				break;
			}

		} catch( Exception e ) {
			throw new PluginException( e );
		}
	}
60978
private static AssetLink createAssetLinkForImageAsset(long assetId) {
    AssetLink assetLink = new AssetLink();
    ImageAsset imageAsset = new ImageAsset();
    imageAsset.setAssetId(assetId);
    assetLink.setAsset(imageAsset);
    return assetLink;
  }
1079561
public function variantsAction(string $assetSourceIdentifier, string $assetProxyIdentifier, string $overviewAction): void
    {
        if (!isset($this->assetSources[$assetSourceIdentifier])) {
            throw new \RuntimeException('Given asset source is not configured.', 1509632166);
        }

        $assetSource = $this->assetSources[$assetSourceIdentifier];
        $assetProxyRepository = $assetSource->getAssetProxyRepository();

        try {
            $assetProxy = $assetProxyRepository->getAssetProxy($assetProxyIdentifier);
            $asset = $this->persistenceManager->getObjectByIdentifier($assetProxy->getLocalAssetIdentifier(), Asset::class);

            /** @var VariantSupportInterface $originalAsset */
            $originalAsset = ($asset instanceof AssetVariantInterface ? $asset->getOriginalAsset() : $asset);

            $variantInformation = array_map(static function (AssetVariantInterface $imageVariant) {
                return (new ImageMapper($imageVariant))->getMappingResult();
            }, $originalAsset->getVariants());

            $this->view->assignMultiple([
                'assetProxy' => $assetProxy,
                'asset' => $originalAsset,
                'assetSource' => $assetSource,
                'imageProfiles' => $this->imageProfilesConfiguration,
                'overviewAction' => $overviewAction,
                'originalInformation' => (new ImageMapper($asset))->getMappingResult(),
                'variantsInformation' => $variantInformation
            ]);
        } catch (AssetNotFoundExceptionInterface $e) {
            $this->throwStatus(404, 'Original asset not found');
        } catch (AssetSourceConnectionExceptionInterface $e) {
            $this->view->assign('connectionError', $e);
        }
    }
583274
private void writeMultiPart(final String assetId, final AttachmentSummary attSummary,
                                HttpURLConnection connection) throws IOException, BadVersionException, RequestFailureException {
        final File fileToWrite = attSummary.getFile();

        String boundary = "---------------------------287032381131322";

        byte[] startBytes = getStartBytes(attSummary, boundary);
        byte[] endBytes = getEndBytes(attSummary, boundary);

        long fileSize;
        fileSize = AccessController.doPrivileged(new PrivilegedAction<Long>() {
            @Override
            public Long run() {
                return attSummary.getFile().length();
            }
        });
        long contentLength = startBytes.length + endBytes.length + fileSize;

        connection.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary);

        connection.setRequestProperty("Content-Length", "" + contentLength);
        connection.setRequestMethod("POST");
        connection.setDoOutput(true);

        OutputStream httpStream = connection.getOutputStream();

        // Write the header
        httpStream.write(startBytes);
        httpStream.flush();

        FileInputStream inputStream = null;
        try {
            try {
                inputStream = AccessController.doPrivileged(new PrivilegedExceptionAction<FileInputStream>() {
                    @Override
                    public FileInputStream run() throws IOException {
                        return new FileInputStream(fileToWrite);
                    }
                });
            } catch (PrivilegedActionException e) {
                throw (IOException) e.getCause();
            }
            byte[] buffer = new byte[1024];
            int read;
            int total = 0;
            while ((read = inputStream.read(buffer)) != -1) {
                httpStream.write(buffer, 0, read);
                total += read;
            }
            if (total != fileSize) {
                throw new IOException("File size was " + fileSize + " but we only uploaded " + total + " bytes");
            }
            httpStream.flush();
        } finally {
            if (inputStream != null) {
                inputStream.close();
            }
        }

        httpStream.write(endBytes);
        httpStream.flush();
        httpStream.close();

    }
479724
def create_stream(self, stream_id, sandbox=None):
        
        if sandbox is not None:
            raise NotImplementedError

        logging.debug("Creating asset stream {}".format(stream_id))

        if stream_id in self.streams:
            raise StreamAlreadyExistsError("Stream with id '{}' already exists".format(stream_id))

        stream = AssetStream(channel=self, stream_id=stream_id, calculated_intervals=None,
                             last_accessed=utcnow(), last_updated=utcnow(), sandbox=sandbox)
        self.streams[stream_id] = stream
        return stream
819941
public CMAAsset publish(CMAAsset asset) {
    assertNotNull(asset, "asset");
    final String assetId = getResourceIdOrThrow(asset, "asset");
    final String spaceId = getSpaceIdOrThrow(asset, "asset");
    final String environmentId = asset.getEnvironmentId();

    return service.publish(
        asset.getSystem().getVersion(),
        spaceId,
        environmentId,
        assetId
    ).blockingFirst();
  }
290025
@Override
    public T add(final Asset asset, final String target, final String name) throws IllegalArgumentException {
        Validate.notNull(target, "target must be specified");
        final ArchivePath path = ArchivePaths.create(target);
        return this.add(asset, path, name);
    }
46167
@Override
    public T add(Asset asset, ArchivePath path) {
        Validate.notNull(asset, "No asset was specified");
        Validate.notNull(path, "No path was specified");

        return addAsset(path, asset);
    }
852465
def create(cls, result_id=None, summary=None, file_modified_at=None):
        """"""
        asset = cls(result_id, summary, file_modified_at)

        db.session.add(asset)
        db.session.commit()

        return asset
932789
public static UploadNotificationAction from(NotificationCompat.Action action) {
        return new UploadNotificationAction(action.icon, action.title, action.actionIntent);
    }
753047
public void copySingleFile(File asset) {
        try {
            if ( !asset.isDirectory() ) {
                String targetPath = config.getDestinationFolder().getCanonicalPath() + File.separatorChar + assetSubPath(asset);
                LOGGER.info("Copying single asset file to [{}]", targetPath);
                copyFile(asset, new File(targetPath));
            } else {
                LOGGER.info("Skip copying single asset file [{}]. Is a directory.", asset.getPath());
            }
        } catch (IOException io) {
            LOGGER.error("Failed to copy the asset file.", io);
        }
    }
1014113
private void compile(AssetInfo asset, File source, File target) throws ServiceException {
        File watched = watchedAssets.get(asset);
        if (watched == null) {
            if (isDevMode()) {
                new Thread(() -> {
                    try {
                        // avoid recursive compiles
                        if (isDevMode())
                            watchedAssets.put(asset, target);
                        doCompile(asset, source, target);
                    }
                    catch (Exception ex) {
                        logger.severeException(ex.getMessage(), ex);
                    }
                }).start();
            }
            else {
                doCompile(asset, source, target);
            }
        }
    }
872438
protected Manifest getJarManifest(String assetId) throws IOException {
        ZipFile repoZip = null;
        Manifest manifest = new Manifest();
        try {
            repoZip = createZipFile();
            ZipEntry entry = createFromRelative(assetId);

            if (null == entry) {
                return null;
            }

            // Input stream to the inner zip
            ZipInputStream zis = new ZipInputStream(repoZip.getInputStream(entry));
            ZipEntry innerEntry = zis.getNextEntry();
            while (null != innerEntry) {
                if ("meta-inf/manifest.mf".equalsIgnoreCase(innerEntry.getName())) {
                    manifest.read(zis);
                    break;
                }
                innerEntry = zis.getNextEntry();
            }
        } finally {
            if (repoZip != null) {
                repoZip.close();
            }
        }
        return manifest;
    }
1240230
function createAsset (commandOptions, { assetName, domainId, precision }) {
  return command(
    commandOptions,
    txHelper.addCommand(
      txHelper.emptyTransaction(),
      'createAsset',
      {
        assetName,
        domainId,
        precision
      }
    )
  )
}
1019214
@Override
    public T addAsWebResource(Asset resource, ArchivePath target) throws IllegalArgumentException {
        Validate.notNull(resource, "Resource should be specified");
        Validate.notNull(target, "Target should be specified");

        ArchivePath location = new BasicPath(getWebPath(), target);
        return add(resource, location);
    }