Examples of DriverPropertyInfo


Examples of java.sql.DriverPropertyInfo

    protected DriverPropertyInfo[] getPropertyInfo(Properties connProps, List<DriverPropertyInfo> baseDriverProps) {
        DriverPropertyInfo[] driverProps = new DriverPropertyInfo[10 + baseDriverProps.size()];
        this.copyBaseProperties(driverProps, baseDriverProps, 10);

        // Query Endpoint parameter
        driverProps[0] = new DriverPropertyInfo(PARAM_QUERY_ENDPOINT, connProps.getProperty(PARAM_QUERY_ENDPOINT));
        driverProps[0].required = !connProps.containsKey(PARAM_UPDATE_ENDPOINT);
        driverProps[0].description = "Sets the SPARQL Query endpoint to use for query operations, if this is specified and "
                + PARAM_UPDATE_ENDPOINT + " is not then a read-only connection will be created";

        // Update Endpoint parameter
        driverProps[1] = new DriverPropertyInfo(PARAM_UPDATE_ENDPOINT, connProps.getProperty(PARAM_UPDATE_ENDPOINT));
        driverProps[1].required = !connProps.containsKey(PARAM_UPDATE_ENDPOINT);
        driverProps[1].description = "Sets the SPARQL Update endpoint to use for update operations, if this is specified and "
                + PARAM_QUERY_ENDPOINT + " is not then a write-only connection will be created";

        // Default Graph parameter
        driverProps[2] = new DriverPropertyInfo(PARAM_DEFAULT_GRAPH_URI, null);
        driverProps[2].required = false;
        driverProps[2].description = "Sets the URI for a default graph for queries, may be specified multiple times to specify multiple graphs which should form the default graph";

        // Named Graph parameter
        driverProps[3] = new DriverPropertyInfo(PARAM_NAMED_GRAPH_URI, null);
        driverProps[3].required = false;
        driverProps[3].description = "Sets the URI for a named graph for queries, may be specified multiple times to specify multiple named graphs which should be accessible";

        // Using Graph parameter
        driverProps[4] = new DriverPropertyInfo(PARAM_USING_GRAPH_URI, null);
        driverProps[4].required = false;
        driverProps[4].description = "Sets the URI for a default graph for updates, may be specified multiple times to specify multiple graphs which should form the default graph";

        // Using Named Graph parameter
        driverProps[5] = new DriverPropertyInfo(PARAM_USING_NAMED_GRAPH_URI, null);
        driverProps[5].required = false;
        driverProps[5].description = "Sets the URI for a named graph for updates, may be specified multiple times to specify multiple named graph which should be accessible";

        // Results Types
        driverProps[6] = new DriverPropertyInfo(PARAM_SELECT_RESULTS_TYPE, connProps.getProperty(PARAM_SELECT_RESULTS_TYPE));
        driverProps[6].required = false;
        driverProps[6].description = "Sets the results type for SELECT queries that will be requested from the remote endpoint";
        driverProps[7] = new DriverPropertyInfo(PARAM_MODEL_RESULTS_TYPE, connProps.getProperty(PARAM_MODEL_RESULTS_TYPE));
        driverProps[7].required = false;
        driverProps[7].description = "Sets the results type for CONSTRUCT and DESCRIBE queries that will be requested from the remote endpoint";

        // User Name parameter
        driverProps[8] = new DriverPropertyInfo(PARAM_USERNAME, connProps.getProperty(PARAM_USERNAME));

        // Password parameter
        driverProps[9] = new DriverPropertyInfo(PARAM_PASSWORD, connProps.getProperty(PARAM_PASSWORD));

        return driverProps;
    }
View Full Code Here

