Debian Codegraph @

bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/UpdateSitePublisherApplication.java

raw
1 /*******************************************************************************
2 * Copyright (c) 2008, 2017 Code 9 and others.
3 *
4 * This
5 * program and the accompanying materials are made available under the terms of
6 * the Eclipse Public License 2.0 which accompanies this distribution, and is
7 * available at
8 * https://www.eclipse.org/legal/epl-2.0/
9 *
10 * SPDX-License-Identifier: EPL-2.0
11 *
12 * Contributors:
13 * Code 9 - initial API and implementation
14 ******************************************************************************/
15 package org.eclipse.equinox.internal.p2.updatesite;
16
17 import java.net.URISyntaxException;
18 import org.eclipse.equinox.p2.publisher.*;
19 import org.eclipse.equinox.p2.publisher.actions.JREAction;
20
21 /**
22 * <p>
23 * This application generates meta-data/artifact repositories from a local update site.
24 * The -source <localdir> parameter must specify the top-level directory containing the update site.
25 * </p>
26 */
27 public class UpdateSitePublisherApplication extends AbstractPublisherApplication {
28
29 private String categoryQualifier = null;
30 private String categoryVersion = null;
31
32 public UpdateSitePublisherApplication() {
33 // nothing todo
34 }
35
36 @Override
37 protected void processParameter(String arg, String parameter, PublisherInfo pinfo) throws URISyntaxException {
38 super.processParameter(arg, parameter, pinfo);
39
40 if (arg.equalsIgnoreCase("-categoryQualifier")) //$NON-NLS-1$
41 categoryQualifier = parameter;
42
43 if (arg.equalsIgnoreCase("-categoryVersion")) //$NON-NLS-1$
44 categoryVersion = parameter;
45 }
46
47 @Override
48 protected IPublisherAction[] createActions() {
49 LocalUpdateSiteAction action = new LocalUpdateSiteAction(source, categoryQualifier);
50 action.setCategoryVersion(categoryVersion);
51 if (addJRE) {
52 return new IPublisherAction[] {action, new JREAction((String) null)};
53 }
54 return new IPublisherAction[] {action};
55 }
56
57 /** by default don't generate the JRE IU */
58 private boolean addJRE = false;
59
60 /**
61 * Detect the flag -addJREIU to turn on the generation of the JREIU.
62 */
63 @Override
64 protected void processFlag(String flag, PublisherInfo publisherInfo) {
65 super.processFlag(flag, publisherInfo);
66 if (flag.equalsIgnoreCase("-addJREIU"))//$NON-NLS-1$
67 {
68 addJRE = true;
69 }
70 }
71 }