org.wso2.carbon.registry.core.Resource.setContentStream()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(103)

本文整理了Java中org.wso2.carbon.registry.core.Resource.setContentStream方法的一些代码示例,展示了Resource.setContentStream的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Resource.setContentStream方法的具体详情如下:
包路径:org.wso2.carbon.registry.core.Resource
类名称:Resource
方法名:setContentStream

Resource.setContentStream介绍

暂无

代码示例

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.reporting

try {
  Resource resource = registry.newResource();
  resource.setContentStream(new ByteArrayInputStream(stream.toByteArray()));
  if (type.toLowerCase().equals("pdf")) {
    resource.setMediaType("application/pdf");

代码示例来源:origin: org.apache.stratos/org.apache.stratos.manager.services.mgt

newResource.setContentStream(new FileInputStream(file));
registry.put(fileRegistryPath, newResource);

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.jcr

property.setProperty(name,value.toString());
}  else if (type.equals("is")) {
  property.setContentStream((InputStream)value);
} else if (type.equals("long")) {
  property.setContent(String.valueOf(((Long) value).longValue()));

代码示例来源:origin: org.wso2.carbon.appmgt/org.wso2.carbon.appmgt.impl

public String addIcon(String resourcePath, Icon icon) throws AppManagementException {
  try {
    Resource thumb = registry.newResource();
    thumb.setContentStream(icon.getContent());
    thumb.setMediaType(icon.getContentType());
    registry.put(resourcePath, thumb);
    if(tenantDomain.equalsIgnoreCase(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME)){
    return RegistryConstants.PATH_SEPARATOR + "registry"
        + RegistryConstants.PATH_SEPARATOR + "resource"
        + RegistryConstants.PATH_SEPARATOR + "_system"
        + RegistryConstants.PATH_SEPARATOR + "governance"
        + resourcePath;
    }
    else{
      return "/t/"+tenantDomain+ RegistryConstants.PATH_SEPARATOR + "registry"
          + RegistryConstants.PATH_SEPARATOR + "resource"
          + RegistryConstants.PATH_SEPARATOR + "_system"
          + RegistryConstants.PATH_SEPARATOR + "governance"
          + resourcePath;
    }
  } catch (RegistryException e) {
    handleException("Error while adding the icon image to the registry", e);
  }
  return null;
}

代码示例来源:origin: org.wso2.carbon.appmgt/org.wso2.carbon.appmgt.impl

public String addResourceFile(String resourcePath, FileContent resourceFile) throws AppManagementException {
  try {
    Resource thumb = registry.newResource();
    thumb.setContentStream(resourceFile.getContent());
    thumb.setMediaType(resourceFile.getContentType());
    registry.put(resourcePath, thumb);
    if(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equalsIgnoreCase(tenantDomain)){
      return RegistryConstants.PATH_SEPARATOR + "registry"
          + RegistryConstants.PATH_SEPARATOR + "resource"
          + RegistryConstants.PATH_SEPARATOR + "_system"
          + RegistryConstants.PATH_SEPARATOR + "governance"
          + resourcePath;
    }
    else{
      return "/t/"+tenantDomain+ RegistryConstants.PATH_SEPARATOR + "registry"
          + RegistryConstants.PATH_SEPARATOR + "resource"
          + RegistryConstants.PATH_SEPARATOR + "_system"
          + RegistryConstants.PATH_SEPARATOR + "governance"
          + resourcePath;
    }
  } catch (RegistryException e) {
    handleException("Error while adding the resource to the registry", e);
  }
  return null;
}

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.extensions

public void put(RequestContext requestContext) throws RegistryException {
  if (!CommonUtil.isUpdateLockAvailable()) {
    return;
  }
  CommonUtil.acquireUpdateLock();
  try {
    SchemaValidator validator = new SchemaValidator();
    Resource resource = requestContext.getResource();
    Object resourceContent = resource.getContent();
    if (resourceContent instanceof byte[]) {
      InputStream in = new ByteArrayInputStream((byte[]) resourceContent);
      validator.validate(in, resource);
    }
    resource.setContentStream(null);
//        requestContext.getRegistry().put(resource.getPath() ,resource);
  } finally {
    CommonUtil.releaseUpdateLock();
  }
}

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.extensions

public void importResource(RequestContext requestContext) throws RegistryException {
  if (!CommonUtil.isUpdateLockAvailable()) {
    return;
  }
  CommonUtil.acquireUpdateLock();
  try {
    SchemaValidator validator = new SchemaValidator();
    Resource resource = requestContext.getResource();
    Object resourceContent = resource.getContent();
    if (resourceContent instanceof byte[]) {
      InputStream in = new ByteArrayInputStream((byte[]) resourceContent);
      validator.validate(in, resource);
    }
    resource.setContentStream(null);
    // requestContext.getRegistry().put(resource.getPath() ,resource);
  } finally {
    CommonUtil.releaseUpdateLock();
  }
}

代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.security.mgt

Resource scenarioResource = new ResourceImpl();
scenarioResource.
    setContentStream(bundleContext.getBundle().
        getResource("scenarios/" + scenarioId + "-policy.xml").openStream());
scenarioResource.setMediaType("application/policy+xml");

代码示例来源:origin: org.wso2.carbon.identity.framework/org.wso2.carbon.security.mgt

Resource scenarioResource = new ResourceImpl();
scenarioResource.
    setContentStream(bundleContext.getBundle().
        getResource("scenarios/" + scenarioId + "-policy.xml").openStream());
scenarioResource.setMediaType("application/policy+xml");

代码示例来源:origin: org.wso2.carbon.commons/org.wso2.carbon.reporting.template.core

registry.beginTransaction();
Resource reportFilesResource = registry.newResource();
reportFilesResource.setContentStream(input);
String location =  ReportConstants.REPORT_BASE_PATH +localPath+template.getTemplateName()+".jrxml";
 registry.put(location, reportFilesResource);

代码示例来源:origin: wso2/carbon-identity-framework

Resource scenarioResource = new ResourceImpl();
scenarioResource.
    setContentStream(bundleContext.getBundle().
        getResource("scenarios/" + scenarioId + "-policy.xml").openStream());
scenarioResource.setMediaType("application/policy+xml");

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.jcr

public Property setProperty(String s, InputStream inputStream) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
  RegistryJCRItemOperationUtil.checkRetentionPolicy(registrySession,getPath());
  RegistryJCRItemOperationUtil.checkRetentionHold(registrySession, getPath());
  registrySession.sessionPending();
  validatePropertyModifyPrivilege(s);
  Resource res = null;
  try {
    res = registrySession.getUserRegistry().newResource();
    if (inputStream != null) {
      res.setContentStream(inputStream);
      res.setProperty("registry.jcr.property.type", "input_stream");
      registrySession.getUserRegistry().put(nodePath + "/" + s, res);
      property = new RegistryProperty(nodePath + "/" + s, registrySession, s,inputStream);
    }
  } catch (RegistryException e) {
    String msg = "failed to resolve the path of the given node or violation of repository syntax " + this;
    log.debug(msg);
    throw new RepositoryException(msg, e);
  }
  isModified = true;
  return property;
}

代码示例来源:origin: org.wso2.greg/org.wso2.carbon.governance.samples.shutterbug

resource.setMediaType(JPEG_MIME);
try {
  resource.setContentStream(Utils.scaleImage(requestContext.getResource().getContentStream(),
      HEIGHT, WIDTH, QUALITY_PERCENTAGE));
} catch (Exception e) {

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.cmis

resource.setContentStream(contentStream.getStream());

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.cmis

fileNode.setContentStream(contentStream.getStream());

相关文章