Examples of java.sql.DriverPropertyInfo

        DriverPropertyInfo[] driverProps;
        if (connProps.containsKey(PARAM_DATASET) || !this.isTrue(connProps, PARAM_EMPTY)) {
            driverProps = new DriverPropertyInfo[1 + baseDriverProps.size()];

            // Dataset parameter
            driverProps[0] = new DriverPropertyInfo(PARAM_DATASET, connProps.getProperty(PARAM_DATASET));
            driverProps[0].required = true;
            driverProps[0].description = "Sets a path to a file that should be read in to form an in-memory dataset";

            this.copyBaseProperties(driverProps, baseDriverProps, 1);
        } else if (connProps.containsKey(PARAM_EMPTY)) {
            driverProps = new DriverPropertyInfo[1 + baseDriverProps.size()];

            // Empty parameter
            driverProps[0] = new DriverPropertyInfo(PARAM_EMPTY, connProps.getProperty(PARAM_EMPTY));
            driverProps[0].required = true;
            driverProps[0].choices = new String[] { "true", "false" };
            driverProps[0].description = "Sets that the driver will use an empty in-memory dataset as the initial dataset, when set to true the "
                    + PARAM_DATASET + " parameter is not required";

            this.copyBaseProperties(driverProps, baseDriverProps, 1);
        } else {
            driverProps = new DriverPropertyInfo[2 + baseDriverProps.size()];

            // Dataset parameter
            driverProps[0] = new DriverPropertyInfo(PARAM_DATASET, connProps.getProperty(PARAM_DATASET));
            driverProps[0].required = true;
            driverProps[0].description = "Sets a path to a file that should be read in to form an in-memory dataset";

            // Empty parameter
            driverProps[1] = new DriverPropertyInfo(PARAM_EMPTY, connProps.getProperty(PARAM_EMPTY));
            driverProps[1].required = false;
            driverProps[1].choices = new String[] { "true", "false" };
            driverProps[1].description = "Sets that the driver will use an empty in-memory dataset as the initial dataset, when set to true the "
                    + PARAM_DATASET + " parameter is not required";
View Full Code Here

Examples of java.sql.DriverPropertyInfo

        // Create base driver properties
        List<DriverPropertyInfo> baseProps = new ArrayList<DriverPropertyInfo>();

        // JDBC compatibility level
        DriverPropertyInfo jdbcCompatLevel = new DriverPropertyInfo(PARAM_JDBC_COMPATIBILITY, ps.getProperty(
                PARAM_JDBC_COMPATIBILITY, Integer.toString(JdbcCompatibility.DEFAULT)));
        jdbcCompatLevel.description = "Configures how compatible the driver will attempt to be with JDBC, primarily affects reported column types for result sets";
        jdbcCompatLevel.required = false;
        String[] choices = new String[9];
        for (int i = 0; i < choices.length; i++) {
            choices[i] = Integer.toString(i + 1);
        }
        jdbcCompatLevel.choices = choices;
        baseProps.add(jdbcCompatLevel);

        // Pre-processors
        DriverPropertyInfo preProcessor = new DriverPropertyInfo(PARAM_PRE_PROCESSOR, StrUtils.strjoin(",",
                this.getValues(ps, PARAM_PRE_PROCESSOR)));
        preProcessor.description = "Configures pre-processors which are used to amend SPARQL text, queries or updates before these are passed to the underlying SPARQL engine, multiple fully qualified class names may be specified";
        preProcessor.required = false;
        baseProps.add(preProcessor);

        // Logging config
        DriverPropertyInfo logging = new DriverPropertyInfo(PARAM_LOGGING, ps.getProperty(PARAM_LOGGING));
        logging.description = "Sets the path to a log4j properties file for configuring logging, the file system is considered first and then the classpath.  If not set defaults to log4j.properties";
        logging.required = false;
        baseProps.add(logging);

        // Have the derived implementation create the final property information
View Full Code Here

Examples of java.sql.DriverPropertyInfo

                                boolean found = false;
                                String messageKey = Messages.get(key);

                                DriverPropertyInfo[] infoArray = new Driver().getPropertyInfo(url, properties);
                                for (int i = 0; i < infoArray.length; i++) {
                                    DriverPropertyInfo info = infoArray[i];
                                    if (info.name.equals(messageKey)) {
                                        assertEquals(message, expected, info.value);
                                        found = true;
                                    }
                                }
View Full Code Here

Examples of java.sql.DriverPropertyInfo

                "Description list size (expected) does not equal DriverPropertyInfo array length (actual)",
                descriptionMap.size(), infoMap.keySet().size());

        for (Iterator iterator = propertyMap.keySet().iterator(); iterator.hasNext();) {
            final String key = (String) iterator.next();
            final DriverPropertyInfo driverPropertyInfo =
                    (DriverPropertyInfo) infoMap.get(propertyMap.get(key));
            assertNotNull("No DriverPropertyInfo object exists for property '" + key + "'", driverPropertyInfo);
            assertEquals(
                    "Property description (expected) does not match DriverPropertyInfo description (actual)",
                    descriptionMap.get(key), driverPropertyInfo.description);
View Full Code Here

Examples of java.sql.DriverPropertyInfo

        loadDriverPropertyInfoMap(infoMap);

        final Iterator iterator = infoMap.keySet().iterator();
        while (iterator.hasNext()) {
            String key = (String) iterator.next();
            DriverPropertyInfo info = (DriverPropertyInfo) infoMap.get(key);
            if (expectedChoicesMap.containsKey(key)) {
                assertEquals("Choices did not match for key " + key,
                             ((String[]) expectedChoicesMap.get(key)), info.choices);
            }
            else {
View Full Code Here

Examples of java.sql.DriverPropertyInfo

        loadDriverPropertyInfoMap(infoMap);

        final Iterator iterator = infoMap.keySet().iterator();
        while (iterator.hasNext()) {
            String key = (String) iterator.next();
            DriverPropertyInfo info = (DriverPropertyInfo) infoMap.get(key);
            if (requiredTrueMap.containsKey(key)) {
                assertTrue("The 'required' field is not true for key " + key, info.required);
            }
            else {
                assertFalse("The 'required' field is not false for key " + key, info.required);
View Full Code Here

Examples of java.sql.DriverPropertyInfo

    private void loadDriverPropertyInfoMap(final Map driverPropertyInfoMap) {
        try {
            final DriverPropertyInfo[] driverPropertyInfoArray = new Driver().getPropertyInfo(
                                "jdbc:jtds:sqlserver://servername/databasename", new Properties());
            for (int i = 0; i < driverPropertyInfoArray.length; i++) {
                DriverPropertyInfo driverPropertyInfo = driverPropertyInfoArray[i];
                driverPropertyInfoMap.put(driverPropertyInfo.name, driverPropertyInfo);
            }
        }
        catch (SQLException e) {
            throw new RuntimeException(e.getMessage());
View Full Code Here

Examples of java.sql.DriverPropertyInfo

    ConnectionUtil.ConnectionSpecifier spec = ConnectionUtil.parseURL(url);
    if (spec == null)
      spec = new ConnectionUtil.ConnectionSpecifier();

    if (spec.getDatabase() == null || spec.getDatabase().isEmpty())
      propInfo.add(new DriverPropertyInfo("database", ""));

    if (spec.getParameters().get("username") == null || spec.getParameters().get("username").toString().isEmpty())
      propInfo.add(new DriverPropertyInfo("username", ""));

    if (spec.getParameters().get("password") == null || spec.getParameters().get("password").toString().isEmpty())
      propInfo.add(new DriverPropertyInfo("password", ""));

    return propInfo.toArray(new DriverPropertyInfo[propInfo.size()]);
  }
View Full Code Here

Examples of java.sql.DriverPropertyInfo

                                                                connStringSecretAttributes.length];
     
      int attrIndex = 0;
      for( int i = 0; i < connStringAttributes.length; i++, attrIndex++ )
      {
        optionsNoDB[attrIndex] = new DriverPropertyInfo(connStringAttributes[i][0],
                    finfo.getProperty(connStringAttributes[i][0]));
        optionsNoDB[attrIndex].description = MessageService.getTextMessage(connStringAttributes[i][1]);
      }

      optionsNoDB[0].choices = Monitor.getMonitor().getServiceList(Property.DATABASE_MODULE);
      // since database name is not stored in FormatableProperties, we
      // assign here explicitly
      optionsNoDB[0].value = dbname;

      for( int i = 0; i < connStringSecretAttributes.length; i++, attrIndex++ )
      {
        optionsNoDB[attrIndex] = new DriverPropertyInfo(connStringSecretAttributes[i][0],
                    (finfo.getProperty(connStringSecretAttributes[i][0]) == null? "" : "****"));
        optionsNoDB[attrIndex].description = MessageService.getTextMessage(connStringSecretAttributes[i][1]);
      }

      for( int i = 0; i < connBooleanAttributes.length; i++, attrIndex++ )
      {
        optionsNoDB[attrIndex] = new DriverPropertyInfo(connBooleanAttributes[i][0],
                   Boolean.valueOf(finfo == null? "" : finfo.getProperty(connBooleanAttributes[i][0])).toString());
        optionsNoDB[attrIndex].description = MessageService.getTextMessage(connBooleanAttributes[i][1]);
        optionsNoDB[attrIndex].choices = BOOLEAN_CHOICES;       
      }

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.