Skip to content

Commit

Permalink
chore(merge): release-10.2.0 into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
bonita-ci committed Sep 9, 2024
2 parents 874714c + 785c9e3 commit 910c64c
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import org.bonitasoft.engine.api.impl.ClientInterceptor;
import org.bonitasoft.engine.api.internal.ServerAPI;
import org.bonitasoft.engine.api.platform.PlatformInformationAPI;
import org.bonitasoft.engine.exception.BonitaHomeNotSetException;
import org.bonitasoft.engine.exception.ServerAPIException;
import org.bonitasoft.engine.exception.UnknownAPITypeException;
Expand Down Expand Up @@ -132,4 +133,9 @@ public static MaintenanceAPI getMaintenanceAPI(final APISession session)
throws BonitaHomeNotSetException, ServerAPIException, UnknownAPITypeException {
return getAPI(MaintenanceAPI.class, session);
}

public static PlatformInformationAPI getPlatformInformationAPI()
throws ServerAPIException, BonitaHomeNotSetException, UnknownAPITypeException {
return getAPI(PlatformInformationAPI.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Copyright (C) 2024 Bonitasoft S.A.
* Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble
* 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
* version 2.1 of the License.
* 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
* program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301, USA.
**/
package org.bonitasoft.engine.api.platform;

import java.util.Map;

import org.bonitasoft.engine.api.NoSessionRequired;

@NoSessionRequired
public interface PlatformInformationAPI {

Map<String, String> getPlatformInformation();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Copyright (C) 2024 Bonitasoft S.A.
* Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble
* 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
* version 2.1 of the License.
* 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
* program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301, USA.
**/
package org.bonitasoft.engine.api.impl.platform;

import java.util.Map;

import org.bonitasoft.engine.api.impl.AvailableInMaintenanceMode;
import org.bonitasoft.engine.api.platform.PlatformInformationAPI;

/**
* Provides runtime information about the platform.
* Information returned is dependent on the edition (Community or Subscription)
* and the platform configuration / license.
*
* @author Emmanuel Duchastenier
*/
@AvailableInMaintenanceMode
public class PlatformInformationAPIImpl implements PlatformInformationAPI {

@Override
public Map<String, String> getPlatformInformation() {
return Map.of(
"edition", "subscription",
"caseCounterLimit", "75",
"caseCounter", "68",
"subscriptionStartTimestamp", "1440806400000");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

import org.bonitasoft.engine.api.*;
import org.bonitasoft.engine.api.impl.*;
import org.bonitasoft.engine.api.impl.platform.PlatformInformationAPIImpl;
import org.bonitasoft.engine.api.platform.PlatformInformationAPI;
import org.bonitasoft.engine.exception.APIImplementationNotFoundException;
import org.bonitasoft.engine.service.APIAccessResolver;

Expand Down Expand Up @@ -45,6 +47,7 @@ public class APIAccessResolverImpl implements APIAccessResolver {
apis.put(BusinessDataAPI.class.getName(), new BusinessDataAPIImpl());
apis.put(TemporaryContentAPI.class.getName(), new TemporaryContentAPIImpl());
apis.put(MaintenanceAPI.class.getName(), new MaintenanceAPIImpl());
apis.put(PlatformInformationAPI.class.getName(), new PlatformInformationAPIImpl());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
import javax.servlet.http.HttpSession;

import org.bonitasoft.console.common.server.utils.SessionUtil;
import org.bonitasoft.engine.api.TenantAPIAccessor;
import org.bonitasoft.engine.api.platform.PlatformInformationAPI;
import org.bonitasoft.engine.exception.BonitaHomeNotSetException;
import org.bonitasoft.engine.exception.ServerAPIException;
import org.bonitasoft.engine.exception.UnknownAPITypeException;
import org.bonitasoft.engine.session.APISession;
import org.springframework.http.HttpStatus;
import org.springframework.web.server.ResponseStatusException;
Expand All @@ -28,9 +33,13 @@ public abstract class AbstractRESTController {
public APISession getApiSession(HttpSession session) {
APISession apiSession = (APISession) session.getAttribute(SessionUtil.API_SESSION_PARAM_KEY);
if (apiSession == null) {
throw new ResponseStatusException(
HttpStatus.UNAUTHORIZED, "Not authenticated");
throw new ResponseStatusException(HttpStatus.UNAUTHORIZED, "Not authenticated");
}
return apiSession;
}

protected PlatformInformationAPI getPlatformInformationAPI()
throws BonitaHomeNotSetException, ServerAPIException, UnknownAPITypeException {
return TenantAPIAccessor.getPlatformInformationAPI();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* Copyright (C) 2024 Bonitasoft S.A.
* Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble
* 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
* version 2.1 of the License.
* 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
* program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301, USA.
**/
package org.bonitasoft.web.rest.server.api.platform;

import java.util.Map;

import lombok.extern.slf4j.Slf4j;
import org.bonitasoft.engine.exception.BonitaException;
import org.bonitasoft.web.rest.server.api.AbstractRESTController;
import org.bonitasoft.web.toolkit.client.common.exception.api.APIException;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/API/system/information")
public class PlatformInformationController extends AbstractRESTController {

@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, String> getPlatformInfo() {
try {
return getPlatformInformationAPI().getPlatformInformation();
} catch (final BonitaException e) {
throw new APIException(e);
}
}
}
1 change: 1 addition & 0 deletions bpm/bonita-web-server/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,7 @@
<!-- API resource URLs need to be listed here in order to avoid being picked up by Restlet which is bound to /API/* -->
<url-pattern>/API/system/maintenance</url-pattern>
<url-pattern>/API/bpm/processInfo/*</url-pattern>
<url-pattern>/API/system/information</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ConsoleServiceServlet</servlet-name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ GET|platform/systemProperty=[tenant_platform_visualization]
GET|platform/license=[platform_management]
POST|tenant/bdm=[bdm_management]
GET|tenant/bdm=[bdm_management]
GET|system/information=[tenant_platform_visualization]

# Living apps
GET|living/application=[application_visualization]
Expand Down

0 comments on commit 910c64c

Please sign in to comment.