1 /*
2 * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
101 } catch (InstantiationException | NoSuchMethodException
102 | InvocationTargetException ex) {
103 Functional.rethrowUnchecked(ex);
104 }
105 return false;
106 }
107
108 private final String name;
109 private final String suffix;
110 private final boolean supported;
111
112 public final static Set<PackageType> LINUX = Set.of(LINUX_DEB, LINUX_RPM);
113 public final static Set<PackageType> WINDOWS = Set.of(WIN_EXE, WIN_MSI);
114 public final static Set<PackageType> MAC = Set.of(MAC_PKG, MAC_DMG);
115 public final static Set<PackageType> NATIVE = Stream.concat(
116 Stream.concat(LINUX.stream(), WINDOWS.stream()),
117 MAC.stream()).collect(Collectors.toUnmodifiableSet());
118
119 private final static class Inner {
120
121 private final static Set<String> DISABLED_PACKAGERS = Optional.ofNullable(
122 TKit.tokenizeConfigProperty("disabledPackagers")).orElse(
123 Collections.emptySet());
124 }
125 }
|
1 /*
2 * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
101 } catch (InstantiationException | NoSuchMethodException
102 | InvocationTargetException ex) {
103 Functional.rethrowUnchecked(ex);
104 }
105 return false;
106 }
107
108 private final String name;
109 private final String suffix;
110 private final boolean supported;
111
112 public final static Set<PackageType> LINUX = Set.of(LINUX_DEB, LINUX_RPM);
113 public final static Set<PackageType> WINDOWS = Set.of(WIN_EXE, WIN_MSI);
114 public final static Set<PackageType> MAC = Set.of(MAC_PKG, MAC_DMG);
115 public final static Set<PackageType> NATIVE = Stream.concat(
116 Stream.concat(LINUX.stream(), WINDOWS.stream()),
117 MAC.stream()).collect(Collectors.toUnmodifiableSet());
118
119 private final static class Inner {
120
121 private static boolean isUbuntu() {
122 if (!TKit.isLinux()) {
123 return false;
124 }
125 return TKit.isUbuntu();
126 }
127
128 private final static Set<String> DISABLED_PACKAGERS;
129
130 static {
131 Set<String> disabledPackagers =
132 TKit.tokenizeConfigProperty("disabledPackagers");
133 if (disabledPackagers != null) {
134 DISABLED_PACKAGERS = disabledPackagers;
135 } else if (isUbuntu()) {
136 DISABLED_PACKAGERS = Set.of("rpm");
137 } else {
138 DISABLED_PACKAGERS = Collections.emptySet();
139 }
140 }
141 }
142 }
|