2 * ============LICENSE_START====================================================
4 * ===========================================================================
5 * Copyright (c) 2018 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
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END====================================================
22 package org.onap.aaf.auth.cm.mapper;
24 import java.io.IOException;
25 import java.util.List;
27 import org.onap.aaf.auth.cm.data.CertDrop;
28 import org.onap.aaf.auth.cm.data.CertRenew;
29 import org.onap.aaf.auth.cm.data.CertReq;
30 import org.onap.aaf.auth.cm.data.CertResp;
31 import org.onap.aaf.auth.dao.cass.ArtiDAO;
32 import org.onap.aaf.auth.dao.cass.CertDAO;
33 import org.onap.aaf.auth.env.AuthzTrans;
34 import org.onap.aaf.auth.layer.Result;
36 public interface Mapper<REQ,CERT,ARTIFACTS,ERROR>
38 public enum API{ERROR,VOID,CERT,CERT_REQ,CERT_RENEW,CERT_DROP,ARTIFACTS};
40 public Class<?> getClass(API api);
41 public<A> A newInstance(API api);
43 public ERROR errorFromMessage(StringBuilder holder, String msgID, String text, Object ... detail);
45 public Result<CERT> toCert(AuthzTrans trans, Result<CertResp> in, boolean withTrustChain) throws IOException;
46 public Result<CERT> toCert(AuthzTrans trans, Result<List<CertDAO.Data>> in);
48 public Result<CertReq> toReq(AuthzTrans trans, REQ req);
49 public Result<CertRenew> toRenew(AuthzTrans trans, REQ req);
50 public Result<CertDrop> toDrop(AuthzTrans trans, REQ req);
52 public List<ArtiDAO.Data> toArtifact(AuthzTrans trans, ARTIFACTS arti);
53 public Result<ARTIFACTS> fromArtifacts(Result<List<ArtiDAO.Data>> readArtifactsByMachine);