Exemplo n.º 1
0
  public SqlManager getSqlManager(DatabaseConnValueContext dbcvc)
      throws DataModelException, InvocationTargetException, InstantiationException,
          IllegalAccessException, IOException, NoSuchMethodException {
    SqlManager result = null;
    if (sourceId != null) {
      SqlManagerComponent component = null;

      String sourceIdText = sourceId.getTextValue(dbcvc);
      if (sourceIdText == null)
        throw new RuntimeException("sourceId returned null text value in " + this);

      if (sourceIdText.startsWith("r ")) {
        String resourceId = sourceIdText.substring(2);
        component =
            (SqlManagerComponent)
                XdmComponentFactory.get(
                    SqlManagerComponent.class,
                    new Resource(QueryResultsValueSource.class, resourceId),
                    XdmComponentFactory.XDMCOMPFLAGS_DEFAULT);
      } else
        component =
            (SqlManagerComponent)
                XdmComponentFactory.get(
                    SqlManagerComponent.class,
                    new File(sourceIdText),
                    XdmComponentFactory.XDMCOMPFLAGS_DEFAULT);
      result = component.getManager();
    } else result = dbcvc.getSqlManager();

    return result;
  }
Exemplo n.º 2
0
  protected void setUp() throws Exception {
    super.setUp();

    component =
        (SqlManagerComponent)
            XdmComponentFactory.get(
                SqlManagerComponent.class,
                new Resource(SchemaTableTest.class, RESOURCE_NAME),
                XdmComponentFactory.XDMCOMPFLAGS_DEFAULT);
    assertNotNull(component);

    schema = component.getManager().getSchema("local");
    assertNotNull(schema);

    populatedSchema = component.getManager().getSchema("db");
    assertNotNull(populatedSchema);

    // TestUtils.getConnProvider(this.getClass().getPackage().getName(), false, false);
    // TestUtils.getConnProvider(this.getClass().getPackage().getName(), true, true);
  }