src/main/java/de/uapcore/lightpit/ModuleManager.java

Wed, 13 May 2020 18:55:05 +0200

author
Mike Becker <universe@uap-core.de>
date
Wed, 13 May 2020 18:55:05 +0200
changeset 44
835dd169642a
parent 36
0f4f8f255c32
child 45
cc7f082c5ef3
permissions
-rw-r--r--

adds equals/hashCode to ResourceKey class

6
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
1 /*
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
3 *
24
8137ec335416 updates copyright header
Mike Becker <universe@uap-core.de>
parents: 22
diff changeset
4 * Copyright 2018 Mike Becker. All rights reserved.
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
5 *
6
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
6 * Redistribution and use in source and binary forms, with or without
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
7 * modification, are permitted provided that the following conditions are met:
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
8 *
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
9 * 1. Redistributions of source code must retain the above copyright
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
10 * notice, this list of conditions and the following disclaimer.
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
11 *
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
12 * 2. Redistributions in binary form must reproduce the above copyright
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
13 * notice, this list of conditions and the following disclaimer in the
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
14 * documentation and/or other materials provided with the distribution.
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
15 *
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
26 * POSSIBILITY OF SUCH DAMAGE.
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
27 *
6
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
28 */
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
29 package de.uapcore.lightpit;
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
30
30
fb30f7b78f9b moves DAO classes to different package
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
31 import org.slf4j.Logger;
fb30f7b78f9b moves DAO classes to different package
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
32 import org.slf4j.LoggerFactory;
fb30f7b78f9b moves DAO classes to different package
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
33
7
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents: 6
diff changeset
34 import javax.servlet.Registration;
6
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
35 import javax.servlet.ServletContext;
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
36 import javax.servlet.ServletContextEvent;
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
37 import javax.servlet.ServletContextListener;
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
38 import javax.servlet.annotation.WebListener;
30
fb30f7b78f9b moves DAO classes to different package
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
39 import java.util.*;
6
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
40
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
41 /**
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
42 * Scans registered servlets for LightPIT modules.
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
43 */
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
44 @WebListener
10
89e3e6e28b69 implements automatic menu generation from module information
Mike Becker <universe@uap-core.de>
parents: 9
diff changeset
45 public final class ModuleManager implements ServletContextListener {
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
46
8
2dfdb79b5344 adds slf4j to project as netbeans library (make sure to have it configured in your environment)
Mike Becker <universe@uap-core.de>
parents: 7
diff changeset
47 private static final Logger LOG = LoggerFactory.getLogger(ModuleManager.class);
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
48
6
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
49 /**
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
50 * The attribute name in the servlet context under which an instance of this class can be found.
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
51 */
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
52 public static final String SC_ATTR_NAME = ModuleManager.class.getName();
10
89e3e6e28b69 implements automatic menu generation from module information
Mike Becker <universe@uap-core.de>
parents: 9
diff changeset
53 private ServletContext sc;
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
54
20
bd1a76c91d5b module synchronization with database
Mike Becker <universe@uap-core.de>
parents: 18
diff changeset
55 /**
27
1f2a96efa69f removes caching of main menu
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
56 * Maps class names to module information.
1f2a96efa69f removes caching of main menu
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
57 */
1f2a96efa69f removes caching of main menu
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
58 private final Map<String, LightPITModule> registeredModules = new HashMap<>();
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
59
27
1f2a96efa69f removes caching of main menu
Mike Becker <universe@uap-core.de>
parents: 24
diff changeset
60 /**
36
0f4f8f255c32 removes features that are not (and probably will not) used anyway
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
61 * Contains the menu entries for the loaded modules.
20
bd1a76c91d5b module synchronization with database
Mike Becker <universe@uap-core.de>
parents: 18
diff changeset
62 */
36
0f4f8f255c32 removes features that are not (and probably will not) used anyway
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
63 private final List<MenuEntry> mainMenu = new ArrayList<>();
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
64
6
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
65 @Override
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
66 public void contextInitialized(ServletContextEvent sce) {
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
67 sc = sce.getServletContext();
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
68 reloadAll();
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
69 sc.setAttribute(SC_ATTR_NAME, this);
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
70 LOG.info("Module manager injected into ServletContext.");
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
71 }
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
72
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
73 @Override
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
74 public void contextDestroyed(ServletContextEvent sce) {
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
75 unloadAll();
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
76 }
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
77
10
89e3e6e28b69 implements automatic menu generation from module information
Mike Becker <universe@uap-core.de>
parents: 9
diff changeset
78 private Optional<LightPITModule> getModuleInfo(Registration reg) {
6
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
79 try {
33
fd8c40ff78c3 fixes several warnings
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
80 final Class<?> scclass = Class.forName(reg.getClassName());
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
81
9
20a9b2bc9063 makes LightPITServlet abstract
Mike Becker <universe@uap-core.de>
parents: 8
diff changeset
82 final boolean lpservlet = AbstractLightPITServlet.class.isAssignableFrom(scclass);
7
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents: 6
diff changeset
83 final boolean lpmodule = scclass.isAnnotationPresent(LightPITModule.class);
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
84
7
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents: 6
diff changeset
85 if (lpservlet && !lpmodule) {
8
2dfdb79b5344 adds slf4j to project as netbeans library (make sure to have it configured in your environment)
Mike Becker <universe@uap-core.de>
parents: 7
diff changeset
86 LOG.warn(
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
87 "{} is a LightPIT Servlet but is missing the module annotation.",
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
88 reg.getClassName()
8
2dfdb79b5344 adds slf4j to project as netbeans library (make sure to have it configured in your environment)
Mike Becker <universe@uap-core.de>
parents: 7
diff changeset
89 );
7
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents: 6
diff changeset
90 } else if (!lpservlet && lpmodule) {
8
2dfdb79b5344 adds slf4j to project as netbeans library (make sure to have it configured in your environment)
Mike Becker <universe@uap-core.de>
parents: 7
diff changeset
91 LOG.warn(
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
92 "{} is annotated as a LightPIT Module but does not extend {}.",
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
93 reg.getClassName(),
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
94 AbstractLightPITServlet.class.getSimpleName()
8
2dfdb79b5344 adds slf4j to project as netbeans library (make sure to have it configured in your environment)
Mike Becker <universe@uap-core.de>
parents: 7
diff changeset
95 );
7
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents: 6
diff changeset
96 }
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
97
10
89e3e6e28b69 implements automatic menu generation from module information
Mike Becker <universe@uap-core.de>
parents: 9
diff changeset
98 if (lpservlet && lpmodule) {
33
fd8c40ff78c3 fixes several warnings
Mike Becker <universe@uap-core.de>
parents: 31
diff changeset
99 final LightPITModule moduleInfo = scclass.getAnnotation(LightPITModule.class);
10
89e3e6e28b69 implements automatic menu generation from module information
Mike Becker <universe@uap-core.de>
parents: 9
diff changeset
100 return Optional.of(moduleInfo);
89e3e6e28b69 implements automatic menu generation from module information
Mike Becker <universe@uap-core.de>
parents: 9
diff changeset
101 } else {
89e3e6e28b69 implements automatic menu generation from module information
Mike Becker <universe@uap-core.de>
parents: 9
diff changeset
102 return Optional.empty();
89e3e6e28b69 implements automatic menu generation from module information
Mike Becker <universe@uap-core.de>
parents: 9
diff changeset
103 }
6
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
104 } catch (ClassNotFoundException ex) {
8
2dfdb79b5344 adds slf4j to project as netbeans library (make sure to have it configured in your environment)
Mike Becker <universe@uap-core.de>
parents: 7
diff changeset
105 LOG.error(
9
20a9b2bc9063 makes LightPITServlet abstract
Mike Becker <universe@uap-core.de>
parents: 8
diff changeset
106 "Servlet registration refers to class {} which cannot be found by the class loader (Reason: {})",
20a9b2bc9063 makes LightPITServlet abstract
Mike Becker <universe@uap-core.de>
parents: 8
diff changeset
107 reg.getClassName(),
20a9b2bc9063 makes LightPITServlet abstract
Mike Becker <universe@uap-core.de>
parents: 8
diff changeset
108 ex.getMessage()
8
2dfdb79b5344 adds slf4j to project as netbeans library (make sure to have it configured in your environment)
Mike Becker <universe@uap-core.de>
parents: 7
diff changeset
109 );
10
89e3e6e28b69 implements automatic menu generation from module information
Mike Becker <universe@uap-core.de>
parents: 9
diff changeset
110 return Optional.empty();
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
111 }
6
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
112 }
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
113
7
598670d5b0b8 core functionality should also use the modules system, changed the code structure accordingly
Mike Becker <universe@uap-core.de>
parents: 6
diff changeset
114 private void handleServletRegistration(String name, Registration reg) {
10
89e3e6e28b69 implements automatic menu generation from module information
Mike Becker <universe@uap-core.de>
parents: 9
diff changeset
115 final Optional<LightPITModule> moduleInfo = getModuleInfo(reg);
20
bd1a76c91d5b module synchronization with database
Mike Becker <universe@uap-core.de>
parents: 18
diff changeset
116 if (moduleInfo.isPresent()) {
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
117 registeredModules.put(reg.getClassName(), moduleInfo.get());
8
2dfdb79b5344 adds slf4j to project as netbeans library (make sure to have it configured in your environment)
Mike Becker <universe@uap-core.de>
parents: 7
diff changeset
118 LOG.info("Module detected: {}", name);
6
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
119 } else {
8
2dfdb79b5344 adds slf4j to project as netbeans library (make sure to have it configured in your environment)
Mike Becker <universe@uap-core.de>
parents: 7
diff changeset
120 LOG.debug("Servlet {} is no module, skipping.", name);
6
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
121 }
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
122 }
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
123
6
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
124 /**
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
125 * Scans for modules and reloads them all.
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
126 */
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
127 public void reloadAll() {
21
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
128 registeredModules.clear();
6
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
129 sc.getServletRegistrations().forEach(this::handleServletRegistration);
36
0f4f8f255c32 removes features that are not (and probably will not) used anyway
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
130 createMainMenu();
30
fb30f7b78f9b moves DAO classes to different package
Mike Becker <universe@uap-core.de>
parents: 29
diff changeset
131
36
0f4f8f255c32 removes features that are not (and probably will not) used anyway
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
132 LOG.info("Modules loaded.");
20
bd1a76c91d5b module synchronization with database
Mike Becker <universe@uap-core.de>
parents: 18
diff changeset
133 }
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
134
20
bd1a76c91d5b module synchronization with database
Mike Becker <universe@uap-core.de>
parents: 18
diff changeset
135 /**
6
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
136 * Unloads all found modules.
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
137 */
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
138 public void unloadAll() {
21
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
139 registeredModules.clear();
6
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
140 LOG.info("All modules unloaded.");
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
141 }
10
89e3e6e28b69 implements automatic menu generation from module information
Mike Becker <universe@uap-core.de>
parents: 9
diff changeset
142
89e3e6e28b69 implements automatic menu generation from module information
Mike Becker <universe@uap-core.de>
parents: 9
diff changeset
143 /**
36
0f4f8f255c32 removes features that are not (and probably will not) used anyway
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
144 * Populates the main menu based on the registered modules.
10
89e3e6e28b69 implements automatic menu generation from module information
Mike Becker <universe@uap-core.de>
parents: 9
diff changeset
145 */
36
0f4f8f255c32 removes features that are not (and probably will not) used anyway
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
146 private void createMainMenu() {
0f4f8f255c32 removes features that are not (and probably will not) used anyway
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
147 mainMenu.clear();
0f4f8f255c32 removes features that are not (and probably will not) used anyway
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
148 registeredModules.entrySet()
0f4f8f255c32 removes features that are not (and probably will not) used anyway
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
149 .stream()
0f4f8f255c32 removes features that are not (and probably will not) used anyway
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
150 .filter(mod -> !mod.getValue().systemModule())
0f4f8f255c32 removes features that are not (and probably will not) used anyway
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
151 .map(mod -> new MenuEntry(
0f4f8f255c32 removes features that are not (and probably will not) used anyway
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
152 mod.getKey(),
0f4f8f255c32 removes features that are not (and probably will not) used anyway
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
153 new ResourceKey(
0f4f8f255c32 removes features that are not (and probably will not) used anyway
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
154 mod.getValue().bundleBaseName(),
0f4f8f255c32 removes features that are not (and probably will not) used anyway
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
155 mod.getValue().menuKey()),
0f4f8f255c32 removes features that are not (and probably will not) used anyway
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
156 mod.getValue().modulePath(),
0f4f8f255c32 removes features that are not (and probably will not) used anyway
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
157 mod.getValue().defaultPriority()))
0f4f8f255c32 removes features that are not (and probably will not) used anyway
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
158 .sorted()
0f4f8f255c32 removes features that are not (and probably will not) used anyway
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
159 .forEachOrdered(mainMenu::add);
10
89e3e6e28b69 implements automatic menu generation from module information
Mike Becker <universe@uap-core.de>
parents: 9
diff changeset
160 }
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
161
21
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
162 /**
36
0f4f8f255c32 removes features that are not (and probably will not) used anyway
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
163 * Returns the main menu.
34
824d4042c857 cleanup and simplification of database access layer
Mike Becker <universe@uap-core.de>
parents: 33
diff changeset
164 *
36
0f4f8f255c32 removes features that are not (and probably will not) used anyway
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
165 * @return a list of menu items
21
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
166 */
36
0f4f8f255c32 removes features that are not (and probably will not) used anyway
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
167 public List<MenuEntry> getMainMenu() {
0f4f8f255c32 removes features that are not (and probably will not) used anyway
Mike Becker <universe@uap-core.de>
parents: 34
diff changeset
168 return Collections.unmodifiableList(mainMenu);
21
b213fef2539e adds first part of a module manager UI
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
169 }
6
da61a1646eba adds module manager
Mike Becker <universe@uap-core.de>
parents:
diff changeset
170 }

mercurial