<mdsal.version>2.3.0-SNAPSHOT</mdsal.version>
<mdsal.model.version>0.11.0-SNAPSHOT</mdsal.model.version>
<yangtools.version>1.2.0-SNAPSHOT</yangtools.version>
- <config.benchmark.configfile>04-xsql.xml</config.benchmark.configfile>
</properties>
<dependencies>
<config.clustered-entity-ownership.configfile>06-clustered-entity-ownership.xml</config.clustered-entity-ownership.configfile>
<config.netty.configfile>00-netty.xml</config.netty.configfile>
<config.mdsal.configfile>01-md-sal.xml</config.mdsal.configfile>
- <config.xsql.configfile>04-xsql.xml</config.xsql.configfile>
</properties>
<dependencyManagement>
<artifactId>sal-broker-impl</artifactId>
</dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-karaf-xsql</artifactId>
- </dependency>
-
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-binding-api</artifactId>
<artifactId>sal-connector-api</artifactId>
</dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-dom-xsql</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-dom-xsql-config</artifactId>
- <classifier>config</classifier>
- <type>xml</type>
- </dependency>
-
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-clustering-commons</artifactId>
<feature name='odl-mdsal-all' version='${project.version}' description="OpenDaylight :: MDSAL :: All">
<feature version='${project.version}'>odl-mdsal-broker</feature>
<feature version='${project.version}'>odl-mdsal-broker-local</feature>
- <feature version='${project.version}'>odl-mdsal-xsql</feature>
<feature version='${project.version}'>odl-toaster</feature>
</feature>
<feature name='odl-mdsal-common' version='${project.version}' description="OpenDaylight :: Config :: All">
<bundle>mvn:org.opendaylight.controller.samples/sample-toaster-consumer/{{VERSION}}</bundle>
<bundle>mvn:org.opendaylight.controller.samples/sample-toaster-provider/{{VERSION}}</bundle>
</feature>
- <feature name ='odl-mdsal-xsql' version='${project.version}'>
- <feature version='${project.version}'>odl-mdsal-broker</feature>
- <bundle>mvn:org.opendaylight.controller/sal-dom-xsql/{{VERSION}}</bundle>
- <bundle>mvn:org.opendaylight.controller/sal-karaf-xsql/{{VERSION}}</bundle>
- <configfile finalname="${config.configfile.directory}/${config.xsql.configfile}">mvn:org.opendaylight.controller/sal-dom-xsql-config/{{VERSION}}/xml/config</configfile>
- </feature>
<feature name ='odl-mdsal-clustering-commons' version='${project.version}'>
<feature version='${project.version}'>odl-mdsal-broker-local</feature>
<feature version="${odlparent.version}">odl-akka-system-2.4</feature>
<type>xml</type>
<classifier>features</classifier>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>odl-mdsal-xsql</artifactId>
- <version>${project.version}</version>
- <type>xml</type>
- <classifier>features</classifier>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>odl-message-bus-collector</artifactId>
<classifier>features</classifier>
</dependency>
</dependencies>
-</project>
\ No newline at end of file
+</project>
<type>xml</type>
<classifier>features</classifier>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>odl-mdsal-xsql</artifactId>
- <type>xml</type>
- <classifier>features</classifier>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>odl-toaster</artifactId>
<classifier>features</classifier>
</dependency>
</dependencies>
-</project>
\ No newline at end of file
+</project>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright © 2016, 2017 Red Hat, Inc. and others.
-
- 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
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.opendaylight.odlparent</groupId>
- <artifactId>single-feature-parent</artifactId>
- <version>1.9.0-SNAPSHOT</version>
- <relativePath/>
- </parent>
-
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>odl-mdsal-xsql</artifactId>
- <version>1.6.0-SNAPSHOT</version>
- <packaging>feature</packaging>
-
- <properties>
- <config.configfile.directory>etc/opendaylight/karaf</config.configfile.directory>
- <config.xsql.configfile>04-xsql.xml</config.xsql.configfile>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>odl-mdsal-broker</artifactId>
- <version>${project.version}</version>
- <type>xml</type>
- <classifier>features</classifier>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>sal-dom-xsql</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>sal-karaf4-xsql</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <!-- finalname="${config.configfile.directory}/${config.xsql.configfile}" -->
- <groupId>${project.groupId}</groupId>
- <artifactId>sal-dom-xsql-config</artifactId>
- <version>${project.version}</version>
- <type>xml</type>
- <classifier>config</classifier>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright © 2016, 2017 Red Hat, Inc. and others.
-
- 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
- -->
-<features name="odl-mdsal-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0">
- <feature name="odl-mdsal-xsql" version="${project.version}">
- <configfile finalname="${config.configfile.directory}/${config.xsql.configfile}">
- mvn:org.opendaylight.controller/sal-dom-xsql-config/${project.version}/xml/config
- </configfile>
- </feature>
-</features>
<module>odl-mdsal-common</module>
<module>odl-mdsal-distributed-datastore</module>
<module>odl-mdsal-remoterpc-connector</module>
- <module>odl-mdsal-xsql</module>
<module>odl-message-bus-collector</module>
<module>odl-toaster</module>
</modules>
<scope>runtime</scope>
</dependency>
- <!-- XSQL support -->
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>sal-dom-xsql</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>sal-karaf-xsql</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>sal-dom-xsql-config</artifactId>
- <version>${project.version}</version>
- <classifier>config</classifier>
- <type>xml</type>
- </dependency>
-
<!-- MessageBus -->
<dependency>
<groupId>org.opendaylight.controller</groupId>
<type>xml</type>
<classifier>features</classifier>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>odl-mdsal-xsql</artifactId>
- <version>${project.version}</version>
- <type>xml</type>
- <classifier>features</classifier>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>odl-message-bus-collector</artifactId>
<module>sal-cluster-admin-api</module>
<module>sal-cluster-admin-impl</module>
- <!-- XSQL -->
- <module>sal-dom-xsql</module>
- <module>sal-karaf-xsql</module>
- <module>sal-karaf4-xsql</module>
- <module>sal-dom-xsql-config</module>
-
<!-- Yang Test Models for MD-SAL -->
<module>sal-test-model</module>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2014 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
---><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.opendaylight.odlparent</groupId>
- <artifactId>odlparent-lite</artifactId>
- <version>1.9.0-SNAPSHOT</version>
- <relativePath/>
- </parent>
-
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-dom-xsql-config</artifactId>
- <version>1.6.0-SNAPSHOT</version>
- <packaging>jar</packaging>
- <description>Configuration files for md-sal</description>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-artifacts</id>
- <goals>
- <goal>attach-artifact</goal>
- </goals>
- <phase>package</phase>
- <configuration>
- <artifacts>
- <artifact>
- <file>${project.build.directory}/classes/04-xsql.xml</file>
- <type>xml</type>
- <classifier>config</classifier>
- </artifact>
- </artifacts>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
+++ /dev/null
-<snapshot>
- <configuration>
- <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
- <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
- <module>
- <type xmlns:XSQL="http://netconfcentral.org/ns/XSQL">
- XSQL:XSQL
- </type>
- <name>XSQL</name>
- <data-broker>
- <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type>
- <name>binding-data-broker</name>
- </data-broker>
- <async-data-broker>
- <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-async-data-broker</type>
- <name>inmemory-data-broker</name>
- </async-data-broker>
- <schema-service>
- <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:schema-service</type>
- <name>yang-schema-service</name>
- </schema-service>
- </module>
- </modules>
- </data>
- </configuration>
- <required-capabilities>
- <capability>http://netconfcentral.org/ns/XSQL?module=XSQL&revision=2014-06-26</capability>
- </required-capabilities>
-</snapshot>
+++ /dev/null
-/target-ide
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-parent</artifactId>
- <version>0.7.0-SNAPSHOT</version>
- <relativePath>../../config/config-parent</relativePath>
- </parent>
-
- <groupId>org.opendaylight.controller</groupId>
- <version>1.6.0-SNAPSHOT</version>
- <artifactId>sal-dom-xsql</artifactId>
- <packaging>bundle</packaging>
- <name>sal-dom-xsql</name>
- <description>XSQL language</description>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>mdsal-artifacts</artifactId>
- <version>1.6.0-SNAPSHOT</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <dependencies>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-config</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-common-util</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-core-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>yang-jmx-generator</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.mdsal</groupId>
- <artifactId>yang-binding</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-test-util</artifactId>
- </dependency>
- </dependencies>
-
- <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL:XSQL</url>
- <scm>
- <connection>scm:git:http://git.opendaylight.org/gerrit/controller.git</connection>
- <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
- <tag>HEAD</tag>
- <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL:XSQL</url>
- </scm>
-</project>
+++ /dev/null
-/*
- * 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;
- }
-
-}
+++ /dev/null
-/*
- * 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> T unwrap(Class<T> 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<String, Class<?>> 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<String, Class<?>> 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> T getObject(int columnIndex, Class<T> type) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public <T> T getObject(String columnLabel, Class<T> type)
- throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
-
+++ /dev/null
-/*
- * 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<NormalizedNode<?, ?>> collectModuleRoots(final XSQLBluePrintNode table,final LogicalDatastoreType type) {
- if (table.getParent().isModule()) {
- try {
- List<NormalizedNode<?, ?>> result = new LinkedList<>();
- YangInstanceIdentifier instanceIdentifier = YangInstanceIdentifier
- .builder()
- .node(XSQLODLUtils.getPath(table.getFirstFromSchemaNodes()).get(0))
- .build();
- DOMDataReadOnlyTransaction t = this.domDataBroker
- .newReadOnlyTransaction();
- Optional<NormalizedNode<?, ?>> 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<XSQLBluePrintNode> tables = rs.getTables();
- List<NormalizedNode<?, ?>> 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<NETask> 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<String> 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<String> 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) {
- }
- }
- }
- }
-}
+++ /dev/null
-/*
- * 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<String, XSQLBluePrintNode> tableNameToBluePrint = new HashMap<>();
- private final Map<String, Map<String, XSQLBluePrintNode>> 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<String, XSQLBluePrintNode> 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<Class<?>, Set<Class<?>>> superClassMap = new HashMap<>();
-
- public static Set<Class<?>> getInheritance(final Class<?> myObjectClass,
- final Class<?> returnType) {
-
- if (returnType != null && myObjectClass.equals(returnType)) {
- return new HashSet<>();
- }
- Set<Class<?>> 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<Class<?>> collectInterfaces(final Class<?> cls) {
- Set<Class<?>> 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<String, XSQLBluePrintNode> 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<String> getAllTableNames() {
- List<String> names = new ArrayList<>();
- for (XSQLBluePrintNode n : this.tableNameToBluePrint.values()) {
- if (!n.isModule() && !n.getColumns().isEmpty()) {
- names.add(n.getBluePrintNodeName());
- }
- }
- return names;
-
- }
-
- public List<String> getInterfaceNames(final XSQLBluePrintNode node) {
- Set<XSQLBluePrintNode> children = node.getChildren();
- List<String> 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> T unwrap(final Class<T> 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;
- }
-}
+++ /dev/null
-/*
- * 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<XSQLBluePrintRelation> relations = new HashSet<>();
- private Set<XSQLBluePrintNode> inheritingNodes = new HashSet<>();
- private Set<XSQLBluePrintNode> children = new HashSet<>();
- private XSQLBluePrintNode parent = null;
-
- private int level = -1;
- private transient Set<String> parentHierarchySet = null;
- private String myInterfaceName = null;
- private Set<XSQLColumn> columns = new HashSet<>();
- private Map<String, XSQLColumn> 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<XSQLBluePrintNode> 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<XSQLBluePrintRelation> getRelations() {
- return this.relations;
- }
-
- public String getClassName() {
- return this.myInterfaceString;
- }
-
- public void addInheritingNode(XSQLBluePrintNode node) {
- this.inheritingNodes.add(node);
- }
-
- public Set<XSQLBluePrintNode> 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<XSQLColumn> 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<XSQLBluePrintRelation> getClonedParents() {
- Set<XSQLBluePrintRelation> 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;
- }
-
-}
+++ /dev/null
-/*
- * 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<Object> 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<Object> 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);
- }
- }
-}
-
+++ /dev/null
-/*
- * 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<Object> {
- 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;
- }
-}
+++ /dev/null
-/*
- * 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<Class<?>, Map<String, Method>> 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<String, Method> 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"));
-
- }
-}
+++ /dev/null
-/*
- * 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<?>, 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<QName> 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<QName> lst = p.getPath();
- return lst.get(lst.size() - 1).toString();
- }
- return null;
- }
-
- public static List<QName> 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<DataSchemaNode> 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<AugmentationSchema> 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<AugmentationSchema> 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<String, Field> 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<Object> getMChildren(final Object o) {
- Map<?, ?> children = getChildren(o);
- List<Object> 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;
- }
-
-}
+++ /dev/null
-/*
- * 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<Runnable> 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;
- }
-
-}
+++ /dev/null
-/*
- * 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<String, Object> 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<String, Object> _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<String, Object> getRecord() {
- return this.record;
- }
-
- public int getRSID() {
- return this.rsID;
- }
-
- public Exception getERROR() {
- return this.err;
- }
-
- public XSQLBluePrint getBluePrint() {
- return this.bluePrint;
- }
-}
+++ /dev/null
-/*
- * 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<byte[]> 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> T unwrap(Class<T> 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<String, Class<?>> 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<String, Class<?>> 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;
- }
-
-}
+++ /dev/null
-/*
- * 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);
- }
-}
+++ /dev/null
-/*
- * 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<XSQLBluePrintNode> tablesInQuery = new ArrayList<>();
- private Map<String, XSQLBluePrintNode> tablesInQueryMap = new ConcurrentHashMap<>();
- private List<XSQLColumn> fieldsInQuery = new ArrayList<>();
- private transient LinkedList<Map<String, Object>> records = new LinkedList<>();
- private transient Map<String, Object> currentRecord = null;
- private boolean finished = false;
- private int id = 0;
- public int numberOfTasks = 0;
- private Map<String, Map<XSQLColumn, List<XSQLCriteria>>> criteria = new ConcurrentHashMap<>();
- private Exception err = null;
- private List<Record> EMPTY_RESULT = new LinkedList<>();
- private transient Map<String, JDBCResultSet> 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<String, JDBCResultSet> 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<String, Object> objValues,
- String tableName) {
- Map<XSQLColumn, List<XSQLCriteria>> tblCriteria = criteria
- .get(tableName);
- if (tblCriteria == null) {
- return 1;
- }
- for (Map.Entry<XSQLColumn, List<XSQLCriteria>> 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<XSQLColumn, List<XSQLCriteria>> tblCriteria = criteria.get(cls
- .getName());
- if (tblCriteria == null) {
- return 1;
- }
- for (Map.Entry<XSQLColumn, List<XSQLCriteria>> 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<String, Map<XSQLColumn, List<XSQLCriteria>>> getCriteria() {
- return this.criteria;
- }
-
- public int getID() {
- return this.id;
- }
-
- public List<XSQLBluePrintNode> 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<XSQLColumn> 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<String, Object> r) {
- synchronized (this) {
- if (records == null) {
- records = new LinkedList<>();
- }
- records.add(r);
- this.notifyAll();
- }
- }
-
- public void addRecord(ArrayList<?> hierarchy) {
- Map<String, Object> 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<String, Object> getCurrent() {
- return this.currentRecord;
- }
-
- private void createRecord(Object data, XSQLBluePrintNode node) {
- Map<String, Object> 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<String, Object> 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<String, Object> getRecord() {
- return this.data;
- }
- }
-
- public static class RecordsContainer {
- public List<Record> records = new LinkedList<>();
- public List<Record> 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<String, Object> 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<String> 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<Object> getChildren(Object node, String tableName,
- XSQLBluePrint bluePrint) {
-
- List<Object> children = XSQLODLUtils.getMChildren(node);
- List<Object> result = new LinkedList<>();
-
- for (Object child : children) {
-
- String odlNodeName = XSQLODLUtils.getNodeIdentiofier(child);
- if (odlNodeName == null) {
- if (child instanceof DataContainerNode) {
- List<Object> 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<Object> _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<Record> addRecords(Object element, XSQLBluePrintNode node,
- boolean root, String tableName, XSQLBluePrint bluePrint) {
- List<Record> 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<Record> subRecords = addRecords(element, parent, false, tableName,
- bluePrint);
- for (Record subRec : subRecords) {
- List<Object> 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> T unwrap(Class<T> 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<String, Class<?>> 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<String, Class<?>> 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> T getObject(int columnIndex, Class<T> type) throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public <T> T getObject(String columnLabel, Class<T> type)
- throws SQLException {
- // TODO Auto-generated method stub
- return null;
- }
-
- // //Metadata
-
-}
+++ /dev/null
-/*
- * 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<String, JDBCResultSet> 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<String, JDBCResultSet> entry : rs.getSubQueries().entrySet()) {
- for(XSQLBluePrintNode node:entry.getValue().getTables()){
- rs.addTableToQuery(node);
- }
- rs.getFields().addAll(entry.getValue().getFields());
- while (entry.getValue().next()) {
- Map<String, Object> rec = entry.getValue().getCurrent();
- Map<String, Object> newRec = new HashMap<>();
- newRec.putAll(rec);
- rs.addRecord(newRec);
- }
- }
- rs.setFinished(true);
- return;
- }
-
- Map<String, XSQLBluePrintNode> logicalNameToNode = new HashMap<>();
- Map<String, String> origNameToName = new HashMap<>();
- List<XSQLColumn> columnOrder = new ArrayList<>();
- int nextLogField = addNextLogicalField(sql, 0,
- logicalNameToNode, origNameToName,columnOrder);
- 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<String, JDBCResultSet> entry : rs.getSubQueries().entrySet()) {
- while (entry.getValue().next()) {
- Map<String, Object> rec = entry.getValue().getCurrent();
- Map<String, Object> newRec = new HashMap<>();
- for (Map.Entry<String, Object> 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<String, XSQLBluePrintNode> logicalNameToNode,
- Map<String, String> origNameToName, List<XSQLColumn> 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<XSQLColumn, List<XSQLCriteria>> tblCriteria = rs.getCriteria().get(
- col.getTableName());
- if (tblCriteria == null) {
- tblCriteria = new ConcurrentHashMap<>();
- rs.getCriteria().put(col.getTableName(), tblCriteria);
- }
- List<XSQLCriteria> 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);
- }
- }
- }
- }
-}
+++ /dev/null
-/*
- * 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<Integer, JDBCResultSet> 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> T unwrap(Class<T> 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
-
- }
-
-}
+++ /dev/null
-/*
- * 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<XSQL> ID = InstanceIdentifier.builder(XSQL.class).build();
- //public static final InstanceIdentifier<SalTest> 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;
- }
-}
+++ /dev/null
-/*
- * 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;
- }
-}
+++ /dev/null
-/*
-* 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 {
-
-}
+++ /dev/null
-<snapshot>
- <configuration>
- <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
- <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
- <module>
- <type xmlns:XSQL="http://netconfcentral.org/ns/XSQL">
- XSQL:XSQL
- </type>
- <name>XSQL</name>
- <data-broker>
- <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type>
- <name>binding-data-broker</name>
- </data-broker>
- <async-data-broker>
- <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-async-data-broker</type>
- <name>inmemory-data-broker</name>
- </async-data-broker>
- <schema-service>
- <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:schema-service</type>
- <name>yang-schema-service</name>
- </schema-service>
- </module>
- </modules>
- </data>
- </configuration>
- <required-capabilities>
- <capability>http://netconfcentral.org/ns/XSQL?module=XSQL&revision=2014-06-26</capability>
- </required-capabilities>
-</snapshot>
+++ /dev/null
-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 <saichler@cisco.com>";
- 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;
- }
- }
-
- }
-
- }
- }
-
-}
+++ /dev/null
-/*
- * 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<InputStream> streams = Collections.singletonList(getInputStream());
-
- try {
- return YangParserTestUtils.parseYangStreams(streams);
- } catch (ReactorException e) {
- throw new RuntimeException("Unable to build schema context from " + streams, e);
- }
- }
-}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.opendaylight.odlparent</groupId>
- <artifactId>bundle-parent</artifactId>
- <version>1.9.0-SNAPSHOT</version>
- <relativePath/>
- </parent>
-
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-karaf-xsql</artifactId>
- <version>1.6.0-SNAPSHOT</version>
- <packaging>bundle</packaging>
- <name>Apache Karaf :: Shell odl/xsql Commands</name>
-
- <description>Provides the OSGi odl commands</description>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>mdsal-artifacts</artifactId>
- <version>1.6.0-SNAPSHOT</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.karaf.shell</groupId>
- <artifactId>org.apache.karaf.shell.console</artifactId>
- <version>${karaf.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- <version>5.0.0</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-dom-xsql</artifactId>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
- <Export-Package>org.opendaylight.controller.xsql*;version=${project.version}</Export-Package>
- <Import-Package>!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,
- *</Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
+++ /dev/null
-/*
- * 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;
- }
-}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0">
-
- <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
- <command>
- <action class="org.opendaylight.controller.xsql.xsql">
- </action>
- </command>
- </command-bundle>
-</blueprint>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.opendaylight.odlparent</groupId>
- <artifactId>bundle-parent</artifactId>
- <version>1.9.0-SNAPSHOT</version>
- <relativePath/>
- </parent>
-
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-karaf4-xsql</artifactId>
- <version>1.6.0-SNAPSHOT</version>
- <packaging>bundle</packaging>
- <name>Apache Karaf :: Shell odl/xsql Commands</name>
-
- <description>Provides the OSGi odl commands</description>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>mdsal-artifacts</artifactId>
- <version>1.6.0-SNAPSHOT</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.karaf.shell</groupId>
- <artifactId>org.apache.karaf.shell.console</artifactId>
- <version>${karaf4.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- <version>5.0.0</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-dom-xsql</artifactId>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
- <Export-Package>org.opendaylight.controller.xsql*;version=${project.version}</Export-Package>
- <Import-Package>!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,
- *</Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
+++ /dev/null
-/*
- * 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;
- }
-}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0">
-
- <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
- <command>
- <action class="org.opendaylight.controller.xsql.xsql">
- </action>
- </command>
- </command-bundle>
-</blueprint>