/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.aries.tx.control.resource.common.impl; import java.util.Map; /** * This interface is used to control the lifecycle of configuration driven * resources */ public interface LifecycleAware { /** * Start the configuration-driven resource. This method will * be called once, and must fail if the resource has already * started or been stopped. * @throws Exception */ public void start() throws Exception; /** * Update the configuration-driven resource. Must fail * (either with false or an exception) if the resource * is closed. * * @return false if the configuration driven resource could * not be updated and should be destroyed/recreated * @throws Exception */ public default boolean update(Map<String, Object> properties) throws Exception { return false; }; /** * Close the configuration driven resource, either because the * configuration was deleted, the bundle is stopping, or an update * could not be dynamically applied. * * Repeated calls to close should have no effect * * @throws Exception */ public void stop() throws Exception; }