Skip to main content
summaryrefslogtreecommitdiffstats
blob: fd875ea3c523fb6bdd975714623d6d4b6ae01aef (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
/*******************************************************************************
 * Copyright (c) 2001, 2005 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.strategy;



import java.util.HashSet;
import java.util.Set;

import org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.ExportStrategy;


/**
 * Abstract implementer off which other export strategies can subclass
 * 
 * @see ExportStrategy
 */
public abstract class ExportStrategyImpl extends ArchiveStrategyImpl implements ExportStrategy {
	/** The list of files already saved by this strategy during invokation of preSave() */
	protected Set savedFiles;

	public ExportStrategyImpl() {
		super();
	}

	public java.util.Set getSavedFiles() {
		if (savedFiles == null)
			savedFiles = new HashSet();
		return savedFiles;
	}

	public boolean hasSaved(String uri) {
		return savedFiles != null && getSavedFiles().contains(uri);
	}

	/**
	 * The default is to do nothing; subclasses may wish to override; typical operations would be to
	 * add extra elements to the outgoing archive, using SaveStrategy#save(File,
	 * java.io.InputStream)
	 */
	public void preSave(SaveStrategy aSaveStrategy) throws org.eclipse.jst.j2ee.commonarchivecore.internal.exception.SaveFailureException {
		//Default
	}

	/**
	 * The file with the given uri has just been saved; add this to the list of saved files
	 */
	protected void saved(String uri) {
		getSavedFiles().add(uri);
	}

	public void setSavedFiles(java.util.Set newSavedFiles) {
		savedFiles = newSavedFiles;
	}
}

Back to the top