From 3e155bc35536039f93a079128c0e490465384722 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Wed, 12 Apr 2017 12:49:57 +0200 Subject: [PATCH] BUG-5222: remove sal-dom-xsql XSQL has been deprecated and de-activated in Carbon due to bugs and not being supported. This patch removes it completely. Change-Id: I9faeb7200faa665484d6a3315cb4b8820b53c976 Signed-off-by: Robert Varga --- .../features-mdsal-benchmark/pom.xml | 1 - features/mdsal/features-mdsal/pom.xml | 17 - .../src/main/features/features.xml | 7 - features/mdsal/features4-mdsal/pom.xml | 9 +- features/mdsal/odl-mdsal-all/pom.xml | 8 +- features/mdsal/odl-mdsal-xsql/pom.xml | 58 - .../src/main/feature/feature.xml | 15 - features/mdsal/pom.xml | 1 - opendaylight/md-sal/mdsal-artifacts/pom.xml | 26 - opendaylight/md-sal/pom.xml | 6 - .../md-sal/sal-dom-xsql-config/pom.xml | 50 - .../src/main/resources/04-xsql.xml | 29 - opendaylight/md-sal/sal-dom-xsql/.gitignore | 1 - opendaylight/md-sal/sal-dom-xsql/pom.xml | 84 - .../main/java/org/odl/xsql/JDBCDriver.java | 89 - .../md/sal/dom/xsql/TablesResultSet.java | 1254 ----------- .../md/sal/dom/xsql/XSQLAdapter.java | 535 ----- .../md/sal/dom/xsql/XSQLBluePrint.java | 1378 ------------ .../md/sal/dom/xsql/XSQLBluePrintNode.java | 307 --- .../sal/dom/xsql/XSQLBluePrintRelation.java | 131 -- .../md/sal/dom/xsql/XSQLColumn.java | 103 - .../md/sal/dom/xsql/XSQLCriteria.java | 383 ---- .../md/sal/dom/xsql/XSQLODLUtils.java | 291 --- .../md/sal/dom/xsql/XSQLThreadPool.java | 122 -- .../md/sal/dom/xsql/jdbc/JDBCCommand.java | 98 - .../md/sal/dom/xsql/jdbc/JDBCConnection.java | 650 ------ .../md/sal/dom/xsql/jdbc/JDBCProxy.java | 35 - .../md/sal/dom/xsql/jdbc/JDBCResultSet.java | 1906 ----------------- .../md/sal/dom/xsql/jdbc/JDBCServer.java | 370 ---- .../md/sal/dom/xsql/jdbc/JDBCStatement.java | 728 ------- .../org/opendaylight/xsql/XSQLProvider.java | 52 - .../org/ns/xsql/rev140626/XSQLModule.java | 49 - .../ns/xsql/rev140626/XSQLModuleFactory.java | 17 - .../src/main/resources/04-xsql.xml | 29 - .../sal-dom-xsql/src/main/yang/XSQL.yang | 74 - .../org/opendaylight/xsql/test/XSQLTest.java | 203 -- .../src/test/resources/BluePrintCache.dat | Bin 88704 -> 0 bytes opendaylight/md-sal/sal-karaf-xsql/pom.xml | 102 - .../opendaylight/controller/xsql/xsql.java | 39 - .../OSGI-INF/blueprint/shell-log.xml | 12 - opendaylight/md-sal/sal-karaf4-xsql/pom.xml | 102 - .../opendaylight/controller/xsql/xsql.java | 39 - .../OSGI-INF/blueprint/shell-log.xml | 12 - 43 files changed, 2 insertions(+), 9420 deletions(-) delete mode 100644 features/mdsal/odl-mdsal-xsql/pom.xml delete mode 100644 features/mdsal/odl-mdsal-xsql/src/main/feature/feature.xml delete mode 100644 opendaylight/md-sal/sal-dom-xsql-config/pom.xml delete mode 100644 opendaylight/md-sal/sal-dom-xsql-config/src/main/resources/04-xsql.xml delete mode 100644 opendaylight/md-sal/sal-dom-xsql/.gitignore delete mode 100644 opendaylight/md-sal/sal-dom-xsql/pom.xml delete mode 100644 opendaylight/md-sal/sal-dom-xsql/src/main/java/org/odl/xsql/JDBCDriver.java delete mode 100644 opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/TablesResultSet.java delete mode 100644 opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLAdapter.java delete mode 100644 opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrint.java delete mode 100644 opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrintNode.java delete mode 100644 opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrintRelation.java delete mode 100644 opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLColumn.java delete mode 100644 opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLCriteria.java delete mode 100644 opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLODLUtils.java delete mode 100644 opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLThreadPool.java delete mode 100644 opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCCommand.java delete mode 100644 opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCConnection.java delete mode 100644 opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCProxy.java delete mode 100644 opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCResultSet.java delete mode 100644 opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCServer.java delete mode 100644 opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCStatement.java delete mode 100644 opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/xsql/XSQLProvider.java delete mode 100644 opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/yang/gen/v1/http/netconfcentral/org/ns/xsql/rev140626/XSQLModule.java delete mode 100644 opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/yang/gen/v1/http/netconfcentral/org/ns/xsql/rev140626/XSQLModuleFactory.java delete mode 100644 opendaylight/md-sal/sal-dom-xsql/src/main/resources/04-xsql.xml delete mode 100644 opendaylight/md-sal/sal-dom-xsql/src/main/yang/XSQL.yang delete mode 100644 opendaylight/md-sal/sal-dom-xsql/src/test/java/org/opendaylight/xsql/test/XSQLTest.java delete mode 100644 opendaylight/md-sal/sal-dom-xsql/src/test/resources/BluePrintCache.dat delete mode 100644 opendaylight/md-sal/sal-karaf-xsql/pom.xml delete mode 100644 opendaylight/md-sal/sal-karaf-xsql/src/main/java/org/opendaylight/controller/xsql/xsql.java delete mode 100644 opendaylight/md-sal/sal-karaf-xsql/src/main/resources/OSGI-INF/blueprint/shell-log.xml delete mode 100644 opendaylight/md-sal/sal-karaf4-xsql/pom.xml delete mode 100644 opendaylight/md-sal/sal-karaf4-xsql/src/main/java/org/opendaylight/controller/xsql/xsql.java delete mode 100644 opendaylight/md-sal/sal-karaf4-xsql/src/main/resources/OSGI-INF/blueprint/shell-log.xml diff --git a/features/benchmark/features-mdsal-benchmark/pom.xml b/features/benchmark/features-mdsal-benchmark/pom.xml index ad3740ddc4..5082503f41 100644 --- a/features/benchmark/features-mdsal-benchmark/pom.xml +++ b/features/benchmark/features-mdsal-benchmark/pom.xml @@ -26,7 +26,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL 2.3.0-SNAPSHOT 0.11.0-SNAPSHOT 1.2.0-SNAPSHOT - 04-xsql.xml diff --git a/features/mdsal/features-mdsal/pom.xml b/features/mdsal/features-mdsal/pom.xml index 15e2005254..b66173bc85 100644 --- a/features/mdsal/features-mdsal/pom.xml +++ b/features/mdsal/features-mdsal/pom.xml @@ -30,7 +30,6 @@ 06-clustered-entity-ownership.xml 00-netty.xml 01-md-sal.xml - 04-xsql.xml @@ -172,11 +171,6 @@ sal-broker-impl - - org.opendaylight.controller - sal-karaf-xsql - - org.opendaylight.controller sal-binding-api @@ -198,17 +192,6 @@ sal-connector-api - - org.opendaylight.controller - sal-dom-xsql - - - org.opendaylight.controller - sal-dom-xsql-config - config - xml - - org.opendaylight.controller sal-clustering-commons diff --git a/features/mdsal/features-mdsal/src/main/features/features.xml b/features/mdsal/features-mdsal/src/main/features/features.xml index 6aa7798d80..0fcdb5e282 100644 --- a/features/mdsal/features-mdsal/src/main/features/features.xml +++ b/features/mdsal/features-mdsal/src/main/features/features.xml @@ -17,7 +17,6 @@ odl-mdsal-broker odl-mdsal-broker-local - odl-mdsal-xsql odl-toaster @@ -67,12 +66,6 @@ mvn:org.opendaylight.controller.samples/sample-toaster-consumer/{{VERSION}} mvn:org.opendaylight.controller.samples/sample-toaster-provider/{{VERSION}} - - odl-mdsal-broker - mvn:org.opendaylight.controller/sal-dom-xsql/{{VERSION}} - mvn:org.opendaylight.controller/sal-karaf-xsql/{{VERSION}} - mvn:org.opendaylight.controller/sal-dom-xsql-config/{{VERSION}}/xml/config - odl-mdsal-broker-local odl-akka-system-2.4 diff --git a/features/mdsal/features4-mdsal/pom.xml b/features/mdsal/features4-mdsal/pom.xml index ad4785c319..5610ee3e8c 100644 --- a/features/mdsal/features4-mdsal/pom.xml +++ b/features/mdsal/features4-mdsal/pom.xml @@ -87,13 +87,6 @@ xml features - - ${project.groupId} - odl-mdsal-xsql - ${project.version} - xml - features - ${project.groupId} odl-message-bus-collector @@ -109,4 +102,4 @@ features - \ No newline at end of file + diff --git a/features/mdsal/odl-mdsal-all/pom.xml b/features/mdsal/odl-mdsal-all/pom.xml index a64cec117a..3fd12765b2 100644 --- a/features/mdsal/odl-mdsal-all/pom.xml +++ b/features/mdsal/odl-mdsal-all/pom.xml @@ -48,12 +48,6 @@ xml features - - ${project.groupId} - odl-mdsal-xsql - xml - features - ${project.groupId} odl-toaster @@ -61,4 +55,4 @@ features - \ No newline at end of file + diff --git a/features/mdsal/odl-mdsal-xsql/pom.xml b/features/mdsal/odl-mdsal-xsql/pom.xml deleted file mode 100644 index 7766c31afa..0000000000 --- a/features/mdsal/odl-mdsal-xsql/pom.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - 4.0.0 - - - org.opendaylight.odlparent - single-feature-parent - 1.9.0-SNAPSHOT - - - - org.opendaylight.controller - odl-mdsal-xsql - 1.6.0-SNAPSHOT - feature - - - etc/opendaylight/karaf - 04-xsql.xml - - - - - ${project.groupId} - odl-mdsal-broker - ${project.version} - xml - features - - - ${project.groupId} - sal-dom-xsql - ${project.version} - - - ${project.groupId} - sal-karaf4-xsql - ${project.version} - - - - ${project.groupId} - sal-dom-xsql-config - ${project.version} - xml - config - - - \ No newline at end of file diff --git a/features/mdsal/odl-mdsal-xsql/src/main/feature/feature.xml b/features/mdsal/odl-mdsal-xsql/src/main/feature/feature.xml deleted file mode 100644 index c8c3887dab..0000000000 --- a/features/mdsal/odl-mdsal-xsql/src/main/feature/feature.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - mvn:org.opendaylight.controller/sal-dom-xsql-config/${project.version}/xml/config - - - diff --git a/features/mdsal/pom.xml b/features/mdsal/pom.xml index 2ff0bcc6b3..c5bcc801bf 100644 --- a/features/mdsal/pom.xml +++ b/features/mdsal/pom.xml @@ -34,7 +34,6 @@ odl-mdsal-common odl-mdsal-distributed-datastore odl-mdsal-remoterpc-connector - odl-mdsal-xsql odl-message-bus-collector odl-toaster diff --git a/opendaylight/md-sal/mdsal-artifacts/pom.xml b/opendaylight/md-sal/mdsal-artifacts/pom.xml index 2fa6116a1c..4e61d156c6 100644 --- a/opendaylight/md-sal/mdsal-artifacts/pom.xml +++ b/opendaylight/md-sal/mdsal-artifacts/pom.xml @@ -291,25 +291,6 @@ runtime - - - ${project.groupId} - sal-dom-xsql - ${project.version} - - - ${project.groupId} - sal-karaf-xsql - ${project.version} - - - ${project.groupId} - sal-dom-xsql-config - ${project.version} - config - xml - - org.opendaylight.controller @@ -382,13 +363,6 @@ xml features - - ${project.groupId} - odl-mdsal-xsql - ${project.version} - xml - features - ${project.groupId} odl-message-bus-collector diff --git a/opendaylight/md-sal/pom.xml b/opendaylight/md-sal/pom.xml index f6b4e07e9a..7734ded2ff 100644 --- a/opendaylight/md-sal/pom.xml +++ b/opendaylight/md-sal/pom.xml @@ -68,12 +68,6 @@ sal-cluster-admin-api sal-cluster-admin-impl - - sal-dom-xsql - sal-karaf-xsql - sal-karaf4-xsql - sal-dom-xsql-config - sal-test-model diff --git a/opendaylight/md-sal/sal-dom-xsql-config/pom.xml b/opendaylight/md-sal/sal-dom-xsql-config/pom.xml deleted file mode 100644 index bab980280a..0000000000 --- a/opendaylight/md-sal/sal-dom-xsql-config/pom.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - 4.0.0 - - org.opendaylight.odlparent - odlparent-lite - 1.9.0-SNAPSHOT - - - - org.opendaylight.controller - sal-dom-xsql-config - 1.6.0-SNAPSHOT - jar - Configuration files for md-sal - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - attach-artifacts - - attach-artifact - - package - - - - ${project.build.directory}/classes/04-xsql.xml - xml - config - - - - - - - - - diff --git a/opendaylight/md-sal/sal-dom-xsql-config/src/main/resources/04-xsql.xml b/opendaylight/md-sal/sal-dom-xsql-config/src/main/resources/04-xsql.xml deleted file mode 100644 index 1b9a37df66..0000000000 --- a/opendaylight/md-sal/sal-dom-xsql-config/src/main/resources/04-xsql.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - XSQL:XSQL - - XSQL - - binding:binding-async-data-broker - binding-data-broker - - - dom:dom-async-data-broker - inmemory-data-broker - - - dom:schema-service - yang-schema-service - - - - - - - http://netconfcentral.org/ns/XSQL?module=XSQL&revision=2014-06-26 - - diff --git a/opendaylight/md-sal/sal-dom-xsql/.gitignore b/opendaylight/md-sal/sal-dom-xsql/.gitignore deleted file mode 100644 index a48e45b9df..0000000000 --- a/opendaylight/md-sal/sal-dom-xsql/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/target-ide diff --git a/opendaylight/md-sal/sal-dom-xsql/pom.xml b/opendaylight/md-sal/sal-dom-xsql/pom.xml deleted file mode 100644 index 6f4fb2d586..0000000000 --- a/opendaylight/md-sal/sal-dom-xsql/pom.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - 4.0.0 - - org.opendaylight.controller - config-parent - 0.7.0-SNAPSHOT - ../../config/config-parent - - - org.opendaylight.controller - 1.6.0-SNAPSHOT - sal-dom-xsql - bundle - sal-dom-xsql - XSQL language - - - - - org.opendaylight.controller - mdsal-artifacts - 1.6.0-SNAPSHOT - pom - import - - - - - - - org.opendaylight.controller - config-api - - - org.opendaylight.controller - sal-binding-api - - - org.opendaylight.controller - sal-binding-config - - - org.opendaylight.controller - sal-common-util - - - org.opendaylight.controller - sal-core-api - - - org.opendaylight.controller - yang-jmx-generator - - - org.opendaylight.mdsal - yang-binding - - - org.opendaylight.yangtools - yang-common - - - org.osgi - org.osgi.core - - - junit - junit - - - org.opendaylight.yangtools - yang-test-util - - - - https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL:XSQL - - scm:git:http://git.opendaylight.org/gerrit/controller.git - scm:git:ssh://git.opendaylight.org:29418/controller.git - HEAD - https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL:XSQL - - diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/odl/xsql/JDBCDriver.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/odl/xsql/JDBCDriver.java deleted file mode 100644 index 933f953678..0000000000 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/odl/xsql/JDBCDriver.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.odl.xsql; - -import java.sql.Connection; -import java.sql.Driver; -import java.sql.DriverManager; -import java.sql.DriverPropertyInfo; -import java.sql.SQLException; -import java.sql.SQLFeatureNotSupportedException; -import java.util.Properties; -import java.util.logging.Logger; - -import org.opendaylight.controller.md.sal.dom.xsql.jdbc.JDBCConnection; -/** - * @author Sharon Aicler(saichler@gmail.com) - **/ -/** - * To be removed in Nitrogen - */ -@Deprecated -public class JDBCDriver implements Driver { - - public static JDBCDriver drv = new JDBCDriver(); - - public JDBCDriver() { - try { - DriverManager.registerDriver(this); - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - @Override - public boolean acceptsURL(String arg0) throws SQLException { - return true; - } - - @Override - public Connection connect(String url, Properties arg1) throws SQLException { - System.err.println("JDBC Connection"); - try { - if (url.equals("svr")) { - return new JDBCConnection(true); - } else { - return new JDBCConnection(url).getProxy(); - } - } catch (Exception err) { - err.printStackTrace(); - } - System.err.println("Error JDBC Connection"); - return null; - } - - @Override - public int getMajorVersion() { - return 1; - } - - @Override - public int getMinorVersion() { - return 0; - } - - @Override - public DriverPropertyInfo[] getPropertyInfo(String arg0, Properties arg1) - throws SQLException { - DriverPropertyInfo i = new DriverPropertyInfo("OpenDayLight", "OpenDayLight"); - return new DriverPropertyInfo[] {i}; - } - - @Override - public boolean jdbcCompliant() { - return false; - } - - @Override - public Logger getParentLogger() throws SQLFeatureNotSupportedException { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/TablesResultSet.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/TablesResultSet.java deleted file mode 100644 index ad97613ecb..0000000000 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/TablesResultSet.java +++ /dev/null @@ -1,1254 +0,0 @@ -/* - * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.md.sal.dom.xsql; - -import java.io.InputStream; -import java.io.Reader; -import java.math.BigDecimal; -import java.net.URL; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -import java.sql.NClob; -import java.sql.Ref; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.RowId; -import java.sql.SQLException; -import java.sql.SQLWarning; -import java.sql.SQLXML; -import java.sql.Statement; -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; -import java.util.Map; -/** - * @author Sharon Aicler(saichler@gmail.com) - **/ -/** - * To be removed in Nitrogen - */ -@Deprecated -public class TablesResultSet implements ResultSet { - - private String tables[] = null; - private int pos = -1; - - public TablesResultSet(XSQLBluePrint cache) { - //tables = cache.getInterfaceNames(); - } - - @Override - public T unwrap(Class iface) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean isWrapperFor(Class iface) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean next() throws SQLException { - if (tables == null) { - return false; - } - pos++; - if (pos >= tables.length) { - return false; - } - return true; - } - - @Override - public void close() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public boolean wasNull() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public String getString(int columnIndex) throws SQLException { - return tables[pos]; - } - - @Override - public boolean getBoolean(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public byte getByte(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public short getShort(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getInt(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public long getLong(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public float getFloat(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public double getDouble(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public BigDecimal getBigDecimal(int columnIndex, int scale) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public byte[] getBytes(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Date getDate(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Time getTime(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Timestamp getTimestamp(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public InputStream getAsciiStream(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public InputStream getUnicodeStream(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public InputStream getBinaryStream(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getString(String columnLabel) throws SQLException { - return tables[pos]; - } - - @Override - public boolean getBoolean(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public byte getByte(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public short getShort(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getInt(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public long getLong(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public float getFloat(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public double getDouble(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public BigDecimal getBigDecimal(String columnLabel, int scale) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public byte[] getBytes(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Date getDate(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Time getTime(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Timestamp getTimestamp(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public InputStream getAsciiStream(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public InputStream getUnicodeStream(String columnLabel) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public InputStream getBinaryStream(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public SQLWarning getWarnings() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public void clearWarnings() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public String getCursorName() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSetMetaData getMetaData() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Object getObject(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Object getObject(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public int findColumn(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public Reader getCharacterStream(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Reader getCharacterStream(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public BigDecimal getBigDecimal(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public BigDecimal getBigDecimal(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean isBeforeFirst() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isAfterLast() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isFirst() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isLast() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public void beforeFirst() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void afterLast() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public boolean first() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean last() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public int getRow() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public boolean absolute(int row) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean relative(int rows) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean previous() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public void setFetchDirection(int direction) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public int getFetchDirection() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public void setFetchSize(int rows) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public int getFetchSize() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getType() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getConcurrency() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public boolean rowUpdated() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean rowInserted() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean rowDeleted() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public void updateNull(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBoolean(int columnIndex, boolean x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateByte(int columnIndex, byte x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateShort(int columnIndex, short x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateInt(int columnIndex, int x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateLong(int columnIndex, long x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateFloat(int columnIndex, float x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateDouble(int columnIndex, double x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBigDecimal(int columnIndex, BigDecimal x) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateString(int columnIndex, String x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBytes(int columnIndex, byte[] x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateDate(int columnIndex, Date x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateTime(int columnIndex, Time x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateTimestamp(int columnIndex, Timestamp x) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateAsciiStream(int columnIndex, InputStream x, int length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBinaryStream(int columnIndex, InputStream x, int length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateCharacterStream(int columnIndex, Reader x, int length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateObject(int columnIndex, Object x, int scaleOrLength) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateObject(int columnIndex, Object x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateNull(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBoolean(String columnLabel, boolean x) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateByte(String columnLabel, byte x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateShort(String columnLabel, short x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateInt(String columnLabel, int x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateLong(String columnLabel, long x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateFloat(String columnLabel, float x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateDouble(String columnLabel, double x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBigDecimal(String columnLabel, BigDecimal x) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateString(String columnLabel, String x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBytes(String columnLabel, byte[] x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateDate(String columnLabel, Date x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateTime(String columnLabel, Time x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateTimestamp(String columnLabel, Timestamp x) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateAsciiStream(String columnLabel, InputStream x, int length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBinaryStream(String columnLabel, InputStream x, - int length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateCharacterStream(String columnLabel, Reader reader, - int length) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateObject(String columnLabel, Object x, int scaleOrLength) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateObject(String columnLabel, Object x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void insertRow() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateRow() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void deleteRow() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void refreshRow() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void cancelRowUpdates() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void moveToInsertRow() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void moveToCurrentRow() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public Statement getStatement() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Object getObject(int columnIndex, Map> map) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Ref getRef(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Blob getBlob(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Clob getClob(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Array getArray(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Object getObject(String columnLabel, Map> map) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Ref getRef(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Blob getBlob(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Clob getClob(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Array getArray(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Date getDate(int columnIndex, Calendar cal) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Date getDate(String columnLabel, Calendar cal) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Time getTime(int columnIndex, Calendar cal) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Time getTime(String columnLabel, Calendar cal) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Timestamp getTimestamp(int columnIndex, Calendar cal) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Timestamp getTimestamp(String columnLabel, Calendar cal) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public URL getURL(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public URL getURL(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public void updateRef(int columnIndex, Ref x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateRef(String columnLabel, Ref x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBlob(int columnIndex, Blob x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBlob(String columnLabel, Blob x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateClob(int columnIndex, Clob x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateClob(String columnLabel, Clob x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateArray(int columnIndex, Array x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateArray(String columnLabel, Array x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public RowId getRowId(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public RowId getRowId(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public void updateRowId(int columnIndex, RowId x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateRowId(String columnLabel, RowId x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public int getHoldability() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public boolean isClosed() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public void updateNString(int columnIndex, String nString) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateNString(String columnLabel, String nString) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateNClob(int columnIndex, NClob nClob) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateNClob(String columnLabel, NClob nClob) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public NClob getNClob(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public NClob getNClob(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public SQLXML getSQLXML(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public SQLXML getSQLXML(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public void updateSQLXML(int columnIndex, SQLXML xmlObject) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateSQLXML(String columnLabel, SQLXML xmlObject) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public String getNString(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getNString(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Reader getNCharacterStream(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Reader getNCharacterStream(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public void updateNCharacterStream(int columnIndex, Reader x, long length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateNCharacterStream(String columnLabel, Reader reader, - long length) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateAsciiStream(int columnIndex, InputStream x, long length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBinaryStream(int columnIndex, InputStream x, long length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateCharacterStream(int columnIndex, Reader x, long length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateAsciiStream(String columnLabel, InputStream x, - long length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBinaryStream(String columnLabel, InputStream x, - long length) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateCharacterStream(String columnLabel, Reader reader, - long length) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBlob(int columnIndex, InputStream inputStream, - long length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBlob(String columnLabel, InputStream inputStream, - long length) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateClob(int columnIndex, Reader reader, long length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateClob(String columnLabel, Reader reader, long length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateNClob(int columnIndex, Reader reader, long length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateNClob(String columnLabel, Reader reader, long length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateNCharacterStream(int columnIndex, Reader x) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateNCharacterStream(String columnLabel, Reader reader) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateAsciiStream(int columnIndex, InputStream x) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBinaryStream(int columnIndex, InputStream x) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateCharacterStream(int columnIndex, Reader x) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateAsciiStream(String columnLabel, InputStream x) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBinaryStream(String columnLabel, InputStream x) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateCharacterStream(String columnLabel, Reader reader) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBlob(int columnIndex, InputStream inputStream) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBlob(String columnLabel, InputStream inputStream) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateClob(int columnIndex, Reader reader) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateClob(String columnLabel, Reader reader) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateNClob(int columnIndex, Reader reader) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateNClob(String columnLabel, Reader reader) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public T getObject(int columnIndex, Class type) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public T getObject(String columnLabel, Class type) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - -} - diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLAdapter.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLAdapter.java deleted file mode 100644 index cb0a704ec6..0000000000 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLAdapter.java +++ /dev/null @@ -1,535 +0,0 @@ -/* - * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.md.sal.dom.xsql; - -import com.google.common.base.Optional; -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.PrintStream; -import java.net.ServerSocket; -import java.net.Socket; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.LinkedList; -import java.util.List; -import javax.annotation.concurrent.GuardedBy; -import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; -import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; -import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction; -import org.opendaylight.controller.md.sal.dom.xsql.jdbc.JDBCResultSet; -import org.opendaylight.controller.md.sal.dom.xsql.jdbc.JDBCServer; -import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; -import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; -import org.opendaylight.yangtools.yang.model.api.Module; -import org.opendaylight.yangtools.yang.model.api.SchemaContext; -import org.opendaylight.yangtools.yang.model.api.SchemaContextListener; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -/** - * @author Sharon Aicler(saichler@gmail.com) - **/ -/** - * To be removed in Nitrogen - */ -@Deprecated -public class XSQLAdapter extends Thread implements SchemaContextListener { - private static final Logger LOG = LoggerFactory.getLogger(XSQLAdapter.class); - - private static final int SLEEP = 10000; - private static XSQLAdapter a = new XSQLAdapter(); - private static PrintStream l = null; - private static String tmpDir = null; - private static File xqlLog = null; - public boolean stopped = false; - private String username; - private String password; - private final String transport = "tcp"; - private int reconnectTimeout; - private int nThreads; - private int qsize; - private final String applicationName = "NQL Adapter"; - private StringBuffer lastInputString = new StringBuffer(); - private boolean toCsv = false; - private String exportToFileName = null; - private final XSQLThreadPool threadPool = new XSQLThreadPool(1, "Tasks", 2000); - private final JDBCServer jdbcServer = new JDBCServer(this); - private String pinningFile; - private ServerSocket serverSocket = null; - private DOMDataBroker domDataBroker = null; - - @GuardedBy("this") - private SchemaContext context; - @GuardedBy("this") - private XSQLBluePrint bluePrint = new XSQLBluePrint(); - - private XSQLAdapter() { - XSQLAdapter.log("Starting Adapter"); - this.setDaemon(true); - try { - serverSocket = new ServerSocket(34343); - } catch (Exception err) { - XSQLAdapter.log(err); - } - this.start(); - XSQLAdapter.log("Adapter Started!"); - - } - - public synchronized void loadBluePrint(){ - try{ - InputStream in = this.getClass().getClassLoader().getResourceAsStream("BluePrintCache.dat"); - if(in!=null){ - this.bluePrint = XSQLBluePrint.load(in); - in.close(); - } - }catch(Exception err){ - err.printStackTrace(); - } - } - - public static XSQLAdapter getInstance() { - return a; - } - - public static File getXQLLogfile() { - tmpDir = System.getProperty("java.io.tmpdir"); - xqlLog = new File(tmpDir + "/xql.log"); - return xqlLog; - } - - public static void main(final String args[]) { - XSQLAdapter adapter = new XSQLAdapter(); - adapter.start(); - } - - public static void log(final String str) { - try { - if (l == null) { - synchronized (XSQLAdapter.class) { - if (l == null) { - l = new PrintStream( - new FileOutputStream(getXQLLogfile())); - } - } - } - l.print(new Date()); - l.print(" - "); - l.println(str); - } catch (Exception err) { - err.printStackTrace(); - } - } - - public static void log(final Exception e) { - try { - if (l == null) { - synchronized (XSQLAdapter.class) { - if (l == null) { - l = new PrintStream( - new FileOutputStream(getXQLLogfile())); - } - } - } - l.print(new Date()); - l.print(" - "); - e.printStackTrace(l); - } catch (Exception err) { - err.printStackTrace(); - } - } - - @Override - public synchronized void onGlobalContextUpdated(final SchemaContext context) { - this.bluePrint = null; - this.context = context; - } - - public void setDataBroker(final DOMDataBroker ddb) { - this.domDataBroker = ddb; - } - - public synchronized XSQLBluePrint getBluePrint() { - if (bluePrint == null) { - LOG.warn("XSQL is not supported in production environments and will be removed in a future release"); - bluePrint = XSQLBluePrint.create(context); - } - - return bluePrint; - } - - public List> collectModuleRoots(final XSQLBluePrintNode table,final LogicalDatastoreType type) { - if (table.getParent().isModule()) { - try { - List> result = new LinkedList<>(); - YangInstanceIdentifier instanceIdentifier = YangInstanceIdentifier - .builder() - .node(XSQLODLUtils.getPath(table.getFirstFromSchemaNodes()).get(0)) - .build(); - DOMDataReadOnlyTransaction t = this.domDataBroker - .newReadOnlyTransaction(); - Optional> node = t.read(type, - instanceIdentifier).get(); - t.close(); - - if (node.isPresent()) { - result.add(node.get()); - } - - return result; - } catch (Exception err) { - XSQLAdapter.log(err); - } - } else { - return collectModuleRoots(table.getParent(),type); - } - return null; - } - - public void execute(final JDBCResultSet rs) { - if(this.domDataBroker==null){ - rs.setFinished(true); - return; - } - List tables = rs.getTables(); - List> roots = collectModuleRoots(tables.get(0),LogicalDatastoreType.OPERATIONAL); - roots.addAll(collectModuleRoots(tables.get(0),LogicalDatastoreType.CONFIGURATION)); - if(roots.isEmpty()){ - rs.setFinished(true); - } - XSQLBluePrintNode main = rs.getMainTable(); - List tasks = new LinkedList<>(); - - for (NormalizedNode entry : roots) { - NETask task = new NETask(rs, entry, main, getBluePrint()); - rs.numberOfTasks++; - tasks.add(task); - } - for (NETask task : tasks) { - threadPool.addTask(task); - } - } - - @Override - public void run() { - while (!stopped) { - try { - Socket s = serverSocket.accept(); - new TelnetConnection(s); - } catch (Exception err) { - err.printStackTrace(); - try { - Thread.sleep(20000); - } catch (Exception err2) { - } - stopped = true; - } - } - } - - public void processCommand(StringBuffer inputString, final PrintStream sout) { - if (inputString.toString().trim().equals("r")) { - sout.println(lastInputString); - inputString = lastInputString; - } - lastInputString = inputString; - String input = inputString.toString().trim(); - if (input.startsWith("setExcel")) { - String substr = input.substring("setExcel".length()).trim(); - if (!substr.equals("")) { - // excelPath01 = substr; - } - // sout.println("Excel Path="+excelPath01); - } else if (input.startsWith("list vrel")) { - String substr = input.substring("list vrel".length()).trim(); - XSQLBluePrintNode node = getBluePrint().getBluePrintNodeByTableName(substr); - if (node == null) { - sout.println("Unknown Interface " + substr); - return; - } - List fld = new ArrayList<>(); - for (XSQLBluePrintRelation r : node.getRelations()) { - fld.add(r.toString()); - } - String p[] = fld.toArray(new String[fld.size()]); - Arrays.sort(p); - for (String element : p) { - sout.println(element); - } - } else if (input.startsWith("list vfields")) { - String substr = input.substring("list vfields".length()).trim(); - XSQLBluePrintNode node = getBluePrint().getBluePrintNodeByTableName(substr); - if (node == null) { - sout.println("Unknown Interface " + substr); - return; - } - List fld = new ArrayList<>(); - for (XSQLColumn c : node.getColumns()) { - fld.add(c.getName()); - } - String p[] = fld.toArray(new String[fld.size()]); - Arrays.sort(p); - for (String element : p) { - sout.println(element); - } - } else if (input.startsWith("jdbc")) { - String addr = input.substring(5).trim(); - jdbcServer.connectToClient(addr); - sout.println("Connected To " + addr); - } else if (input.startsWith("fetch")) { - // fetchSize = Integer.parseInt(input.substring(6).trim()); - } else if (input.startsWith("list vtables")) { - - String iNames[] = getBluePrint().getAllTableNames().toArray( - new String[0]); - Arrays.sort(iNames); - sout.println(); - for (String iName : iNames) { - sout.println(iName); - } - } else if (input.equals("help") || input.equals("?")) { - // sout.println(getLongDescription()); - } else if (input.equals("avmdata")) { - try { - // myConnection.getManagedData(); - } catch (Exception err) { - } - } else if (input.equals("innerjoin")) { - // innerJoin = !innerJoin; - // sout.println("Inner Join set to "+innerJoin); - } else if (input.equals("exit")) { - try { - sout.close(); - } catch (Exception err) { - } - } else if (input.equals("save")) { - getBluePrint().save(); - } else if (input.equals("tocsv")) { - toCsv = !toCsv; - sout.println("to csv file is " + toCsv); - } else if (input.indexOf("filename") != -1) { - exportToFileName = input.substring(input.indexOf(" ")).trim(); - sout.println("Exporting to file:" + exportToFileName); - } else if (!input.equals("")) { - if (toCsv) { - if (exportToFileName != null) { - try { - PrintStream o = new PrintStream(new File( - exportToFileName)); - executeSql(inputString.toString(), o); - o.close(); - } catch (Exception err) { - err.printStackTrace(); - } - } else { - try { - String fName = "export-" + System.currentTimeMillis() - + ".csv"; - PrintStream o = new PrintStream(new File(fName)); - executeSql(inputString.toString(), o); - o.close(); - sout.println("Exported to file " + fName); - } catch (Exception err) { - err.printStackTrace(); - } - - } - } else { - executeSql(inputString.toString(), sout); - } - } - sout.println(); - } - - public void executeSql(final String sql, final PrintStream out) { - JDBCResultSet rs = new JDBCResultSet(sql); - try { - int count = 0; - JDBCServer.execute(rs, this); - boolean isFirst = true; - int loc = rs.getFields().size() - 1; - int totalWidth = 0; - for (XSQLColumn c : rs.getFields()) { - if (isFirst) { - isFirst = false; - if (toCsv) { - out.print("\""); - } - } - - if (!toCsv) { - out.print("|"); - } - - out.print(c.getName()); - - if (!toCsv) { - int cw = c.getCharWidth(); - int cnw = c.getName().length(); - if (cnw > cw) { - c.setCharWidth(cnw); - } - int gap = cw - cnw; - for (int i = 0; i < gap; i++) { - out.print(" "); - } - } - - totalWidth += c.getCharWidth() + 1; - - if (loc > 0) { - if (toCsv) { - out.print("\",\""); - } - } - loc--; - } - - if (toCsv) { - out.println("\""); - } else { - totalWidth++; - out.println("|"); - for (int i = 0; i < totalWidth; i++) { - out.print("-"); - } - out.println(); - } - - while (rs.next()) { - isFirst = true; - loc = rs.getFields().size() - 1; - for (XSQLColumn c : rs.getFields()) { - if (isFirst) { - isFirst = false; - if (toCsv) { - out.print("\""); - } - } - - if (!toCsv) { - out.print("|"); - } - - Object sValue = rs.getObject(c.toString()); - if (sValue == null) { - sValue = ""; - } - out.print(sValue); - - int cw = c.getCharWidth(); - int vw = sValue.toString().length(); - int gap = cw - vw; - for (int i = 0; i < gap; i++) { - out.print(" "); - } - - if (loc > 0) { - if (toCsv) { - out.print("\",\""); - } - } - loc--; - } - if (toCsv) { - out.println("\""); - } else { - out.println("|"); - } - count++; - } - out.println("Total Number Of Records=" + count); - } catch (Exception err) { - err.printStackTrace(out); - } - } - - public static class NETask implements Runnable { - - private final JDBCResultSet rs; - private final NormalizedNode modelRoot; - private final XSQLBluePrintNode main; - private final XSQLBluePrint bluePrint; - - public NETask(final JDBCResultSet _rs, final NormalizedNode _modelRoot, - final XSQLBluePrintNode _main, final XSQLBluePrint _bluePrint) { - this.rs = _rs; - this.modelRoot = _modelRoot; - this.main = _main; - this.bluePrint = _bluePrint; - } - - @Override - public void run() { - rs.addRecords(modelRoot, main, true, main.getBluePrintNodeName(), - bluePrint); - synchronized (rs) { - rs.numberOfTasks--; - if (rs.numberOfTasks == 0) { - rs.setFinished(true); - rs.notifyAll(); - } - } - } - } - - private class TelnetConnection extends Thread { - - private Socket socket = null; - private InputStream in = null; - private PrintStream out = null; - private final Module currentModule = null; - - public TelnetConnection(final Socket s) { - this.socket = s; - try { - this.in = s.getInputStream(); - this.out = new PrintStream(s.getOutputStream()); - this.start(); - } catch (Exception err) { - XSQLAdapter.log(err); - } - } - - @Override - public void run() { - StringBuffer inputString = new StringBuffer(); - String prompt = "XSQL>"; - try { - while (!stopped) { - if (currentModule != null) { - prompt = "XQL/" + currentModule.getName() + ">"; - } - out.print(prompt); - char c = 0; - byte data[] = new byte[1]; - while (!socket.isClosed() && socket.isConnected() && !socket.isInputShutdown() && c != '\n') { - try { - in.read(data); - c = (char) data[0]; - inputString.append(c); - } catch (Exception err) { - err.printStackTrace(out); - stopped = true; - break; - } - } - - processCommand(inputString, out); - inputString = new StringBuffer(); - } - } catch (Exception err) { - try { - socket.close(); - } catch (Exception err2) { - } - } - } - } -} diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrint.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrint.java deleted file mode 100644 index d6aaa270b5..0000000000 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrint.java +++ /dev/null @@ -1,1378 +0,0 @@ -/* - * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.md.sal.dom.xsql; - -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Proxy; -import java.lang.reflect.Type; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.ResultSet; -import java.sql.RowIdLifetime; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import org.opendaylight.yangtools.yang.model.api.Module; -import org.opendaylight.yangtools.yang.model.api.SchemaContext; -/** - * @author Sharon Aicler(saichler@gmail.com) - **/ -/** - * To be removed in Nitrogen - */ -@Deprecated -public class XSQLBluePrint implements DatabaseMetaData, Serializable { - - private static final long serialVersionUID = 1L; - - public static final String CACHE_FILE_NAME = "./BluePrintCache.dat"; - - private final Map tableNameToBluePrint = new HashMap<>(); - private final Map> odlNameToBluePrint = new HashMap<>(); - - private final boolean cacheLoadedSuccessfuly = false; - private DatabaseMetaData myProxy = null; - - public static final String replaceAll(final String source, final String toReplace, - final String withThis) { - int index = source.indexOf(toReplace); - int index2 = 0; - StringBuffer result = new StringBuffer(); - while (index != -1) { - result.append(source.substring(index2, index)); - result.append(withThis); - index2 = index + toReplace.length(); - index = source.indexOf(toReplace, index2); - } - if (index2 < source.length()) { - result.append(source.substring(index2)); - } - return result.toString(); - } - - XSQLBluePrint() { - - } - - public void save() { - ObjectOutputStream out = null; - try { - out = new ObjectOutputStream(new DataOutputStream( - new FileOutputStream(CACHE_FILE_NAME))); - out.writeObject(this); - } catch (Exception err) { - err.printStackTrace(); - } finally { - try { - out.close(); - } catch (Exception err) { - } - } - } - - static XSQLBluePrint create(final SchemaContext context) { - final XSQLBluePrint ret = new XSQLBluePrint(); - for (Module m : context.getModules()) { - XSQLODLUtils.createOpenDaylightCache(ret, m); - } - - return ret; - } - - public static XSQLBluePrint load(final InputStream ins) { - ObjectInputStream in = null; - try { - in = new ObjectInputStream(new DataInputStream(ins)); - return (XSQLBluePrint) in.readObject(); - } catch (Exception err) { - err.printStackTrace(); - } finally { - try { - in.close(); - } catch (Exception err) { - } - } - return null; - } - - private class NQLBluePrintProxy implements InvocationHandler { - @Override - public Object invoke(final Object proxy, final Method method, final Object[] args) - throws Throwable { - System.out.println("Method " + method); - return method.invoke(XSQLBluePrint.this, args); - } - } - - public DatabaseMetaData getProxy() { - if (myProxy == null) { - try { - myProxy = (DatabaseMetaData) Proxy.newProxyInstance(getClass() - .getClassLoader(), - new Class[] { DatabaseMetaData.class }, - new NQLBluePrintProxy()); - } catch (Exception err) { - err.printStackTrace(); - } - } - return myProxy; - } - - public XSQLBluePrintNode[] getBluePrintNodeByODLTableName( - final String odlTableName) { - Map map = this.odlNameToBluePrint - .get(odlTableName); - if (map == null) { - return null; - } - return map.values().toArray(new XSQLBluePrintNode[map.size()]); - } - - public XSQLBluePrintNode getBluePrintNodeByTableName(String tableName) { - if (tableName.indexOf(".") != -1) { - tableName = tableName.substring(tableName.lastIndexOf(".") + 1); - } - - XSQLBluePrintNode node = tableNameToBluePrint.get(tableName); - - if (node != null) { - return node; - } - - for (XSQLBluePrintNode n : tableNameToBluePrint.values()) { - if (n.getBluePrintNodeName().endsWith(tableName)) { - return n; - } - } - - for (XSQLBluePrintNode n : tableNameToBluePrint.values()) { - if (n.getBluePrintNodeName().toLowerCase() - .endsWith(tableName.toLowerCase())) { - return n; - } - } - - for (XSQLBluePrintNode n : tableNameToBluePrint.values()) { - if (n.getBluePrintNodeName().toLowerCase() - .equals(tableName.toLowerCase())) { - return n; - } - } - - for (XSQLBluePrintNode n : tableNameToBluePrint.values()) { - if (n.getBluePrintNodeName().toLowerCase() - .indexOf(tableName.toLowerCase()) != -1) { - return n; - } - } - return null; - } - - public boolean isCacheLoaded() { - return cacheLoadedSuccessfuly; - } - - private static Map, Set>> superClassMap = new HashMap<>(); - - public static Set> getInheritance(final Class myObjectClass, - final Class returnType) { - - if (returnType != null && myObjectClass.equals(returnType)) { - return new HashSet<>(); - } - Set> result = superClassMap.get(myObjectClass); - if (result != null) { - return result; - } - result = new HashSet<>(); - superClassMap.put(myObjectClass, result); - if (returnType != null) { - if (!returnType.equals(myObjectClass)) { - Class mySuperClass = myObjectClass.getSuperclass(); - while (mySuperClass != null) { - result.add(mySuperClass); - mySuperClass = mySuperClass.getSuperclass(); - } - result.addAll(collectInterfaces(myObjectClass)); - } - } - return result; - } - - public static Set> collectInterfaces(final Class cls) { - Set> result = new HashSet<>(); - Class myInterfaces[] = cls.getInterfaces(); - if (myInterfaces != null) { - for (Class in : myInterfaces) { - result.add(in); - result.addAll(collectInterfaces(in)); - } - } - return result; - } - - public XSQLBluePrintNode addToBluePrintCache(final XSQLBluePrintNode blNode,final XSQLBluePrintNode parent) { - XSQLBluePrintNode existingNode = this.tableNameToBluePrint.get(blNode.getBluePrintNodeName()); - if(existingNode!=null){ - existingNode.mergeAugmentation(blNode); - return existingNode; - }else{ - this.tableNameToBluePrint.put(blNode.getBluePrintNodeName(), blNode); - Map map = this.odlNameToBluePrint.get(blNode.getODLTableName()); - if (map == null) { - map = new HashMap<>(); - this.odlNameToBluePrint.put(blNode.getODLTableName(), map); - } - map.put(blNode.getBluePrintNodeName(), blNode); - if(parent!=null) { - parent.addChild(blNode); - } - return blNode; - } - } - - public Class getGenericType(final ParameterizedType type) { - Type[] typeArguments = type.getActualTypeArguments(); - for (Type typeArgument : typeArguments) { - if (typeArgument instanceof ParameterizedType) { - ParameterizedType pType = (ParameterizedType) typeArgument; - return (Class) pType.getRawType(); - } else if (typeArgument instanceof Class) { - return (Class) typeArgument; - } - } - return null; - } - - public Class getMethodReturnTypeFromGeneric(final Method m) { - Type rType = m.getGenericReturnType(); - if (rType instanceof ParameterizedType) { - return getGenericType((ParameterizedType) rType); - } - return null; - } - - public List getAllTableNames() { - List names = new ArrayList<>(); - for (XSQLBluePrintNode n : this.tableNameToBluePrint.values()) { - if (!n.isModule() && !n.getColumns().isEmpty()) { - names.add(n.getBluePrintNodeName()); - } - } - return names; - - } - - public List getInterfaceNames(final XSQLBluePrintNode node) { - Set children = node.getChildren(); - List names = new ArrayList<>(); - for (XSQLBluePrintNode n : children) { - if (!n.isModule() && !n.getColumns().isEmpty()) { - names.add(n.toString()); - } - names.addAll(getInterfaceNames(n)); - } - return names; - } - - @Override - public boolean allProceduresAreCallable() throws SQLException { - return false; - } - - @Override - public boolean allTablesAreSelectable() throws SQLException { - return true; - } - - @Override - public boolean autoCommitFailureClosesAllResultSets() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean dataDefinitionCausesTransactionCommit() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean dataDefinitionIgnoredInTransactions() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean deletesAreDetected(final int type) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean doesMaxRowSizeIncludeBlobs() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public ResultSet getAttributes(final String catalog, final String schemaPattern, - final String typeNamePattern, final String attributeNamePattern) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getBestRowIdentifier(final String catalog, final String schema, - final String table, final int scope, final boolean nullable) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getCatalogs() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getCatalogSeparator() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getCatalogTerm() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getClientInfoProperties() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getColumnPrivileges(final String catalog, final String schema, - final String table, final String columnNamePattern) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getColumns(final String catalog, final String schemaPattern, - final String tableNamePattern, final String columnNamePattern) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Connection getConnection() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getCrossReference(final String parentCatalog, - final String parentSchema, final String parentTable, final String foreignCatalog, - final String foreignSchema, final String foreignTable) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public int getDatabaseMajorVersion() throws SQLException { - return 0; - } - - @Override - public int getDatabaseMinorVersion() throws SQLException { - // TODO Auto-generated method stub - return 1; - } - - @Override - public String getDatabaseProductName() throws SQLException { - return "OpenDayLight"; - } - - @Override - public String getDatabaseProductVersion() throws SQLException { - return "0.1"; - } - - @Override - public int getDefaultTransactionIsolation() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getDriverMajorVersion() { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getDriverMinorVersion() { - // TODO Auto-generated method stub - return 0; - } - - @Override - public String getDriverName() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getDriverVersion() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getExportedKeys(final String catalog, final String schema, final String table) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getExtraNameCharacters() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getFunctionColumns(final String catalog, final String schemaPattern, - final String functionNamePattern, final String columnNamePattern) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getFunctions(final String catalog, final String schemaPattern, - final String functionNamePattern) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getIdentifierQuoteString() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getImportedKeys(final String catalog, final String schema, final String table) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getIndexInfo(final String catalog, final String schema, final String table, - final boolean unique, final boolean approximate) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public int getJDBCMajorVersion() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getJDBCMinorVersion() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxBinaryLiteralLength() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxCatalogNameLength() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxCharLiteralLength() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxColumnNameLength() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxColumnsInGroupBy() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxColumnsInIndex() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxColumnsInOrderBy() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxColumnsInSelect() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxColumnsInTable() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxConnections() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxCursorNameLength() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxIndexLength() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxProcedureNameLength() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxRowSize() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxSchemaNameLength() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxStatementLength() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxStatements() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxTableNameLength() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxTablesInSelect() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxUserNameLength() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public String getNumericFunctions() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getPrimaryKeys(final String catalog, final String schema, final String table) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getProcedureColumns(final String catalog, final String schemaPattern, - final String procedureNamePattern, final String columnNamePattern) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getProcedures(final String catalog, final String schemaPattern, - final String procedureNamePattern) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getProcedureTerm() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public int getResultSetHoldability() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public RowIdLifetime getRowIdLifetime() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getSchemas() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getSchemas(final String catalog, final String schemaPattern) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getSchemaTerm() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getSearchStringEscape() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getSQLKeywords() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public int getSQLStateType() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public String getStringFunctions() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getSuperTables(final String catalog, final String schemaPattern, - final String tableNamePattern) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getSuperTypes(final String catalog, final String schemaPattern, - final String typeNamePattern) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getSystemFunctions() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getTablePrivileges(final String catalog, final String schemaPattern, - final String tableNamePattern) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getTables(final String catalog, final String schemaPattern, - final String tableNamePattern, final String[] types) throws SQLException { - return new TablesResultSet(this); - } - - @Override - public ResultSet getTableTypes() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getTimeDateFunctions() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getTypeInfo() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getUDTs(final String catalog, final String schemaPattern, - final String typeNamePattern, final int[] types) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getURL() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getUserName() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getVersionColumns(final String catalog, final String schema, - final String table) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean insertsAreDetected(final int type) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isCatalogAtStart() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isReadOnly() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean locatorsUpdateCopy() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean nullPlusNonNullIsNull() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean nullsAreSortedAtEnd() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean nullsAreSortedAtStart() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean nullsAreSortedHigh() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean nullsAreSortedLow() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean othersDeletesAreVisible(final int type) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean othersInsertsAreVisible(final int type) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean othersUpdatesAreVisible(final int type) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean ownDeletesAreVisible(final int type) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean ownInsertsAreVisible(final int type) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean ownUpdatesAreVisible(final int type) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean storesLowerCaseIdentifiers() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean storesLowerCaseQuotedIdentifiers() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean storesMixedCaseIdentifiers() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean storesMixedCaseQuotedIdentifiers() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean storesUpperCaseIdentifiers() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean storesUpperCaseQuotedIdentifiers() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsAlterTableWithAddColumn() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsAlterTableWithDropColumn() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsANSI92EntryLevelSQL() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsANSI92FullSQL() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsANSI92IntermediateSQL() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsBatchUpdates() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsCatalogsInDataManipulation() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsCatalogsInIndexDefinitions() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsCatalogsInProcedureCalls() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsCatalogsInTableDefinitions() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsColumnAliasing() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsConvert() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsConvert(final int fromType, final int toType) - throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsCoreSQLGrammar() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsCorrelatedSubqueries() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsDataDefinitionAndDataManipulationTransactions() - throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsDataManipulationTransactionsOnly() - throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsDifferentTableCorrelationNames() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsExpressionsInOrderBy() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsExtendedSQLGrammar() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsFullOuterJoins() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsGetGeneratedKeys() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsGroupBy() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsGroupByBeyondSelect() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsGroupByUnrelated() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsIntegrityEnhancementFacility() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsLikeEscapeClause() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsLimitedOuterJoins() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsMinimumSQLGrammar() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsMixedCaseIdentifiers() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsMultipleOpenResults() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsMultipleResultSets() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsMultipleTransactions() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsNamedParameters() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsNonNullableColumns() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsOpenCursorsAcrossCommit() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsOpenCursorsAcrossRollback() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsOpenStatementsAcrossCommit() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsOpenStatementsAcrossRollback() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsOrderByUnrelated() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsOuterJoins() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsPositionedDelete() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsPositionedUpdate() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsResultSetConcurrency(final int type, final int concurrency) - throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsResultSetHoldability(final int holdability) - throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsResultSetType(final int type) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsSavepoints() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsSchemasInDataManipulation() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsSchemasInIndexDefinitions() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsSchemasInProcedureCalls() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsSchemasInTableDefinitions() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsSelectForUpdate() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsStatementPooling() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsStoredProcedures() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsSubqueriesInComparisons() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsSubqueriesInExists() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsSubqueriesInIns() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsSubqueriesInQuantifieds() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsTableCorrelationNames() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsTransactionIsolationLevel(final int level) - throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsTransactions() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsUnion() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsUnionAll() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean updatesAreDetected(final int type) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean usesLocalFilePerTable() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean usesLocalFiles() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isWrapperFor(final Class iface) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public T unwrap(final Class iface) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getPseudoColumns(final String catalog, final String schemaPattern, - final String tableNamePattern, final String columnNamePattern) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean generatedKeyAlwaysReturned() throws SQLException { - // TODO Auto-generated method stub - return false; - } -} diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrintNode.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrintNode.java deleted file mode 100644 index f54a3c98d7..0000000000 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrintNode.java +++ /dev/null @@ -1,307 +0,0 @@ -/* - * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.md.sal.dom.xsql; - -import java.io.Serializable; -import java.sql.SQLException; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -/** - * @author Sharon Aicler(saichler@gmail.com) - **/ -/** - * To be removed in Nitrogen - */ -@Deprecated -public class XSQLBluePrintNode implements Serializable { - - private static final long serialVersionUID = 1L; - private Class myInterface = null; - private String myInterfaceString = null; - private Set relations = new HashSet<>(); - private Set inheritingNodes = new HashSet<>(); - private Set children = new HashSet<>(); - private XSQLBluePrintNode parent = null; - - private int level = -1; - private transient Set parentHierarchySet = null; - private String myInterfaceName = null; - private Set columns = new HashSet<>(); - private Map origNameToColumn = new HashMap<>(); - - private transient Object[] odlSchemaNodes = null; - private boolean module = false; - private String bluePrintTableName = null; - private String odlTableName = null; - private String origName = null; - - public void mergeAugmentation(XSQLBluePrintNode aug) { - this.relations.addAll(aug.relations); - this.inheritingNodes.addAll(aug.inheritingNodes); - this.children.addAll(aug.children); - this.columns.addAll(aug.columns); - this.origNameToColumn.putAll(aug.origNameToColumn); - if (aug.odlSchemaNodes != null) { - for (Object sn : aug.odlSchemaNodes) { - addToSchemaNodes(sn); - } - } - } - - public XSQLBluePrintNode(String name, String _origName, int _level) { - this.level = _level; - this.odlTableName = name; - this.bluePrintTableName = name; - this.origName = _origName; - } - - public XSQLBluePrintNode(Class _myInterface, int _level) { - this.myInterface = _myInterface; - this.myInterfaceString = _myInterface.getName(); - this.myInterfaceName = myInterface.getSimpleName(); - this.level = _level; - } - - public XSQLBluePrintNode(Object _odlNode, int _level, - XSQLBluePrintNode _parent) { - addToSchemaNodes(_odlNode); - this.level = _level; - this.module = XSQLODLUtils.isModule(_odlNode); - this.parent = _parent; - this.bluePrintTableName = XSQLODLUtils.getBluePrintName(_odlNode); - this.odlTableName = XSQLODLUtils - .getODLNodeName(getFirstFromSchemaNodes()); - } - - private void addToSchemaNodes(Object schemaObject) { - if (this.odlSchemaNodes == null) - this.odlSchemaNodes = new Object[1]; - else { - Object[] temp = new Object[this.odlSchemaNodes.length + 1]; - System.arraycopy(this.odlSchemaNodes, 0, temp, 0, - this.odlSchemaNodes.length); - this.odlSchemaNodes = temp; - } - this.odlSchemaNodes[this.odlSchemaNodes.length - 1] = schemaObject; - } - - public Object getFirstFromSchemaNodes() { - if (this.odlSchemaNodes == null) { - return null; - } - return this.odlSchemaNodes[0]; - } - - public String getOrigName() { - return this.origName; - } - - public String getBluePrintNodeName() { - return this.bluePrintTableName; - } - - public boolean isModule() { - return this.module; - } - - public Set getChildren() { - return this.children; - } - - public String getODLTableName() { - if (this.odlTableName == null) { - this.odlTableName = XSQLODLUtils - .getODLNodeName(getFirstFromSchemaNodes()); - } - return this.odlTableName; - } - - public void addChild(XSQLBluePrintNode ch) { - this.children.add(ch); - } - - public boolean isModelChild(Class p) { - if (this.relations.size() == 0) { - return false; - } - for (XSQLBluePrintRelation parentRelation : this.relations) { - if (parentRelation.getParent().getInterface().equals(p)) { - return true; - } - } - for (XSQLBluePrintRelation dtr : this.relations) { - XSQLBluePrintNode parent = dtr.getParent(); - if (!parent.getInterface().equals(this.getInterface()) - && !parent.getInterface().isAssignableFrom( - this.getInterface()) - && this.getInterface().isAssignableFrom( - parent.getInterface()) && parent.isModelChild(p)) { - return true; - } - } - return false; - } - - public Set getRelations() { - return this.relations; - } - - public String getClassName() { - return this.myInterfaceString; - } - - public void addInheritingNode(XSQLBluePrintNode node) { - this.inheritingNodes.add(node); - } - - public Set getInheritingNodes() { - return this.inheritingNodes; - } - - public void addColumn(Object node, String tableName) { - XSQLColumn c = new XSQLColumn(node, getBluePrintNodeName(), this); - this.columns.add(c); - } - - public XSQLColumn addColumn(String name, String tableName, String origName, - String origTableName) { - XSQLColumn c = new XSQLColumn(name, tableName, origName, origTableName); - this.columns.add(c); - this.origNameToColumn.put(origName, c); - return c; - } - - public void addColumn(String methodName) { - if (methodName.startsWith("get")) { - methodName = methodName.substring(3); - } else if (methodName.startsWith("is")) { - methodName = methodName.substring(2); - } - XSQLColumn c = new XSQLColumn(methodName, myInterfaceName, null); - this.columns.add(c); - } - - public Collection getColumns() { - return this.columns; - } - - public XSQLColumn findColumnByName(String name) throws SQLException { - - XSQLColumn exactMatch = null; - XSQLColumn indexOfMatch = null; - XSQLColumn exactLowercaseMatch = null; - XSQLColumn indexOfLowerCaseMatch = null; - - for (XSQLColumn col : columns) { - if (col.getName().equals(name)) { - exactMatch = col; - } - if (col.getName().indexOf(name) != -1) { - indexOfMatch = col; - } - if (col.getName().toLowerCase().equals(name.toLowerCase())) { - exactLowercaseMatch = col; - } - if (col.getName().toLowerCase().indexOf(name.toLowerCase()) != -1) { - indexOfLowerCaseMatch = col; - } - } - - if (exactMatch != null) { - return exactMatch; - } - if (exactLowercaseMatch != null) { - return exactLowercaseMatch; - } - if (indexOfMatch != null) { - return indexOfMatch; - } - if (indexOfLowerCaseMatch != null) { - return indexOfLowerCaseMatch; - } - - throw new SQLException("Unknown field name '" + name + "'"); - } - - public void addParent(XSQLBluePrintNode parent, String property) { - try { - if (property.equals("ContainingTPs")) { - return; - } - // Method m = parent.getInterface().getMethod("get"+property, null); - // if(!m.getDeclaringClass().equals(parent.getInterface())) - // return; - XSQLBluePrintRelation rel = new XSQLBluePrintRelation(parent, - property, myInterface); - relations.add(rel); - } catch (Exception err) { - err.printStackTrace(); - } - } - - public XSQLBluePrintNode getParent() { - return this.parent; - } - - public Set getClonedParents() { - Set result = new HashSet<>(); - result.addAll(this.relations); - return result; - } - - public String toString() { - if (myInterfaceName != null) { - return myInterfaceName; - } - if (this.odlSchemaNodes != null) { - return getBluePrintNodeName(); - } - if (odlTableName != null) { - return odlTableName; - } - return "Unknown"; - } - - public Class getInterface() { - return this.myInterface; - } - - public int getLevel() { - return this.level; - } - - @Override - public boolean equals(Object obj) { - XSQLBluePrintNode other = (XSQLBluePrintNode) obj; - if (this.odlSchemaNodes != null) { - return getBluePrintNodeName().equals(other.getBluePrintNodeName()); - } else if (this.odlTableName == null && other.odlTableName != null) { - return false; - } - if (this.odlTableName != null && other.odlTableName == null) { - return false; - } else { - return this.odlTableName.equals(other.odlTableName); - } - } - - @Override - public int hashCode() { - if (myInterfaceString != null) { - return myInterfaceString.hashCode(); - } else if (this.odlSchemaNodes != null) { - return bluePrintTableName.hashCode(); - } - return 0; - } - -} diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrintRelation.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrintRelation.java deleted file mode 100644 index ae1dffdf32..0000000000 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLBluePrintRelation.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.md.sal.dom.xsql; - -import java.io.Serializable; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * To be removed in Nitrogen - */ -@Deprecated -public class XSQLBluePrintRelation implements Serializable { - private static final long serialVersionUID = 2L; - private XSQLBluePrintNode parent = null; - private String property = null; - private Class childClass = null; - - public XSQLBluePrintRelation(XSQLBluePrintNode _parent, String _property, - Class _childClass) { - this.parent = _parent; - this.property = _property; - this.childClass = _childClass; - } - - public Class getNEClosestClass() { - Class p = parent.getInterface(); - return getNEClosestClass(p); - } - - - public static Class getNEClosestClass(Class p) { - while (!p.getInterfaces()[0] - .equals(Object.class/*XSQLBluePrint.STOP_INTERFACE*/)) { - p = p.getInterfaces()[0]; - } - return p; - } - - public XSQLBluePrintNode getParent() { - return parent; - } - - public String getProperty() { - return property; - } - - public Class getChildClass() { - return this.childClass; - } - - public boolean equals(Object obj) { - XSQLBluePrintRelation other = (XSQLBluePrintRelation) obj; - if (other.parent != null && this.parent == null) { - return false; - } - if (other.parent == null && this.parent != null) { - return false; - } - - if (other.parent == null && this.parent == null) { - return property.equals(other.property); - } - - if (other.parent.toString().equals(this.parent.toString())) { - return property.equals(other.property); - } - - return false; - } - - public int hashCode() { - if (parent != null) { - return parent.toString().hashCode() + property.hashCode(); - } - return property.hashCode(); - } - - public String toString() { - if (parent != null) { - return parent.toString() + ":" + property; - } else { - return property; - } - } - - public List execute(Object o) { - if (o == null) { - return null; - } - - List result = new LinkedList<>(); - if (o instanceof Set) { - for (Object oo : (Set) o) { - addToResult(result, execute(oo)); - } - } else if (o instanceof List) { - for (Object oo : (List) o) { - addToResult(result, execute(oo)); - } - } else if (o instanceof Map) { - for (Object oo : ((Map) o).values()) { - addToResult(result, execute(oo)); - } - } else { - addToResult(result, XSQLCriteria.getValue(o, this.property)); - } - return result; - } - - private static void addToResult(List result, Object o) { - if (o instanceof Set) { - result.addAll((Set)o); - } else if (o instanceof List) { - result.addAll((List)o); - } else if (o instanceof Map) { - result.addAll(((Map)o).values()); - } else if (o != null) { - result.add(o); - } - } -} - diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLColumn.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLColumn.java deleted file mode 100644 index 7b084fd497..0000000000 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLColumn.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.md.sal.dom.xsql; - -import java.io.Serializable; - -/** - * To be removed in Nitrogen - */ -@Deprecated -public class XSQLColumn implements Serializable, Comparable { - private static final long serialVersionUID = 4854919735031714751L; - - private String name = null; - private String tableName = null; - private int charWidth = -1; - private Class type = null; - private transient Object bluePrintNode = null; - private String origName = null; - private String origTableName = null; - - public XSQLColumn(Object odlNode, String _tableName, Object _bluePrintNode) { - this.name = XSQLODLUtils.getNodeNameFromDSN(odlNode); - this.tableName = _tableName; - this.bluePrintNode = _bluePrintNode; - this.type = XSQLODLUtils.getTypeForODLColumn(odlNode); - } - - public XSQLColumn(String _name, String _tableName,String _origName, String _origTableName){ - this.name = _name; - this.tableName = _tableName; - this.origName = _origName; - this.origTableName = _origTableName; - } - - public String getName() { - return name; - } - - public String getTableName() { - return tableName; - } - - public void setCharWidth(int i) { - if (this.charWidth < i) { - this.charWidth = i; - } - } - - public int getCharWidth() { - return this.charWidth; - } - - @Override - public int hashCode() { - return this.name.hashCode() + this.tableName.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof XSQLColumn)) { - return false; - } - XSQLColumn other = (XSQLColumn) obj; - return tableName.equals(other.tableName) && name.equals(other.name); - } - - public Object getBluePrintNode() { - return this.bluePrintNode; - } - - @Override - public String toString() { - return tableName + "." + name; - } - - @Override - public int compareTo(Object o) { - return this.toString().compareTo(o.toString()); - } - - public Object getResultSetValue(Object obj){ - if(this.type.equals(String.class)){ - return obj.toString(); - }else - if(this.type.equals(int.class)){ - return Integer.parseInt(obj.toString()); - }else - if(this.type.equals(long.class)){ - return Long.parseLong(obj.toString()); - }else - if(this.type.equals(byte.class)){ - return Byte.parseByte(obj.toString()); - } - return null; - } -} diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLCriteria.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLCriteria.java deleted file mode 100644 index aa2d8b96b2..0000000000 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLCriteria.java +++ /dev/null @@ -1,383 +0,0 @@ -/* - * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.md.sal.dom.xsql; - -import java.io.Serializable; -import java.lang.reflect.Method; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -/** - * To be removed in Nitrogen - */ -@Deprecated -public class XSQLCriteria implements Serializable { - private static final long serialVersionUID = 1L; - - private static final String operators[] = - new String[] {" and ", " or ", ">=", "<=", "!=", "=", ">", "<", "like", - "is null", "not null", "skip"}; - private static final String STRING_CHAR = "'"; - - public static final int OP_CODE_AND = 0; - public static final int OP_CODE_OR = 1; - public static final int OP_CODE_GTEQ = 2; - public static final int OP_CODE_LTEQ = 3; - public static final int OP_CODE_NOT_EQ = 4; - public static final int OP_CODE_EQUAL = 5; - public static final int OP_CODE_GT = 6; - public static final int OP_CODE_LT = 7; - public static final int OP_CODE_LIKE = 8; - public static final int OP_CODE_NULL = 9; - public static final int OP_CODE_NOT_NULL = 10; - public static final int OP_CODE_SKIP = 11; - - private XSQLCriteria left = null; - private XSQLCriteria right = null; - - private int operation = -1; - - private Object leftValue = null; - private Object rightValue = null; - private String criteria = null; - - private static final Map, Map> methodCache = - new ConcurrentHashMap<>(); - - public XSQLCriteria(final String data, final int parentOperation) { - criteria = data; - parse(data, parentOperation); - } - - private void parse(String data, int parentOperation) { - - data = data.trim(); - - int index1 = data.indexOf("("); - if (index1 != -1) { - String leftCondition = data.substring(0, index1).trim(); - if (leftCondition.trim().equals("")) { - int index2 = data.lastIndexOf(")"); - if (index2 < data.length() - 1) { - String rtValue = data.substring(index2 + 1).trim(); - if (!rtValue.equals("")) { - left = - new XSQLCriteria(data.substring(index1 + 1, index2), - parentOperation); - data = data.substring(index2 + 1); - } else { - data = data.substring(1, index2); - } - } else { - data = data.substring(1, index2); - } - } else { - right = new XSQLCriteria( - data.substring(index1 + 1, data.length() - 1), - parentOperation); - data = data.substring(0, index1); - } - } - - for (int i = 0; i < operators.length; i++) { - index1 = data.indexOf(operators[i]); - if (index1 != -1) { - this.operation = i; - if (left == null) { - left = new XSQLCriteria(data.substring(0, index1), - this.operation); - } - if (left.leftValue != null && left.rightValue == null - && left.right == null) { - leftValue = left.leftValue; - left = null; - } - if (right == null) { - right = new XSQLCriteria( - data.substring(index1 + operators[i].length()), - this.operation); - } - if (right.leftValue != null && right.rightValue == null - && right.right == null) { - rightValue = right.leftValue; - right = null; - } - return; - } - } - - if (data.startsWith("'") && data.endsWith("'")) { - data = data.substring(1, data.length() - 1); - } - - if (parentOperation == OP_CODE_LIKE && data.startsWith("%") && data.endsWith("%") - && data.substring(1, data.length() - 1).indexOf("%") == -1) { - data = data.substring(1, data.length() - 1); - } - - leftValue = data; - } - - public static Object getValue(Object element, String propertyName) { - try { - Map cache = methodCache.get(element.getClass()); - if (cache == null) { - cache = new ConcurrentHashMap<>(); - methodCache.put(element.getClass(), cache); - } - - Method m = cache.get(propertyName); - if (m == null) { - Method methods[] = element.getClass().getMethods(); - for (Method mm : methods) { - if (mm.getName().equals(propertyName) || mm.getName() - .equals("get" + propertyName) || mm.getName() - .equals("is" + propertyName)) { - m = mm; - m.setAccessible(true); - cache.put(propertyName, m); - break; - } - } - } - - Object value = null; - if (m == null) { - return null; - } - if (m.getParameterTypes() == null - || m.getParameterTypes().length == 0) { - value = m.invoke(element, null); - } else { - if (String.class.isAssignableFrom(m.getParameterTypes()[0])) { - return null; - } - Object arg = m.getParameterTypes()[0].newInstance(); - value = m.invoke(element, arg); - } - return value; - } catch (Exception err) { - err.printStackTrace(); - } - return null; - } - - public int isObjectFitCriteria(Object element, String propertyName) { - Object value = getValue(element, propertyName); - if (value != null) { - value = value.toString(); - } - return checkValue(value); - } - - public int checkValue(Object value) { - if (leftValue != null && rightValue != null) { - Object aSide = null; - Object bSide = null; - if (leftValue.equals("?")) { - aSide = value; - } else { - aSide = leftValue; - } - - if (rightValue.equals("?")) { - bSide = value; - } else { - bSide = rightValue; - } - if (operation != OP_CODE_SKIP && operation != OP_CODE_NULL) { - if (aSide == null && bSide != null) { - return 0; - } else if (aSide != null && bSide == null) { - return 0; - } else if (aSide == null && bSide == null) { - return 1; - } - } - switch (operation) { - case OP_CODE_EQUAL: - if (aSide.equals(bSide)) { - return 1; - } else { - return 0; - } - case OP_CODE_NOT_EQ: - if (!aSide.equals(bSide)) { - return 1; - } else { - return 0; - } - case OP_CODE_LIKE: - if (aSide.toString().indexOf(bSide.toString()) != -1) { - return 1; - } else { - return 0; - } - case OP_CODE_NULL: - if (aSide == null) { - return 1; - } else { - return 0; - } - case OP_CODE_NOT_NULL: - if (aSide != null) { - return 1; - } else { - return 0; - } - case OP_CODE_GT: - if (aSide == null || bSide == null) { - return 0; - } - if (Double.parseDouble(aSide.toString().trim()) > Double - .parseDouble(bSide.toString().trim())) { - return 1; - } else { - return 0; - } - case OP_CODE_GTEQ: - if (aSide == null || bSide == null) { - return 0; - } - if (Double.parseDouble(aSide.toString().trim()) >= Double - .parseDouble(bSide.toString().trim())) { - return 1; - } else { - return 0; - } - - case OP_CODE_LT: - if (aSide == null || bSide == null) { - return 0; - } - if (Double.parseDouble(aSide.toString().trim()) < Double - .parseDouble(bSide.toString().trim())) { - return 1; - } else { - return 0; - } - case OP_CODE_LTEQ: - if (aSide == null || bSide == null) { - return 0; - } - if (Double.parseDouble(aSide.toString().trim()) <= Double - .parseDouble(bSide.toString().trim())) { - return 1; - } else { - return 0; - } - } - } - - int leftResult = 0; - if (left != null) { - leftResult = left.checkValue(value); - } - - int rightResult = 0; - if (right != null) { - rightResult = right.checkValue(value); - } - - if (operation == OP_CODE_SKIP) { - if (rightResult == 0) { - return 2; - } else { - return 3; - } - } - - if (operation == OP_CODE_AND) { - if (leftResult == 0) { - return 0; - } - if (rightResult == 0) { - return 0; - } - if (leftResult >= 2) { - return leftResult; - } - if (rightResult >= 2) { - return rightResult; - } - - return 1; - } - - if (operation == OP_CODE_OR) { - if (leftResult == 0 && rightResult == 0) { - return 0; - } - if (leftResult >= 2) { - return leftResult; - } - if (rightResult >= 2) { - return rightResult; - } - return 1; - } - - return 0; - } - - public String toString() { - return criteria; - } - - public String getCriteriaForProperty(XSQLColumn col) { - StringBuffer result = new StringBuffer(); - if (criteria == null) { - return ""; - } - - if (leftValue != null && rightValue != null) { - if (leftValue.toString().toLowerCase().equals(col.getName().toLowerCase()) || - leftValue.toString().toLowerCase().equals(col.toString().toLowerCase()) /*|| - /*col.getName().toLowerCase().indexOf(leftValue.toString().toLowerCase()) != -1*/) { - result.append("? ").append(operators[operation]).append(" ").append(rightValue); - }else - if (rightValue.toString().toLowerCase().equals(col.getName().toLowerCase()) || - rightValue.toString().toLowerCase().equals(col.toString().toLowerCase()) /*|| - col.getName().toLowerCase().indexOf(rightValue.toString().toLowerCase()) != -1*/) { - result.append("? ").append(operators[operation]).append(" ").append(leftValue); - } - return result.toString(); - } else if (left != null && right != null) { - String leftString = left.getCriteriaForProperty(col); - String rightString = right.getCriteriaForProperty(col); - if (!leftString.equals("") && !rightString.equals("")) { - return leftString + " " + operators[operation] + " " - + rightString; - } else if (!leftString.equals("")) { - return leftString; - } else if (!rightString.equals("")) { - return rightString; - } - return ""; - } else if (leftValue != null && leftValue.toString().toLowerCase() - .equals(col.toString().toLowerCase()) && right != null) { - return "? " + operators[operation] + " (" + right - .getCriteriaForProperty(col) + ")"; - } else if (rightValue != null && rightValue.toString().toLowerCase() - .equals(col.toString().toLowerCase()) && left != null) { - return "(" + left.getCriteriaForProperty(col) + ") " - + operators[operation] + " ?"; - } - return ""; - } - - public static void main(String args[]) { - XSQLCriteria p = - new XSQLCriteria("ip like '%101%' or (354>=0 or 456>=3)", -1); - System.out.println(p.checkValue("192.268.4.4")); - p = new XSQLCriteria("? like '%267%'", -1); - System.out.println(p.checkValue("192.268.4.4")); - - } -} diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLODLUtils.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLODLUtils.java deleted file mode 100644 index 834e273168..0000000000 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLODLUtils.java +++ /dev/null @@ -1,291 +0,0 @@ -/* - * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.md.sal.dom.xsql; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import org.opendaylight.yangtools.yang.common.QName; -import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument; -import org.opendaylight.yangtools.yang.model.api.AugmentationSchema; -import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode; -import org.opendaylight.yangtools.yang.model.api.DataNodeContainer; -import org.opendaylight.yangtools.yang.model.api.DataSchemaNode; -import org.opendaylight.yangtools.yang.model.api.ListSchemaNode; -import org.opendaylight.yangtools.yang.model.api.Module; -import org.opendaylight.yangtools.yang.model.api.SchemaPath; -import org.opendaylight.yangtools.yang.model.api.Status; -import org.opendaylight.yangtools.yang.model.api.TypeDefinition; -import org.opendaylight.yangtools.yang.model.util.type.DerivedTypes; - -/** - * @author Sharon Aicler(saichler@gmail.com) - **/ -/** - * To be removed in Nitrogen - */ -@Deprecated -public class XSQLODLUtils { - - private static Map, Class> types = - new ConcurrentHashMap<>(); - - static { - types.put(QName.class, QName.class); - types.put(SchemaPath.class, SchemaPath.class); - types.put(Status.class, Status.class); - } - - public static boolean isColumnType(final Class cls) { - return types.containsKey(cls); - } - - public static String getTableName(final Object odlNode) { - if (odlNode instanceof Module) { - return ((Module) odlNode).getNamespace().toString(); - } else if (odlNode instanceof DataSchemaNode) { - SchemaPath p = ((DataSchemaNode) odlNode).getPath(); - return extractTableName(p); - } else { - int i = 0; - } - return null; - } - - public static String extractTableName(final SchemaPath path) { - List lst = path.getPath(); - StringBuffer name = new StringBuffer(); - int i = 0; - for (QName q : lst) { - name.append(q.getLocalName()); - i++; - if (i < lst.size()) { - name.append("/"); - } - } - return name.toString(); - } - - public static String getBluePrintName(final Object odlNode){ - if (odlNode instanceof Module) { - return ((Module) odlNode).getNamespace().toString(); - } else if (odlNode instanceof DataSchemaNode) { - SchemaPath p = ((DataSchemaNode) odlNode).getPath(); - return extractTableName(p); - } - return null; - } - - public static String getODLNodeName(final Object odlNode) { - if (odlNode instanceof Module) { - return ((Module) odlNode).getNamespace().toString(); - } else if (odlNode instanceof DataSchemaNode) { - SchemaPath p = ((DataSchemaNode) odlNode).getPath(); - List lst = p.getPath(); - return lst.get(lst.size() - 1).toString(); - } - return null; - } - - public static List getPath(final Object odlNode) { - return ((DataSchemaNode) odlNode).getPath().getPath(); - } - - - public static String getODLTableName(final Object odlNode) { - if (odlNode instanceof Module) { - return ((Module) odlNode).getNamespace().toString(); - } else if (odlNode instanceof DataSchemaNode) { - return ((DataSchemaNode) odlNode).getPath().toString(); - } - return null; - } - - public static String getNodeNameFromDSN(final Object o) { - DataSchemaNode node = (DataSchemaNode) o; - String nodeName = node.getQName().toString(); - int index = nodeName.lastIndexOf(")"); - return nodeName.substring(index + 1); - } - - public static boolean isModule(final Object o) { - if (o instanceof Module) { - return true; - } - return false; - } - - public static boolean createOpenDaylightCache(final XSQLBluePrint bluePrint, final Module module) { - XSQLBluePrintNode node = new XSQLBluePrintNode(module, 0,null); - bluePrint.addToBluePrintCache(node,null); - collectODL(bluePrint, node, module.getChildNodes(), 1); - return true; - } - - private static void collectODL(final XSQLBluePrint bluePrint, - final XSQLBluePrintNode parent, final Collection nodes, int level) { - if (nodes == null) { - return; - } - for (DataSchemaNode n : nodes) { - if (n instanceof DataNodeContainer) { - XSQLBluePrintNode bn = new XSQLBluePrintNode(n, level,parent); - bn = bluePrint.addToBluePrintCache(bn,parent); - if (n instanceof ListSchemaNode) { - level++; - collectODL(bluePrint, bn,((ListSchemaNode) n).getChildNodes(), level); - Set s = ((ListSchemaNode)n).getAvailableAugmentations(); - if(s!=null){ - for(AugmentationSchema as:s){ - collectODL(bluePrint, bn,as.getChildNodes(), level); - } - } - level--; - }else{ - level++; - collectODL(bluePrint, bn,((DataNodeContainer) n).getChildNodes(), level); - if(n instanceof ContainerSchemaNode){ - Set s = ((ContainerSchemaNode)n).getAvailableAugmentations(); - if(s!=null){ - for(AugmentationSchema as:s){ - collectODL(bluePrint, bn,as.getChildNodes(), level); - } - } - } - level--; - } - } else { - if (parent != null) { - parent.addColumn(n, parent.getParent().getBluePrintNodeName()); - } else { - XSQLAdapter.log("NO Parent!"); - } - } - } - } - - public static Map refFieldsCache = - new HashMap<>(); - - public static Field findField(final Class c, final String name) { - if (c == null) { - return null; - } - String cacheKey = c.getName() + name; - Field f = refFieldsCache.get(cacheKey); - if (f != null) { - return f; - } - - try { - f = c.getDeclaredField(name); - f.setAccessible(true); - refFieldsCache.put(cacheKey, f); - return f; - } catch (Exception err) { - } - - Class s = c.getSuperclass(); - if (s != null) { - f = findField(s, name); - if (f != null) { - refFieldsCache.put(cacheKey, f); - } - return f; - } - return null; - } - - - private static Object get(final Object o, final String name) { - try { - Class c = o.getClass(); - Field f = findField(c, name); - return f.get(o); - } catch (Exception err) { - //XSQLAdapter.log(err); - } - return null; - } - - public static List getMChildren(final Object o) { - Map children = getChildren(o); - List result = new LinkedList<>(); - for (Object val : children.values()) { - result.add(val); - } - return result; - } - - public static Map getChildren(final Object o) { - return (Map) get(o, "children"); - } - - public static Collection getChildrenCollection(final Object o) { - Object value = get(o, "children"); - if(value==null) { - return Collections.emptyList(); - } - if(value instanceof Map) { - return ((Map)value).values(); - } else - if(value instanceof Collection){ - return (Collection)value; - }else{ - XSQLAdapter.log("Unknown Child Value Type="+value.getClass().getName()); - return new ArrayList(); - } - } - - public static Object getValue(final Object o) { - return get(o, "value"); - } - - public static String getNodeIdentiofier(final Object o) { - try{ - return ((PathArgument) get(o, "nodeIdentifier")).getNodeType().toString(); - }catch(Exception err){ - return null; - } - } - - public static String getNodeName(final Object o) { - Object nodeID = get(o, "nodeIdentifier"); - if (nodeID != null) { - String nodeName = nodeID.toString(); - int index = nodeName.lastIndexOf(")"); - return nodeName.substring(index + 1); - } - return "NULL"; - } - - public static Class getTypeForODLColumn(final Object odlNode){ - final Object o = get(odlNode,"type"); - if (o instanceof TypeDefinition) { - final TypeDefinition type = (TypeDefinition)o; - - if (DerivedTypes.isUint32(type) || DerivedTypes.isUint64(type)) { - return long.class; - } else if (DerivedTypes.isUint16(type)) { - return int.class; - } else if (DerivedTypes.isUint8(type)) { - return byte.class; - } - } - - return String.class; - } - -} diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLThreadPool.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLThreadPool.java deleted file mode 100644 index fc8d6a046d..0000000000 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/XSQLThreadPool.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.md.sal.dom.xsql; - -import java.util.LinkedList; - -/** - * To be removed in Nitrogen - */ -@Deprecated -public class XSQLThreadPool { - private LinkedList tasks = new LinkedList<>(); - private int threadCount = 0; - private int maxThreadCount = 10; - private String threadPoolName = "Simple Thread Pool"; - private int waitTimeForIdle = 10000; - private int maxQueueSize = -1; - public Object waitForSlotSync = new Object(); - - public XSQLThreadPool(int _maxThreadCount, String name, - int _waitTimeForIdle) { - this.maxThreadCount = _maxThreadCount; - this.threadPoolName = name; - this.waitTimeForIdle = _waitTimeForIdle; - } - - public void addTask(Runnable r) { - synchronized (tasks) { - tasks.add(r); - tasks.notifyAll(); - if (threadCount < maxThreadCount) { - threadCount++; - new WorkerThread(threadCount).start(); - } - } - } - - private class WorkerThread extends Thread { - - private long lastTimeExecuted = System.currentTimeMillis(); - - public WorkerThread(int threadNumber) { - super( - "Thread #" + threadNumber + " Of Threadpool " + threadPoolName); - } - - public void run() { - Runnable runthis = null; - while (true) { - runthis = null; - if (maxQueueSize != -1) { - synchronized (waitForSlotSync) { - if (tasks.size() < maxQueueSize) { - waitForSlotSync.notifyAll(); - } - } - } - synchronized (tasks) { - if (tasks.isEmpty()) { - try { - tasks.wait(2000); - } catch (Exception err) { - } - } - - if (!tasks.isEmpty()) { - runthis = tasks.removeFirst(); - } - } - if (runthis != null) { - try { - runthis.run(); - } catch (Exception err) { - err.printStackTrace(); - } - lastTimeExecuted = System.currentTimeMillis(); - } - if (System.currentTimeMillis() - lastTimeExecuted - > waitTimeForIdle) { - break; - } - } - synchronized (tasks) { - threadCount--; - } - } - } - - public int getNumberOfThreads() { - return threadCount; - } - - public void waitForSlot() { - if (tasks.size() > maxQueueSize) { - synchronized (waitForSlotSync) { - try { - waitForSlotSync.wait(); - } catch (Exception err) { - err.printStackTrace(); - } - } - } - } - - public boolean isEmpty() { - if (this.threadCount == 0) { - return true; - } - return false; - } - - public void setMaxQueueSize(int size) { - this.maxQueueSize = size; - } - -} diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCCommand.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCCommand.java deleted file mode 100644 index 20b8589bba..0000000000 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCCommand.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.md.sal.dom.xsql.jdbc; - -import java.io.Serializable; -import java.util.Map; - -import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrint; - -/** - * To be removed in Nitrogen - */ -@Deprecated -public class JDBCCommand implements Serializable { - private static final long serialVersionUID = 1L; - - public int type = 0; - public static final int TYPE_EXECUTE_QUERY = 1; - public static final int TYPE_QUERY_REPLY = 2; - public static final int TYPE_QUERY_RECORD = 3; - public static final int TYPE_QUERY_FINISH = 4; - public static final int TYPE_QUERY_ERROR = 5; - public static final int TYPE_METADATA = 6; - public static final int TYPE_METADATA_REPLY = 7; - - private JDBCResultSet rs = null; - private Map record = null; - private int rsID = -1; - private Exception err = null; - private XSQLBluePrint bluePrint = null; - - public JDBCCommand() { - - } - - public void setType(int t) { - this.type = t; - } - - public JDBCCommand(Exception _err, int _RSID) { - this.type = TYPE_QUERY_ERROR; - this.err = _err; - this.rsID = _RSID; - } - - public JDBCCommand(XSQLBluePrint bl) { - this.type = TYPE_METADATA_REPLY; - this.bluePrint = bl; - } - - public JDBCCommand(JDBCResultSet _rs, int _type) { - this.type = TYPE_EXECUTE_QUERY; - this.rs = _rs; - this.type = _type; - this.rsID = rs.getID(); - } - - public JDBCCommand(Map _record, int _rsID) { - this.record = _record; - this.rsID = _rsID; - this.type = TYPE_QUERY_RECORD; - } - - public JDBCCommand(int _rsID) { - this.rsID = _rsID; - this.type = TYPE_QUERY_FINISH; - } - - public int getType() { - return this.type; - } - - public JDBCResultSet getRS() { - return this.rs; - } - - public Map getRecord() { - return this.record; - } - - public int getRSID() { - return this.rsID; - } - - public Exception getERROR() { - return this.err; - } - - public XSQLBluePrint getBluePrint() { - return this.bluePrint; - } -} diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCConnection.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCConnection.java deleted file mode 100644 index a66db1a2cf..0000000000 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCConnection.java +++ /dev/null @@ -1,650 +0,0 @@ -/* - * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.md.sal.dom.xsql.jdbc; - -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.net.ServerSocket; -import java.net.Socket; -import java.sql.Array; -import java.sql.Blob; -import java.sql.CallableStatement; -import java.sql.Clob; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.NClob; -import java.sql.PreparedStatement; -import java.sql.SQLClientInfoException; -import java.sql.SQLException; -import java.sql.SQLWarning; -import java.sql.SQLXML; -import java.sql.Savepoint; -import java.sql.Statement; -import java.sql.Struct; -import java.util.LinkedList; -import java.util.Map; -import java.util.Properties; -import java.util.concurrent.Executor; - -import org.opendaylight.controller.md.sal.dom.xsql.XSQLAdapter; -import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrint; - -/** - * To be removed in Nitrogen - */ -@Deprecated -public class JDBCConnection implements Connection, Runnable { - private Socket socket = null; - private DataInputStream in = null; - private DataOutputStream out = null; - private LinkedList queue = new LinkedList<>(); - private XSQLAdapter adapter = null; - private XSQLBluePrint metaData = null; - private String addr = null; - private boolean wasClosed = false; - - public JDBCConnection(Socket s, XSQLAdapter _a) { - this.socket = s; - this.adapter = _a; - try { - in = new DataInputStream( - new BufferedInputStream(s.getInputStream())); - out = new DataOutputStream(new BufferedOutputStream( - s.getOutputStream())); - new JDBCObjectReader(); - new Thread(this).start(); - } catch (Exception err) { - err.printStackTrace(); - } - } - - public Connection getProxy() { - return this; - /* - return (Connection) Proxy.newProxyInstance(this.getClass() - .getClassLoader(), new Class[] { Connection.class }, - new JDBCProxy(this)); - */ - } - - public JDBCConnection(String _addr) throws Exception { - this.addr = _addr; - init(); - } - - private void init() throws Exception { - if (addr.startsWith("http://")) { - addr = addr.substring(7); - } - System.err.print("Address is:" + addr); - socket = new Socket(addr, 40004); - try { - in = new DataInputStream(new BufferedInputStream( - socket.getInputStream())); - out = new DataOutputStream(new BufferedOutputStream( - socket.getOutputStream())); - new JDBCObjectReader(); - new Thread(this).start(); - } catch (Exception err) { - err.printStackTrace(); - } - } - - public JDBCConnection(boolean server) { - try { - try (ServerSocket s = new ServerSocket(50003)) { - socket = s.accept(); - try { - in = new DataInputStream(new BufferedInputStream(socket.getInputStream())); - out = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream())); - new JDBCObjectReader(); - new Thread(this).start(); - } catch (Exception err) { - err.printStackTrace(); - } - } - } catch (Exception err) { - err.printStackTrace(); - } - } - - private boolean isStopped() { - if (adapter != null && adapter.stopped) { - return true; - } - if (socket == null || socket.isClosed()) { - return true; - } - return false; - } - - public void run() { - byte data[] = null; - while (!isStopped()) { - try { - int len = in.readInt(); - data = new byte[len]; - in.readFully(data); - addObject(data); - - } catch (Exception err) { - System.out.println("Connection Lost or Closed."); - try { - out.close(); - } catch (Exception er) { - } - out = null; - try { - in.close(); - } catch (Exception er) { - } - in = null; - try { - socket.close(); - } catch (Exception err2) { - } - socket = null; - } - } - } - - private void addObject(byte[] data) { - synchronized (queue) { - queue.add(data); - queue.notifyAll(); - } - } - - private class JDBCObjectReader extends Thread { - - public JDBCObjectReader() { - super("JDBCObjectReader"); - start(); - } - - public void run() { - while (!isStopped()) { - byte data[] = null; - synchronized (queue) { - if (queue.size() == 0) { - try { - queue.wait(1000); - } catch (Exception err) { - } - } - if (queue.size() > 0) { - data = queue.removeFirst(); - } - } - if (data != null) { - JDBCCommand command = (JDBCCommand) deSerialize(data); - processCommand(command); - } - } - } - - private Object deSerialize(byte data[]) { - try { - ByteArrayInputStream in = new ByteArrayInputStream(data); - ObjectInputStream oin = new ObjectInputStream(in); - return oin.readObject(); - } catch (Exception err) { - err.printStackTrace(); - } - return null; - } - } - - public void processCommand(JDBCCommand cmd) { - switch (cmd.getType()) { - case JDBCCommand.TYPE_METADATA_REPLY: - this.metaData = cmd.getBluePrint(); - synchronized (this) { - this.notifyAll(); - } - break; - case JDBCCommand.TYPE_METADATA: - send(new JDBCCommand(this.adapter.getBluePrint())); - break; - case JDBCCommand.TYPE_EXECUTE_QUERY: - try { - JDBCServer.execute(cmd.getRS(), adapter); - send(new JDBCCommand(cmd.getRS(), JDBCCommand.TYPE_QUERY_REPLY)); - QueryUpdater u = new QueryUpdater(cmd.getRS()); - new Thread(u).start(); - } catch (Exception err) { - send(new JDBCCommand(err, cmd.getRSID())); - } - break; - case JDBCCommand.TYPE_QUERY_REPLY: - JDBCResultSet rs1 = JDBCStatement.getQuery(cmd.getRS().getID()); - rs1.updateData(cmd.getRS()); - break; - case JDBCCommand.TYPE_QUERY_RECORD: - JDBCResultSet rs2 = JDBCStatement.getQuery(cmd.getRSID()); - rs2.addRecord(cmd.getRecord()); - break; - case JDBCCommand.TYPE_QUERY_FINISH: - JDBCResultSet rs3 = JDBCStatement.removeQuery(cmd.getRSID()); - rs3.setFinished(true); - break; - case JDBCCommand.TYPE_QUERY_ERROR: - System.err.println("ERROR Executing Query\n"); - cmd.getERROR().printStackTrace(); - JDBCResultSet rs4 = JDBCStatement.removeQuery(cmd.getRSID()); - rs4.setError(cmd.getERROR()); - rs4.setFinished(true); - synchronized (rs4) { - rs4.notifyAll(); - } - } - } - - private class QueryUpdater implements Runnable { - - private JDBCResultSet rs = null; - - public QueryUpdater(JDBCResultSet _rs) { - this.rs = _rs; - } - - public void run() { - while (rs.next()) { - JDBCCommand rec = new JDBCCommand(rs.getCurrent(), rs.getID()); - send(rec); - } - JDBCCommand end = new JDBCCommand(rs.getID()); - send(end); - } - } - - public void send(Object o) { - - if (this.socket == null) { - try { - init(); - } catch (Exception err) { - err.printStackTrace(); - } - } - - try { - ByteArrayOutputStream bout = new ByteArrayOutputStream(); - ObjectOutputStream oout = new ObjectOutputStream(bout); - oout.writeObject(o); - byte data[] = bout.toByteArray(); - synchronized (socket) { - out.writeInt(data.length); - out.write(data); - out.flush(); - } - } catch (Exception err) { - err.printStackTrace(); - } - } - - @Override - public boolean isWrapperFor(Class arg0) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public T unwrap(Class arg0) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public void clearWarnings() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void close() throws SQLException { - wasClosed = true; - try { - socket.close(); - } catch (Exception err) { - } - socket = null; - } - - @Override - public void commit() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public Array createArrayOf(String typeName, Object[] elements) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Blob createBlob() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Clob createClob() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public NClob createNClob() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public SQLXML createSQLXML() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Statement createStatement() throws SQLException { - return new JDBCStatement(this).getProxy(); - } - - @Override - public Statement createStatement(int resultSetType, - int resultSetConcurrency, int resultSetHoldability) - throws SQLException { - return new JDBCStatement(this).getProxy(); - } - - @Override - public Statement createStatement(int resultSetType, int resultSetConcurrency) - throws SQLException { - return new JDBCStatement(this).getProxy(); - } - - @Override - public Struct createStruct(String typeName, Object[] attributes) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean getAutoCommit() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public String getCatalog() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Properties getClientInfo() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getClientInfo(String name) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public int getHoldability() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public DatabaseMetaData getMetaData() throws SQLException { - if (this.metaData == null) { - JDBCCommand cmd = new JDBCCommand(); - cmd.setType(JDBCCommand.TYPE_METADATA); - synchronized (this) { - send(cmd); - try { - this.wait(); - } catch (Exception err) { - err.printStackTrace(); - } - } - } - return metaData; - } - - @Override - public int getTransactionIsolation() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public Map> getTypeMap() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public SQLWarning getWarnings() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean isClosed() throws SQLException { - return false; - } - - @Override - public boolean isReadOnly() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isValid(int timeout) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public String nativeSQL(String sql) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public CallableStatement prepareCall(String sql, int resultSetType, - int resultSetConcurrency, int resultSetHoldability) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public CallableStatement prepareCall(String sql, int resultSetType, - int resultSetConcurrency) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public CallableStatement prepareCall(String sql) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public PreparedStatement prepareStatement(String sql, int resultSetType, - int resultSetConcurrency, int resultSetHoldability) - throws SQLException { - System.err.println("SQL 1=" + sql); - return new JDBCStatement(this, sql).getProxy(); - } - - @Override - public PreparedStatement prepareStatement(String sql, int resultSetType, - int resultSetConcurrency) throws SQLException { - System.err.println("SQL 2=" + sql); - return new JDBCStatement(this, sql).getProxy(); - } - - @Override - public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) - throws SQLException { - System.err.println("SQL 3=" + sql); - return new JDBCStatement(this, sql).getProxy(); - } - - @Override - public PreparedStatement prepareStatement(String sql, int[] columnIndexes) - throws SQLException { - System.err.println("SQL 4=" + sql); - return new JDBCStatement(this, sql).getProxy(); - } - - @Override - public PreparedStatement prepareStatement(String sql, String[] columnNames) - throws SQLException { - System.err.println("SQL 5=" + sql); - return new JDBCStatement(this, sql).getProxy(); - } - - @Override - public PreparedStatement prepareStatement(String sql) throws SQLException { - System.err.println("SQL 6=" + sql); - return new JDBCStatement(this, sql).getProxy(); - } - - @Override - public void releaseSavepoint(Savepoint savepoint) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void rollback() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void rollback(Savepoint savepoint) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setAutoCommit(boolean autoCommit) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setCatalog(String catalog) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setClientInfo(Properties properties) - throws SQLClientInfoException { - // TODO Auto-generated method stub - - } - - @Override - public void setClientInfo(String name, String value) - throws SQLClientInfoException { - // TODO Auto-generated method stub - - } - - @Override - public void setHoldability(int holdability) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setReadOnly(boolean readOnly) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public Savepoint setSavepoint() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Savepoint setSavepoint(String name) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public void setTransactionIsolation(int level) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setTypeMap(Map> map) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setSchema(String schema) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public String getSchema() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public void abort(Executor executor) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setNetworkTimeout(Executor executor, int milliseconds) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public int getNetworkTimeout() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - -} diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCProxy.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCProxy.java deleted file mode 100644 index da9f71a5c3..0000000000 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCProxy.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.md.sal.dom.xsql.jdbc; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * To be removed in Nitrogen - */ -@Deprecated -public class JDBCProxy implements InvocationHandler { - private static final Logger LOG = LoggerFactory.getLogger(JDBCProxy.class); - private Object myObject = null; - private Class myObjectClass = null; - - public JDBCProxy(Object obj) { - this.myObject = obj; - this.myObjectClass = this.myObject.getClass(); - } - - @Override - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - LOG.debug("Class {} Method {}", this.myObjectClass.getSimpleName(), method.getName()); - return method.invoke(this.myObject, args); - } -} diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCResultSet.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCResultSet.java deleted file mode 100644 index d82c5ba674..0000000000 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCResultSet.java +++ /dev/null @@ -1,1906 +0,0 @@ -/* - * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.md.sal.dom.xsql.jdbc; - -import java.io.InputStream; -import java.io.Reader; -import java.io.Serializable; -import java.lang.reflect.Method; -import java.math.BigDecimal; -import java.net.URL; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -import java.sql.NClob; -import java.sql.Ref; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.RowId; -import java.sql.SQLException; -import java.sql.SQLWarning; -import java.sql.SQLXML; -import java.sql.Statement; -import java.sql.Time; -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; - -import org.opendaylight.controller.md.sal.dom.xsql.XSQLAdapter; -import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrint; -import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrintNode; -import org.opendaylight.controller.md.sal.dom.xsql.XSQLColumn; -import org.opendaylight.controller.md.sal.dom.xsql.XSQLCriteria; -import org.opendaylight.controller.md.sal.dom.xsql.XSQLODLUtils; -import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode; - -/** - * @author Sharon Aicler(saichler@gmail.com) - **/ -/** - * To be removed in Nitrogen - */ -@Deprecated -public class JDBCResultSet implements Serializable, ResultSet, ResultSetMetaData { - private static final long serialVersionUID = -7450200738431047057L; - private static final ClassLoader CLASS_LOADER = JDBCResultSet.class.getClassLoader(); - private static final Class[] PROXY_INTERFACES = new Class[] { ResultSet.class }; - private static int nextID = 0; - - private String sql = null; - private List tablesInQuery = new ArrayList<>(); - private Map tablesInQueryMap = new ConcurrentHashMap<>(); - private List fieldsInQuery = new ArrayList<>(); - private transient LinkedList> records = new LinkedList<>(); - private transient Map currentRecord = null; - private boolean finished = false; - private int id = 0; - public int numberOfTasks = 0; - private Map>> criteria = new ConcurrentHashMap<>(); - private Exception err = null; - private List EMPTY_RESULT = new LinkedList<>(); - private transient Map subQueries = new HashMap<>(); - - public ResultSet getProxy() { - return this; - //return (ResultSet) Proxy.newProxyInstance(CLASS_LOADER, PROXY_INTERFACES, new JDBCProxy(this)); - } - - public void setSQL(String _sql) { - this.sql = _sql; - } - - public JDBCResultSet addSubQuery(String _sql, String logicalName) { - if (subQueries == null) { - subQueries = new HashMap<>(); - } - JDBCResultSet rs = new JDBCResultSet(_sql); - this.subQueries.put(logicalName, rs); - return rs; - } - - public Map getSubQueries() { - if (this.subQueries == null) { - this.subQueries = new HashMap<>(); - } - return this.subQueries; - } - - public JDBCResultSet(String _sql) { - synchronized (JDBCResultSet.class) { - nextID++; - id = nextID; - } - this.sql = _sql; - } - - public String getSQL() { - return this.sql; - } - - public void setError(Exception _err) { - this.err = _err; - } - - public Exception getError() { - return this.err; - } - - public void updateData(JDBCResultSet rs) { - synchronized (this) { - this.tablesInQuery = rs.tablesInQuery; - this.tablesInQueryMap = rs.tablesInQueryMap; - this.fieldsInQuery = rs.fieldsInQuery; - this.notifyAll(); - } - } - - public int isObjectFitCriteria(Map objValues, - String tableName) { - Map> tblCriteria = criteria - .get(tableName); - if (tblCriteria == null) { - return 1; - } - for (Map.Entry> cc : tblCriteria - .entrySet()) { - for (XSQLCriteria c : cc.getValue()) { - Object value = objValues.get(cc.getKey().toString()); - int result = c.checkValue(value); - if (result == 0) { - return 0; - } - } - } - return 1; - } - - public int isObjectFitCriteria(Object element, Class cls) { - Map> tblCriteria = criteria.get(cls - .getName()); - if (tblCriteria == null) { - return 1; - } - for (Map.Entry> cc : tblCriteria - .entrySet()) { - for (XSQLCriteria c : cc.getValue()) { - int result = c.isObjectFitCriteria(element, cc.getKey() - .getName()); - if (result == 0) { - return 0; - } - } - } - return 1; - } - - public Map>> getCriteria() { - return this.criteria; - } - - public int getID() { - return this.id; - } - - public List getTables() { - return tablesInQuery; - } - - public void addTableToQuery(XSQLBluePrintNode node) { - if (this.tablesInQueryMap.containsKey(node.getBluePrintNodeName())) { - return; - } - this.tablesInQuery.add(node); - this.tablesInQueryMap.put(node.getBluePrintNodeName(), node); - } - - public List getFields() { - return this.fieldsInQuery; - } - - public XSQLBluePrintNode getMainTable() { - if (tablesInQuery.size() == 1) { - return tablesInQuery.get(0); - } - XSQLBluePrintNode result = null; - for (XSQLBluePrintNode node : tablesInQuery) { - if (result == null) { - result = node; - } else if (result.getLevel() < node.getLevel()) { - result = node; - } - } - return result; - } - - public boolean isFinished() { - return finished; - } - - public void setFinished(boolean b) { - this.finished = b; - } - - public int size() { - return this.records.size(); - } - - public void addRecord(Map r) { - synchronized (this) { - if (records == null) { - records = new LinkedList<>(); - } - records.add(r); - this.notifyAll(); - } - } - - public void addRecord(ArrayList hierarchy) { - Map rec = new HashMap<>(); - for (int i = hierarchy.size() - 1; i >= 0; i--) { - Object element = hierarchy.get(i); - for (XSQLColumn c : fieldsInQuery) { - if (c.getTableName().equals(element.getClass().getSimpleName())) { - try { - Method m = element.getClass().getMethod(c.getName(), - null); - Object value = m.invoke(element, null); - rec.put(c.getName(), value); - } catch (Exception err) { - err.printStackTrace(); - } - } - } - } - this.records.add(rec); - } - - public boolean next() { - this.currentRecord = null; - if (records == null) { - records = new LinkedList<>(); - } - while (!finished || records.size() > 0) { - synchronized (this) { - if (records.size() == 0) { - try { - this.wait(1000); - } catch (Exception err) { - } - if (records.size() > 0) { - try { - currentRecord = records.removeFirst(); - return true; - } finally { - this.notifyAll(); - } - } - } else { - try { - currentRecord = records.removeFirst(); - return true; - } finally { - this.notifyAll(); - } - } - } - } - return false; - } - - public Map getCurrent() { - return this.currentRecord; - } - - private void createRecord(Object data, XSQLBluePrintNode node) { - Map rec = new HashMap<>(); - for (XSQLColumn c : this.fieldsInQuery) { - if (c.getTableName().equals(node.getBluePrintNodeName())) { - try { - Method m = node.getInterface().getMethod(c.getName(), null); - Object value = m.invoke(data, null); - if (value != null) { - rec.put(c.getName(), value); - } else { - rec.put(c.getName(), ""); - } - } catch (Exception err) { - err.printStackTrace(); - } - - } - } - } - - public static class Record { - // The map container the Attribute 2 the attribute value - public Map data = new HashMap<>(); - // The Element Object (Possibly some kind of NormalizedNode - public Object element = null; - // Does this record fit the criteria - // In case of a list property, we first collect the list and only then - // we - // we decide which list item should be included or not. - public boolean fitCriteria = true; - - public Map getRecord() { - return this.data; - } - } - - public static class RecordsContainer { - public List records = new LinkedList<>(); - public List fitRecords = new LinkedList<>(); - public Object currentObject = null; - } - - private void collectColumnValues(RecordsContainer rContainer, - XSQLBluePrintNode bpn) { - Collection subChildren = XSQLODLUtils - .getChildrenCollection(rContainer.currentObject); - Record r = new Record(); - r.element = rContainer.currentObject; - for (Object stc : subChildren) { - if (stc.getClass().getName() - .endsWith("ImmutableUnkeyedListEntryNode")) { - r.fitCriteria = false; - rContainer.currentObject = stc; - collectColumnValues(rContainer, bpn); - } else if (stc.getClass().getName() - .endsWith("ImmutableAugmentationNode")) { - Map values = XSQLODLUtils.getChildren(stc); - for (Object key : values.keySet()) { - Object val = values.get(key); - if (val.getClass().getName().endsWith("ImmutableLeafNode")) { - Object value = XSQLODLUtils.getValue(val); - String k = XSQLODLUtils.getNodeName(val); - if (value != null) { - r.data.put(bpn.getBluePrintNodeName() + "." + k, - value.toString()); - } - } - } - } else if (stc.getClass().getName().endsWith("ImmutableLeafNode")) { - String k = XSQLODLUtils.getNodeName(stc); - Object value = XSQLODLUtils.getValue(stc); - if (value != null) { - r.data.put(bpn.getBluePrintNodeName() + "." + k, - value.toString()); - } - } - } - if (r.fitCriteria) { - rContainer.records.add(r); - } - } - - private void addToData(Record rec, XSQLBluePrintNode bpn,XSQLBluePrint bluePrint, Map fullRecord) { - XSQLBluePrintNode eNodes[] = bluePrint - .getBluePrintNodeByODLTableName(XSQLODLUtils - .getNodeIdentiofier(rec.element)); - if (bpn != null) { - for (XSQLColumn c : fieldsInQuery) { - for (XSQLBluePrintNode eNode : eNodes) { - if (((XSQLBluePrintNode) c.getBluePrintNode()) - .getBluePrintNodeName().equals( - eNode.getBluePrintNodeName())) { - // Object value = Criteria.getValue(rec.element, - // c.getName()); - String columnName = c.toString(); - Object value = fullRecord.get(columnName); - if (value != null) { - try { - Object rsValue = c.getResultSetValue(value); - c.setCharWidth(rsValue.toString().length()); - rec.data.put(columnName, rsValue); - } catch (Exception err) { - } - } - } - } - } - } - } - - private boolean beenHere(Set beenHereElement, Object element) { - if (beenHereElement == null) { - beenHereElement = new HashSet<>(); - } - - String elementKey = null; - - try { - elementKey = element.toString(); - } catch (Exception err) { - elementKey = "Unknown"; - } - - if (beenHereElement.contains(elementKey)) { - return true; - } - - beenHereElement.add(elementKey); - return false; - } - - public List getChildren(Object node, String tableName, - XSQLBluePrint bluePrint) { - - List children = XSQLODLUtils.getMChildren(node); - List result = new LinkedList<>(); - - for (Object child : children) { - - String odlNodeName = XSQLODLUtils.getNodeIdentiofier(child); - if (odlNodeName == null) { - if (child instanceof DataContainerNode) { - List augChidlren = getChildren(child, tableName, - bluePrint); - result.addAll(augChidlren); - } - continue; - } - - XSQLBluePrintNode eNodes[] = bluePrint - .getBluePrintNodeByODLTableName(odlNodeName); - if (eNodes == null) { - continue; - } - - boolean match = false; - for (XSQLBluePrintNode enode : eNodes) { - if (tableName.startsWith(enode.toString())) { - match = true; - break; - } - } - - if (!match) { - continue; - } - - if (child.getClass().getName().endsWith("ImmutableUnkeyedListNode")) { - result.add(child); - } else if (child.getClass().getName() - .endsWith("ImmutableContainerNode")) { - result.add(child); - } else if (child.getClass().getName() - .endsWith("ImmutableAugmentationNode")) { - List _children = XSQLODLUtils.getMChildren(child); - for (Object c : _children) { - if (c.getClass().getName() - .endsWith("ImmutableContainerNode")) { - result.add(c); - } - } - } else if (child.getClass().getName().endsWith("ImmutableMapNode")) { - result.addAll(XSQLODLUtils.getMChildren(child)); - } else { - XSQLAdapter.log("Missed Node Data OF Type=" - + child.getClass().getName()); - } - } - return result; - } - - public List addRecords(Object element, XSQLBluePrintNode node, - boolean root, String tableName, XSQLBluePrint bluePrint) { - List result = new LinkedList<>(); - String nodeID = XSQLODLUtils.getNodeIdentiofier(element); - if (node.getODLTableName().equals(nodeID)) { - XSQLBluePrintNode bluePrintNode = bluePrint - .getBluePrintNodeByODLTableName(nodeID)[0]; - RecordsContainer rContainer = new RecordsContainer(); - rContainer.currentObject = element; - XSQLBluePrintNode bpn = this.tablesInQueryMap.get(bluePrintNode - .getBluePrintNodeName()); - if (this.criteria.containsKey(bluePrintNode.getBluePrintNodeName()) - || bpn != null) { - collectColumnValues(rContainer, bpn); - for (Record r : rContainer.records) { - if (!(isObjectFitCriteria(r.data, - bpn.getBluePrintNodeName()) == 1)) { - r.fitCriteria = false; - } - if (r.fitCriteria) { - Record rec = new Record(); - rec.element = r.element; - addToData(rec, bpn, bluePrint, r.data); - rContainer.fitRecords.add(rec); - } - } - if (rContainer.fitRecords.isEmpty()) - return EMPTY_RESULT; - } - if (rContainer.records.isEmpty()) { - Record rec = new Record(); - rec.element = rContainer.currentObject; - if (root) { - addRecord(rec.data); - } else { - result.add(rec); - } - } else { - for (Record rec : rContainer.fitRecords) { - if (root) { - addRecord(rec.data); - } else { - result.add(rec); - } - } - } - return result; - } - - XSQLBluePrintNode parent = node.getParent(); - List subRecords = addRecords(element, parent, false, tableName, - bluePrint); - for (Record subRec : subRecords) { - List subO = getChildren(subRec.element, tableName, - bluePrint); - if (subO != null) { - for (Object subData : subO) { - RecordsContainer rContainer = new RecordsContainer(); - rContainer.currentObject = subData; - - String recID = XSQLODLUtils - .getNodeIdentiofier(rContainer.currentObject); - XSQLBluePrintNode eNodes[] = bluePrint - .getBluePrintNodeByODLTableName(recID); - XSQLBluePrintNode bpn = null; - for (XSQLBluePrintNode eNode : eNodes) { - bpn = this.tablesInQueryMap.get(eNode - .getBluePrintNodeName()); - if (bpn != null) { - break; - } - } - if (bpn != null) { - collectColumnValues(rContainer, bpn); - for (Record r : rContainer.records) { - if ((isObjectFitCriteria(r.data, - bpn.getBluePrintNodeName()) == 1)) { - Record rec = new Record(); - rec.data.putAll(subRec.data); - rec.element = r.element; - addToData(rec, bpn, bluePrint, r.data); - } else { - r.fitCriteria = false; - } - } - } - if (rContainer.records.isEmpty()) { - Record rec = new Record(); - rec.data.putAll(subRec.data); - rec.element = rContainer.currentObject; - if (root) { - if (!rec.data.isEmpty()) { - addRecord(rec.data); - } - } else { - result.add(rec); - } - } else { - for (Record r : rContainer.records) { - r.data.putAll(subRec.data); - if (r.fitCriteria) { - if (root) { - if (!r.data.isEmpty()) { - addRecord(r.data); - } - } else { - result.add(r); - } - } - } - } - } - } - } - return result; - } - - @Override - public boolean isWrapperFor(Class iface) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public T unwrap(Class iface) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean absolute(int row) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public void afterLast() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void beforeFirst() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void cancelRowUpdates() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void clearWarnings() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void close() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void deleteRow() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public int findColumn(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public boolean first() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public Array getArray(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Array getArray(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public InputStream getAsciiStream(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public InputStream getAsciiStream(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public BigDecimal getBigDecimal(int columnIndex, int scale) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public BigDecimal getBigDecimal(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public BigDecimal getBigDecimal(String columnLabel, int scale) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public BigDecimal getBigDecimal(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public InputStream getBinaryStream(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public InputStream getBinaryStream(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Blob getBlob(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Blob getBlob(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean getBoolean(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean getBoolean(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public byte getByte(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public byte getByte(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public byte[] getBytes(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public byte[] getBytes(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Reader getCharacterStream(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Reader getCharacterStream(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Clob getClob(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Clob getClob(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public int getConcurrency() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public String getCursorName() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Date getDate(int columnIndex, Calendar cal) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Date getDate(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Date getDate(String columnLabel, Calendar cal) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Date getDate(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public double getDouble(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public double getDouble(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getFetchDirection() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getFetchSize() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public float getFloat(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public float getFloat(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getHoldability() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getInt(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getInt(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public long getLong(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public long getLong(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public ResultSetMetaData getMetaData() throws SQLException { - return this; - } - - @Override - public Reader getNCharacterStream(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Reader getNCharacterStream(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public NClob getNClob(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public NClob getNClob(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getNString(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getNString(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Object getObject(int columnIndex, Map> map) - throws SQLException { - return getObject(columnIndex); - } - - @Override - public Object getObject(int columnIndex) throws SQLException { - return currentRecord.get(this.fieldsInQuery.get(columnIndex - 1) - .toString()); - } - - @Override - public Object getObject(String columnLabel, Map> map) - throws SQLException { - return getObject(columnLabel); - } - - @Override - public Object getObject(String columnLabel) throws SQLException { - return currentRecord.get(columnLabel); - } - - @Override - public Ref getRef(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Ref getRef(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public int getRow() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public RowId getRowId(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public RowId getRowId(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public SQLXML getSQLXML(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public SQLXML getSQLXML(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public short getShort(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public short getShort(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public Statement getStatement() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getString(int columnIndex) throws SQLException { - return "Kuku"; - } - - @Override - public String getString(String columnLabel) throws SQLException { - return "Kuku"; - } - - @Override - public Time getTime(int columnIndex, Calendar cal) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Time getTime(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Time getTime(String columnLabel, Calendar cal) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Time getTime(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Timestamp getTimestamp(int columnIndex, Calendar cal) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Timestamp getTimestamp(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Timestamp getTimestamp(String columnLabel, Calendar cal) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Timestamp getTimestamp(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public int getType() throws SQLException { - return ResultSet.TYPE_FORWARD_ONLY; - } - - @Override - public URL getURL(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public URL getURL(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public InputStream getUnicodeStream(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public InputStream getUnicodeStream(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public SQLWarning getWarnings() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public void insertRow() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public boolean isAfterLast() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isBeforeFirst() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isClosed() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isFirst() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isLast() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean last() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public void moveToCurrentRow() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void moveToInsertRow() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public boolean previous() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public void refreshRow() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public boolean relative(int rows) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean rowDeleted() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean rowInserted() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean rowUpdated() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public void setFetchDirection(int direction) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setFetchSize(int rows) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateArray(int columnIndex, Array x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateArray(String columnLabel, Array x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateAsciiStream(int columnIndex, InputStream x, int length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateAsciiStream(int columnIndex, InputStream x, long length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateAsciiStream(int columnIndex, InputStream x) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateAsciiStream(String columnLabel, InputStream x, int length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateAsciiStream(String columnLabel, InputStream x, long length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateAsciiStream(String columnLabel, InputStream x) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBigDecimal(int columnIndex, BigDecimal x) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBigDecimal(String columnLabel, BigDecimal x) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBinaryStream(int columnIndex, InputStream x, int length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBinaryStream(int columnIndex, InputStream x, long length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBinaryStream(int columnIndex, InputStream x) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBinaryStream(String columnLabel, InputStream x, int length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBinaryStream(String columnLabel, InputStream x, - long length) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBinaryStream(String columnLabel, InputStream x) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBlob(int columnIndex, Blob x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBlob(int columnIndex, InputStream inputStream, long length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBlob(int columnIndex, InputStream inputStream) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBlob(String columnLabel, Blob x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBlob(String columnLabel, InputStream inputStream, - long length) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBlob(String columnLabel, InputStream inputStream) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBoolean(int columnIndex, boolean x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBoolean(String columnLabel, boolean x) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateByte(int columnIndex, byte x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateByte(String columnLabel, byte x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBytes(int columnIndex, byte[] x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateBytes(String columnLabel, byte[] x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateCharacterStream(int columnIndex, Reader x, int length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateCharacterStream(int columnIndex, Reader x, long length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateCharacterStream(int columnIndex, Reader x) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateCharacterStream(String columnLabel, Reader reader, - int length) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateCharacterStream(String columnLabel, Reader reader, - long length) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateCharacterStream(String columnLabel, Reader reader) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateClob(int columnIndex, Clob x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateClob(int columnIndex, Reader reader, long length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateClob(int columnIndex, Reader reader) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateClob(String columnLabel, Clob x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateClob(String columnLabel, Reader reader, long length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateClob(String columnLabel, Reader reader) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateDate(int columnIndex, Date x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateDate(String columnLabel, Date x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateDouble(int columnIndex, double x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateDouble(String columnLabel, double x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateFloat(int columnIndex, float x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateFloat(String columnLabel, float x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateInt(int columnIndex, int x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateInt(String columnLabel, int x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateLong(int columnIndex, long x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateLong(String columnLabel, long x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateNCharacterStream(int columnIndex, Reader x, long length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateNCharacterStream(int columnIndex, Reader x) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateNCharacterStream(String columnLabel, Reader reader, - long length) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateNCharacterStream(String columnLabel, Reader reader) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateNClob(int columnIndex, NClob nClob) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateNClob(int columnIndex, Reader reader, long length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateNClob(int columnIndex, Reader reader) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateNClob(String columnLabel, NClob nClob) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateNClob(String columnLabel, Reader reader, long length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateNClob(String columnLabel, Reader reader) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateNString(int columnIndex, String nString) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateNString(String columnLabel, String nString) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateNull(int columnIndex) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateNull(String columnLabel) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateObject(int columnIndex, Object x, int scaleOrLength) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateObject(int columnIndex, Object x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateObject(String columnLabel, Object x, int scaleOrLength) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateObject(String columnLabel, Object x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateRef(int columnIndex, Ref x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateRef(String columnLabel, Ref x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateRow() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateRowId(int columnIndex, RowId x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateRowId(String columnLabel, RowId x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateSQLXML(int columnIndex, SQLXML xmlObject) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateSQLXML(String columnLabel, SQLXML xmlObject) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateShort(int columnIndex, short x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateShort(String columnLabel, short x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateString(int columnIndex, String x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateString(String columnLabel, String x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateTime(int columnIndex, Time x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateTime(String columnLabel, Time x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateTimestamp(int columnIndex, Timestamp x) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void updateTimestamp(String columnLabel, Timestamp x) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public boolean wasNull() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public String getCatalogName(int column) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getColumnClassName(int column) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public int getColumnCount() throws SQLException { - return fieldsInQuery.size(); - } - - @Override - public int getColumnDisplaySize(int column) throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public String getColumnLabel(int column) throws SQLException { - return this.fieldsInQuery.get(column - 1).toString(); - } - - @Override - public String getColumnName(int column) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public int getColumnType(int column) throws SQLException { - return 12; - } - - @Override - public String getColumnTypeName(int column) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public int getPrecision(int column) throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getScale(int column) throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public String getSchemaName(int column) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getTableName(int column) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean isAutoIncrement(int column) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isCaseSensitive(int column) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isCurrency(int column) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isDefinitelyWritable(int column) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public int isNullable(int column) throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public boolean isReadOnly(int column) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isSearchable(int column) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isSigned(int column) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isWritable(int column) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public T getObject(int columnIndex, Class type) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public T getObject(String columnLabel, Class type) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - // //Metadata - -} diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCServer.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCServer.java deleted file mode 100644 index 2b50a4d87e..0000000000 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCServer.java +++ /dev/null @@ -1,370 +0,0 @@ -/* - * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.md.sal.dom.xsql.jdbc; - -import java.net.ServerSocket; -import java.net.Socket; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.StringTokenizer; -import java.util.concurrent.ConcurrentHashMap; -import org.opendaylight.controller.md.sal.dom.xsql.XSQLAdapter; -import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrint; -import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrintNode; -import org.opendaylight.controller.md.sal.dom.xsql.XSQLColumn; -import org.opendaylight.controller.md.sal.dom.xsql.XSQLCriteria; - -/** - * To be removed in Nitrogen - */ -@Deprecated -public class JDBCServer extends Thread { - private ServerSocket socket = null; - private XSQLAdapter adapter = null; - - public JDBCServer(XSQLAdapter a) { - super("JDBC Server"); - this.adapter = a; - start(); - } - - public void run() { - try { - socket = new ServerSocket(40004); - while (!adapter.stopped) { - Socket s = socket.accept(); - new JDBCConnection(s, adapter); - } - } catch (Exception err) { - err.printStackTrace(); - } - } - - public void connectToClient(String addr) { - try { - Socket s = new Socket(addr, 50003); - new JDBCConnection(s, adapter); - } catch (Exception err) { - err.printStackTrace(); - } - } - - public static void execute(JDBCResultSet rs, XSQLAdapter adapter)throws SQLException { - if(rs.getSQL().toLowerCase().trim().equals("select 1")){ - rs.setFinished(true); - return; - } - checkAndBreakSubQueries(rs, adapter); - if (rs.getSubQueries().size() == 0) { - parseTables(rs, adapter.getBluePrint()); - parseFields(rs, adapter.getBluePrint()); - parseCriteria(rs, adapter.getBluePrint()); - try { - adapter.execute(rs); - } catch (Exception err) { - throw new SQLException("Error", err); - } - } else { - parseExternalQuery(rs); - } - } - - public static void parseExternalQuery(JDBCResultSet rs) throws SQLException { - String sql = rs.getSQL(); - for (Map.Entry entry : rs.getSubQueries() - .entrySet()) { - int index = sql.toLowerCase().indexOf(entry.getValue().getSQL()); - String extSql = sql.substring(0, index); - index = extSql.lastIndexOf("("); - extSql = extSql.substring(0, index); - System.out.println("External SQL=" + extSql); - parseLogicalFields(extSql, rs); - } - } - - public static void parseLogicalFields(String sql, JDBCResultSet rs) - throws SQLException { - if(sql.trim().toLowerCase().equals("select * from")){ - for (Map.Entry entry : rs.getSubQueries().entrySet()) { - for(XSQLBluePrintNode node:entry.getValue().getTables()){ - rs.addTableToQuery(node); - } - rs.getFields().addAll(entry.getValue().getFields()); - while (entry.getValue().next()) { - Map rec = entry.getValue().getCurrent(); - Map newRec = new HashMap<>(); - newRec.putAll(rec); - rs.addRecord(newRec); - } - } - rs.setFinished(true); - return; - } - - Map logicalNameToNode = new HashMap<>(); - Map origNameToName = new HashMap<>(); - List columnOrder = new ArrayList<>(); - int nextLogField = addNextLogicalField(sql, 0, - logicalNameToNode, origNameToName,columnOrder); - int next = sql.toLowerCase().indexOf(" as ", nextLogField); - while (next != -1) { - nextLogField = addNextLogicalField(sql, nextLogField + 1, - logicalNameToNode, origNameToName,columnOrder); - next = sql.toLowerCase().indexOf(" as ", nextLogField + 1); - } - - for (XSQLBluePrintNode node : logicalNameToNode.values()) { - rs.addTableToQuery(node); - } - rs.getFields().addAll(columnOrder); - for (Map.Entry entry : rs.getSubQueries().entrySet()) { - while (entry.getValue().next()) { - Map rec = entry.getValue().getCurrent(); - Map newRec = new HashMap<>(); - for (Map.Entry e : rec.entrySet()) { - Object value = e.getValue(); - String logicalKey = origNameToName.get(e.getKey()); - if (value != null && logicalKey != null) { - newRec.put(logicalKey, value); - } - } - rs.addRecord(newRec); - } - } - rs.setFinished(true); - } - - public static void main(String args[]) { - String sql = "SELECT DISTINCT" - + "\"LOGICAL_TABLE_1\".\"nodes/node.id\" AS \"COL0\"\n" - + ",\"LOGICAL_TABLE_1\".\"nodes/node.id\" AS \"COL1\"\n" - + ",\"LOGICAL_TABLE_1\".\"nodes/node.id\" AS \"COL2\"\n" - + "FROM\n" - + "(select * from nodes/node;) \"LOGICAL_TABLE_1\"\n"; - JDBCResultSet rs = new JDBCResultSet(sql); - try { - parseLogicalFields(sql, rs); - } catch (Exception err) { - err.printStackTrace(); - } - } - - public static int addNextLogicalField(String sql, int startIndex, - Map logicalNameToNode, - Map origNameToName, List columnOrder) { - int index1 = sql.indexOf("\"", startIndex); - int index2 = sql.indexOf("\".\"", index1); - int index3 = sql.indexOf("\"", index2 + 3); - int index4 = sql.toLowerCase().indexOf(" as ", startIndex); - int index5 = sql.indexOf("\"", index4); - int index6 = sql.indexOf("\"", index5 + 1); - - String tblName = sql.substring(index1 + 1, index2); - String origFieldNameFull = sql.substring(index2 + 3, index3); - String origTableName = ""; - String origFieldName = ""; - if (origFieldNameFull.indexOf(".") != -1) { - origTableName = origFieldNameFull.substring(0,origFieldNameFull.indexOf(".")); - origFieldName = origFieldNameFull.substring(origFieldNameFull.indexOf(".") + 1); - } - String logicalFieldName = sql.substring(index5 + 1, index6); - XSQLBluePrintNode node = logicalNameToNode.get(tblName); - if (node == null) { - node = new XSQLBluePrintNode(tblName, origTableName, 0); - logicalNameToNode.put(tblName, node); - } - columnOrder.add(node.addColumn(logicalFieldName, tblName, origFieldName, origTableName)); - origNameToName.put(origFieldNameFull, tblName + "." + logicalFieldName); - return index6; - } - - public static void checkAndBreakSubQueries(JDBCResultSet rs,XSQLAdapter adapter) throws SQLException { - String sql = rs.getSQL().toLowerCase(); - int index = sql.indexOf("select"); - if (index == -1) - throw new SQLException("Select statement is missing..."); - int index2 = sql.indexOf("select", index + 6); - if (index2 != -1) { - int startSubQuery = index2; - for (int i = startSubQuery; i >= 0; i--) { - if (sql.charAt(i) == '(') { - startSubQuery = i; - break; - } - } - int braketCount = 0; - int endSubQuery = startSubQuery; - do { - if (sql.charAt(endSubQuery) == '(') { - braketCount++; - } - else if (sql.charAt(endSubQuery) == ')') { - braketCount--; - } - endSubQuery++; - } while (braketCount > 0 || endSubQuery == sql.length()); - String subQuerySQL = sql.substring(startSubQuery + 1,endSubQuery - 1); - if(rs.getSQL().toLowerCase().substring(0,startSubQuery).trim().equals("select * from")){ - rs.setSQL(subQuerySQL); - return; - } - index = sql.indexOf("\"", endSubQuery); - index2 = sql.indexOf("\"", index + 1); - if(index==-1){ - index = endSubQuery; - index2 = sql.length(); - } - String logicalName = rs.getSQL().substring(index + 1, index2).trim(); - JDBCResultSet subRS = rs.addSubQuery(subQuerySQL, logicalName); - JDBCServer.execute(subRS, adapter); - } - } - - public static void parseTables(JDBCResultSet rs, XSQLBluePrint bp) - throws SQLException { - String lowSQL = rs.getSQL().toLowerCase(); - int from = lowSQL.indexOf("from"); - int where = lowSQL.indexOf("where"); - int subQuery = lowSQL.indexOf("select", 2); - int fromTo = lowSQL.indexOf(";"); - - if (where != -1 && subQuery != -1 && where < subQuery) { - fromTo = where; - } else if (where != -1 && subQuery != -1 && where > subQuery) { - fromTo = subQuery; - } else if (where != -1) { - fromTo = where; - } else if (subQuery != -1) { - fromTo = subQuery; - } - - if (from == -1) { - throw new SQLException("Missing \"from\" statement."); - } - - if (fromTo == -1) { - throw new SQLException("Missing terminating \";\"."); - } - - String tableNames = rs.getSQL().substring(from + 4, fromTo).trim(); - StringTokenizer tokens = new StringTokenizer(tableNames, ","); - while (tokens.hasMoreTokens()) { - String tableName = tokens.nextToken().trim(); - XSQLBluePrintNode table = bp.getBluePrintNodeByTableName(tableName); - if (table == null) { - throw new SQLException("Unknown table name \"" + tableName - + "\""); - } - rs.addTableToQuery(table); - } - } - - public static void addCriteria(XSQLColumn col, XSQLCriteria c, - JDBCResultSet rs) { - Map> tblCriteria = rs.getCriteria().get( - col.getTableName()); - if (tblCriteria == null) { - tblCriteria = new ConcurrentHashMap<>(); - rs.getCriteria().put(col.getTableName(), tblCriteria); - } - List lstCriteria = tblCriteria.get(col); - if (lstCriteria == null) { - lstCriteria = new ArrayList<>(); - tblCriteria.put(col, lstCriteria); - } - lstCriteria.add(c); - } - - public static void parseFields(JDBCResultSet rs, XSQLBluePrint bp) - throws SQLException { - String lowSQL = rs.getSQL().toLowerCase(); - if (!lowSQL.startsWith("select")) { - throw new SQLException("Missing 'select' statement."); - } - int from = lowSQL.indexOf("from"); - if (from == -1) { - throw new SQLException("Missing 'from' statement."); - } - String fields = rs.getSQL().substring(6, from).trim(); - StringTokenizer tokens = new StringTokenizer(fields, ","); - while (tokens.hasMoreTokens()) { - String token = tokens.nextToken().trim(); - if (token.equals("*")) { - for (XSQLBluePrintNode table : rs.getTables()) { - rs.getFields().addAll(table.getColumns()); - } - return; - } - if (token.indexOf(".") != -1) { - XSQLBluePrintNode tbl = bp.getBluePrintNodeByTableName(token - .substring(0, token.indexOf(".")).trim()); - String p = token.substring(token.indexOf(".") + 1); - if (p.equals("*")) { - for (XSQLColumn c : tbl.getColumns()) { - rs.getFields().add(c); - } - } else { - XSQLColumn col = tbl.findColumnByName(p); - rs.getFields().add(col); - } - } else { - XSQLColumn col = null; - for (XSQLBluePrintNode table : rs.getTables()) { - try { - col = table.findColumnByName(token); - } catch (Exception err) { - } - if (col != null) { - break; - } - } - if (col == null) { - throw new SQLException("Unknown field name '" + token - + "'."); - } - - rs.getFields().add(col); - } - } - } - - public static void parseCriteria(JDBCResultSet rs, XSQLBluePrint bp) { - String lowSQL = rs.getSQL().toLowerCase(); - int where = lowSQL.indexOf("where"); - int order = lowSQL.indexOf("order"); - int whereTo = lowSQL.indexOf(";"); - - if (where == -1) { - return; - } - - if (order != -1) { - whereTo = order; - } - - if(whereTo==-1) { - whereTo=lowSQL.length(); - } - - String whereStatement = rs.getSQL().substring(where + 5, whereTo) - .trim(); - XSQLCriteria cr = new XSQLCriteria(whereStatement, -1); - for (XSQLBluePrintNode tbl : rs.getTables()) { - for (XSQLColumn col : tbl.getColumns()) { - String colCriteria = cr.getCriteriaForProperty(col); - if (colCriteria != null && !colCriteria.trim().equals("")) { - addCriteria(col, new XSQLCriteria(colCriteria, -1), rs); - } - } - } - } -} diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCStatement.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCStatement.java deleted file mode 100644 index c319e52ebb..0000000000 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/controller/md/sal/dom/xsql/jdbc/JDBCStatement.java +++ /dev/null @@ -1,728 +0,0 @@ -/* - * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.md.sal.dom.xsql.jdbc; - -import java.io.InputStream; -import java.io.Reader; -import java.math.BigDecimal; -import java.net.URL; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Connection; -import java.sql.Date; -import java.sql.NClob; -import java.sql.ParameterMetaData; -import java.sql.PreparedStatement; -import java.sql.Ref; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.RowId; -import java.sql.SQLException; -import java.sql.SQLWarning; -import java.sql.SQLXML; -import java.sql.Time; -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -/** - * To be removed in Nitrogen - */ -@Deprecated -public class JDBCStatement implements PreparedStatement { - private JDBCResultSet rs = null; - private transient JDBCConnection connection = null; - private static Map queries = new ConcurrentHashMap<>(); - private String sql = null; - - public JDBCStatement(JDBCConnection con,String _sql) { - this.connection = con; - this.sql = _sql; - } - - public JDBCStatement(JDBCConnection con) { - this.connection = con; - } - - public void setSQL(String _sql){ - this.sql = _sql; - } - - public JDBCStatement() { - - } - - public PreparedStatement getProxy() { - return this; - /* - return (PreparedStatement) Proxy.newProxyInstance(this.getClass() - .getClassLoader(), new Class[] { PreparedStatement.class }, - new JDBCProxy(this)); - */ - } - - public static JDBCResultSet getQuery(int id) { - return queries.get(id); - } - - public static JDBCResultSet removeQuery(int id) { - return queries.remove(id); - } - - @Override - public java.sql.ResultSet executeQuery(String _sql) throws SQLException { - rs = new JDBCResultSet(_sql); - queries.put(rs.getID(), rs); - synchronized (rs) { - this.connection.send(new JDBCCommand(rs, - JDBCCommand.TYPE_EXECUTE_QUERY)); - try { - rs.wait(); - } catch (Exception err) { - } - if (rs.getError() != null) { - throw ((SQLException) rs.getError()); - } - } - return rs.getProxy(); - } - - @Override - public boolean execute(String _sql) throws SQLException { - return true; - } - - public void addRecord(ArrayList hierarchy) { - rs.addRecord(hierarchy); - } - - public int size() { - return rs.size(); - } - - public void setFinished(boolean b) { - this.rs.setFinished(b); - } - - public JDBCResultSet getRS() { - return this.rs; - } - - public ResultSet getResultSet() { - return this.rs; - } - - @Override - public boolean isWrapperFor(Class arg0) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public T unwrap(Class arg0) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public void addBatch(String sql) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void cancel() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void clearBatch() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void clearWarnings() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void close() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public boolean execute(String sql, int autoGeneratedKeys) - throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean execute(String sql, int[] columnIndexes) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean execute(String sql, String[] columnNames) - throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public int[] executeBatch() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public int executeUpdate(String sql, int autoGeneratedKeys) - throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int executeUpdate(String sql, int[] columnIndexes) - throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int executeUpdate(String sql, String[] columnNames) - throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int executeUpdate(String sql) throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public Connection getConnection() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public int getFetchDirection() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getFetchSize() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public java.sql.ResultSet getGeneratedKeys() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public int getMaxFieldSize() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxRows() throws SQLException { - return 200; - } - - @Override - public boolean getMoreResults() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean getMoreResults(int current) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public int getQueryTimeout() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getResultSetConcurrency() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getResultSetHoldability() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getResultSetType() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getUpdateCount() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public SQLWarning getWarnings() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean isClosed() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isPoolable() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public void setCursorName(String name) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setEscapeProcessing(boolean enable) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setFetchDirection(int direction) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setFetchSize(int rows) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setMaxFieldSize(int max) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setMaxRows(int max) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setPoolable(boolean poolable) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setQueryTimeout(int seconds) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void closeOnCompletion() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public boolean isCloseOnCompletion() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public ResultSet executeQuery() throws SQLException { - return this.executeQuery(this.sql); - } - - @Override - public int executeUpdate() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public void setNull(int parameterIndex, int sqlType) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setBoolean(int parameterIndex, boolean x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setByte(int parameterIndex, byte x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setShort(int parameterIndex, short x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setInt(int parameterIndex, int x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setLong(int parameterIndex, long x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setFloat(int parameterIndex, float x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setDouble(int parameterIndex, double x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setBigDecimal(int parameterIndex, BigDecimal x) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setString(int parameterIndex, String x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setBytes(int parameterIndex, byte[] x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setDate(int parameterIndex, Date x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setTime(int parameterIndex, Time x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setTimestamp(int parameterIndex, Timestamp x) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setAsciiStream(int parameterIndex, InputStream x, int length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setUnicodeStream(int parameterIndex, InputStream x, int length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setBinaryStream(int parameterIndex, InputStream x, int length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void clearParameters() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setObject(int parameterIndex, Object x, int targetSqlType) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setObject(int parameterIndex, Object x) throws SQLException { - // TODO Auto-generated method stub - } - - @Override - public boolean execute() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public void addBatch() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setCharacterStream(int parameterIndex, Reader reader, int length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setRef(int parameterIndex, Ref x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setBlob(int parameterIndex, Blob x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setClob(int parameterIndex, Clob x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setArray(int parameterIndex, Array x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public ResultSetMetaData getMetaData() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public void setDate(int parameterIndex, Date x, Calendar cal) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setTime(int parameterIndex, Time x, Calendar cal) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setNull(int parameterIndex, int sqlType, String typeName) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setURL(int parameterIndex, URL x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public ParameterMetaData getParameterMetaData() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public void setRowId(int parameterIndex, RowId x) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setNString(int parameterIndex, String value) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setNCharacterStream(int parameterIndex, Reader value, - long length) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setNClob(int parameterIndex, NClob value) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setClob(int parameterIndex, Reader reader, long length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setBlob(int parameterIndex, InputStream inputStream, long length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setNClob(int parameterIndex, Reader reader, long length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setSQLXML(int parameterIndex, SQLXML xmlObject) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setObject(int parameterIndex, Object x, int targetSqlType, - int scaleOrLength) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setAsciiStream(int parameterIndex, InputStream x, long length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setBinaryStream(int parameterIndex, InputStream x, long length) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setCharacterStream(int parameterIndex, Reader reader, - long length) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setAsciiStream(int parameterIndex, InputStream x) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setBinaryStream(int parameterIndex, InputStream x) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setCharacterStream(int parameterIndex, Reader reader) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setNCharacterStream(int parameterIndex, Reader value) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setClob(int parameterIndex, Reader reader) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setBlob(int parameterIndex, InputStream inputStream) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setNClob(int parameterIndex, Reader reader) throws SQLException { - // TODO Auto-generated method stub - - } - -} diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/xsql/XSQLProvider.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/xsql/XSQLProvider.java deleted file mode 100644 index fa85cf4530..0000000000 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/xsql/XSQLProvider.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.xsql; - -import org.opendaylight.controller.md.sal.binding.api.DataBroker; -import org.opendaylight.controller.md.sal.binding.api.WriteTransaction; -import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; -import org.opendaylight.controller.md.sal.dom.xsql.XSQLAdapter; -import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.xsql.rev140626.XSQL; -import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.xsql.rev140626.XSQLBuilder; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; - -/** - * @author Sharon Aicler(saichler@gmail.com) - **/ -/** - * To be removed in Nitrogen - */ -@Deprecated -public class XSQLProvider implements AutoCloseable { - - public static final InstanceIdentifier ID = InstanceIdentifier.builder(XSQL.class).build(); - //public static final InstanceIdentifier ID2 = InstanceIdentifier.builder(SalTest.class).build(); - - public void close() { - } - - public XSQL buildXSQL(DataBroker dps) { - XSQLAdapter.log("Building XSL..."); - XSQLBuilder builder = new XSQLBuilder(); - builder.setPort("34343"); - XSQL xsql = builder.build(); - try { - if (dps != null) { - XSQLAdapter.log("Starting TRansaction..."); - WriteTransaction t = dps.newReadWriteTransaction(); - t.delete(LogicalDatastoreType.OPERATIONAL, ID); - t.put(LogicalDatastoreType.OPERATIONAL,ID,xsql); - XSQLAdapter.log("Submitting..."); - t.submit(); - } - } catch (Exception e) { - XSQLAdapter.log(e); - } - return xsql; - } -} diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/yang/gen/v1/http/netconfcentral/org/ns/xsql/rev140626/XSQLModule.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/yang/gen/v1/http/netconfcentral/org/ns/xsql/rev140626/XSQLModule.java deleted file mode 100644 index 40200f86d9..0000000000 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/yang/gen/v1/http/netconfcentral/org/ns/xsql/rev140626/XSQLModule.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.xsql.rev140626; - -import org.opendaylight.controller.md.sal.dom.xsql.XSQLAdapter; -import org.opendaylight.xsql.XSQLProvider; -/** - * @author Sharon Aicler(saichler@gmail.com) - **/ -/** - * To be removed in Nitrogen - */ -@Deprecated -public class XSQLModule extends org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.xsql.rev140626.AbstractXSQLModule { - private static final long SLEEP_TIME_BEFORE_CREATING_TRANSACTION = 10000; - public XSQLModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { - super(identifier, dependencyResolver); - } - - public XSQLModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.xsql.rev140626.XSQLModule oldModule, java.lang.AutoCloseable oldInstance) { - super(identifier, dependencyResolver, oldModule, oldInstance); - } - - @Override - public void customValidation() { - // add custom validation form module attributes here. - } - - @Override - public java.lang.AutoCloseable createInstance() { - XSQLAdapter xsqlAdapter = XSQLAdapter.getInstance(); - getSchemaServiceDependency().registerSchemaContextListener(xsqlAdapter); - xsqlAdapter.setDataBroker(getAsyncDataBrokerDependency()); - final XSQLProvider p = new XSQLProvider(); - Runnable runthis = new Runnable() { - @Override - public void run() { - try{Thread.sleep(SLEEP_TIME_BEFORE_CREATING_TRANSACTION);}catch(Exception err){} - p.buildXSQL(getDataBrokerDependency()); - } - }; - return p; - } -} diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/yang/gen/v1/http/netconfcentral/org/ns/xsql/rev140626/XSQLModuleFactory.java b/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/yang/gen/v1/http/netconfcentral/org/ns/xsql/rev140626/XSQLModuleFactory.java deleted file mode 100644 index e2c1d4d09c..0000000000 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/java/org/opendaylight/yang/gen/v1/http/netconfcentral/org/ns/xsql/rev140626/XSQLModuleFactory.java +++ /dev/null @@ -1,17 +0,0 @@ -/* -* Generated file -* -* Generated from: yang module name: XSQL yang module local name: XSQL -* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator -* Generated at: Thu Jun 26 14:56:25 PDT 2014 -* -* Do not modify this file unless it is present under src/main directory -*/ -package org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.xsql.rev140626; -/** - * To be removed in Nitrogen - */ -@Deprecated -public class XSQLModuleFactory extends org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.xsql.rev140626.AbstractXSQLModuleFactory { - -} diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/resources/04-xsql.xml b/opendaylight/md-sal/sal-dom-xsql/src/main/resources/04-xsql.xml deleted file mode 100644 index 1b9a37df66..0000000000 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/resources/04-xsql.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - XSQL:XSQL - - XSQL - - binding:binding-async-data-broker - binding-data-broker - - - dom:dom-async-data-broker - inmemory-data-broker - - - dom:schema-service - yang-schema-service - - - - - - - http://netconfcentral.org/ns/XSQL?module=XSQL&revision=2014-06-26 - - diff --git a/opendaylight/md-sal/sal-dom-xsql/src/main/yang/XSQL.yang b/opendaylight/md-sal/sal-dom-xsql/src/main/yang/XSQL.yang deleted file mode 100644 index 1c7a4ff848..0000000000 --- a/opendaylight/md-sal/sal-dom-xsql/src/main/yang/XSQL.yang +++ /dev/null @@ -1,74 +0,0 @@ -module XSQL{ - yang-version 1; - namespace "http://netconfcentral.org/ns/XSQL"; - prefix XSQL; - - import config { prefix config; revision-date 2013-04-05; } - import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28; } - import rpc-context { prefix rpcx; revision-date 2013-06-17; } - import opendaylight-md-sal-dom {prefix sal;} - import opendaylight-md-sal-common {prefix common;} - - organization "Netconf Central"; - contact "Sharon Aicler "; - description "YANG version of the XSQL status"; - - revision "2014-06-26" { - description "XSQL module initial version"; - } - - container XSQL { - presence "Indicates the XSQL service is available"; - description "Container to indicate the XSQL availability"; - leaf port { - type string; - config false; - mandatory true; - description "The port the XSQL binds on"; - } - } - - identity XSQL { - base config:module-type; - config:java-name-prefix XSQL; - status deprecated; - } - - augment "/config:modules/config:module/config:configuration" { - status deprecated; - case XSQL { - when "/config:modules/config:module/config:type = 'XSQL'"; - - container data-broker { - uses config:service-ref { - refine type { - mandatory false; - config:required-identity mdsal:binding-async-data-broker; - } - } - } - - container async-data-broker { - uses config:service-ref { - refine type { - mandatory false; - config:required-identity sal:dom-async-data-broker; - } - } - - } - - container schema-service { - uses config:service-ref { - refine type { - mandatory false; - config:required-identity sal:schema-service; - } - } - - } - - } - } - -} diff --git a/opendaylight/md-sal/sal-dom-xsql/src/test/java/org/opendaylight/xsql/test/XSQLTest.java b/opendaylight/md-sal/sal-dom-xsql/src/test/java/org/opendaylight/xsql/test/XSQLTest.java deleted file mode 100644 index eccdab3407..0000000000 --- a/opendaylight/md-sal/sal-dom-xsql/src/test/java/org/opendaylight/xsql/test/XSQLTest.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.xsql.test; - -import java.io.InputStream; -import java.sql.SQLException; -import java.util.Collections; -import java.util.List; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.opendaylight.controller.md.sal.dom.xsql.XSQLAdapter; -import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrint; -import org.opendaylight.controller.md.sal.dom.xsql.jdbc.JDBCResultSet; -import org.opendaylight.controller.md.sal.dom.xsql.jdbc.JDBCServer; -import org.opendaylight.yangtools.yang.model.api.SchemaContext; -import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException; -import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils; - -@Deprecated -public class XSQLTest { - private static final String DATASTORE_TEST_YANG = "/sal-persisted-dom-test.yang"; - private XSQLBluePrint bluePrint = null; - //private static SchemaContext schemaContext = null; - @BeforeClass - public static void loadSchemaContext(){ - //schemaContext = createTestContext(); - } - - @Before - public void before() { - try{ - InputStream in = this.getClass().getClassLoader().getResourceAsStream("BluePrintCache.dat"); - if(in!=null){ - bluePrint = XSQLBluePrint.load(in); - log("Loaded Blue Print!"); - }else{ - log("Can't find Blue Print!"); - } - in.close(); - }catch(Exception err){ - err.printStackTrace(); - } - } - - @Test - public void testQueryParsingSimpleNoCriteria() { - String sql = "select * from nodes/node;"; - JDBCResultSet rs = new JDBCResultSet(sql); - parseTables(sql,bluePrint, rs); - parseFields(sql, bluePrint, rs); - JDBCServer.parseCriteria(rs, bluePrint); - if(rs.getCriteria().isEmpty()){ - log("Test Criteria parsing of \""+sql+"\" Passed!"); - Assert.assertEquals(true, true); - }else{ - log("Test Criteria parsing of \""+sql+"\" Failed!"); - Assert.assertEquals(false, true); - } - } - - @Test - public void testQueryParsingComplexNoCriteria() { - String sql = "select nodes/node.id,nodes/node/node-connector.id,nodes/node/node-connector.hardware-address from nodes/node,nodes/node/node-connector;"; - JDBCResultSet rs = new JDBCResultSet(sql); - parseTables(sql,bluePrint, rs); - parseFields(sql, bluePrint, rs); - JDBCServer.parseCriteria(rs, bluePrint); - if(rs.getCriteria().isEmpty()){ - log("Test Criteria parsing of \""+sql+"\" Passed!"); - Assert.assertEquals(true, true); - }else{ - log("Test Criteria parsing of \""+sql+"\" Failed!"); - Assert.assertEquals(false, true); - } - } - - @Test - public void testQueryParsingComplexWithCriteria() { - String sql = "select nodes/node.id,nodes/node/node-connector.id,nodes/node/node-connector.hardware-address from nodes/node,nodes/node/node-connector where hardware-address like 'AB';"; - JDBCResultSet rs = new JDBCResultSet(sql); - parseTables(sql,bluePrint, rs); - parseFields(sql, bluePrint, rs); - JDBCServer.parseCriteria(rs, bluePrint); - if(!rs.getCriteria().isEmpty()){ - log("Test Criteria parsing of \""+sql+"\" Passed!"); - Assert.assertEquals(true, true); - }else{ - log("Test Criteria parsing of \""+sql+"\" Failed!"); - Assert.assertEquals(false, true); - } - } - - @Test - public void testQueryParsingSimpleWithCriteria() { - String sql = "select * from nodes/node where nodes/node.id like 'something...';"; - JDBCResultSet rs = new JDBCResultSet(sql); - parseTables(sql,bluePrint, rs); - parseFields(sql, bluePrint, rs); - JDBCServer.parseCriteria(rs, bluePrint); - if(!rs.getCriteria().isEmpty()){ - log("Test Criteria parsing of \""+sql+"\" Passed!"); - Assert.assertEquals(true, true); - }else{ - log("Test Criteria parsing of \""+sql+"\" Failed!"); - Assert.assertEquals(false, true); - } - } - - private static void parseTables(final String sql,final XSQLBluePrint bp,final JDBCResultSet rs){ - try{ - JDBCServer.parseTables(rs, bp); - log("Test Table parsing of \""+sql+"\" Passed!"); - Assert.assertEquals(true,true); - }catch(SQLException err){ - log("Test Table parsing of \""+sql+"\" Failed!"); - err.printStackTrace(); - Assert.assertEquals(false,true); - } - } - - @Test - public void testQueryParsingComplexWithCriteriaAndGrouping() { - - String sub_sql = "select nodes/node.id,nodes/node/node-connector.id,nodes/node/node-connector.hardware-address from nodes/node,nodes/node/node-connector where hardware-address like 'AB';"; - - String sql = "SELECT DISTINCT" - + "\"LOGICAL_TABLE_1\".\"nodes/node.id\" AS \"COL0\"\n" - + ",\"LOGICAL_TABLE_1\".\"nodes/node.address\" AS \"COL1\"\n" - + ",\"LOGICAL_TABLE_1\".\"nodes/node/node-connector.hardware-address\" AS \"COL2\"\n" - + "FROM\n" - + "("+sub_sql+") \"LOGICAL_TABLE_1\"\n"; - - - - JDBCResultSet rs = new JDBCResultSet(sql); - XSQLAdapter.getInstance().loadBluePrint(); - try{ - JDBCServer.checkAndBreakSubQueries(rs, XSQLAdapter.getInstance()); - if(rs.getSubQueries().isEmpty()){ - log("Logical table parsing for "+sql+" Failed!"); - }else{ - JDBCServer.parseExternalQuery(rs); - log("Fields="+rs.getFields().size()); - Assert.assertEquals(rs.getFields().size(), 3); - Assert.assertEquals(rs.getTables().size(), 1); - Assert.assertEquals(rs.getTables().get(0).getODLTableName(), "LOGICAL_TABLE_1"); - - JDBCResultSet subRS = rs.getSubQueries().values().iterator().next(); - parseTables(sql,bluePrint, subRS); - parseFields(sql, bluePrint, subRS); - JDBCServer.parseCriteria(subRS, bluePrint); - if(!subRS.getCriteria().isEmpty()){ - log("Test Criteria parsing of \""+sql+"\" Passed!"); - Assert.assertEquals(true, true); - }else{ - log("Test Criteria parsing of \""+sql+"\" Failed!"); - Assert.assertEquals(false, true); - } - } - }catch(SQLException err){ - err.printStackTrace(); - } - } - - private static void parseFields(final String sql,final XSQLBluePrint bp,final JDBCResultSet rs){ - try{ - JDBCServer.parseFields(rs, bp); - log("Test Fields parsing of \""+sql+"\" Passed!"); - Assert.assertEquals(true,true); - }catch(SQLException err){ - log("Test Fields parsing of \""+sql+"\" Failed!"); - err.printStackTrace(); - Assert.assertEquals(false,true); - } - } - - private static void log(final String str) { - System.out.print("*** XSQL Tests -"); - System.out.println(str); - } - - private static InputStream getInputStream() { - return XSQLTest.class.getResourceAsStream(DATASTORE_TEST_YANG); - } - - public static SchemaContext createTestContext() { - final List streams = Collections.singletonList(getInputStream()); - - try { - return YangParserTestUtils.parseYangStreams(streams); - } catch (ReactorException e) { - throw new RuntimeException("Unable to build schema context from " + streams, e); - } - } -} diff --git a/opendaylight/md-sal/sal-dom-xsql/src/test/resources/BluePrintCache.dat b/opendaylight/md-sal/sal-dom-xsql/src/test/resources/BluePrintCache.dat deleted file mode 100644 index 152f7878df6ab928a53c5a5e0a7c1f638b208faa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 88704 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 - - - - - 4.0.0 - - - org.opendaylight.odlparent - bundle-parent - 1.9.0-SNAPSHOT - - - - org.opendaylight.controller - sal-karaf-xsql - 1.6.0-SNAPSHOT - bundle - Apache Karaf :: Shell odl/xsql Commands - - Provides the OSGi odl commands - - - - - org.opendaylight.controller - mdsal-artifacts - 1.6.0-SNAPSHOT - pom - import - - - - - - - org.apache.karaf.shell - org.apache.karaf.shell.console - ${karaf.version} - - - - org.osgi - org.osgi.core - - - - org.osgi - org.osgi.compendium - 5.0.0 - provided - - - - junit - junit - - - org.opendaylight.controller - sal-dom-xsql - - - - - - - org.apache.felix - maven-bundle-plugin - true - - - ${project.artifactId} - org.opendaylight.controller.xsql*;version=${project.version} - !org.opendaylight.controller.xsql*, - org.apache.aries.blueprint, - org.osgi.service.blueprint.container, - org.osgi.service.blueprint.reflect, - org.apache.karaf.shell.commands, - org.apache.karaf.shell.console, - * - - - - - - - diff --git a/opendaylight/md-sal/sal-karaf-xsql/src/main/java/org/opendaylight/controller/xsql/xsql.java b/opendaylight/md-sal/sal-karaf-xsql/src/main/java/org/opendaylight/controller/xsql/xsql.java deleted file mode 100644 index fc171e5c60..0000000000 --- a/opendaylight/md-sal/sal-karaf-xsql/src/main/java/org/opendaylight/controller/xsql/xsql.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.xsql; - -import org.apache.karaf.shell.commands.Argument; -import org.apache.karaf.shell.commands.Command; -import org.apache.karaf.shell.commands.Option; -import org.apache.karaf.shell.console.OsgiCommandSupport; -import org.opendaylight.controller.md.sal.dom.xsql.XSQLAdapter; - -/** - * To be removed in Nitrogen - */ -@Deprecated -@Command(scope = "odl", name = "xsql", description = "XSQL Karaf Command") -public class xsql extends OsgiCommandSupport { - - @Option(name = "-o", aliases = { "--option" }, description = "An option to the command", required = false, multiValued = false) - private String option; - - @Argument(name = "argument", description = "Argument to the command", required = false, multiValued = false) - private String argument; - - protected Object doExecute() throws Exception { - if(argument==null){ - System.out.println("Nothing to do..., please specify a command."); - return null; - } - XSQLAdapter.getInstance().processCommand(new StringBuffer(argument), - System.out); - return null; - } -} diff --git a/opendaylight/md-sal/sal-karaf-xsql/src/main/resources/OSGI-INF/blueprint/shell-log.xml b/opendaylight/md-sal/sal-karaf-xsql/src/main/resources/OSGI-INF/blueprint/shell-log.xml deleted file mode 100644 index e9a4a233d3..0000000000 --- a/opendaylight/md-sal/sal-karaf-xsql/src/main/resources/OSGI-INF/blueprint/shell-log.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - diff --git a/opendaylight/md-sal/sal-karaf4-xsql/pom.xml b/opendaylight/md-sal/sal-karaf4-xsql/pom.xml deleted file mode 100644 index 1a0c714e0d..0000000000 --- a/opendaylight/md-sal/sal-karaf4-xsql/pom.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - 4.0.0 - - - org.opendaylight.odlparent - bundle-parent - 1.9.0-SNAPSHOT - - - - org.opendaylight.controller - sal-karaf4-xsql - 1.6.0-SNAPSHOT - bundle - Apache Karaf :: Shell odl/xsql Commands - - Provides the OSGi odl commands - - - - - org.opendaylight.controller - mdsal-artifacts - 1.6.0-SNAPSHOT - pom - import - - - - - - - org.apache.karaf.shell - org.apache.karaf.shell.console - ${karaf4.version} - - - - org.osgi - org.osgi.core - - - - org.osgi - org.osgi.compendium - 5.0.0 - provided - - - - junit - junit - - - org.opendaylight.controller - sal-dom-xsql - - - - - - - org.apache.felix - maven-bundle-plugin - true - - - ${project.artifactId} - org.opendaylight.controller.xsql*;version=${project.version} - !org.opendaylight.controller.xsql*, - org.apache.aries.blueprint, - org.osgi.service.blueprint.container, - org.osgi.service.blueprint.reflect, - org.apache.karaf.shell.commands, - org.apache.karaf.shell.console, - * - - - - - - - diff --git a/opendaylight/md-sal/sal-karaf4-xsql/src/main/java/org/opendaylight/controller/xsql/xsql.java b/opendaylight/md-sal/sal-karaf4-xsql/src/main/java/org/opendaylight/controller/xsql/xsql.java deleted file mode 100644 index fc171e5c60..0000000000 --- a/opendaylight/md-sal/sal-karaf4-xsql/src/main/java/org/opendaylight/controller/xsql/xsql.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.xsql; - -import org.apache.karaf.shell.commands.Argument; -import org.apache.karaf.shell.commands.Command; -import org.apache.karaf.shell.commands.Option; -import org.apache.karaf.shell.console.OsgiCommandSupport; -import org.opendaylight.controller.md.sal.dom.xsql.XSQLAdapter; - -/** - * To be removed in Nitrogen - */ -@Deprecated -@Command(scope = "odl", name = "xsql", description = "XSQL Karaf Command") -public class xsql extends OsgiCommandSupport { - - @Option(name = "-o", aliases = { "--option" }, description = "An option to the command", required = false, multiValued = false) - private String option; - - @Argument(name = "argument", description = "Argument to the command", required = false, multiValued = false) - private String argument; - - protected Object doExecute() throws Exception { - if(argument==null){ - System.out.println("Nothing to do..., please specify a command."); - return null; - } - XSQLAdapter.getInstance().processCommand(new StringBuffer(argument), - System.out); - return null; - } -} diff --git a/opendaylight/md-sal/sal-karaf4-xsql/src/main/resources/OSGI-INF/blueprint/shell-log.xml b/opendaylight/md-sal/sal-karaf4-xsql/src/main/resources/OSGI-INF/blueprint/shell-log.xml deleted file mode 100644 index e9a4a233d3..0000000000 --- a/opendaylight/md-sal/sal-karaf4-xsql/src/main/resources/OSGI-INF/blueprint/shell-log.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - -- 2.36.6