001/*
002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *     bstefanescu
011 */
012package org.nuxeo.runtime.model;
013
014import java.io.IOException;
015import java.io.InputStream;
016import java.net.URL;
017
018/**
019 * A named stream used to be able to deploy new components without referring to them via URLs.
020 *
021 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
022 */
023public interface StreamRef {
024
025    /**
026     * Get an unique identifier for this stream.
027     */
028    String getId();
029
030    /**
031     * Get the stream content.
032     *
033     * @return
034     */
035    InputStream getStream() throws IOException;
036
037    /**
038     * Get an URL to that stream. May return null if no URL is available.
039     *
040     * @return
041     */
042    URL asURL();
043}