Package com.volantis.mcs.repository.jdbc

Examples of com.volantis.mcs.repository.jdbc.JDBCRepositoryConnection


        hypersonicMgr.useCleanupWith(new Executor() {
            public void execute() throws Exception {

                InternalJDBCRepository repository = createRepository(
                        hypersonicMgr.getSource(), null, "#dp");
                JDBCRepositoryConnection connection =
                        (JDBCRepositoryConnection) repository.connect();
                JDBCDeviceRepositoryAccessor accessor =
                        new JDBCDeviceRepositoryAccessor(repository, location);

                Connection conn = connection.getConnection();
                createTables(conn);

                DefaultPolicyDescriptor descriptor =
                        new DefaultPolicyDescriptor();
                descriptor.setCategory("category");
                PolicyType type = new DefaultRangePolicyType(1, 100);
                descriptor.setPolicyType(type);
                accessor.addPolicyDescriptor(connection, "range", descriptor);

                // Check the database contents
                checkPolicyTypeRow(conn, null, "range", 0, 0);
                checkTypesRow(conn, null, 0, 3);
                checkCategoryRow(conn, null, 0, "category");
                checkTypesRangeRow(conn, null, 0, 1, 100);

                connection.disconnect();
                repository.terminate();
            }
        });
    }
View Full Code Here


        hypersonicMgr.useCleanupWith(new Executor() {
            public void execute() throws Exception {

                InternalJDBCRepository repository = createRepository(
                        hypersonicMgr.getSource(), null, "#dp");
                JDBCRepositoryConnection connection =
                        (JDBCRepositoryConnection) repository.connect();
                JDBCDeviceRepositoryAccessor accessor =
                        new JDBCDeviceRepositoryAccessor(repository, location);

                Connection conn = connection.getConnection();
                createTables(conn);

                DefaultPolicyDescriptor descriptor =
                        new DefaultPolicyDescriptor();
                descriptor.setCategory("category");
                descriptor.setPolicyType(new DefaultRangePolicyType(3, 4));
                accessor.addPolicyDescriptor(connection, "range", descriptor);
                accessor.removePolicyDescriptor(connection, "range");

                // Check the database contents are empty
                checkAllEmpty(conn);

                connection.disconnect();
                repository.terminate();
            }
        });
    }
View Full Code Here

        hypersonicMgr.useCleanupWith(new Executor() {
            public void execute() throws Exception {

                InternalJDBCRepository repository = createRepository(
                        hypersonicMgr.getSource(), null, "#dp");
                JDBCRepositoryConnection connection =
                        (JDBCRepositoryConnection) repository.connect();
                JDBCDeviceRepositoryAccessor accessor =
                        new JDBCDeviceRepositoryAccessor(repository, location);

                Connection conn = connection.getConnection();
                createTables(conn);

                DefaultPolicyDescriptor descriptor =
                        new DefaultPolicyDescriptor();
                descriptor.setCategory("category");
                DefaultStructurePolicyType type =
                        new DefaultStructurePolicyType();
                type.addFieldType("f1", new DefaultBooleanPolicyType());
                type.addFieldType("f2", new DefaultRangePolicyType(2, 99));
                type.complete();
                descriptor.setPolicyType(type);
                accessor.addPolicyDescriptor(connection, "structure", descriptor);

                // Check the database contents
                checkCategoryRow(conn, null, 0, "category");
                checkPolicyTypeRow(conn, null, "structure", 0, 0);
                checkTypesRow(conn, "TYPE_INSTANCE_ID=0", 0, 7);
                // structure row and dependent boolean type
                checkTypesStructureRow(conn, "FIELDNAME='f1'", 0, "f1", 1);
                checkTypesRow(conn, "TYPE_INSTANCE_ID=1", 1, 0);
                // structure row and dependent range type
                checkTypesStructureRow(conn, "FIELDNAME='f2'", 0, "f2", 2);
                checkTypesRow(conn, "TYPE_INSTANCE_ID=2", 2, 3);
                checkTypesRangeRow(conn, null, 2, 2, 99);

                connection.disconnect();
                repository.terminate();
            }
        });
    }
