summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/att/dmf/mr/transaction
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/att/dmf/mr/transaction')
-rw-r--r--src/main/java/com/att/dmf/mr/transaction/DMaaPTransactionFactory.java44
-rw-r--r--src/main/java/com/att/dmf/mr/transaction/DMaaPTransactionObj.java83
-rw-r--r--src/main/java/com/att/dmf/mr/transaction/DMaaPTransactionObjDB.java86
-rw-r--r--src/main/java/com/att/dmf/mr/transaction/TransactionObj.java202
-rw-r--r--src/main/java/com/att/dmf/mr/transaction/TrnRequest.java183
-rw-r--r--src/main/java/com/att/dmf/mr/transaction/impl/DMaaPSimpleTransactionFactory.java62
6 files changed, 0 insertions, 660 deletions
diff --git a/src/main/java/com/att/dmf/mr/transaction/DMaaPTransactionFactory.java b/src/main/java/com/att/dmf/mr/transaction/DMaaPTransactionFactory.java
deleted file mode 100644
index 8ae4c12..0000000
--- a/src/main/java/com/att/dmf/mr/transaction/DMaaPTransactionFactory.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed 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 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package com.att.dmf.mr.transaction;
-/**
- *
- * @author anowarul.islam
- *
- * @param <K>
- */
-public interface DMaaPTransactionFactory<K extends DMaaPTransactionObj> {
-
- /**
- *
- * @param data
- * @return
- */
- K makeNewTransactionObj ( String data );
- /**
- *
- * @param id
- * @return
- */
- K makeNewTransactionId ( String id );
-
-}
diff --git a/src/main/java/com/att/dmf/mr/transaction/DMaaPTransactionObj.java b/src/main/java/com/att/dmf/mr/transaction/DMaaPTransactionObj.java
deleted file mode 100644
index 7f5dd3a..0000000
--- a/src/main/java/com/att/dmf/mr/transaction/DMaaPTransactionObj.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed 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 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package com.att.dmf.mr.transaction;
-
-import org.json.JSONObject;
-/**
- * This is an interface for DMaaP transactional logging object class.
- * @author nilanjana.maity
- *
- */
-public interface DMaaPTransactionObj {
- /**
- * This will get the transaction id
- * @return id transactionId
- */
- String getId();
- /**
- * This will set the transaction id
- * @param id transactionId
- */
- void setId(String id);
- /**
- * This will sync the transaction object mapping
- * @return String or null
- */
- String serialize();
- /**
- * get the total message count once the publisher published
- * @return long totalMessageCount
- */
- long getTotalMessageCount();
- /**
- * set the total message count once the publisher published
- * @param totalMessageCount
- */
- void setTotalMessageCount(long totalMessageCount);
- /**
- * get the total Success Message Count once the publisher published
- * @return getSuccessMessageCount
- */
- long getSuccessMessageCount();
- /**
- * set the total Success Message Count once the publisher published
- * @param successMessageCount
- */
- void setSuccessMessageCount(long successMessageCount);
- /**
- * get the failure Message Count once the publisher published
- * @return failureMessageCount
- */
- long getFailureMessageCount();
- /**
- * set the failure Message Count once the publisher published
- * @param failureMessageCount
- */
- void setFailureMessageCount(long failureMessageCount);
-
- /**
- * wrapping the data into json object
- * @return JSONObject
- */
- JSONObject asJsonObject();
-
-}
diff --git a/src/main/java/com/att/dmf/mr/transaction/DMaaPTransactionObjDB.java b/src/main/java/com/att/dmf/mr/transaction/DMaaPTransactionObjDB.java
deleted file mode 100644
index abebaba..0000000
--- a/src/main/java/com/att/dmf/mr/transaction/DMaaPTransactionObjDB.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed 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 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package com.att.dmf.mr.transaction;
-
-import java.util.Set;
-
-import com.att.nsa.configs.ConfigDbException;
-import com.att.nsa.security.NsaSecurityManagerException;
-
-
-/**
- * Persistent storage for Transaction Object and secrets built over an abstract config db. Instances
- * of this DB must support concurrent access.
- * @author nilanjana.maity
- *
- * @param <K> DMaaPTransactionObj
- */
-public interface DMaaPTransactionObjDB <K extends DMaaPTransactionObj> {
-
-
- /**
- * Create a new Transaction Object. If one exists,
- * @param id
- * @return the new Transaction record
- * @throws ConfigDbException
- */
- K createTransactionObj (String id) throws KeyExistsException, ConfigDbException;
-
-
- /**
- * An exception to signal a Transaction object already exists
- * @author nilanjana.maity
- *
- */
- public static class KeyExistsException extends NsaSecurityManagerException
- {
- /**
- * If the key exists
- * @param key
- */
- public KeyExistsException ( String key ) { super ( "Transaction Object " + key + " exists" ); }
- private static final long serialVersionUID = 1L;
- }
-
- /**
- * Save a Transaction Object record. This must be used after changing auxiliary data on the record.
- * Note that the transaction must exist (via createTransactionObj).
- * @param transactionObj
- * @throws ConfigDbException
- */
- void saveTransactionObj ( K transactionObj ) throws ConfigDbException;
-
- /**
- * Load an Transaction Object record based on the Transaction ID value
- * @param transactionId
- * @return a transaction record or null
- * @throws ConfigDbException
- */
- K loadTransactionObj ( String transactionId ) throws ConfigDbException;
-
- /**
- * Load all Transaction objects.
- * @return
- * @throws ConfigDbException
- */
- Set<String> loadAllTransactionObjs () throws ConfigDbException;
-} \ No newline at end of file
diff --git a/src/main/java/com/att/dmf/mr/transaction/TransactionObj.java b/src/main/java/com/att/dmf/mr/transaction/TransactionObj.java
deleted file mode 100644
index 7223f0f..0000000
--- a/src/main/java/com/att/dmf/mr/transaction/TransactionObj.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed 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 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package com.att.dmf.mr.transaction;
-
-import org.json.JSONObject;
-
-/**
- * This is the class which will have the transaction enabled logging object
- * details
- *
- * @author nilanjana.maity
- *
- */
-public class TransactionObj implements DMaaPTransactionObj {
-
- private String id;
- private String createTime;
- private long totalMessageCount;
- private long successMessageCount;
- private long failureMessageCount;
- private JSONObject fData = new JSONObject();
- private TrnRequest trnRequest;
- private static final String kAuxData = "transaction";
-
- /**
- * Initializing constructor
- * put the json data for transaction enabled logging
- *
- * @param data
- */
- public TransactionObj(JSONObject data) {
- fData = data;
-
- // check for required fields (these throw if not present)
- getId();
- getTotalMessageCount();
- getSuccessMessageCount();
- getFailureMessageCount();
-
- // make sure we've got an aux data object
- final JSONObject aux = fData.optJSONObject(kAuxData);
- if (aux == null) {
- fData.put(kAuxData, new JSONObject());
- }
- }
-
- /**
- * this constructor will have the details of transaction id,
- * totalMessageCount successMessageCount, failureMessageCount to get the
- * transaction object
- *
- * @param id
- * @param totalMessageCount
- * @param successMessageCount
- * @param failureMessageCount
- */
- public TransactionObj(String id, long totalMessageCount, long successMessageCount, long failureMessageCount) {
- this.id = id;
- this.totalMessageCount = totalMessageCount;
- this.successMessageCount = successMessageCount;
- this.failureMessageCount = failureMessageCount;
-
- }
-
- /**
- * The constructor passing only transaction id
- *
- * @param id
- */
- public TransactionObj(String id) {
- this.id = id;
- }
-
- /**
- * Wrapping the data into json object
- *
- * @return JSONObject
- */
- public JSONObject asJsonObject() {
- final JSONObject full = new JSONObject(fData, JSONObject.getNames(fData));
- return full;
- }
-
- /**
- * To get the transaction id
- */
- public String getId() {
- return id;
- }
-
- /**
- * To set the transaction id
- */
- public void setId(String id) {
- this.id = id;
- }
-
- /**
- *
- * @return
- */
- public String getCreateTime() {
- return createTime;
- }
-
- /**
- *
- * @param createTime
- */
- public void setCreateTime(String createTime) {
- this.createTime = createTime;
- }
-
- @Override
- public String serialize() {
- fData.put("transactionId", id);
- fData.put("totalMessageCount", totalMessageCount);
- fData.put("successMessageCount", successMessageCount);
- fData.put("failureMessageCount", failureMessageCount);
- return fData.toString();
- }
-
- public long getTotalMessageCount() {
- return totalMessageCount;
- }
-
- public void setTotalMessageCount(long totalMessageCount) {
- this.totalMessageCount = totalMessageCount;
- }
-
- public long getSuccessMessageCount() {
- return successMessageCount;
- }
-
- public void setSuccessMessageCount(long successMessageCount) {
- this.successMessageCount = successMessageCount;
- }
-
- public long getFailureMessageCount() {
- return failureMessageCount;
- }
-
- /**
- * @param failureMessageCount
- */
- public void setFailureMessageCount(long failureMessageCount) {
- this.failureMessageCount = failureMessageCount;
- }
-
- /**
- *
- * @return JSOnObject fData
- */
- public JSONObject getfData() {
- return fData;
- }
-
- /**
- * set the json object into data
- *
- * @param fData
- */
- public void setfData(JSONObject fData) {
- this.fData = fData;
- }
-
- /**
- *
- * @return
- */
- public TrnRequest getTrnRequest() {
- return trnRequest;
- }
-
- /**
- *
- * @param trnRequest
- */
- public void setTrnRequest(TrnRequest trnRequest) {
- this.trnRequest = trnRequest;
- }
-
-}
diff --git a/src/main/java/com/att/dmf/mr/transaction/TrnRequest.java b/src/main/java/com/att/dmf/mr/transaction/TrnRequest.java
deleted file mode 100644
index f7f18a2..0000000
--- a/src/main/java/com/att/dmf/mr/transaction/TrnRequest.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed 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 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package com.att.dmf.mr.transaction;
-
-/**
- * Created for transaction enable logging details, this is nothing but a bean
- * class.
- *
- * @author nilanjana.maity
- *
- */
-public class TrnRequest {
-
- private String id;
- private String requestCreate;
- private String requestHost;
- private String serverHost;
- private String messageProceed;
- private String totalMessage;
- private String clientType;
- private String url;
-
- /**
- *
- *
- *
- * @return id
- *
- */
- public String getId() {
- return id;
- }
-
- /**
- *
- *
- * @param id
- */
- public void setId(String id) {
- this.id = id;
- }
-
- /**
- *
- *
- * @return requestCreate
- */
- public String getRequestCreate() {
- return requestCreate;
- }
-
- /**
- *
- * @param requestCreate
- */
- public void setRequestCreate(String requestCreate) {
- this.requestCreate = requestCreate;
- }
-
- /**
- *
- * @return
- */
- public String getRequestHost() {
- return requestHost;
- }
-
- /**
- *
- * @param requestHost
- */
- public void setRequestHost(String requestHost) {
- this.requestHost = requestHost;
- }
-
- /**
- *
- *
- *
- * @return
- */
- public String getServerHost() {
- return serverHost;
- }
-
- /**
- *
- * @param serverHost
- */
- public void setServerHost(String serverHost) {
- this.serverHost = serverHost;
- }
-
- /**
- *
- *
- *
- * @return
- */
- public String getMessageProceed() {
- return messageProceed;
- }
-
- /**
- *
- * @param messageProceed
- */
- public void setMessageProceed(String messageProceed) {
- this.messageProceed = messageProceed;
- }
-
- /**
- *
- * @return
- */
- public String getTotalMessage() {
- return totalMessage;
- }
-
- /**
- *
- * @param totalMessage
- *
- *
- */
- public void setTotalMessage(String totalMessage) {
- this.totalMessage = totalMessage;
- }
-
- /**
- *
- * @return
- */
- public String getClientType() {
- return clientType;
- }
-
- /**
- *
- * @param clientType
- *
- */
- public void setClientType(String clientType) {
- this.clientType = clientType;
- }
-
- /**
- *
- * @return
- */
- public String getUrl() {
- return url;
- }
-
- /**
- *
- * @param url
- *
- */
- public void setUrl(String url) {
- this.url = url;
- }
-
-}
diff --git a/src/main/java/com/att/dmf/mr/transaction/impl/DMaaPSimpleTransactionFactory.java b/src/main/java/com/att/dmf/mr/transaction/impl/DMaaPSimpleTransactionFactory.java
deleted file mode 100644
index c54f2db..0000000
--- a/src/main/java/com/att/dmf/mr/transaction/impl/DMaaPSimpleTransactionFactory.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * ============LICENSE_START=======================================================
- * org.onap.dmaap
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed 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 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- *
- *******************************************************************************/
-package com.att.dmf.mr.transaction.impl;
-
-import org.json.JSONObject;
-
-import com.att.dmf.mr.transaction.DMaaPTransactionFactory;
-import com.att.dmf.mr.transaction.DMaaPTransactionObj;
-import com.att.dmf.mr.transaction.TransactionObj;
-
-/**
- * A factory for the simple Transaction implementation
- *
- *
- * @author nilanjana.maity
- *
- */
-public class DMaaPSimpleTransactionFactory implements DMaaPTransactionFactory<DMaaPTransactionObj> {
- /**
- *
- * @param data
- * @return DMaaPTransactionObj
- */
- @Override
- public DMaaPTransactionObj makeNewTransactionObj(String data) {
- JSONObject jsonObject = new JSONObject(data);
- return new TransactionObj(jsonObject.getString("transactionId"), jsonObject.getLong("totalMessageCount"),
- jsonObject.getLong("successMessageCount"), jsonObject.getLong("failureMessageCount"));
- }
-
- /**
- *
- * @param id
- * @return TransactionObj
- *
- *
- */
- @Override
- public DMaaPTransactionObj makeNewTransactionId(String id) {
- return new TransactionObj(id);
- }
-
-}