Skip to main content
summaryrefslogtreecommitdiffstats
blob: 711ecb26de860a61bee0921b60bb5cf6bf8656a9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*******************************************************************************
 * Copyright (c) 2005, 2007 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jst.jee.archive;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;

import org.eclipse.core.runtime.IPath;

/**
 * {@link IArchiveLoadAdapter} knows how to load or read the contents for an
 * {@link IArchive}. This provides a delegation model for reading in the
 * contents of an {@link IArchive}.
 * 
 * By extending {@link AbstractArchiveLoadAdapter} and using
 * {@link ArchiveOptions} clients may "plug in" to an instance of an
 * {@link IArchive}. Examples might include reading from a zip file, from an
 * input stream, from the local file system, or from a workbench.
 * 
 * This interface is not intended to be implemented by or subclassed by clients.
 * Clients should instead subclass {@link AbstractArchiveLoadAdapter} or one if
 * its subclasses.
 */
public interface IArchiveLoadAdapter extends IArchiveAdapter {

	/**
	 * Called to release any resources held by this {@link IArchiveLoadAdapter}.
	 */
	public void close();

	/**
	 * Returns <code>true</code> if this {@link IArchiveLoadAdapter} contains
	 * the {@link IArchiveResource} specified by the passed {@link IPath}. If
	 * this method returns <code>true</code> then this
	 * {@link IArchiveLoadAdapter} should be able to successfully return an
	 * {@link IArchiveResource} from {@link #getArchiveResource(IPath)} using an
	 * equal passed {@link IPath}.
	 * 
	 * @param resourcePath
	 * @return
	 */
	public boolean containsArchiveResource(IPath resourcePath);

	/**
	 * Returns the {@link IArchiveResource} specified by the passed
	 * {@link IPath}. A {@link FileNotFoundException} is thrown if this
	 * {@link IArchiveLoadAdapter} does not contain the {@link IArchiveResource}
	 * as specified by {@link #containsArchiveResource(IPath)}.
	 * 
	 * @param resourcePath
	 * @return
	 * @throws FileNotFoundException
	 */
	public IArchiveResource getArchiveResource(IPath resourcePath) throws FileNotFoundException;

	/**
	 * Returns a {@link List} of all {@link IArchiveResource} contained by this
	 * {@link IArchiveLoadAdapter}.
	 * 
	 * @return
	 */
	public List <IArchiveResource> getArchiveResources();

	/**
	 * Returns an {@link InputStream} for the specified {@link IArchiveResource}.
	 * If the specified {@link IArchiveResource} is not contained by this
	 * {@link IArchiveLoadAdapter}, then a {@link FileNotFoundException} is
	 * thrown. An {@link IOException} is thrown for all other errors.
	 * 
	 * @param archiveResource
	 * @return
	 * @throws IOException
	 * @throws FileNotFoundException
	 */
	public InputStream getInputStream(IArchiveResource archiveResource) throws IOException, FileNotFoundException;

	/**
	 * Returns <code>true</code> if this {@link IArchiveLoadAdapter} contains
	 * a model Object specified by the passed {@link IPath}.
	 * 
	 * @param modelObjectPath
	 * @return
	 */
	public boolean containsModelObject(IPath modelObjectPath);

	/**
	 * Returns the model Object specified by the passed {@link IPath}. An
	 * {@link ArchiveModelLoadException} is thrown if this
	 * {@link IArchiveLoadAdapter} does not contain the model Object as
	 * specified by {@link #containsModelObject(IPath)}.
	 * 
	 * @param modelObjectPath
	 * @return
	 * @throws ArchiveModelLoadException
	 */
	public Object getModelObject(IPath modelObjectPath) throws ArchiveModelLoadException;

}

Back to the top