Skip to main content
summaryrefslogtreecommitdiffstats
blob: 8192d266ce8b04439deda6023462352f51cfc0fd (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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
/*******************************************************************************
 * Copyright (c) 2001, 2006 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.j2ee.commonarchivecore.internal;


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

import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.DuplicateObjectException;
import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.OpenFailureException;
import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.ReopenException;
import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.ResourceLoadException;
import org.eclipse.jst.j2ee.commonarchivecore.internal.exception.SaveFailureException;
import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveManifest;
import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.FileIterator;
import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.RuntimeClasspathEntry;
import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.SaveFilter;
import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.LoadStrategy;
import org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.SaveStrategy;
import org.eclipse.jst.j2ee.commonarchivecore.looseconfig.internal.LooseArchive;


/**
 * @generated
 */
public interface Archive extends Container {

	public static final int EXPAND_NONE = 0;
	public static final int EXPAND_WAR_FILES = 1 << 1;
	public static final int EXPAND_EAR_FILES = 1 << 2;
	public static final int EXPAND_EJBJAR_FILES = 1 << 3;
	public static final int EXPAND_APPCLIENT_FILES = 1 << 4;
	public static final int EXPAND_ARCHIVES = 1 << 5;
	public static final int EXPAND_RAR_FILES = 1 << 6;
	public static final int EXPAND_ALL = (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6);

	public Archive addCopy(Archive anArchive) throws org.eclipse.jst.j2ee.commonarchivecore.internal.exception.DuplicateObjectException;

	public File addCopy(File aFile) throws org.eclipse.jst.j2ee.commonarchivecore.internal.exception.DuplicateObjectException;

	/**
	 * Get a flattened list from the directory, then addCopy the list
	 * 
	 * @throws com.ibm.etools.archive.exception.DuplicateObjectException
	 *             if a file with a uri that equals one of the nested files in the directory exists
	 * 
	 * @return java.util.List the copied files that were added to the archive
	 */
	public List addCopy(ReadOnlyDirectory dir) throws org.eclipse.jst.j2ee.commonarchivecore.internal.exception.DuplicateObjectException;

	public List addCopyFiles(List listOfFiles) throws org.eclipse.jst.j2ee.commonarchivecore.internal.exception.DuplicateObjectException;

	public void addOrReplaceMofResource(Resource aResource);

	/**
	 * @deprecated Use {@link #getDependentOpenArchives()}
	 * 
	 * If any opened archive contains files that have this archive as its loading container, return
	 * false; otherwise return true. This method supports the following scenario: open jar A. create
	 * jar B. Copy files from A to B. Attempt to close jar A before saving jar B. Then attempt to
	 * save B, and the save fails because A is closed. This method allows client code to test for
	 * dependent open archives before saving the source archive. If this method returns false, the
	 * solution is to either close or save B before closing A.
	 */
	public boolean canClose();

	/**
	 * Closes the load strategy for this archive and closes all contained archives; WARNING: If
	 * files have been copied from this archive to another archive, then the destination archive
	 * should be saved or closed before this archive can be safely closed; to test if this archive
	 * can safely close invoke {@link #canClose()}
	 */
	public void close();

	/**
	 * Save this archive as an expanded directory where the flags is the result of bitwise or of the
	 * specified types to be expanded; example:
	 * <code>anEarFile.saveAsDirectory(anEarFile.EXPAND_WAR_FILES | anEarFile.EXPAND_EJBJARFILES)</code>;
	 * 
	 * If this archive was loaded from the same uri as it is being extracted to, the orignal will be
	 * deleted and replaced with the directory
	 * 
	 * @throws SaveFailureException
	 *             if an exception occurs while saving
	 * 
	 * @throws ReopenException
	 *             if an exception occurs while re-syncing the archive to the newly saved
	 *             destination
	 */
	public void extract(int expansionFlags) throws SaveFailureException, ReopenException;

	/**
	 * For performance, save the archive without reopening; Further operations on this instance
	 * without first calling {@link #reopen}will yield unexpected results.
	 * 
	 * @see #extract(int)
	 */
	public void extractNoReopen(int expansionFlags) throws SaveFailureException;

	/**
	 * Save this archive as a directory using the specified uri
	 * 
	 * The archive will not be renamed
	 * 
	 * @throws SaveFailureException
	 *             if an exception occurs while saving
	 * 
	 * @see #extract(int)
	 */
	public void extractTo(String uri, int expansionFlags) throws SaveFailureException;

	/**
	 * Insert the method's description here. Creation date: (11/29/00 6:35:08 PM)
	 * 
	 * @return java.lang.ClassLoader
	 */
	public java.lang.ClassLoader getArchiveClassLoader();

	/**
	 * Return a list of files in the ARchive that start with the prefix
	 */
	public java.util.List filterFilesByPrefix(String prefix);

	/**
	 * Return a list of files in the Archive excluding any file that starts with one of the prefixes
	 */
	public java.util.List filterFilesWithoutPrefix(String[] prefixes);

	/**
	 * Returns a filtered list of archive files; adds will not be reflected; use
	 * 
	 * @link Archive#add(File)
	 */
	public List getArchiveFiles();

	public ResourceSet getResourceSet();

	/**
	 * Return a list of all root level (non-nested) opened archives containing files that have this
	 * archive as its loading container; the set will be empty if no such opened archive exists.
	 * This method supports the following scenario: open jar A. create jar B. Copy files from A to
	 * B. Attempt to close jar A before saving jar B. Then attempt to save B, and the save fails
	 * because A is closed. This method allows client code to test for dependent open archives
	 * before saving the source archive. If the return value is not empty, the solution is to either
	 * close or save B before closing A.
	 */
	public Set getDependentOpenArchives();

	/**
	 * Insert the method's description here. Creation date: (11/29/00 6:35:08 PM)
	 * 
	 * @return java.lang.String
	 */
	public java.lang.String getExtraClasspath();

	/**
	 * Used internally by the framework, specifically as an optimization when saving/exploding
	 * archives with nested archives
	 */
	public FileIterator getFilesForSave() throws IOException;

	public Collection getLoadedMofResources();

	public ArchiveManifest getManifest();

	public Resource getMofResource(String uri) throws FileNotFoundException, ResourceLoadException;

	public org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveOptions getOptions();

	/**
	 * @see LoadStrategy#getResourceInputStream(String)
	 */
	public InputStream getResourceInputStream(String uri) throws IOException;

	/**
	 * Used for websphere runtime where archives are on disk (not nested in jars)
	 * 
	 * @return list of absolute paths that represents this archive only, and in the case of
	 *         WARFiles, the nested loadable contents.
	 */
	public RuntimeClasspathEntry[] getLocalRuntimeClassPath();

	/**
	 * Used for websphere runtime where archives are on disk (not nested in jars) to get the
	 * recursive behavior, the Archive must belong to an EAR file
	 * 
	 * @return list of absolute paths that represents this archive, all it's prereqs, recursive.
	 */
	public RuntimeClasspathEntry[] getFullRuntimeClassPath();

	/**
	 * Used for websphere runtime where archives are on disk (not nested in jars) to get the
	 * recursive behavior, the Archive must belong to an EAR file
	 * 
	 * @return list of absolute paths that represents the dependencies of this Archive, all it's
	 *         prereqs, recursive.
	 */
	public RuntimeClasspathEntry[] getDependencyClassPath();

	/**
	 * Return the absolute path of the root from which meta resources get loaded
	 */
	public String getResourcesPath() throws FileNotFoundException;

	/**
	 * Return the absolute path of the root from which classes and properties are loaded
	 */
	public String getBinariesPath() throws FileNotFoundException;

	/**
	 * Optional filter for saving a subset of files; filter will be applied for all save and extract
	 * invokations
	 */
	public SaveFilter getSaveFilter();

	/**
	 * Insert the method's description here. Creation date: (11/29/00 6:35:08 PM)
	 * 
	 * @return com.ibm.etools.archive.SaveStrategy
	 */
	public org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.SaveStrategy getSaveStrategy();

	/**
	 * Insert the method's description here. Creation date: (11/29/00 6:35:08 PM)
	 * 
	 * @return java.lang.String
	 */
	public java.lang.String getXmlEncoding();

	/**
	 * Return whether this Archive has
	 * 
	 * @other on it's classpath, either directly or transitively
	 * @param Archive
	 *            other - another archive in the same EAR file
	 */
	public boolean hasClasspathVisibilityTo(Archive other);

	/**
	 * Internal API; Used for implementation of {@link #hasClasspathVisibilityTo(Archive)}
	 * 
	 * @param Archive
	 *            other - another archive in the same EAR file
	 * @param Set
	 *            visited - the set of archives already visited
	 */
	public boolean hasClasspathVisibilityTo(Archive other, Set visited, EARFile ear);

	/**
	 * Perform any necessary initialization after the archive has been opened.
	 */
	public void initializeAfterOpen();

	/**
	 * Used internally by the load strategy
	 */
	public void initializeClassLoader();

	/**
	 * An item is considered a duplicate if the archive contains a file or loaded mof resource with
	 * the uri, or if the uri is equal to the manifest uri
	 */
	public boolean isDuplicate(String uri);

	/**
	 * Used as an optimization at copy time
	 */
	public boolean isManifestSet();

	public boolean isMofResourceLoaded(String uri);

	/**
	 * Used internally for dispatch between the archive and the load strategy when building the file
	 * list; clients should not need to call this method.
	 */
	public boolean isNestedArchive(String uri);

	/**
	 * Indicates whether the archive is still opened for read; if not, IOExceptions could be thrown
	 * on attempts to get input streams on file entries. reopen() will cause this archive and its
	 * nested archives to rebuild their load strategies
	 */
	public boolean isOpen();

	/**
	 * Create a new mof resource and add it to the resource set of the context of this archive; all
	 * resources in memory are saved when the archive is saved
	 * 
	 * @throws DuplicateObjectException
	 *             if a resource already exists in this archive having the uri
	 */
	public Resource makeMofResource(String uri) throws DuplicateObjectException;

	/**
	 * Create a new mof resource and add it to the resource set of the context of this archive; all
	 * resources in memory are saved when the archive is saved
	 * 
	 * @throws DuplicateObjectException
	 *             if a resource already exists in this archive having the uri
	 */
	public Resource makeMofResource(String uri, EList extent) throws DuplicateObjectException;

	/**
	 * Used internally for dispatch between the archive and the load strategy when building the file
	 * list; clients should not need to call this method.
	 */
	public Archive openNestedArchive(String uri) throws OpenFailureException;

	/**
	 * Used internally for dispatch between the archive and the load strategy when building the file
	 * list; clients should not need to call this method.
	 */
	public Archive openNestedArchive(LooseArchive loose) throws OpenFailureException;

	/**
	 * Set the value of the extra class path with no refresh of the class loader
	 */
	public void primSetExtraClasspath(java.lang.String newExtraClasspath);

	public void remove(File aFile);

	/**
	 * Used internally for "re-syncing" an archive after save; clients normally should not need this
	 * method
	 */
	public void reopen() throws ReopenException;

	/**
	 * Used internally for reopening nested archives; clients normally should not need this method
	 */
	public void reopen(Archive parent) throws ReopenException;

	/**
	 * Save this archive as a jar file with the uri of the archive;
	 * 
	 * @throws SaveFailureException
	 *             if an exception occurs while saving
	 * 
	 * @throws ReopenException
	 *             if an exception occurs while re-syncing the archive to the newly saved
	 *             destination
	 */
	public void save() throws SaveFailureException, ReopenException;

	/**
	 * Save this archive using the save strategy specified
	 * 
	 * @throws SaveFailureException
	 *             if an exception occurs while saving
	 */
	public void save(SaveStrategy aStrategy) throws SaveFailureException;

	/**
	 * Save this archive as a jar file using uri provided; If the uri is different than the URI of
	 * this archive, the uri of this archive will change to the new uri (for reopen)
	 * 
	 * @throws SaveFailureException
	 *             if an exception occurs while saving
	 * 
	 * @throws ReopenException
	 *             if an exception occurs while re-syncing the archive to the newly saved
	 *             destination
	 */
	public void saveAs(String uri) throws SaveFailureException, ReopenException;

	/**
	 * For performance, save the archive without reopening; Further operations on this instance
	 * without first calling {@link #reopen}will yield unexpected results.
	 * 
	 * @see #saveAs(String)
	 */
	public void saveAsNoReopen(String uri) throws SaveFailureException;

	/**
	 * For performance, save the archive without reopening; Further operations on this instance
	 * without first calling {@link #reopen}will yield unexpected results.
	 * 
	 * @see #save()
	 */
	public void saveNoReopen() throws SaveFailureException;

	/**
	 * Insert the method's description here. Creation date: (11/29/00 6:35:08 PM)
	 * 
	 * @param newArchiveClassLoader
	 *            java.lang.ClassLoader
	 */
	public void setArchiveClassLoader(java.lang.ClassLoader newArchiveClassLoader);

	/**
	 * Insert the method's description here. Creation date: (11/29/00 6:35:08 PM)
	 * 
	 * @param newExtraClasspath
	 *            java.lang.String
	 */
	public void setExtraClasspath(java.lang.String newExtraClasspath);

	public void setManifest(ArchiveManifest newManifest);

	public void setManifest(java.util.jar.Manifest aManifest);

	/**
	 * Sets the Class-path manifest entry, rebuilds the class loader, and refreshes any reflected
	 * java classes
	 */
	public void setManifestClassPathAndRefresh(String classpath);

	public void setOptions(org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ArchiveOptions newOptions);

	/**
	 * Optional filter for saving a subset of files; filter will be applied for all save and extract
	 * invokations
	 */
	public void setSaveFilter(SaveFilter aFilter);

	/**
	 * Insert the method's description here. Creation date: (11/29/00 6:35:08 PM)
	 * 
	 * @param newSaveStrategy
	 *            com.ibm.etools.archive.SaveStrategy
	 */
	public void setSaveStrategy(org.eclipse.jst.j2ee.commonarchivecore.internal.strategy.SaveStrategy newSaveStrategy);

	/**
	 * Insert the method's description here. Creation date: (11/29/00 6:35:08 PM)
	 * 
	 * @param newXmlEncoding
	 *            java.lang.String
	 */
	public void setXmlEncoding(java.lang.String newXmlEncoding);

	/**
	 * Determine whether java reflection should be set up for this archive
	 */
	public boolean shouldUseJavaReflection();

	/**
	 * Returns the value of the '<em><b>Types</b></em>' attribute list.
	 * The list contents are of type {@link java.lang.String}.
	 * <!-- begin-user-doc -->
	 * <p>
	 * If the meaning of the '<em>Types</em>' attribute list isn't clear, there really should be
	 * more of a description here...
	 * </p>
	 * <!-- end-user-doc -->
	 * @return the value of the '<em>Types</em>' attribute list.
	 * @see org.eclipse.jst.j2ee.commonarchivecore.CommonarchivePackage#getArchive_Types()
	 * @model type="java.lang.String"
	 * @generated
	 */
	EList getTypes();

	boolean isType(String type);
}

Back to the top