bjoern@3515: package de.intevation.flys.client.server; bjoern@3515: bjoern@3515: import java.util.ArrayList; bjoern@3515: import java.util.List; bjoern@3515: bjoern@3515: import org.apache.log4j.Logger; bjoern@3515: bjoern@3515: import de.intevation.flys.client.client.FLYSConstants; bjoern@3515: import de.intevation.flys.client.client.services.ModuleService; bjoern@3515: import de.intevation.flys.client.server.auth.User; bjoern@3515: import de.intevation.flys.client.shared.model.DefaultModule; bjoern@3515: import de.intevation.flys.client.shared.model.Module; bjoern@3515: bjoern@3515: public class ModuleServiceImpl bjoern@3515: extends RemoteServiceServlet bjoern@3515: implements ModuleService bjoern@3515: { bjoern@3515: private static final Logger logger = bjoern@3515: Logger.getLogger(ModuleServiceImpl.class); bjoern@3515: bjoern@3515: /** Constant value for the WINFO plugin.*/ bjoern@3515: public static final String FIELD_PLUGIN_WINFO = "winfo"; bjoern@3515: bjoern@3515: /** Constant value for the MINFO plugin.*/ bjoern@3515: public static final String FIELD_PLUGIN_MINFO = "minfo"; bjoern@3515: bjoern@3515: /** Constant value for the MAP plugin.*/ bjoern@3515: public static final String FIELD_PLUGIN_MAP = "new_map"; bjoern@3515: bjoern@3515: /** Constant value for the CHART plugin.*/ bjoern@3515: public static final String FIELD_PLUGIN_CHART = "new_chart"; bjoern@3515: bjoern@3515: /** Constant value for the FIX plugin.*/ bjoern@3515: public static final String FIELD_PLUGIN_FIX = "fixanalysis"; bjoern@3515: bjoern@3515: @Override bjoern@3515: public Module[] list(String locale) { bjoern@3515: User user = this.getUser(); bjoern@3515: bjoern@3515: //TODO load modules from artifactserver bjoern@3515: Module[] available = { bjoern@3515: new DefaultModule(FIELD_PLUGIN_WINFO, "WINFO"), bjoern@3515: new DefaultModule(FIELD_PLUGIN_MINFO, "MINFO"), bjoern@3515: new DefaultModule(FIELD_PLUGIN_MAP, "MAP"), bjoern@3515: new DefaultModule(FIELD_PLUGIN_CHART, "CHART"), bjoern@3515: new DefaultModule(FIELD_PLUGIN_FIX, "FIX") bjoern@3515: }; bjoern@3515: bjoern@3515: List modules = new ArrayList(available.length); bjoern@3515: for(Module module : available) { bjoern@3515: if (user == null || user.canUseFeature("module:" + module.getName())) { bjoern@3515: modules.add(module); bjoern@3515: } bjoern@3515: } bjoern@3515: return modules.toArray(new Module[modules.size()]); bjoern@3515: } bjoern@3515: } bjoern@3515: bjoern@3515: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 tw=80 :