diff --git a/hsarweb/lib/cas-client-core-3.1.10.jar b/hsarweb/WebContent/WEB-INF/lib/cas-client-core-3.1.10.jar similarity index 100% rename from hsarweb/lib/cas-client-core-3.1.10.jar rename to hsarweb/WebContent/WEB-INF/lib/cas-client-core-3.1.10.jar diff --git a/hsarweb/lib/commons-logging-1.1.1.jar b/hsarweb/WebContent/WEB-INF/lib/commons-logging-1.1.1.jar similarity index 100% rename from hsarweb/lib/commons-logging-1.1.1.jar rename to hsarweb/WebContent/WEB-INF/lib/commons-logging-1.1.1.jar diff --git a/hsarweb/WebContent/WEB-INF/lib/vaadin-6.4.8.jar b/hsarweb/WebContent/WEB-INF/lib/vaadin-6.4.8.jar new file mode 100644 index 0000000..f1bd9cf Binary files /dev/null and b/hsarweb/WebContent/WEB-INF/lib/vaadin-6.4.8.jar differ diff --git a/hsarweb/lib/ws-commons-util-1.0.2.jar b/hsarweb/WebContent/WEB-INF/lib/ws-commons-util-1.0.2.jar similarity index 100% rename from hsarweb/lib/ws-commons-util-1.0.2.jar rename to hsarweb/WebContent/WEB-INF/lib/ws-commons-util-1.0.2.jar diff --git a/hsarweb/lib/xmlrpc-client-3.1.3.jar b/hsarweb/WebContent/WEB-INF/lib/xmlrpc-client-3.1.3.jar similarity index 100% rename from hsarweb/lib/xmlrpc-client-3.1.3.jar rename to hsarweb/WebContent/WEB-INF/lib/xmlrpc-client-3.1.3.jar diff --git a/hsarweb/lib/xmlrpc-common-3.1.3.jar b/hsarweb/WebContent/WEB-INF/lib/xmlrpc-common-3.1.3.jar similarity index 100% rename from hsarweb/lib/xmlrpc-common-3.1.3.jar rename to hsarweb/WebContent/WEB-INF/lib/xmlrpc-common-3.1.3.jar diff --git a/hsarweb/webapp/WEB-INF/web.xml b/hsarweb/WebContent/WEB-INF/web.xml similarity index 60% rename from hsarweb/webapp/WEB-INF/web.xml rename to hsarweb/WebContent/WEB-INF/web.xml index aa5f931..ae5a4c8 100644 --- a/hsarweb/webapp/WEB-INF/web.xml +++ b/hsarweb/WebContent/WEB-INF/web.xml @@ -1,8 +1,9 @@ - - + + + + HSAdmin serverName @@ -16,7 +17,12 @@ xmlrpcURL https://agnes.ostwall195.de:9443/hsar/xmlrpc/hsadmin - + + Vaadin production mode + productionMode + false + + CAS Authentication Filter org.jasig.cas.client.authentication.AuthenticationFilter @@ -26,7 +32,7 @@ service - http://agnes.ostwall195.de:8180/hsarweb + https://agnes.ostwall195.de:8443/HSAdmin @@ -43,11 +49,11 @@ proxyCallbackUrl - https://agnes.ostwall195.de:9443/hsarweb/proxyCallback + https://agnes.ostwall195.de:8443/HSAdmin/proxyCallback service - http://agnes.ostwall195.de:8180/hsarweb + https://agnes.ostwall195.de:8443/HSAdmin @@ -60,20 +66,22 @@ CAS Authentication Filter /* - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - - Faces Servlet - *.html - + + HSAdmin Web + com.vaadin.terminal.gwt.server.ApplicationServlet + + Vaadin application class to start + application + de.hsadmin.web.DomainModule + + + + HSAdmin Web + /* + + index.html index.jsp - - + \ No newline at end of file diff --git a/hsarweb/webapp/index.jsp b/hsarweb/WebContent/index.jsp similarity index 83% rename from hsarweb/webapp/index.jsp rename to hsarweb/WebContent/index.jsp index 033e747..28fd4ea 100644 --- a/hsarweb/webapp/index.jsp +++ b/hsarweb/WebContent/index.jsp @@ -4,9 +4,9 @@ - Hello World + HSAdmin Web Client - + \ No newline at end of file diff --git a/hsarweb/build.xml b/hsarweb/build.xml index 011bff7..0a0d023 100644 --- a/hsarweb/build.xml +++ b/hsarweb/build.xml @@ -2,16 +2,16 @@ - + + + + - - - - + diff --git a/hsarweb/lib/commons-beanutils-1.7.0.jar b/hsarweb/lib/commons-beanutils-1.7.0.jar deleted file mode 100644 index b1b89c9..0000000 Binary files a/hsarweb/lib/commons-beanutils-1.7.0.jar and /dev/null differ diff --git a/hsarweb/lib/commons-codec-1.3.jar b/hsarweb/lib/commons-codec-1.3.jar deleted file mode 100644 index 957b675..0000000 Binary files a/hsarweb/lib/commons-codec-1.3.jar and /dev/null differ diff --git a/hsarweb/lib/commons-collections-3.2.jar b/hsarweb/lib/commons-collections-3.2.jar deleted file mode 100644 index 75580be..0000000 Binary files a/hsarweb/lib/commons-collections-3.2.jar and /dev/null differ diff --git a/hsarweb/lib/commons-digester-1.8.jar b/hsarweb/lib/commons-digester-1.8.jar deleted file mode 100644 index 1110f0a..0000000 Binary files a/hsarweb/lib/commons-digester-1.8.jar and /dev/null differ diff --git a/hsarweb/lib/commons-discovery-0.4.jar b/hsarweb/lib/commons-discovery-0.4.jar deleted file mode 100644 index 8355f0b..0000000 Binary files a/hsarweb/lib/commons-discovery-0.4.jar and /dev/null differ diff --git a/hsarweb/lib/jstl-api-1.2.jar b/hsarweb/lib/jstl-api-1.2.jar deleted file mode 100644 index 183ed63..0000000 Binary files a/hsarweb/lib/jstl-api-1.2.jar and /dev/null differ diff --git a/hsarweb/lib/jstl-impl-1.2.jar b/hsarweb/lib/jstl-impl-1.2.jar deleted file mode 100644 index 110ca51..0000000 Binary files a/hsarweb/lib/jstl-impl-1.2.jar and /dev/null differ diff --git a/hsarweb/lib/myfaces-api-2.0.1.jar b/hsarweb/lib/myfaces-api-2.0.1.jar deleted file mode 100644 index bbcada1..0000000 Binary files a/hsarweb/lib/myfaces-api-2.0.1.jar and /dev/null differ diff --git a/hsarweb/lib/myfaces-impl-2.0.1.jar b/hsarweb/lib/myfaces-impl-2.0.1.jar deleted file mode 100644 index 199b7d8..0000000 Binary files a/hsarweb/lib/myfaces-impl-2.0.1.jar and /dev/null differ diff --git a/hsarweb/src/de/hsadmin/web/Bean.java b/hsarweb/src/de/hsadmin/web/Bean.java deleted file mode 100644 index c58fc95..0000000 --- a/hsarweb/src/de/hsadmin/web/Bean.java +++ /dev/null @@ -1,54 +0,0 @@ -package de.hsadmin.web; - -import java.text.DateFormat; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; -import java.util.ResourceBundle; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.ManagedProperty; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="hello") -@SessionScoped -public class Bean { - - public final static DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT); - - @ManagedProperty(value="#{context}") - private Context context; - - @ManagedProperty(value="#{remote}") - private Remote remote; - - public String getMessage() { - Map where = new HashMap(); - where.put("name", context.getUser()); - String name = "Welt"; - try { - Object test = remote.callSearch("user", context.getUser(), where); - if (test instanceof Object[] && ((Object[])test).length > 0 ) { - if (((Object[])test)[0] instanceof Map) { - name = (String) ((Map)((Object[])test)[0]).get("comment"); - } - } - } catch (HsarwebException e) { - e.printStackTrace(); - } - return "Hallo " + name; - } - - public String getTime() { - return df.format(new Date()); - } - - public void setContext(Context context) { - this.context = context; - } - - public void setRemote(Remote remote) { - this.remote = remote; - } - -} diff --git a/hsarweb/src/de/hsadmin/web/Context.java b/hsarweb/src/de/hsadmin/web/Context.java deleted file mode 100644 index 7b257b1..0000000 --- a/hsarweb/src/de/hsadmin/web/Context.java +++ /dev/null @@ -1,42 +0,0 @@ -package de.hsadmin.web; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; -import javax.faces.context.ExternalContext; -import javax.faces.context.FacesContext; - -import org.jasig.cas.client.authentication.AttributePrincipal; -import org.jasig.cas.client.util.AbstractCasFilter; -import org.jasig.cas.client.validation.Assertion; - -@ManagedBean(name="context") -@SessionScoped -public class Context { - - private ExternalContext getExternalContext() { - return FacesContext.getCurrentInstance().getExternalContext(); - } - - private AttributePrincipal getPrincipal() { - ExternalContext context = getExternalContext(); - Assertion assertion = (Assertion) context.getSessionMap().get(AbstractCasFilter.CONST_CAS_ASSERTION); - return assertion.getPrincipal(); - } - - public String getUser() { - return getPrincipal().getName(); - } - - public String getProxyTicket() { - String backendURL = getContextParam("backendURL"); - return getPrincipal().getProxyTicketFor(backendURL); - } - - public String getContextPath() { - return getExternalContext().getRequestContextPath(); - } - - public String getContextParam(String name) { - return getExternalContext().getInitParameter(name); - } -} diff --git a/hsarweb/src/de/hsadmin/web/Domain.java b/hsarweb/src/de/hsadmin/web/Domain.java deleted file mode 100644 index 1afd769..0000000 --- a/hsarweb/src/de/hsadmin/web/Domain.java +++ /dev/null @@ -1,106 +0,0 @@ -package de.hsadmin.web; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.ManagedProperty; -import javax.faces.bean.SessionScoped; -import javax.faces.context.FacesContext; - -@ManagedBean(name="domain") -@SessionScoped -public class Domain { - - @ManagedProperty(value="#{context}") - private Context context; - - @ManagedProperty(value="#{remote}") - private Remote remote; - - @ManagedProperty(value="#{texts}") - private Texts texts; - - private List> list = null; - private String error = null; - public Map labels = null; - public Map urls = null; - - public String getError() { - return error; - } - - public void setContext(Context context) { - this.context = context; - } - - public void setRemote(Remote remote) { - this.remote = remote; - } - - public void setTexts(Texts texts) { - this.texts = texts; - } - - public List> getList() { - if (list == null) { - list = new ArrayList>(); - try { - Map whereParams = new HashMap(); - Object testList = remote.callSearch("domain", context.getUser(), whereParams); - if (testList != null && testList instanceof Object[]) { - Object[] lst = (Object[])testList; - for (int i = 0; i) { - Map row = (Map) testRow; - Map dom = new HashMap(); - for (String key : new String[] { "id", "name", "user", "hive", "pac", "since" }) { - dom.put(key, (String) row.get(key)); - } - list.add(dom); - } - } - } - } catch (HsarwebException e) { - error = e.getMessage(); - } - } - return list; - } - - public Map getLabels() { - if (labels == null) { - labels = new HashMap(); - for (String key : new String[]{ "name", "user" }) { - labels.put(key, texts.getLabel("domain." + key + ".label")); - } - - } - return labels; - } - - public Map getUrls() { - if (urls == null) { - String path = context.getContextPath() + "/"; - urls = new HashMap(); - for (String key : new String[]{ "edit", "delete" }) { - urls.put(key, path + "domain/" + key + ".html"); - } - - } - return urls; - } - - public String delete() { - System.out.println("domain.delete" + FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("dom_id")); - return null; - } - - public String edit() { - System.out.println("domain.edit" + FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("dom_id")); - return null; - } -} diff --git a/hsarweb/src/de/hsadmin/web/DomainModule.java b/hsarweb/src/de/hsadmin/web/DomainModule.java new file mode 100644 index 0000000..df3e5ab --- /dev/null +++ b/hsarweb/src/de/hsadmin/web/DomainModule.java @@ -0,0 +1,29 @@ +package de.hsadmin.web; + +import java.util.Date; + +import de.hsadmin.web.config.ModuleConfig; +import de.hsadmin.web.config.PropertyConfig; + +public class DomainModule extends GenericModule { + + private static final long serialVersionUID = 1L; + + private ModuleConfig moduleConfig; + + public DomainModule() { + moduleConfig = new ModuleConfig("domain"); + moduleConfig.addProperty(new PropertyConfig(moduleConfig, "id", Long.class, "", true, true)); + moduleConfig.addProperty(new PropertyConfig(moduleConfig, "name", String.class, "")); + moduleConfig.addProperty(new PropertyConfig(moduleConfig, "user", String.class, "")); + moduleConfig.addProperty(new PropertyConfig(moduleConfig, "pac", String.class, "", true)); + moduleConfig.addProperty(new PropertyConfig(moduleConfig, "hive", String.class, "", true)); + moduleConfig.addProperty(new PropertyConfig(moduleConfig, "since", Date.class, "")); + } + + @Override + public ModuleConfig getModuleConfig() { + return moduleConfig; + } + +} diff --git a/hsarweb/src/de/hsadmin/web/GenericModule.java b/hsarweb/src/de/hsadmin/web/GenericModule.java new file mode 100644 index 0000000..bf9abca --- /dev/null +++ b/hsarweb/src/de/hsadmin/web/GenericModule.java @@ -0,0 +1,212 @@ +package de.hsadmin.web; + +import java.text.DateFormat; +import java.text.ParseException; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.jasig.cas.client.authentication.AttributePrincipal; +import org.jasig.cas.client.authentication.AuthenticationFilter; +import org.jasig.cas.client.validation.Assertion; + +import com.vaadin.Application; +import com.vaadin.data.Property; +import com.vaadin.terminal.Sizeable; +import com.vaadin.terminal.ThemeResource; +import com.vaadin.terminal.gwt.server.HttpServletRequestListener; +import com.vaadin.ui.Button; +import com.vaadin.ui.Table; +import com.vaadin.ui.Window; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.themes.BaseTheme; + +import de.hsadmin.web.config.ModuleConfig; +import de.hsadmin.web.config.PropertyConfig; + +public abstract class GenericModule extends Application implements HttpServletRequestListener { + + private static final long serialVersionUID = 1L; + private static final DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT); + + private HttpSession httpSession; + private AttributePrincipal userPrincipal; + private ServletContext servletContext; + private Table table; + + + @Override + public void init() { + Window mainWindow = new Window(getModuleConfig().getName()); + mainWindow.setHeight(100.0f, Sizeable.UNITS_PERCENTAGE); + mainWindow.setWidth(100.0f, Sizeable.UNITS_PERCENTAGE); + try { + initTable(); + mainWindow.addComponent(table); + } catch (IllegalAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + setMainWindow(mainWindow); + } + + private void initTable() throws IllegalAccessException { + table = new Table() { + private static final long serialVersionUID = 35127658139420917L; + @Override + protected String formatPropertyValue(Object rowId, Object colId, + Property property) { + if (Date.class == property.getType()) { + try { + return df.format(property.getValue()); + } catch (IllegalArgumentException e) { + return "---"; + } + } + return super.formatPropertyValue(rowId, colId, property); + } + }; + table.setWidth(100.0f, Sizeable.UNITS_PERCENTAGE); + table.setHeight(100.0f, Sizeable.UNITS_PERCENTAGE); + table.setSelectable(true); + table.setImmediate(true); + table.setColumnCollapsingAllowed(true); + table.setColumnReorderingAllowed(true); + for (PropertyConfig prop : getModuleConfig().getPropertyList()) { + table.addContainerProperty(prop.getId(), prop.getType(), prop.getDefaultValue()); + table.setColumnHeader(prop.getId(), prop.getLabel()); + if (prop.isHidden()) { + table.setColumnCollapsed(prop.getId(), true); + } + } + table.addContainerProperty("edit", Button.class, null); + table.setColumnWidth("edit", 16); + table.setColumnHeader("edit", ""); + table.addContainerProperty("del", Button.class, null); + table.setColumnWidth("del", 16); + table.setColumnHeader("del", ""); + loadTable(); + } + + private void loadTable() { + Remote remote = new Remote(this); + table.removeAllItems(); + try { + Object callSearch = remote.callSearch(userPrincipal.getName(), new HashMap()); + List propertyList = getModuleConfig().getPropertyList(); + if (callSearch instanceof Object[]) { + for (Object row : ((Object[])callSearch)) { + long oid = -1L; + if (row instanceof Map) { + Object[] itemData = new Object[propertyList.size()+2]; + int idx = 0; + for (PropertyConfig prop : propertyList) { + Object valueObject = ((Map) row).get(prop.getId()); + if (valueObject != null && valueObject instanceof String) { + if (Long.class.equals(prop.getType())) { + itemData[idx] = Long.parseLong((String) valueObject); + } + if (Date.class.equals(prop.getType())) { + try { + itemData[idx] = df.parse((String) valueObject); + } catch (ParseException e) { + Calendar cal = Calendar.getInstance(); + cal.clear(); + itemData[idx] = cal.getTime(); + } + } + if (String.class.equals(prop.getType())) { + itemData[idx] = (String) valueObject; + } + if (prop.isIdent() && Long.class.equals(prop.getType())) { + if (valueObject instanceof String) { + oid = Long.parseLong((String) valueObject); + } + } + } + idx++; + } + itemData[idx] = createEditButton(oid); + idx++; + itemData[idx] = createDeleteButton(oid); + idx++; + table.addItem(itemData, oid); + } + } + table.sort(); + } + } catch (UnsupportedOperationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (HsarwebException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + private Button createEditButton(long id) { + ThemeResource icon = new ThemeResource("../runo/icons/16/document-txt.png"); + Button button = new Button(); + button.setIcon(icon); + button.setData(id); + button.setStyleName(BaseTheme.BUTTON_LINK); + button.addListener(new Button.ClickListener() { + private static final long serialVersionUID = 1L; + @Override + public void buttonClick(ClickEvent event) { + loadTable(); + System.out.println("Data: " + event.getButton().getData()); + } + }); + return button; + } + + private Button createDeleteButton(long id) { + ThemeResource icon = new ThemeResource("../runo/icons/16/cancel.png"); + Button button = new Button(); + button.setIcon(icon); + button.setData(id); + button.setStyleName(BaseTheme.BUTTON_LINK); + button.addListener(new Button.ClickListener() { + private static final long serialVersionUID = 1L; + @Override + public void buttonClick(ClickEvent event) { + loadTable(); + System.out.println("Data: " + event.getButton().getData()); + } + }); + return button; + } + + public String getProxyTicket() { + return userPrincipal.getProxyTicketFor(servletContext.getInitParameter("backendURL")); + } + + public String getContextParam(String string) { + return servletContext.getInitParameter(string); + } + + @Override + public void onRequestStart(HttpServletRequest request, + HttpServletResponse response) { + httpSession = request.getSession(); + servletContext = httpSession.getServletContext(); + userPrincipal = ((Assertion) httpSession.getAttribute(AuthenticationFilter.CONST_CAS_ASSERTION)).getPrincipal(); + } + + @Override + public void onRequestEnd(HttpServletRequest request, + HttpServletResponse response) { + + } + + public abstract ModuleConfig getModuleConfig(); + +} diff --git a/hsarweb/src/de/hsadmin/web/HsarwebException.java b/hsarweb/src/de/hsadmin/web/HsarwebException.java index 50761a9..0fb59ea 100644 --- a/hsarweb/src/de/hsadmin/web/HsarwebException.java +++ b/hsarweb/src/de/hsadmin/web/HsarwebException.java @@ -5,16 +5,8 @@ public class HsarwebException extends Exception { private static final long serialVersionUID = 1L; - public HsarwebException(String msg, Exception e) { - super(msg, e); - } - - public HsarwebException(Exception e) { - super(e); - } - - public HsarwebException(String msg) { - super(msg); + public HsarwebException(String string, Throwable e) { + super(string, e); } } diff --git a/hsarweb/src/de/hsadmin/web/Modules.java b/hsarweb/src/de/hsadmin/web/Modules.java deleted file mode 100644 index 87321c1..0000000 --- a/hsarweb/src/de/hsadmin/web/Modules.java +++ /dev/null @@ -1,63 +0,0 @@ -package de.hsadmin.web; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.ManagedProperty; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="modules") -@SessionScoped -public class Modules { - - @ManagedProperty(value="#{context}") - private Context context; - - @ManagedProperty(value="#{texts}") - private Texts texts; - - public String[] pageNames = new String[] { "hello", "domain" }; - public Map labels = null; - public Map urls = null; - - public List getPageNames() { - ArrayList names = new ArrayList(); - for (String name : pageNames) { - names.add(name); - } - return names; - } - - public Map getLabels() { - if (labels == null) { - labels = new HashMap(); - for (String key : pageNames) { - labels.put(key, texts.getLabel(key + ".label")); - } - } - return labels; - } - - public Map getUrls() { - if (urls == null) { - String path = context.getContextPath() + "/"; - urls = new HashMap(); - for (String key : pageNames) { - urls.put(key, path + key + "/index.html"); - } - } - return urls; - } - - public void setContext(Context context) { - this.context = context; - } - - public void setTexts(Texts texts) { - this.texts = texts; - } - -} diff --git a/hsarweb/src/de/hsadmin/web/Remote.java b/hsarweb/src/de/hsadmin/web/Remote.java index 388f3ed..ce4f683 100644 --- a/hsarweb/src/de/hsadmin/web/Remote.java +++ b/hsarweb/src/de/hsadmin/web/Remote.java @@ -4,35 +4,27 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.Map; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.ManagedProperty; -import javax.faces.bean.SessionScoped; - import org.apache.xmlrpc.XmlRpcException; import org.apache.xmlrpc.client.XmlRpcClient; import org.apache.xmlrpc.client.XmlRpcClientConfigImpl; -@ManagedBean(name="remote") -@SessionScoped public class Remote { private XmlRpcClient client; + private GenericModule module; - @ManagedProperty(value="#{context}") - private Context context; - - public Remote() throws HsarwebException { - client = null; + public Remote(GenericModule module) { + this.module = module; } - - public Object callSearch(String module, String user, Map where) throws HsarwebException { + + public Object callSearch(String user, Map where) throws HsarwebException { Object[] params = new Object[3]; params[0] = user; - params[1] = context.getProxyTicket(); + params[1] = module.getProxyTicket(); params[2] = where; Object res; try { - res = getClient().execute(module + ".search", params); + res = getClient().execute(module.getModuleConfig().getName() + ".search", params); } catch (XmlRpcException e) { throw new HsarwebException("error in remote server call", e); } @@ -43,7 +35,7 @@ public class Remote { if (client == null) { XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); try { - String xmlrpcURL = context.getContextParam("xmlrpcURL"); + String xmlrpcURL = module.getContextParam("xmlrpcURL"); config.setServerURL(new URL(xmlrpcURL)); } catch (MalformedURLException e) { throw new HsarwebException("error in remote server url", e); @@ -54,7 +46,5 @@ public class Remote { return client; } - public void setContext(Context context) { - this.context = context; - } + } diff --git a/hsarweb/src/de/hsadmin/web/Texts.java b/hsarweb/src/de/hsadmin/web/Texts.java deleted file mode 100644 index a5833ba..0000000 --- a/hsarweb/src/de/hsadmin/web/Texts.java +++ /dev/null @@ -1,17 +0,0 @@ -package de.hsadmin.web; - -import java.util.ResourceBundle; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="texts") -@SessionScoped -public class Texts { - - public String getLabel(String key) { - ResourceBundle resource = ResourceBundle.getBundle("texts.messages"); - return resource.getString(key); - } - -} diff --git a/hsarweb/src/de/hsadmin/web/config/LocaleConfig.java b/hsarweb/src/de/hsadmin/web/config/LocaleConfig.java new file mode 100644 index 0000000..82500a8 --- /dev/null +++ b/hsarweb/src/de/hsadmin/web/config/LocaleConfig.java @@ -0,0 +1,21 @@ +package de.hsadmin.web.config; + +import java.util.Locale; +import java.util.ResourceBundle; + +public class LocaleConfig { + + private ResourceBundle bundle; + + public LocaleConfig(Locale locale, String moduleName) { + bundle = ResourceBundle.getBundle("texts." + moduleName, locale); + } + + public String getText(String key) { + try { + return bundle.getString(key); + } catch (Exception e) { + return "!!" + key + "!!"; + } + } +} diff --git a/hsarweb/src/de/hsadmin/web/config/ModuleConfig.java b/hsarweb/src/de/hsadmin/web/config/ModuleConfig.java new file mode 100644 index 0000000..28e4793 --- /dev/null +++ b/hsarweb/src/de/hsadmin/web/config/ModuleConfig.java @@ -0,0 +1,38 @@ +package de.hsadmin.web.config; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; + +public class ModuleConfig implements Serializable { + + private static final long serialVersionUID = 1L; + + private String name; + private List propertyList; + private LocaleConfig localeConfig; + + public ModuleConfig(String name) { + this.name = name; + propertyList = new ArrayList(); + localeConfig = new LocaleConfig(Locale.getDefault(), name); + } + + public String getName() { + return name; + } + + public void addProperty(PropertyConfig property) { + this.propertyList.add(property); + } + + public List getPropertyList() { + return propertyList; + } + + public String getLabel(String key) { + return localeConfig.getText(key); + } + +} diff --git a/hsarweb/src/de/hsadmin/web/config/PropertyConfig.java b/hsarweb/src/de/hsadmin/web/config/PropertyConfig.java new file mode 100644 index 0000000..fe7c237 --- /dev/null +++ b/hsarweb/src/de/hsadmin/web/config/PropertyConfig.java @@ -0,0 +1,87 @@ +package de.hsadmin.web.config; + +import java.io.Serializable; + +public class PropertyConfig implements Serializable { + + private static final long serialVersionUID = 1L; + + private ModuleConfig moduleConfig; + private String id; + private Class type; + private String defaultValue; + private boolean hidden; + private boolean ident; + + public PropertyConfig(ModuleConfig moduleConfig, String id, Class clasz, String defaultValue) { + this.moduleConfig = moduleConfig; + this.id = id; + this.type = clasz; + this.defaultValue = defaultValue; + this.setHidden(false); + this.setIdent(false); + } + + public PropertyConfig(ModuleConfig moduleConfig, String id, Class clasz, String defaultValue, boolean hidden) { + this.moduleConfig = moduleConfig; + this.id = id; + this.type = clasz; + this.defaultValue = defaultValue; + this.setHidden(hidden); + this.setIdent(false); + } + + public PropertyConfig(ModuleConfig moduleConfig, String id, Class clasz, String defaultValue, boolean hidden, boolean ident) { + this.moduleConfig = moduleConfig; + this.id = id; + this.type = clasz; + this.defaultValue = defaultValue; + this.setHidden(hidden); + this.setIdent(ident); + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getLabel() { + return moduleConfig.getLabel(id); + } + + public Class getType() { + return type; + } + + public void setType(Class type) { + this.type = type; + } + + public String getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(String defaultValue) { + this.defaultValue = defaultValue; + } + + public void setHidden(boolean hidden) { + this.hidden = hidden; + } + + public boolean isHidden() { + return hidden; + } + + public void setIdent(boolean ident) { + this.ident = ident; + } + + public boolean isIdent() { + return ident; + } + +} diff --git a/hsarweb/src/texts/domain.properties b/hsarweb/src/texts/domain.properties new file mode 100644 index 0000000..848f402 --- /dev/null +++ b/hsarweb/src/texts/domain.properties @@ -0,0 +1,6 @@ +id=identifier +name=domain +user=admin +pac=packet +hive=host +since=connected since \ No newline at end of file diff --git a/hsarweb/src/texts/domain_de.properties b/hsarweb/src/texts/domain_de.properties new file mode 100644 index 0000000..7ed475c --- /dev/null +++ b/hsarweb/src/texts/domain_de.properties @@ -0,0 +1,6 @@ +id=Schlüssel +name=Domain +user=Administrator +pac=Paket +hive=Server +since=aufgeschaltet seit \ No newline at end of file diff --git a/hsarweb/src/texts/messages_de.properties b/hsarweb/src/texts/messages_de.properties deleted file mode 100644 index 33d5f7b..0000000 --- a/hsarweb/src/texts/messages_de.properties +++ /dev/null @@ -1,6 +0,0 @@ -edit=bearbeiten -delete=loeschen -hello.label=Hallo -domain.label=Domains -domain.name.label=Domain -domain.user.label=Verwalter \ No newline at end of file diff --git a/hsarweb/src/texts/messages_en.properties b/hsarweb/src/texts/messages_en.properties deleted file mode 100644 index 4ac1c97..0000000 --- a/hsarweb/src/texts/messages_en.properties +++ /dev/null @@ -1,6 +0,0 @@ -edit=edit -delete=delete -hello.label=Hello -domain.label=Domains -domain.name.label=Domain -domain.user.label=Owner \ No newline at end of file diff --git a/hsarweb/webapp/WEB-INF/faces-config.xml b/hsarweb/webapp/WEB-INF/faces-config.xml deleted file mode 100644 index 2a65339..0000000 --- a/hsarweb/webapp/WEB-INF/faces-config.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - de - en - - texts.messages - - texts.messages - msgs - - - - \ No newline at end of file diff --git a/hsarweb/webapp/domain/index.xhtml b/hsarweb/webapp/domain/index.xhtml deleted file mode 100644 index 5a20127..0000000 --- a/hsarweb/webapp/domain/index.xhtml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - Hello World - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hsarweb/webapp/hello/index.xhtml b/hsarweb/webapp/hello/index.xhtml deleted file mode 100644 index db691aa..0000000 --- a/hsarweb/webapp/hello/index.xhtml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - Hello World - - - - - - - , es ist jetzt  Uhr. - - - - - \ No newline at end of file diff --git a/hsarweb/webapp/resources/images/logo.png b/hsarweb/webapp/resources/images/logo.png deleted file mode 100644 index f0d4dbc..0000000 Binary files a/hsarweb/webapp/resources/images/logo.png and /dev/null differ diff --git a/hsarweb/webapp/resources/styles/hsar.css b/hsarweb/webapp/resources/styles/hsar.css deleted file mode 100644 index 2157e31..0000000 --- a/hsarweb/webapp/resources/styles/hsar.css +++ /dev/null @@ -1,99 +0,0 @@ -body { - font-family:Arial,Helvetica,SansSerif; - font-style:normal; - font-variant:normal; - font-size:12pt; - font-weight:normal; - margin:0px; - padding:0px; - min-height:1600px; - color:#707172; - background-color:#f0f0f0; -} -.page { - width:944px; - margin-left:auto; - margin-top:2px; - margin-right:auto; - padding-top:0px; - padding-left:0px; - padding-right:0px; - color:#707172; - background-color:#ffffff; -} -.header { - height:68px; - width:944px; - margin:0px; - padding:0px; - background-color:#005094; - background-image:url(../resources/images/logo.png); - background-repeat:no-repeat; - border-style: none solid; - border-width: 1px; - border-color: #005094; -} -.main { - width:936px; - margin:0px; - padding-top:10px; - padding-left:4px; - padding-right:4px; - padding-bottom:0px; - border-style: none solid; - border-width: 1px; - border-color: #dd4901; -} -.menu { - float:left; - width:300px; - margin-left:0px; - margin-top:0px; - margin-right:0px; - padding-top:0px; - padding-left:0px; - padding-right:0px; -} -.dummy { - clear:both; -} -.content { - width:606px; - margin-left:304px; - margin-top:0px; - margin-right:auto; - margin-bottom:0px; - padding-top:0px; - padding-left:10px; - padding-right:10px; - border-left-style: solid; - border-left-width: 1px; - border-left-color: #dd4901; -} -.footer { - width:944px; - clear:left; - font-family:Arial,Helvetica,SansSerif; - font-style:normal; - font-variant:normal; - font-size:10pt; - font-weight:normal; - text-decoration:none; - text-align:center; - padding-top:4px; - padding-bottom:4px; - padding-left:0px; - padding-right:0px; - border-top-color:#ede9e8; - border-top-width:2pt; - border-top-style:solid; - border-left-style: solid; - border-left-width: 1px; - border-left-color: #dd4901; - border-right-style: solid; - border-right-width: 1px; - border-right-color: #dd4901; - border-bottom-style: solid; - border-bottom-width: 1px; - border-bottom-color: #dd4901; -} diff --git a/hsarweb/webapp/templates/menu-template.xhtml b/hsarweb/webapp/templates/menu-template.xhtml deleted file mode 100644 index b3f6d08..0000000 --- a/hsarweb/webapp/templates/menu-template.xhtml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - Hello World - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hsarweb/webapp/templates/template.xhtml b/hsarweb/webapp/templates/template.xhtml deleted file mode 100644 index fb960e7..0000000 --- a/hsarweb/webapp/templates/template.xhtml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - #{title} - - - - -
-
- -
-
- -
- Default Content -
-
-
- -
-
- \ No newline at end of file