congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
ExternalReferenceSPI
Code IndexAdd Tabnine to your IDE (free)

How to use
ExternalReferenceSPI
in
net.sf.taverna.t2.reference

Best Java code snippets using net.sf.taverna.t2.reference.ExternalReferenceSPI (Showing top 20 results out of 315)

origin: net.sf.taverna.t2.activities/external-tool-activity

protected InputStream getAsStream(ReferenceService referenceService, T2Reference t2Reference) {
  Identified identified = referenceService.resolveIdentifier(t2Reference, null, null);
  if (identified instanceof ReferenceSet) {
    ExternalReferenceSPI ref = ((ReferenceSet) identified).getExternalReferences().iterator().next();
    return ref.openStream(invocationContext);
  }
  return null;
}
origin: net.sf.taverna.t2.ui-components/results-view

  public int compare(ExternalReferenceSPI o1,
      ExternalReferenceSPI o2) {
    return (int) (o1.getResolutionCost() - o2
        .getResolutionCost());
  }
});
origin: net.sf.taverna.t2.core/reference-impl

  || ers.getResolutionCost() < cheapestReferenceCost) {
cheapestReference = ers;
cheapestReferenceCost = ers.getResolutionCost();
  .openStream(context), cheapestReference.getDataNature(), cheapestReference.getCharset());
origin: net.sf.taverna.t2/t2reference-impl

  || ers.getResolutionCost() < cheapestReferenceCost) {
cheapestReference = ers;
cheapestReferenceCost = ers.getResolutionCost();
  .openStream(context));
origin: net.sf.taverna.t2.ui-components/results-view

  if (externalReference.getDataNature().equals(ReferencedDataNature.TEXT)) {
    break;
FileOutputStream fileOutputStream = new FileOutputStream(targetFile);
InputStream openStream = externalReferences.get(0)
    .openStream(context);
IOUtils.copyLarge(openStream, fileOutputStream);
try {
origin: net.sf.taverna.t2.core/provenanceconnector

refElement.addContent(externalReference.getDataNature()
    .toString());
element.addContent(refElement);
origin: net.sf.taverna.t2.core/reference-impl

/**
 * Construct a new ReferenceSetImpl with the given set of external
 * references and identifier.
 * 
 * @param references
 *            the set of ExternalReferenceSPI which this reference set
 *            should contain initially
 * @param id
 *            the T2Reference to use, must be an instance of
 *            ReferenceSetT2ReferenceImpl so hibernate can make use of it as
 *            a compound primary key component
 */
public ReferenceSetImpl(Set<ExternalReferenceSPI> references,
    T2ReferenceImpl id) {
  setTypedId(id);
  this.externalReferences = references;
  
  //  Should be at least one - otherwise we cannot calculate the data size
  if (externalReferences != null && externalReferences.size() > 0){		
    // Just take the first ExternalReferenceSPI returned
    ExternalReferenceSPI externalReferenceSPI = externalReferences.toArray(new ExternalReferenceSPI[0])[0];
    approximateSizeInBytes = externalReferenceSPI.getApproximateSizeInBytes();
  }

}
origin: net.sf.taverna.t2/reference-impl

  || ers.getResolutionCost() < cheapestReferenceCost) {
cheapestReference = ers;
cheapestReferenceCost = ers.getResolutionCost();
  .openStream(context));
origin: net.sf.taverna.t2.lang/results

ReferencedDataNature erDataNature = ers.getDataNature();
if (!erDataNature.equals(ReferencedDataNature.UNKNOWN)) {
  dataNature = erDataNature;
origin: net.sf.taverna.t2.workbench.views/results

public static MagicMatch getMagicMatch(ExternalReferenceSPI externalReference, InvocationContext context) {
  InputStream inputStream = externalReference.openStream(context);
  byte[] bytes = null;
  MagicMatch magicMatch = null;
origin: net.sf.taverna.t2.ui-components/results-view

  public int compare(ExternalReferenceSPI o1,
      ExternalReferenceSPI o2) {
    return (int) (o1.getResolutionCost() - o2
        .getResolutionCost());
  }
});
origin: net.sf.taverna.t2/results

ReferencedDataNature erDataNature = ers.getDataNature();
if (!erDataNature.equals(ReferencedDataNature.UNKNOWN)) {
  dataNature = erDataNature;
origin: net.sf.taverna.t2.workbench.views/results

private String getMimeType(ExternalReferenceSPI externalReference, InvocationContext context) {
  if (!mimeTypes.containsKey(externalReference)) {
    InputStream inputStream = externalReference.openStream(context);
    try {
      byte[] bytes = new byte[64];
      inputStream.read(bytes);
      mimeTypes.put(externalReference, Magic.getMagicMatch(bytes, true).getMimeType());
    } catch (IOException e) {
      e.printStackTrace();
      logger.debug("Failed to read from stream to determine mimetype", e);
    } catch (MagicParseException e) {
      e.printStackTrace();
      logger.debug("Error calling mime magic", e);
    } catch (MagicMatchNotFoundException e) {
      e.printStackTrace();
      logger.debug("Error calling mime magic", e);
    } catch (MagicException e) {
      e.printStackTrace();
      logger.debug("Error calling mime magic", e);
    } finally {
      try {
        inputStream.close();
      } catch (IOException e) {
        e.printStackTrace();
        logger.debug("Failed to close stream after determining mimetype", e);
      }
    }
  }
  return mimeTypes.get(externalReference);
}
origin: net.sf.taverna.t2.ui-components/results-view

  public int compare(ExternalReferenceSPI o1,
      ExternalReferenceSPI o2) {
    return (int) (o1.getResolutionCost() - o2
        .getResolutionCost());
  }
});
origin: net.sf.taverna.t2/t2reference-impl

