Basic structure for new admin app
parent
1d399a299b
commit
0cb2214dd2
|
|
@ -213,7 +213,7 @@
|
||||||
<artifactId>ccm-core</artifactId>
|
<artifactId>ccm-core</artifactId>
|
||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
<includes>
|
<includes>
|
||||||
<include>views/</include>
|
<include>WEB-INF/</include>
|
||||||
</includes>
|
</includes>
|
||||||
</overlay>
|
</overlay>
|
||||||
<overlay>
|
<overlay>
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,6 @@
|
||||||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
|
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
|
||||||
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
|
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
|
||||||
<application>
|
<application>
|
||||||
<resource-handler>org.libreccm.ui.CcmFaceletsResourceHandler</resource-handler>
|
<resource-handler>org.libreccm.mvc.facelets.CcmViewResourceHandler</resource-handler>
|
||||||
</application>
|
</application>
|
||||||
</faces-config>
|
</faces-config>
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,10 @@
|
||||||
<param-name>ccm.distribution</param-name>
|
<param-name>ccm.distribution</param-name>
|
||||||
<param-value>libreccm</param-value>
|
<param-value>libreccm</param-value>
|
||||||
</context-param>
|
</context-param>
|
||||||
|
<context-param>
|
||||||
|
<param-name>resteasy.resources</param-name>
|
||||||
|
<param-value>org.jboss.resteasy.plugins.stats.RegistryStatsResource</param-value>
|
||||||
|
</context-param>
|
||||||
|
|
||||||
<!-- No JSESSIONID!!! -->
|
<!-- No JSESSIONID!!! -->
|
||||||
<session-config>
|
<session-config>
|
||||||
|
|
@ -66,7 +70,7 @@
|
||||||
<param-value>true</param-value>
|
<param-value>true</param-value>
|
||||||
</context-param>
|
</context-param>
|
||||||
|
|
||||||
<!-- <servlet>
|
<!-- <servlet>
|
||||||
<servlet-name>vaadin-servlet</servlet-name>
|
<servlet-name>vaadin-servlet</servlet-name>
|
||||||
<servlet-class>com.vaadin.cdi.server.VaadinCDIServlet</servlet-class>
|
<servlet-class>com.vaadin.cdi.server.VaadinCDIServlet</servlet-class>
|
||||||
</servlet>
|
</servlet>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.ui.admin;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import javax.enterprise.inject.Instance;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.ws.rs.ApplicationPath;
|
||||||
|
import javax.ws.rs.core.Application;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@ApplicationPath("/@admin")
|
||||||
|
public class AdminApplication extends Application {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Instance<AdminPage> adminPages;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<Class<?>> getClasses() {
|
||||||
|
return adminPages
|
||||||
|
.stream()
|
||||||
|
.map(AdminPage::getControllerClasses)
|
||||||
|
.flatMap(controllers -> controllers.stream())
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
|
// final Set<Class<?>> classes = new HashSet<>();
|
||||||
|
// classes.add(SystemInformationController.class);
|
||||||
|
//// classes.add(UsersApi.class);
|
||||||
|
// return classes;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.ui.admin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
public class AdminConstants {
|
||||||
|
|
||||||
|
private AdminConstants() {
|
||||||
|
// Nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String ADMIN_BUNDLE = "org.libreccm.ui.AdminBundle";
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.ui.admin;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
public interface AdminPage {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Classes implementing the controllers of the page.
|
||||||
|
*
|
||||||
|
* @return A set of controllers to be added to the {@link AdminApplication}.
|
||||||
|
*/
|
||||||
|
Set<Class<?>> getControllerClasses();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the resourcebundle which provides the label of the admin page.
|
||||||
|
*
|
||||||
|
* @return The bundle to use for retrieving the label of the page.
|
||||||
|
*/
|
||||||
|
String getLabelBundle();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the key for retrieving the label of the page from the label bundle.
|
||||||
|
*
|
||||||
|
* @return The key of the label.
|
||||||
|
*/
|
||||||
|
String getLabelKey();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the resourcebundle which provides the description of the admin page.
|
||||||
|
*
|
||||||
|
* @return The bundle to use for retrieving the label of the page.
|
||||||
|
*/
|
||||||
|
String getDescriptionBundle();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the key for retrieving the description of the page from the
|
||||||
|
* description bundle.
|
||||||
|
*
|
||||||
|
* @return The key of the label.
|
||||||
|
*/
|
||||||
|
String getDescriptionKey();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the position of the page in the admin nav bar.
|
||||||
|
*
|
||||||
|
* @return The position of the page in the admin navigation.
|
||||||
|
*/
|
||||||
|
int getPosition();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.ui.admin.systeminformation;
|
||||||
|
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.mvc.Controller;
|
||||||
|
import javax.ws.rs.GET;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@RequestScoped
|
||||||
|
@Controller
|
||||||
|
@Path("/systeminformation")
|
||||||
|
public class SystemInformationController {
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/")
|
||||||
|
public String getSystemInformation() {
|
||||||
|
return "org/libreccm/ui/admin/systeminformation.xhtml";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.ui.admin.systeminformation;
|
||||||
|
|
||||||
|
import com.arsdigita.util.SystemInformation;
|
||||||
|
import com.arsdigita.util.UncheckedWrapperException;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@RequestScoped
|
||||||
|
@Named("SystemInformationModel")
|
||||||
|
public class SystemInformationModel {
|
||||||
|
|
||||||
|
public Map<String, String> getCcmSystemInformation() {
|
||||||
|
final Properties properties = new Properties();
|
||||||
|
try {
|
||||||
|
final InputStream stream = getClass().getResourceAsStream(
|
||||||
|
"systeminformation.properties");
|
||||||
|
if (stream == null) {
|
||||||
|
properties.put("version", "");
|
||||||
|
properties.put("appname", "LibreCCM");
|
||||||
|
properties.put("apphomepage", "http://www.libreccm.org");
|
||||||
|
} else {
|
||||||
|
properties.load(stream);
|
||||||
|
}
|
||||||
|
// properties.load(getClass().getResourceAsStream(
|
||||||
|
// "WEB-INF/systeminformation.properties"));
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new UncheckedWrapperException(ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
final Map<String, String> sysInfo = new HashMap<>();
|
||||||
|
|
||||||
|
for (String key : properties.stringPropertyNames()) {
|
||||||
|
sysInfo.put(key, properties.getProperty(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
return sysInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getJavaSystemProperties() {
|
||||||
|
final Properties systemProperties = System.getProperties();
|
||||||
|
final Map<String, String> result = new HashMap<>();
|
||||||
|
for (final Object key : systemProperties.keySet()) {
|
||||||
|
result.put(
|
||||||
|
(String) key, systemProperties.getProperty((String) key)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2020 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.ui.admin.systeminformation;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.libreccm.ui.admin.AdminConstants;
|
||||||
|
import org.libreccm.ui.admin.AdminPage;
|
||||||
|
|
||||||
|
import javax.enterprise.context.ApplicationScoped;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@ApplicationScoped
|
||||||
|
public class SystemInformationPage implements AdminPage {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<Class<?>> getControllerClasses() {
|
||||||
|
final Set<Class<?>> classes = new HashSet<>();
|
||||||
|
classes.add(SystemInformationController.class);
|
||||||
|
return classes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLabelBundle() {
|
||||||
|
return AdminConstants.ADMIN_BUNDLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLabelKey() {
|
||||||
|
return "systeminformation.label";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescriptionBundle() {
|
||||||
|
return AdminConstants.ADMIN_BUNDLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescriptionKey() {
|
||||||
|
return "systeminformation.description";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getPosition() {
|
||||||
|
return 80;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html">
|
||||||
|
<h:head>
|
||||||
|
<title>System Information</title>
|
||||||
|
</h:head>
|
||||||
|
<h:body>
|
||||||
|
<h1>System Information</h1>
|
||||||
|
<h2>LibreCCM System Information</h2>
|
||||||
|
<dl>
|
||||||
|
<c:forEach items="#{SystemInformationModel.ccmSystemInformation}"
|
||||||
|
var="prop">
|
||||||
|
<div>
|
||||||
|
<dt>#{prop.key}</dt>
|
||||||
|
<dd>#{prop.value}</dd>
|
||||||
|
</div>
|
||||||
|
</c:forEach>
|
||||||
|
</dl>
|
||||||
|
</h:body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
systeminformation.description=Provides several informations about LibreCCM and the environment
|
||||||
|
systeminformation.label=System Information
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
systeminformation.description=Zeigt Informationen \u00fcber LibreCCM und die Umgebung
|
||||||
|
systeminformation.label=System Informationen
|
||||||
Loading…
Reference in New Issue