<commit_before>/*******************************************************************************
 * Copyright (C) 2007 The University of Manchester   
 * 
 *  Modifications to the initial code base are copyright of their
 *  respective authors, or their employers as appropriate.
 * 
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public License
 *  as published by the Free Software Foundation; either version 2.1 of
 *  the License, or (at your option) any later version.
 *    
 *  This program is distributed in the hope that it will be useful, but
 *  WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *    
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 ******************************************************************************/
package net.sf.taverna.t2.reference;

import java.io.InputStream;

/**
 * Constructs an ExternalReferenceSPI instance from a byte stream. Used by the
 * {@link ReferenceSetAugmentor} when there isn't a direct reference to
 * reference translation path available for a desired target type, but available
 * for external use wherever this functionality is needed.
 * <p>
 * Where an underlying resource is required this is extracted from the supplied
 * ReferenceContext, this implies that all methods in implementations of this
 * interface should be thread safe, allowing multiple concurrent threads
 * cleanly. For SPI purposes implementations should be java beans with default
 * constructors.
 * 
 * @author <NAME>
 */
public interface ExternalReferenceBuilderSPI<TargetType extends ExternalReferenceSPI> {

	/**
	 * Given a stream of bytes, build the appropriate target
	 * ExternalReferenceSPI implementation which would de-reference to the value
	 * of that stream and return it.
	 * 
	 * @param existingReferences
	 *            the references to be used as sources for the translation. In
	 *            general the implementation will use one of these references.
	 * @param context
	 *            a reference resolution context, needed potentially to
	 *            construct the new ExternalReferenceSchemeSPI, especially in
	 *            cases where the context contains security agents giving access
	 *            to a remote data staging system *
	 * @throws ExternalReferenceConstructionException
	 *             if an error occurs instantiating the new reference.
	 * @return the newly constructed ExternalReferenceSPI instance.
	 */
	public TargetType createReference(InputStream byteStream,
			ReferenceContext context);

	/**
	 * Expose the type of the ExternalReferenceSPI that this builder can<commit_msg>Corrected javadoc<commit_after>/*******************************************************************************
 * Copyright (C) 2007 The University of Manchester   
 * 
 *  Modifications to the initial code base are copyright of their
 *  respective authors, or their employers as appropriate.
 * 
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public License
 *  as published by the Free Software Foundation; either version 2.1 of
 *  the License, or (at your option) any later version.
 *    
 *  This program is distributed in the hope that it will be useful, but
 *  WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *    
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 ******************************************************************************/
package net.sf.taverna.t2.reference;

import java.io.InputStream;

/**
 * Constructs an ExternalReferenceSPI instance from a byte stream. Used by the
 * {@link ReferenceSetAugmentor} when there isn't a direct reference to
 * reference translation path available for a desired target type, but available
 * for external use wherever this functionality is needed.
 * <p>
 * Where an underlying resource is required this is extracted from the supplied
 * ReferenceContext, this implies that all methods in implementations of this
 * interface should be thread safe, allowing multiple concurrent threads
 * cleanly. For SPI purposes implementations should be java beans with default
 * constructors.
 * 
 * @author <NAME>
 */
public interface ExternalReferenceBuilderSPI<TargetType extends ExternalReferenceSPI> {

	/**
	 * Given a stream of bytes, build the appropriate target
	 * ExternalReferenceSPI implementation which would de-reference to the value
	 * of that stream and return it.
	 * 
	 * @param byteStream
	 *            the bytestream to read target from.
	 * @param context
	 *            a reference resolution context, needed potentially to
	 *            construct the new ExternalReferenceSchemeSPI, especially in
	 *            cases where the context contains security agents giving access
	 *            to a remote data staging system *
	 * @throws ExternalReferenceConstructionException
	 *             if an error occurs instantiating the new reference.
	 * @return the newly constructed ExternalReferenceSPI instance.
	 */
	public TargetType createReference(InputStream byteStream,
			ReferenceContext context);

	/**
	 * Expose the type of the ExternalReferenceSPI that this builder can
{'fraction_non_alphanumeric': 0.10039813051756967, 'fraction_numerical': 0.007270209451272287, 'mean_word_length': 3.859545836837679, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1468607', 'n_tokens_mistral': 1341, 'n_tokens_neox': 1221, 'n_words': 668}