if (initialBuilder != null && sourceReference != null) {
  ExternalReferenceSPI builtReference = initialBuilder
      .createReference(sourceReference.openStream(context),
          context);
  results.add(builtReference);
origin: net.sf.taverna.t2.ui-components/results-view

  public int compare(ExternalReferenceSPI o1, ExternalReferenceSPI o2) {
    return (int) (o1.getResolutionCost() - o2.getResolutionCost());
  }
});
origin: net.sf.taverna.t2.workbench.views/results

public static String getMimeType(ExternalReferenceSPI externalReference, InvocationContext context) {
  InputStream inputStream = externalReference.openStream(context);
  byte[] bytes = null;
  String mimeType = null;
origin: net.sf.taverna.t2.workbench.views/results

  public int compare(ExternalReferenceSPI o1, ExternalReferenceSPI o2) {
    return (int) (o1.getResolutionCost() - o2.getResolutionCost());
  }
});
origin: net.sf.taverna.t2.core/reference-impl

if (initialBuilder != null && sourceReference != null) {
  ExternalReferenceSPI builtReference = initialBuilder.createReference(
      sourceReference.openStream(context), context);
  results.add(builtReference);
  currentReference = builtReference;
origin: net.sf.taverna.t2.workbench.views/results

  public int compare(ExternalReferenceSPI o1, ExternalReferenceSPI o2) {
    return (int) (o1.getResolutionCost() - o2.getResolutionCost());
  }
});
net.sf.taverna.t2.referenceExternalReferenceSPI

Javadoc

A reference to a single piece of data. This may or may not be within the enactment infrastructure, it could refer to data held in a file, a URL, a grid storage system or anything of that nature. Ideally the data this reference points to should not change - we'd like to say 'must not change' at this point but this isn't always possible, implementations should aim to provide the appearance that data are immutable.

When used within the workflow engine implementations of this interface are always contained in a ReferenceSet instance.

Implementors of this interface are strongly advised to use the AbstractExternalReference superclass - this provides the necessary primary key information used by hibernate-based implementations of the reference manager. Technically we don't require it as it's possible that other backend stores may exist, but the core store used by T2 is based on hibernate so it's a very good idea to follow this! Basically if you don't your code won't work in the current system.

This interface is an SPI - while implementations are never constructed based on the SPI registry it is used to discover all implementing classes and automatically register their hibernate mapping files. Implementors should add their implementation class name to a META-INF/services/net.sf.taverna.t2.reference.ExternalReferenceSPI file in the implementation artifact. For examples please refer to the t2reference-core-extensions module, this contains implementations of this interface for common basic reference types.

Note - if your implementation class has a complex hibernate mapping that uses components which are themselves mapped into the database (perfectly legal to do) then you must mark those components as instances of HibernateMappedEntity so their corresponding mapping and class definitions are loaded by the Hibernate backed reference set dao. If your implementation class uses inline compound keys or other component types where you reference another class but the other class is not mapped itself in hibernate you must instead make the component class an instance of HibernateComponentClass - a marker interface - for the same reason. Both of these are SPIs themselves, and require the appropriate entries to be added to their service metadata files in your extension jar.

Most used methods

  • openStream
    Open and return an InputStream to the data referenced using, if required, any facilities within the
  • getDataNature
    Determine, if possible, whether the data this reference refers to is textual or binary in nature. If
  • getResolutionCost
    Resolution cost is an informal guide to how costly the process of de-referencing this reference woul
  • getApproximateSizeInBytes
  • getCharset
    For textual data return the character set that should be used to pull data into a java String object

Popular in Java

  • Running tasks concurrently on multiple threads
  • addToBackStack (FragmentTransaction)
  • onCreateOptionsMenu (Activity)
  • startActivity (Activity)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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