hsarweb/WebContent/WEB-INF/lib/cas-client-core-3.1.10.jarBinary files differ
hsarweb/WebContent/WEB-INF/lib/commons-logging-1.1.1.jarBinary files differ
hsarweb/WebContent/WEB-INF/lib/vaadin-6.4.8.jarBinary files differ
hsarweb/WebContent/WEB-INF/lib/ws-commons-util-1.0.2.jarBinary files differ
hsarweb/WebContent/WEB-INF/lib/xmlrpc-client-3.1.3.jarBinary files differ
hsarweb/WebContent/WEB-INF/lib/xmlrpc-common-3.1.3.jarBinary files differ
hsarweb/WebContent/WEB-INF/web.xml
File was renamed from hsarweb/webapp/WEB-INF/web.xml @@ -1,8 +1,9 @@ <?xml version="1.0" encoding="ISO-8859-1"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>HSAdmin</display-name> <context-param> <param-name>serverName</param-name> @@ -16,7 +17,12 @@ <param-name>xmlrpcURL</param-name> <param-value>https://agnes.ostwall195.de:9443/hsar/xmlrpc/hsadmin</param-value> </context-param> <context-param> <description>Vaadin production mode</description> <param-name>productionMode</param-name> <param-value>false</param-value> </context-param> <filter> <filter-name>CAS Authentication Filter</filter-name> <filter-class>org.jasig.cas.client.authentication.AuthenticationFilter</filter-class> @@ -26,7 +32,7 @@ </init-param> <init-param> <param-name>service</param-name> <param-value>http://agnes.ostwall195.de:8180/hsarweb</param-value> <param-value>https://agnes.ostwall195.de:8443/HSAdmin</param-value> </init-param> </filter> @@ -43,11 +49,11 @@ </init-param> <init-param> <param-name>proxyCallbackUrl</param-name> <param-value>https://agnes.ostwall195.de:9443/hsarweb/proxyCallback</param-value> <param-value>https://agnes.ostwall195.de:8443/HSAdmin/proxyCallback</param-value> </init-param> <init-param> <param-name>service</param-name> <param-value>http://agnes.ostwall195.de:8180/hsarweb</param-value> <param-value>https://agnes.ostwall195.de:8443/HSAdmin</param-value> </init-param> </filter> @@ -60,20 +66,22 @@ <filter-name>CAS Authentication Filter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.html</url-pattern> </servlet-mapping> <servlet> <servlet-name>HSAdmin Web</servlet-name> <servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class> <init-param> <description>Vaadin application class to start</description> <param-name>application</param-name> <param-value>de.hsadmin.web.DomainModule</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>HSAdmin Web</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app> </web-app> hsarweb/WebContent/index.jsp
File was renamed from hsarweb/webapp/index.jsp @@ -4,9 +4,9 @@ <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Hello World</title> <title>HSAdmin Web Client</title> </head> <body> <jsp:forward page="hello/index.html" /> </body> </html> hsarweb/build.xml
@@ -2,16 +2,16 @@ <project name="hsarweb" default="war"> <path id="cp"> <fileset dir="lib"> <fileset dir="WebContent/WEB-INF/lib"> <include name="**/*.jar"/> </fileset> <fileset dir="/usr/share/java"> <include name="servlet-api-2.4.jar"/> </fileset> </path> <target name="war" depends="compile"> <war destfile="build/hsarweb.war" basedir="webapp"> <lib dir="lib"> <include name="**/*.jar"/> </lib> <war destfile="build/hsarweb.war" basedir="WebContent"> <classes dir="build/cls" /> <classes dir="src"> <include name="**/*.properties"/> hsarweb/lib/commons-beanutils-1.7.0.jarBinary files differ
hsarweb/lib/commons-codec-1.3.jarBinary files differ
hsarweb/lib/commons-collections-3.2.jarBinary files differ
hsarweb/lib/commons-digester-1.8.jarBinary files differ
hsarweb/lib/commons-discovery-0.4.jarBinary files differ
hsarweb/lib/jstl-api-1.2.jarBinary files differ
hsarweb/lib/jstl-impl-1.2.jarBinary files differ
hsarweb/lib/myfaces-api-2.0.1.jarBinary files differ
hsarweb/lib/myfaces-impl-2.0.1.jarBinary files differ
hsarweb/src/de/hsadmin/web/Bean.java
File was deleted hsarweb/src/de/hsadmin/web/Context.java
File was deleted hsarweb/src/de/hsadmin/web/Domain.java
File was deleted hsarweb/src/de/hsadmin/web/DomainModule.java
New file @@ -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; } } hsarweb/src/de/hsadmin/web/GenericModule.java
New file @@ -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<String, String>()); List<PropertyConfig> 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(); } hsarweb/src/de/hsadmin/web/HsarwebException.java
@@ -5,16 +5,8 @@ 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); } } hsarweb/src/de/hsadmin/web/Modules.java
File was deleted hsarweb/src/de/hsadmin/web/Remote.java
@@ -4,35 +4,27 @@ 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<String, String> where) throws HsarwebException { public Object callSearch(String user, Map<String, String> 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 @@ 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 @@ return client; } public void setContext(Context context) { this.context = context; } } hsarweb/src/de/hsadmin/web/Texts.java
File was deleted hsarweb/src/de/hsadmin/web/config/LocaleConfig.java
New file @@ -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 + "!!"; } } } hsarweb/src/de/hsadmin/web/config/ModuleConfig.java
New file @@ -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<PropertyConfig> propertyList; private LocaleConfig localeConfig; public ModuleConfig(String name) { this.name = name; propertyList = new ArrayList<PropertyConfig>(); localeConfig = new LocaleConfig(Locale.getDefault(), name); } public String getName() { return name; } public void addProperty(PropertyConfig property) { this.propertyList.add(property); } public List<PropertyConfig> getPropertyList() { return propertyList; } public String getLabel(String key) { return localeConfig.getText(key); } } hsarweb/src/de/hsadmin/web/config/PropertyConfig.java
New file @@ -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; } } hsarweb/src/texts/domain.properties
New file @@ -0,0 +1,6 @@ id=identifier name=domain user=admin pac=packet hive=host since=connected since hsarweb/src/texts/domain_de.properties
New file @@ -0,0 +1,6 @@ id=Schlüssel name=Domain user=Administrator pac=Paket hive=Server since=aufgeschaltet seit hsarweb/src/texts/messages_de.properties
File was deleted hsarweb/src/texts/messages_en.properties
File was deleted hsarweb/webapp/WEB-INF/faces-config.xml
File was deleted hsarweb/webapp/domain/index.xhtml
File was deleted hsarweb/webapp/hello/index.xhtml
File was deleted hsarweb/webapp/resources/images/logo.pngBinary files differ
hsarweb/webapp/resources/styles/hsar.css
File was deleted hsarweb/webapp/templates/menu-template.xhtml
File was deleted hsarweb/webapp/templates/template.xhtml
File was deleted