private static String tmpDir = null;
private static File xqlLog = null;
public boolean stopped = false;
- private List<String> elementHosts = new ArrayList<String>();
+ private List<String> elementHosts = new ArrayList<>();
private String username;
private String password;
private String transport = "tcp";
private int nThreads;
private int qsize;
private String applicationName = "NQL Adapter";
- private Map<String, NEEntry> elements = new ConcurrentHashMap<String, XSQLAdapter.NEEntry>();
+ private Map<String, NEEntry> elements = new ConcurrentHashMap<>();
private StringBuffer lastInputString = new StringBuffer();
private XSQLBluePrint bluePrint = new XSQLBluePrint();
private boolean toCsv = false;
public List<Object> collectModuleRoots(XSQLBluePrintNode table,LogicalDatastoreType type) {
if (table.getParent().isModule()) {
try {
- List<Object> result = new LinkedList<Object>();
+ List<Object> result = new LinkedList<>();
YangInstanceIdentifier instanceIdentifier = YangInstanceIdentifier
.builder()
.node(XSQLODLUtils.getPath(table.getFirstFromSchemaNodes()).get(0))
rs.setFinished(true);
}
XSQLBluePrintNode main = rs.getMainTable();
- List<NETask> tasks = new LinkedList<XSQLAdapter.NETask>();
+ List<NETask> tasks = new LinkedList<>();
for (Object entry : roots) {
NETask task = new NETask(rs, entry, main, bluePrint);
sout.println("Unknown Interface " + substr);
return;
}
- List<String> fld = new ArrayList<String>();
+ List<String> fld = new ArrayList<>();
for (XSQLBluePrintRelation r : node.getRelations()) {
fld.add(r.toString());
}
sout.println("Unknown Interface " + substr);
return;
}
- List<String> fld = new ArrayList<String>();
+ List<String> fld = new ArrayList<>();
for (XSQLColumn c : node.getColumns()) {
fld.add(c.getName());
}
public static final String CACHE_FILE_NAME = "./BluePrintCache.dat";
- private Map<String, XSQLBluePrintNode> tableNameToBluePrint = new HashMap<String, XSQLBluePrintNode>();
- private Map<String, Map<String, XSQLBluePrintNode>> odlNameToBluePrint = new HashMap<String, Map<String, XSQLBluePrintNode>>();
+ private Map<String, XSQLBluePrintNode> tableNameToBluePrint = new HashMap<>();
+ private Map<String, Map<String, XSQLBluePrintNode>> odlNameToBluePrint = new HashMap<>();
private boolean cacheLoadedSuccessfuly = false;
private DatabaseMetaData myProxy = null;
this.tableNameToBluePrint.put(blNode.getBluePrintNodeName(), blNode);
Map<String, XSQLBluePrintNode> map = this.odlNameToBluePrint.get(blNode.getODLTableName());
if (map == null) {
- map = new HashMap<String, XSQLBluePrintNode>();
+ map = new HashMap<>();
this.odlNameToBluePrint.put(blNode.getODLTableName(), map);
}
map.put(blNode.getBluePrintNodeName(), blNode);
}
public List<String> getAllTableNames() {
- List<String> names = new ArrayList<String>();
+ List<String> names = new ArrayList<>();
for (XSQLBluePrintNode n : this.tableNameToBluePrint.values()) {
if (!n.isModule() && !n.getColumns().isEmpty()) {
names.add(n.getBluePrintNodeName());
public List<String> getInterfaceNames(XSQLBluePrintNode node) {
Set<XSQLBluePrintNode> children = node.getChildren();
- List<String> names = new ArrayList<String>();
+ List<String> names = new ArrayList<>();
for (XSQLBluePrintNode n : children) {
if (!n.isModule() && !n.getColumns().isEmpty()) {
names.add(n.toString());
private static final long serialVersionUID = 1L;
private Class<?> myInterface = null;
private String myInterfaceString = null;
- private Set<XSQLBluePrintRelation> relations = new HashSet<XSQLBluePrintRelation>();
- private Set<XSQLBluePrintNode> inheritingNodes = new HashSet<XSQLBluePrintNode>();
- private Set<XSQLBluePrintNode> children = new HashSet<XSQLBluePrintNode>();
+ private Set<XSQLBluePrintRelation> relations = new HashSet<>();
+ private Set<XSQLBluePrintNode> inheritingNodes = new HashSet<>();
+ private Set<XSQLBluePrintNode> children = new HashSet<>();
private XSQLBluePrintNode parent = null;
private int level = -1;
private transient Set<String> parentHierarchySet = null;
private String myInterfaceName = null;
- private Set<XSQLColumn> columns = new HashSet<XSQLColumn>();
- private Map<String, XSQLColumn> origNameToColumn = new HashMap<String, XSQLColumn>();
+ private Set<XSQLColumn> columns = new HashSet<>();
+ private Map<String, XSQLColumn> origNameToColumn = new HashMap<>();
private transient Object[] odlSchemaNodes = null;
private boolean module = false;
}
public Set<XSQLBluePrintRelation> getClonedParents() {
- Set<XSQLBluePrintRelation> result = new HashSet<XSQLBluePrintRelation>();
+ Set<XSQLBluePrintRelation> result = new HashSet<>();
result.addAll(this.relations);
return result;
}
private String criteria = null;
private static final Map<Class<?>, Map<String, Method>> methodCache =
- new ConcurrentHashMap<Class<?>, Map<String, Method>>();
+ new ConcurrentHashMap<>();
public XSQLCriteria(final String data, final int parentOperation) {
criteria = data;
try {
Map<String, Method> cache = methodCache.get(element.getClass());
if (cache == null) {
- cache = new ConcurrentHashMap<String, Method>();
+ cache = new ConcurrentHashMap<>();
methodCache.put(element.getClass(), cache);
}
public class XSQLODLUtils {
private static Map<Class<?>, Class<?>> types =
- new ConcurrentHashMap<Class<?>, Class<?>>();
+ new ConcurrentHashMap<>();
static {
types.put(QName.class, QName.class);
}
public static Map<String, Field> refFieldsCache =
- new HashMap<String, Field>();
+ new HashMap<>();
public static Field findField(Class<?> c, String name) {
if (c == null) {
public static List<Object> getMChildren(Object o) {
Map<?, ?> children = getChildren(o);
- List<Object> result = new LinkedList<Object>();
+ List<Object> result = new LinkedList<>();
for (Object val : children.values()) {
result.add((Object) val);
}
import java.util.LinkedList;
public class XSQLThreadPool {
- private LinkedList<Runnable> tasks = new LinkedList<Runnable>();
+ private LinkedList<Runnable> tasks = new LinkedList<>();
private int threadCount = 0;
private int maxThreadCount = 10;
private String threadPoolName = "Simple Thread Pool";
private Socket socket = null;
private DataInputStream in = null;
private DataOutputStream out = null;
- private LinkedList<byte[]> queue = new LinkedList<byte[]>();
+ private LinkedList<byte[]> queue = new LinkedList<>();
private XSQLAdapter adapter = null;
private XSQLBluePrint metaData = null;
private String addr = null;
private static int nextID = 0;
private String sql = null;
- private List<XSQLBluePrintNode> tablesInQuery = new ArrayList<XSQLBluePrintNode>();
- private Map<String, XSQLBluePrintNode> tablesInQueryMap = new ConcurrentHashMap<String, XSQLBluePrintNode>();
- private List<XSQLColumn> fieldsInQuery = new ArrayList<XSQLColumn>();
+ private List<XSQLBluePrintNode> tablesInQuery = new ArrayList<>();
+ private Map<String, XSQLBluePrintNode> tablesInQueryMap = new ConcurrentHashMap<>();
+ private List<XSQLColumn> fieldsInQuery = new ArrayList<>();
private transient LinkedList<Map<String, Object>> records = new LinkedList<>();
private transient Map<String, Object> currentRecord = null;
private boolean finished = false;
private int id = 0;
public int numberOfTasks = 0;
- private Map<String, Map<XSQLColumn, List<XSQLCriteria>>> criteria = new ConcurrentHashMap<String, Map<XSQLColumn, List<XSQLCriteria>>>();
+ private Map<String, Map<XSQLColumn, List<XSQLCriteria>>> criteria = new ConcurrentHashMap<>();
private Exception err = null;
- private List<Record> EMPTY_RESULT = new LinkedList<Record>();
- private transient Map<String, JDBCResultSet> subQueries = new HashMap<String, JDBCResultSet>();
+ private List<Record> EMPTY_RESULT = new LinkedList<>();
+ private transient Map<String, JDBCResultSet> subQueries = new HashMap<>();
public ResultSet getProxy() {
return this;
public JDBCResultSet addSubQuery(String _sql, String logicalName) {
if (subQueries == null) {
- subQueries = new HashMap<String, JDBCResultSet>();
+ subQueries = new HashMap<>();
}
JDBCResultSet rs = new JDBCResultSet(_sql);
this.subQueries.put(logicalName, rs);
}
public static class RecordsContainer {
- public List<Record> records = new LinkedList<Record>();
- public List<Record> fitRecords = new LinkedList<Record>();
+ public List<Record> records = new LinkedList<>();
+ public List<Record> fitRecords = new LinkedList<>();
public Object currentObject = null;
}
private boolean beenHere(Set<String> beenHereElement, Object element) {
if (beenHereElement == null) {
- beenHereElement = new HashSet<String>();
+ beenHereElement = new HashSet<>();
}
String elementKey = null;
XSQLBluePrint bluePrint) {
List<Object> children = XSQLODLUtils.getMChildren(node);
- List<Object> result = new LinkedList<Object>();
+ List<Object> result = new LinkedList<>();
for (Object child : children) {
public List<Record> addRecords(Object element, XSQLBluePrintNode node,
boolean root, String tableName, XSQLBluePrint bluePrint) {
- List<Record> result = new LinkedList<Record>();
+ List<Record> result = new LinkedList<>();
String nodeID = XSQLODLUtils.getNodeIdentiofier(element);
if (node.getODLTableName().equals(nodeID)) {
XSQLBluePrintNode bluePrintNode = bluePrint
return;
}
- Map<String, XSQLBluePrintNode> logicalNameToNode = new HashMap<String, XSQLBluePrintNode>();
- Map<String, String> origNameToName = new HashMap<String, String>();
+ Map<String, XSQLBluePrintNode> logicalNameToNode = new HashMap<>();
+ Map<String, String> origNameToName = new HashMap<>();
List<XSQLColumn> columnOrder = new ArrayList<>();
int nextLogField = addNextLogicalField(sql, 0,
logicalNameToNode, origNameToName,columnOrder);
Map<XSQLColumn, List<XSQLCriteria>> tblCriteria = rs.getCriteria().get(
col.getTableName());
if (tblCriteria == null) {
- tblCriteria = new ConcurrentHashMap<XSQLColumn, List<XSQLCriteria>>();
+ tblCriteria = new ConcurrentHashMap<>();
rs.getCriteria().put(col.getTableName(), tblCriteria);
}
List<XSQLCriteria> lstCriteria = tblCriteria.get(col);
if (lstCriteria == null) {
- lstCriteria = new ArrayList<XSQLCriteria>();
+ lstCriteria = new ArrayList<>();
tblCriteria.put(col, lstCriteria);
}
lstCriteria.add(c);
public class JDBCStatement implements PreparedStatement {
private JDBCResultSet rs = null;
private transient JDBCConnection connection = null;
- private static Map<Integer, JDBCResultSet> queries = new ConcurrentHashMap<Integer, JDBCResultSet>();
+ private static Map<Integer, JDBCResultSet> queries = new ConcurrentHashMap<>();
private String sql = null;
public JDBCStatement(JDBCConnection con,String _sql) {