SystemInformation API

Jens Pelzetter 2020-06-08 20:10:46 +02:00
parent 3b6f069895
commit 0b9c2e9b27
3 changed files with 55 additions and 1 deletions

View File

@ -53,7 +53,6 @@ import java.util.stream.Stream;
* *
* *
* @author Jens Pelzetter * @author Jens Pelzetter
* @version $Id$
*/ */
public class SystemInformation { public class SystemInformation {

View File

@ -45,6 +45,9 @@ public class AdminApi extends Application {
classes.add(RolesApi.class); classes.add(RolesApi.class);
classes.add(UsersApi.class); classes.add(UsersApi.class);
// System Information API
classes.add(SystemInformationApi.class);
return classes; return classes;
} }

View File

@ -0,0 +1,52 @@
/*
* 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.api.admin;
import com.arsdigita.util.SystemInformation;
import org.libreccm.core.CoreConstants;
import org.libreccm.security.AuthorizationRequired;
import org.libreccm.security.RequiresPrivilege;
import javax.enterprise.context.RequestScoped;
import javax.transaction.Transactional;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@RequestScoped
@Path("/systeminformation")
public class SystemInformationApi {
@GET
@Path("/{domainIdentifier}/{path:^[\\w\\-/]+$}")
@Produces(MediaType.APPLICATION_JSON)
@AuthorizationRequired
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
@Transactional(Transactional.TxType.REQUIRED)
public SystemInformation getSystemInformation() {
return SystemInformation.getInstance();
}
}