1 /*******************************************************************************
2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 * ============LICENSE_END=========================================================
19 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
21 *******************************************************************************/
22 package com.att.dmf.mr.transaction;
26 import com.att.nsa.configs.ConfigDbException;
27 import com.att.nsa.security.NsaSecurityManagerException;
31 * Persistent storage for Transaction Object and secrets built over an abstract config db. Instances
32 * of this DB must support concurrent access.
33 * @author nilanjana.maity
35 * @param <K> DMaaPTransactionObj
37 public interface DMaaPTransactionObjDB <K extends DMaaPTransactionObj> {
41 * Create a new Transaction Object. If one exists,
43 * @return the new Transaction record
44 * @throws ConfigDbException
46 K createTransactionObj (String id) throws KeyExistsException, ConfigDbException;
50 * An exception to signal a Transaction object already exists
51 * @author nilanjana.maity
54 public static class KeyExistsException extends NsaSecurityManagerException
60 public KeyExistsException ( String key ) { super ( "Transaction Object " + key + " exists" ); }
61 private static final long serialVersionUID = 1L;
65 * Save a Transaction Object record. This must be used after changing auxiliary data on the record.
66 * Note that the transaction must exist (via createTransactionObj).
67 * @param transactionObj
68 * @throws ConfigDbException
70 void saveTransactionObj ( K transactionObj ) throws ConfigDbException;
73 * Load an Transaction Object record based on the Transaction ID value
74 * @param transactionId
75 * @return a transaction record or null
76 * @throws ConfigDbException
78 K loadTransactionObj ( String transactionId ) throws ConfigDbException;
81 * Load all Transaction objects.
83 * @throws ConfigDbException
85 Set<String> loadAllTransactionObjs () throws ConfigDbException;