All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bonitasoft.engine.api.PlatformAPI Maven / Gradle / Ivy

There is a newer version: 10.2.0
Show newest version
/**
 * Copyright (C) 2019 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;

import java.util.Map;

import org.bonitasoft.engine.exception.CreationException;
import org.bonitasoft.engine.exception.DeletionException;
import org.bonitasoft.engine.exception.UpdateException;
import org.bonitasoft.engine.platform.Platform;
import org.bonitasoft.engine.platform.PlatformNotFoundException;
import org.bonitasoft.engine.platform.PlatformState;
import org.bonitasoft.engine.platform.StartNodeException;
import org.bonitasoft.engine.platform.StopNodeException;
import org.bonitasoft.engine.session.InvalidSessionException;

/**
 * Manage the platform.
 * 

* The platform is the base on which runs the engine.
* It mainly handles the creation of tables in database and also allow to start/stop a Node which is the current Virtual * machine on which runs the engine. There * is only one platform for a running Bonita Engine. *

* * @author Elias Ricken de Medeiros * @author Lu Kai * @author Zhang Bole * @author Matthieu Chaffotte * @author Emmanuel Duchastenier */ public interface PlatformAPI { /** * Create the platform. *

* The platform creation is done in 3 steps: *

    *
  • Creation of the persistence structure: tables are created
  • *
  • Initialization of persistence structure: index are added, default values and so on
  • *
  • The platform state is persisted
  • *
* * @throws org.bonitasoft.engine.session.InvalidSessionException * occurs if the API session is invalid, e.g session has expired. * @throws CreationException * occurs when an exception is thrown during platform creation * @deprecated since 7.3.0. Use {@link #initializePlatform()} instead. */ @Deprecated void createPlatform() throws CreationException; /** * Initialize the platform. * The running environment of Bonita Engine is initialized and marked as activated.
* Business elements linked to the execution are initialized, after this step the technical user will be able to * connect to the engine and to import the * * @throws org.bonitasoft.engine.session.InvalidSessionException * occurs if the API session is invalid, e.g session has expired. * @throws CreationException * occurs when an exception is thrown during platform creation */ void initializePlatform() throws CreationException; /** * Utility method that call {@link #createPlatform()} and {@link #initializePlatform()} * * @see #createPlatform() * @see #initializePlatform() * @throws org.bonitasoft.engine.session.InvalidSessionException * occurs if the API session is invalid, e.g session has expired. * @throws CreationException * occurs when an exception is thrown during platform creation * @deprecated since 7.3.0. Use {@link #initializePlatform()} instead. */ @Deprecated void createAndInitializePlatform() throws CreationException; /** * Starts the node. *

* The node is the currently Java Virtual Machine on which Bonita Engine is running *

* Starting the node make the Scheduler service to start and restart elements that were not finished by the Work * service on the previous shutdown. * * @throws org.bonitasoft.engine.session.InvalidSessionException * occurs if API Session is invalid, e.g session has expired. * @throws StartNodeException * occurs when an exception is thrown during the activation of the node */ void startNode() throws StartNodeException; /** * Stops the node. *

* The node is the currently Java Virtual Machine on which Bonita Engine is running *

* Stopping the node make the Scheduler service to stop. * * @throws org.bonitasoft.engine.session.InvalidSessionException * occurs if API Session is invalid, e.g session has expired. * @throws StopNodeException * occurs when an exception is thrown during the stop of the node */ void stopNode() throws StopNodeException; /** * Clean the platform. *

* Empty all execution informations, i.e. database tables are cleaned and a new execution environment can be * initialized. *

* /!\Please remember that all data will be DELETED/!\ *

* This method does the opposite of {@link #initializePlatform()} * * @see #initializePlatform() * @throws org.bonitasoft.engine.session.InvalidSessionException * Generic exception thrown if API Session is invalid, e.g session has expired. * @throws DeletionException * occurs when an exception is thrown during platform deletion */ void cleanPlatform() throws DeletionException; /** * Delete the platform *

* This method delete the platform, i.e. all the database tables. * * @see #createPlatform() * @throws org.bonitasoft.engine.session.InvalidSessionException * Generic exception thrown if API Session is invalid, e.g session has expired. * @throws DeletionException * occurs when an exception is thrown during platform deletion * @deprecated since 7.3.0. Use {@link #cleanPlatform()} instead. */ @Deprecated void deletePlatform() throws DeletionException; /** * Clean and delete a platform. * * @see #cleanPlatform() * @see #deletePlatform() * @throws org.bonitasoft.engine.session.InvalidSessionException * Generic exception thrown if API Session is invalid, e.g session has expired. * @throws DeletionException * occurs when an exception is thrown during platform deletion * @deprecated since 6.5.0 (typo in method name). Use {@link #cleanPlatform()} instead. */ @Deprecated void cleanAndDeletePlaftorm() throws DeletionException; /** * Clean and delete a platform. * * @see #cleanPlatform() * @see #deletePlatform() * @throws InvalidSessionException * Generic exception thrown if API Session is invalid, e.g session has expired. * @throws DeletionException * occurs when an exception is thrown during platform deletion * @deprecated since 7.3.0. Use {@link #cleanPlatform()} instead. */ @Deprecated void cleanAndDeletePlatform() throws DeletionException; /** * Get the platform. * * @return the Platform object * @throws org.bonitasoft.engine.session.InvalidSessionException * Generic exception thrown if API Session is invalid, e.g session has expired. * @throws PlatformNotFoundException * occurs when the identifier does not refer to an existing platform */ Platform getPlatform() throws PlatformNotFoundException; /** * Check if the default tenant is created or not. * * @return true if the default tenant exists * @throws PlatformNotFoundException when the default tenant existence cannot be determined * @since 7.3 */ boolean isPlatformInitialized() throws PlatformNotFoundException; /** * Check if the platform created or not. * * @return true if the platform exists * @throws org.bonitasoft.engine.session.InvalidSessionException * Generic exception thrown if API Session is invalid, e.g session has expired. * @throws PlatformNotFoundException * occurs when the identifier does not refer to an existing platform */ boolean isPlatformCreated() throws PlatformNotFoundException; /** * Get the state of the platform of the current node * * @return {@link PlatformState#STARTED} or {@link PlatformState#STOPPED} depending on the scheduler state * @throws org.bonitasoft.engine.session.InvalidSessionException * Generic exception thrown if API Session is invalid, e.g session has expired. * @throws PlatformNotFoundException * occurs when the identifier does not refer to an existing platform */ PlatformState getPlatformState() throws PlatformNotFoundException; /** * Is the current node started? * * @return true if the node is started, false if not started or if its state cannot be determined. * @since 6.1 */ boolean isNodeStarted(); /** * Reschedules triggers which are in error state. * * @throws UpdateException * If an exception occurs during the scheduling * @since 6.2 */ void rescheduleErroneousTriggers() throws UpdateException; /** * INTERNAL USE ONLY * get client configuration files of the platform * * @return the client platform configuration files as a map containing file name and file content * @since 7.3 */ @Internal Map getClientPlatformConfigurations(); /** * INTERNAL USE ONLY * get client configuration files of the tenants * * @return the client tenants configuration files as a map containing for each tenant id a map with file name and * file content * @since 7.3 */ @Internal Map> getClientTenantConfigurations(); /** * INTERNAL USE ONLY * get client auto login configuration file for tenant * * @return file content * @since 7.3 */ @Internal byte[] getClientTenantConfiguration(long tenantId, String file); /** * INTERNAL USE ONLY * update a single client configuration file of the tenant * * @param tenantId tenant to update * @param file file name to update * @param content the new content of the file * @throws UpdateException * @since 7.3 */ @Internal void updateClientTenantConfigurationFile(long tenantId, String file, byte[] content) throws UpdateException; }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy