Skip to main content
summaryrefslogtreecommitdiffstats
blob: 5578dd0dd80af5c5765a0a4ae9553fd282faf992 (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
/*******************************************************************************
 * Copyright (c) 2008, 2017 Code 9 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: 
 *   Code 9 - initial API and implementation
 ******************************************************************************/
package org.eclipse.equinox.internal.p2.updatesite;

import java.net.URISyntaxException;
import org.eclipse.equinox.p2.publisher.*;
import org.eclipse.equinox.p2.publisher.actions.JREAction;

/**
 * <p>
 * This application generates meta-data/artifact repositories from a local update site.
 * The -source <localdir> parameter must specify the top-level directory containing the update site.
 * </p>
 */
public class UpdateSitePublisherApplication extends AbstractPublisherApplication {

	private String categoryQualifier = null;
	private String categoryVersion = null;

	public UpdateSitePublisherApplication() {
		// nothing todo
	}

	@Override
	protected void processParameter(String arg, String parameter, PublisherInfo pinfo) throws URISyntaxException {
		super.processParameter(arg, parameter, pinfo);

		if (arg.equalsIgnoreCase("-categoryQualifier")) //$NON-NLS-1$
			categoryQualifier = parameter;

		if (arg.equalsIgnoreCase("-categoryVersion")) //$NON-NLS-1$
			categoryVersion = parameter;
	}

	@Override
	protected IPublisherAction[] createActions() {
		LocalUpdateSiteAction action = new LocalUpdateSiteAction(source, categoryQualifier);
		action.setCategoryVersion(categoryVersion);
		if (addJRE) {
			return new IPublisherAction[] {action, new JREAction((String) null)};
		}
		return new IPublisherAction[] {action};
	}

	/** by default don't generate the JRE IU */
	private boolean addJRE = false;

	/**
	 * Detect the flag -addJREIU to turn on the generation of the JREIU.
	 */
	@Override
	protected void processFlag(String flag, PublisherInfo publisherInfo) {
		super.processFlag(flag, publisherInfo);
		if (flag.equalsIgnoreCase("-addJREIU"))//$NON-NLS-1$
		{
			addJRE = true;
		}
	}
}

Back to the top