1.1 --- a/src/java/de/uapcore/lightpit/LightPITModule.java Sun Apr 08 16:51:15 2018 +0200 1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 1.3 @@ -1,170 +0,0 @@ 1.4 -/* 1.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 1.6 - * 1.7 - * Copyright 2018 Mike Becker. All rights reserved. 1.8 - * 1.9 - * Redistribution and use in source and binary forms, with or without 1.10 - * modification, are permitted provided that the following conditions are met: 1.11 - * 1.12 - * 1. Redistributions of source code must retain the above copyright 1.13 - * notice, this list of conditions and the following disclaimer. 1.14 - * 1.15 - * 2. Redistributions in binary form must reproduce the above copyright 1.16 - * notice, this list of conditions and the following disclaimer in the 1.17 - * documentation and/or other materials provided with the distribution. 1.18 - * 1.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 1.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 1.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 1.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 1.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 1.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 1.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 1.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 1.29 - * POSSIBILITY OF SUCH DAMAGE. 1.30 - * 1.31 - */ 1.32 -package de.uapcore.lightpit; 1.33 - 1.34 -import java.lang.annotation.Documented; 1.35 -import java.lang.annotation.ElementType; 1.36 -import java.lang.annotation.Retention; 1.37 -import java.lang.annotation.RetentionPolicy; 1.38 -import java.lang.annotation.Target; 1.39 -import javax.servlet.annotation.WebServlet; 1.40 - 1.41 - 1.42 -/** 1.43 - * Contains information about a LightPIT module. 1.44 - * 1.45 - * This annotation is typically used to annotate the {@link WebServlet} which 1.46 - * implements the module's functionality. 1.47 - */ 1.48 -@Documented 1.49 -@Retention(RetentionPolicy.RUNTIME) 1.50 -@Target(ElementType.TYPE) 1.51 -public @interface LightPITModule { 1.52 - /** 1.53 - * Base name of the module specific resource bundle. 1.54 - * @return a base name suitable for the JSTL tag 'setBundle'. 1.55 - */ 1.56 - String bundleBaseName(); 1.57 - 1.58 - /** 1.59 - * An array of required modules, identified by the string representation of 1.60 - * their class names. 1.61 - * @return an array of class names of required modules 1.62 - */ 1.63 - String[] requires() default {}; 1.64 - 1.65 - /** 1.66 - * The path for this module, which will also be used for the menu entry. 1.67 - * 1.68 - * This path must adhere to the URL pattern of the Servlet but must not 1.69 - * contain any starting or trailing slashes. 1.70 - * 1.71 - * @return the relative module path 1.72 - */ 1.73 - String modulePath(); 1.74 - 1.75 - /** 1.76 - * Returns the properties key for the module name. 1.77 - * 1.78 - * @return the properties key 1.79 - */ 1.80 - String nameKey() default "name"; 1.81 - 1.82 - /** 1.83 - * Returns the properties key for the module description. 1.84 - * 1.85 - * @return the properties key 1.86 - */ 1.87 - String descKey() default "description"; 1.88 - 1.89 - 1.90 - /** 1.91 - * Returns the properties key for the menu label. 1.92 - * 1.93 - * Set this string to empty string, if the module should be hidden from 1.94 - * the menu. 1.95 - * 1.96 - * @return the properties key 1.97 - */ 1.98 - String menuKey() default "menuLabel"; 1.99 - 1.100 - /** 1.101 - * Returns the properties key for the page title. 1.102 - * 1.103 - * By default this is the same as the menu label. 1.104 - * 1.105 - * @return the properties key 1.106 - */ 1.107 - String titleKey() default "menuLabel"; 1.108 - 1.109 - /** 1.110 - * If set to <code>true</code>, this module is always loaded, but never 1.111 - * visible in the menu or the Web UI module manager. 1.112 - * 1.113 - * @return true, if this is a system module 1.114 - */ 1.115 - boolean systemModule() default false; 1.116 - 1.117 - /** 1.118 - * Class representing the annotation. 1.119 - * This is necessary, because the EL resolver cannot deal with 1.120 - * annotation objects. 1.121 - * 1.122 - * Note, that only the properties which are interesting for the JSP pages 1.123 - * are proxied by this object. 1.124 - */ 1.125 - public static class ELProxy { 1.126 - private final String bundleBaseName, modulePath, menuKey, titleKey, nameKey, descKey; 1.127 - 1.128 - public static ELProxy convert(LightPITModule annotation) { 1.129 - return new ELProxy( 1.130 - annotation.bundleBaseName(), 1.131 - annotation.modulePath(), 1.132 - annotation.menuKey(), 1.133 - annotation.titleKey(), 1.134 - annotation.nameKey(), 1.135 - annotation.descKey() 1.136 - ); 1.137 - } 1.138 - 1.139 - private ELProxy(String bundleBaseName, String modulePath, String menuKey, String titleKey, String nameKey, String descKey) { 1.140 - this.bundleBaseName = bundleBaseName; 1.141 - this.modulePath = modulePath; 1.142 - this.menuKey = menuKey; 1.143 - this.titleKey = titleKey; 1.144 - this.nameKey = nameKey; 1.145 - this.descKey = descKey; 1.146 - } 1.147 - 1.148 - public String getBundleBaseName() { 1.149 - return bundleBaseName; 1.150 - } 1.151 - 1.152 - public String getMenuKey() { 1.153 - return menuKey; 1.154 - } 1.155 - 1.156 - public String getModulePath() { 1.157 - return modulePath; 1.158 - } 1.159 - 1.160 - public String getTitleKey() { 1.161 - return titleKey; 1.162 - } 1.163 - 1.164 - public String getNameKey() { 1.165 - return nameKey; 1.166 - } 1.167 - 1.168 - public String getDescKey() { 1.169 - return descKey; 1.170 - } 1.171 - 1.172 - } 1.173 -}