2 * ============LICENSE_START====================================================
4 * ===========================================================================
5 * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
7 * Modifications Copyright (C) 2018 IBM.
8 * ===========================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END====================================================
24 package org.onap.aaf.auth.batch.helpers;
26 import org.onap.aaf.misc.env.Env;
27 import org.onap.aaf.misc.env.TimeTaken;
28 import org.onap.aaf.misc.env.Trans;
30 import com.datastax.driver.core.ResultSet;
31 import com.datastax.driver.core.Row;
32 import com.datastax.driver.core.Session;
33 import com.datastax.driver.core.SimpleStatement;
34 import com.datastax.driver.core.Statement;
36 public class NsAttrib {
38 public final String ns;
39 public final String key;
40 public final String value;
42 public static Creator<NsAttrib> v2_0_11 = new Creator<NsAttrib>() {
44 public NsAttrib create(Row row) {
45 return new NsAttrib(row.getString(0), row.getString(1), row.getString(2));
49 public String select() {
50 return "select ns,key,value from authz.ns_attrib";
55 public NsAttrib(String ns, String key, String value) {
61 public static void load(Trans trans, Session session, Creator<NsAttrib> creator, Visitor<NsAttrib> visitor) {
62 trans.info().log( "query: " + creator.select() );
64 TimeTaken tt = trans.start("Load NsAttributes", Env.REMOTE);
66 Statement stmt = new SimpleStatement(creator.select());
67 results = session.execute(stmt);
72 tt = trans.start("Process NsAttributes", Env.SUB);
75 for (Row row : results.all()) {
77 visitor.visit(creator.create(row));
81 trans.info().log("Found",count,"NS Attributes");