View Full Code Here

        hypersonicMgr.useCleanupWith(new Executor() {
            public void execute() throws Exception {

                InternalJDBCRepository repository = createRepository(
                        hypersonicMgr.getSource(), null, "#dp");
                JDBCRepositoryConnection connection =
                        (JDBCRepositoryConnection) repository.connect();
                JDBCDeviceRepositoryAccessor accessor =
                        new JDBCDeviceRepositoryAccessor(repository, location);

                Connection conn = connection.getConnection();
                createTables(conn);

                DefaultPolicyDescriptor descriptor =
                        new DefaultPolicyDescriptor();
                descriptor.setCategory("category");
                DefaultStructurePolicyType structure =
                        new DefaultStructurePolicyType();
                structure.addFieldType("f1", new DefaultBooleanPolicyType());
                structure.addFieldType("f2", new DefaultIntPolicyType());
                structure.complete();
                descriptor.setPolicyType(structure);
                accessor.addPolicyDescriptor(connection, "structure", descriptor);
                accessor.removePolicyDescriptor(connection, "structure");

                // Check the database contents are empty
                checkAllEmpty(conn);

                connection.disconnect();
                repository.terminate();
            }
        });
    }
View Full Code Here

        hypersonicMgr.useCleanupWith(new Executor() {
            public void execute() throws Exception {

                InternalJDBCRepository repository = createRepository(
                        hypersonicMgr.getSource(), null, "#dp");
                JDBCRepositoryConnection connection =
                        (JDBCRepositoryConnection) repository.connect();
                JDBCDeviceRepositoryAccessor accessor =
                        new JDBCDeviceRepositoryAccessor(repository, location);

                Connection conn = connection.getConnection();
                createTables(conn);

                DefaultPolicyDescriptor descriptor =
                        new DefaultPolicyDescriptor();
                descriptor.setCategory("category");
                DefaultOrderedSetPolicyType type =
                        new DefaultOrderedSetPolicyType(
                                new DefaultBooleanPolicyType());
                descriptor.setPolicyType(type);
                accessor.addPolicyDescriptor(connection, "oset", descriptor);

                // Check the database contents
                checkCategoryRow(conn, null, 0, "category");
                checkPolicyTypeRow(conn, null, "oset", 0, 0);
                checkTypesRow(conn, "TYPE_INSTANCE_ID=0", 0, 5);
                // set row and dependent boolean type
                checkTypesSetRow(conn, null, 0, 1, true);
                checkTypesRow(conn, "TYPE_INSTANCE_ID=1", 1, 0);

                connection.disconnect();
                repository.terminate();
            }
        });
    }
View Full Code Here

  public
  RepositoryEnumeration enumerateDevicePatterns (RepositoryConnection connection)
    throws RepositoryException {

    // Cast the repository connection to a JDBC Connection.
    JDBCRepositoryConnection jdbcConnection
      = (JDBCRepositoryConnection) connection;

    // Get the java.sql.Connection out of the JDBC Connection.
    Connection sqlConnection = jdbcConnection.getConnection ();

    Statement stmt = null;
    ResultSet rs = null;
    try {
      stmt = sqlConnection.createStatement ();
View Full Code Here

    PreparedStatement pstmt = null;

    // Resolve field names

    // Cast the repository connection to a JDBC Connection.
    JDBCRepositoryConnection jdbcConnection
        = (JDBCRepositoryConnection) connection;

    String projectField = resolveFieldName(jdbcConnection, PROJECT_COLUMN_NAMES);
    String nameField = resolveFieldName(jdbcConnection, NAME_COLUMN_NAMES);
    String policyField = resolveFieldName(jdbcConnection, POLICY_COLUMN_NAMES);
View Full Code Here

    Connection sqlConnection = ((JDBCRepositoryConnection) connection).
        getConnection ();

    String projectName = getProjectName();

    JDBCRepositoryConnection jdbcConnection
        = (JDBCRepositoryConnection) connection;

    String projectQuoted = JDBCAccessorHelper.quoteValue(projectName);
    String deviceQuoted = JDBCAccessorHelper.quoteValue(deviceName);
View Full Code Here

    // Cast the repository connection to a JDBC Connection in
    // order to get the java.sql.Connection out.
    Connection sqlConnection = ((JDBCRepositoryConnection) connection).
        getConnection ();

    JDBCRepositoryConnection jdbcConnection
        = (JDBCRepositoryConnection) connection;

    String projectName = getProjectName();
    String projectQuoted = JDBCAccessorHelper.quoteValue(projectName);
    String deviceQuoted = JDBCAccessorHelper.quoteValue(deviceName);
View Full Code Here

      throws RepositoryException {

    Connection sqlConnection = ((JDBCRepositoryConnection) connection).
        getConnection ();

    JDBCRepositoryConnection jdbcConnection
        = (JDBCRepositoryConnection) connection;

    String projectName = getProjectName();

    Statement stmt = null;
View Full Code Here

TOP

Related Classes of com.volantis.mcs.repository.jdbc.JDBCRepositoryConnection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.