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

org.ow2.petals.microkernel.jbi.management.task.deployment.undeploy.RemoveSAStateHolderTask Maven / Gradle / Ivy

There is a newer version: 4.3.0
Show newest version
/**
 * Copyright (c) 2006-2012 EBM WebSourcing, 2012-2016 Linagora
 * 
 * This program/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 program/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/library; If not, see http://www.gnu.org/licenses/
 * for the GNU Lesser General Public License version 2.1.
 */
package org.ow2.petals.microkernel.jbi.management.task.deployment.undeploy;

import org.ow2.petals.microkernel.api.configuration.ContainerConfiguration;
import org.ow2.petals.microkernel.api.jbi.management.Context;
import org.ow2.petals.microkernel.api.system.SystemStateService;
import org.ow2.petals.microkernel.jbi.management.task.AbstractLoggableTask;
import org.ow2.petals.systemstate.generated.ServiceAssembly;

import com.ebmwebsourcing.easycommons.log.LoggingUtil;

/**
 * This task removes service assembly from state holder file.
 * 
 * 

* This task MUST be executed with a {@link Context} containing: *

    *
  • service assembly name as entity name
  • *
  • archive URL
  • *
  • install URL
  • *
* and returns following data in the {@link Context}: *
    *
  • the service assembly state holder ({@link ServiceAssembly}).
  • *
*

* The task has a non-robust approach: it tries to do all the subtasks and * doesn't have the undo capability.

* * @author Olivier Fabre - EBM WebSourcing * @author Frederic Gardes - EBM WebSourcing */ public class RemoveSAStateHolderTask extends AbstractLoggableTask { /** * JBI Container :: Recovery Service */ private final SystemStateService recoveryService; public RemoveSAStateHolderTask(final LoggingUtil log, final SystemStateService recoveryService, final ContainerConfiguration containerConfiguration) { super(log, containerConfiguration); this.recoveryService = recoveryService; } public void execute(Context context) throws Exception { String name = context.getEntityName(); ServiceAssembly serviceAssemblyStateHolder = null; try { serviceAssemblyStateHolder = this.recoveryService .deleteServiceAssemblyStateHolder(name); } catch (Exception e) { this.log .error("The service assembly '" + name + "' state holder can not be removed", e); } context.setServiceAssemblyStateHolder(serviceAssemblyStateHolder); } public void undo(Context context) throws Exception { // TODO : recreate the service assembly state holder } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy