001    /*
002     * Cumulus4j - Securing your data in the cloud - http://cumulus4j.org
003     * Copyright (C) 2011 NightLabs Consulting GmbH
004     *
005     * This program is free software: you can redistribute it and/or modify
006     * it under the terms of the GNU Affero General Public License as
007     * published by the Free Software Foundation, either version 3 of the
008     * License, or (at your option) any later version.
009     *
010     * This program is distributed in the hope that it will be useful,
011     * but WITHOUT ANY WARRANTY; without even the implied warranty of
012     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
013     * GNU Affero General Public License for more details.
014     *
015     * You should have received a copy of the GNU Affero General Public License
016     * along with this program.  If not, see <http://www.gnu.org/licenses/>.
017     */
018    package org.cumulus4j.store.crypto.keymanager.messagebroker.pmf;
019    
020    /**
021     * A <code>PendingRequest</code>'s {@link PendingRequest#getStatus() status}.
022     * <p>
023     * The {@link MessageBrokerPMF} first assigns the status {@link #waitingForProcessing}
024     * when a new request comes in when a thread enters the
025     * {@link MessageBrokerPMF#query(Class, org.cumulus4j.keymanager.back.shared.Request)
026     * query(...)} method.
027     * </p>
028     * <p>
029     * When a key-manager obtains the request by calling {@link MessageBrokerPMF#pollRequest(String) pollRequest(...)},
030     * the status changes to {@link #currentlyBeingProcessed}.
031     * </p>
032     * <p>
033     * Finally, when the {@link MessageBrokerPMF#pushResponse(org.cumulus4j.keymanager.back.shared.Response) pushResponse(...)}
034     * method is called, the response is associated with the request
035     * (via {@link PendingRequest#setResponse(org.cumulus4j.keymanager.back.shared.Response)}) and the status advances to {@link #completed}.
036     * </p>
037     * <p>
038     * When the {@link MessageBrokerPMF#query(Class, org.cumulus4j.keymanager.back.shared.Request)
039     * query(...)} method picks up the response, it finally deletes the {@link PendingRequest} from the datastore.
040     * </p>
041     *
042     * @author Marco หงุ่ยตระกูล-Schulze - marco at nightlabs dot de
043     */
044    public enum PendingRequestStatus
045    {
046            waitingForProcessing,
047            currentlyBeingProcessed,
048            completed
049    }