congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
ArtifactContent
Code IndexAdd Tabnine to your IDE (free)

How to use
ArtifactContent
in
org.artificer.common

Best Java code snippets using org.artificer.common.ArtifactContent (Showing top 12 results out of 315)

origin: org.artificer/artificer-integration

  @Override
  public boolean allowExpansionFromArchive(ArtifactContent content, ArchiveContext archiveContext) {
    if (
        // core
        content.getFilename().endsWith(".xsd") || content.getFilename().endsWith(".wsdl") || content.getFilename().endsWith(".wspolicy")
        // Maven Facade support
        || content.getFilename().endsWith(".sha1") || content.getFilename().endsWith(".pom")) {
      return true;
    }
    if (content.getFilename().endsWith(".xml") && !content.getFilename().equals("pom.xml")) {
      // XML files, but not POMs
      return true;
    }
    return false;
  }
}
origin: org.artificer/artificer-integration

  /**
   * Since the build process is multi-step and parses the content multiple times, it's necessary to be given
   * the byte[] and provide on-demand ByteArrayInputStreams as needed.
   * 
   * @return InputStream
   */
  protected InputStream getContentStream() throws FileNotFoundException {
    return artifactContent.getInputStream();
  }
}
origin: org.artificer/artificer-repository-hibernate

  private void processDocument(ArtificerDocumentArtifact artificerArtifact, ArtifactContent content) throws Exception {
    InputStream inputStream = null;
    try {
      if (content != null) {
        artificerArtifact.setContentSize(content.getSize());
        inputStream = content.getInputStream();
        String sha1Hash = DigestUtils.shaHex(inputStream);
        artificerArtifact.setContentHash(sha1Hash);
      } else {
        artificerArtifact.setContentSize(0);
        artificerArtifact.setContentHash("");
      }
    } finally {
      if (inputStream != null) {
        IOUtils.closeQuietly(inputStream);
      }
    }
  }
}
origin: org.artificer/artificer-integration

public static ArchiveContext createArchiveContext(ArtifactContent content) throws IOException {
  File archiveWorkDir = File.createTempFile(UUID.randomUUID().toString(), ".work");
  archiveWorkDir.delete();
  archiveWorkDir.mkdir();
  ArchiveUtils.unpackToWorkDir(content.getFile(), archiveWorkDir);
  return new ArchiveContext(content, archiveWorkDir);
}
origin: org.artificer/artificer-integration

@Override
public boolean isArchive(ArtifactContent content) {
  String filename = content.getFilename();
  return filename.endsWith(".jar") || filename.endsWith(".ear") || filename.endsWith(".war")
      || filename.endsWith(".zip");
}
origin: org.artificer/artificer-repository-hibernate

  @Override
  public void write(ArtificerDocumentArtifact artifact, ArtifactContent content, EntityManager entityManager) throws Exception {
    artifact.setContent(IOUtils.toByteArray(content.getInputStream()));
  }
}
origin: org.artificer/artificer-integration-kie

@Override
public ArtifactType detect(ArtifactContent content) {
  if (content.getFilename().equals("kmodule.xml")) {
    return ArtifactType.valueOf(KieJarModel.KieXmlDocument, true);
  }
  if (content.getFilename().endsWith(".bpmn") || content.getFilename().endsWith(".bpmn2")) {
    return ArtifactType.valueOf(KieJarModel.BpmnDocument, true);
  }
  if (content.getFilename().endsWith(".drl")) {
    return ArtifactType.valueOf(KieJarModel.DroolsDocument, true);
  }
  return null;
}
origin: org.artificer/artificer-repository-hibernate

  @Override
  public void write(ArtificerDocumentArtifact artifact, ArtifactContent content, EntityManager entityManager) throws Exception {
    InputStream inputStream = null;
    try {
      File out = new File(path + artifact.getUuid());
      out.createNewFile();
      inputStream = content.getInputStream();
      Files.copy(content.getInputStream(), out.toPath(), StandardCopyOption.REPLACE_EXISTING);
      artifact.setContentPath(path + artifact.getUuid());
    } finally {
      if (inputStream != null) {
        IOUtils.closeQuietly(inputStream);
      }
    }
  }
}
origin: org.artificer/artificer-integration-rtgov

@Override
public ArtifactType detect(ArtifactContent content) {
  return RTGovModel.detect(content.getFilename());
}
origin: org.artificer/artificer-integration-kie

@Override
public boolean allowExpansionFromArchive(ArtifactContent content, ArchiveContext archiveContext) {
  if (archiveContext.isExtendedTypeArchive(KieJarModel.TYPE_ARCHIVE)) {
    String filename = content.getFilename();
    if (filename.endsWith(".bpmn") || filename.endsWith(".bpmn2") || filename.endsWith(".drl")) {
      return true;
    }
  }
  return super.allowExpansionFromArchive(content, archiveContext);
}
origin: org.artificer/artificer-integration

@Override
public ArtifactType detect(ArtifactContent content, ArchiveContext archiveContext) {
  if (archiveContext.isExpandedFromArchive()) {
    return detect(content);
  }
  if (content.getFilename().endsWith(".zip")) {
    return ArtifactType.valueOf("ZipArchive", true);
  }
  return null;
}
origin: org.artificer/artificer-integration

@Override
public ArtifactType detect(ArtifactContent content) {
  String filename = content.getFilename().toLowerCase();
  if (filename.endsWith(".xml")) {
    return ArtifactType.XmlDocument();
  } else if (filename.endsWith(".wsdl")) {
    return ArtifactType.WsdlDocument();
  } else if (filename.endsWith(".xsd")) {
    return ArtifactType.XsdDocument();
  } else if (filename.endsWith(".wspolicy")) {
    return ArtifactType.PolicyDocument();
  } else if (!isArchive(content)) {
    // Don't allow archives within archives to become documents!  Only process if explicitly OK'd by another
    // detector (JavaArtifactTypeDetector, etc.).
    return ArtifactType.Document();
  } else {
    return null;
  }
}
org.artificer.commonArtifactContent

Javadoc

When S-RAMP is handed content's InputStream, it needs to be read multiple times (multiple times in the extensions, then again for persistence), some of which automatically close the stream. Further, we don't want to trust that custom extensions will always "do the right thing" and call #reset. So, this object is passed around throughout the process. Using a temp file, it creates on-demand streams.

Most used methods

  • getFilename
    Obtain the artifact's filename.
  • getInputStream
    Obtain this artifact's InputStream, created on-demand.
  • getFile
    Obtain a reference to the artifact's temporary File on the filesystem.
  • getSize

Popular in Java

  • Finding current android device location
  • scheduleAtFixedRate (Timer)
  • getSharedPreferences (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Reference (javax.naming)
  • Sublime Text for Python
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now