Examples of PersistentConnectorClient


Examples of net.sourceforge.jivalo.cnfmgr.persistent.client.PersistentConnectorClient

    public Vector executeSqlQuery(String resourceName) throws Exception {
        String sqlString = getSqlString();
        PreparedStatementParameter[] parameters = getParameters();

        return new PersistentConnectorClient().executeSqlQuery(sqlString,
            parameters, resourceName);
    }
View Full Code Here

Examples of net.sourceforge.jivalo.cnfmgr.persistent.client.PersistentConnectorClient

    public Integer executeSql(String resourceName) throws Exception {
        String sqlString = getSqlString();
        PreparedStatementParameter[] parameters = getParameters();

        return new PersistentConnectorClient().executeSql(sqlString,
            parameters, resourceName);
    }
View Full Code Here

Examples of net.sourceforge.jivalo.cnfmgr.persistent.client.PersistentConnectorClient

            "WHERE CONFIG_PARAMETER_PARENT = ? AND CONFIG_PARAMETER_NAME = ? "
            + "AND CONFIG_PARAMETER_TYPE = ?";

        String[] names = split(nodeName);
        try {
            PersistentConnectorClient client = new PersistentConnectorClient();
            PreparedStatementParameter[] parameters = new
                PreparedStatementParameter[3];
            parameters[0] = new PreparedStatementParameter(names[0],
                Types.VARCHAR);
            parameters[1] = new PreparedStatementParameter(names[1],
                Types.VARCHAR);
            parameters[2] = new PreparedStatementParameter(
              ( isUserNode.booleanValue()? USER_TYPE_NODE : SYSTEM_TYPE_NODE ),
                Types.INTEGER);
            Vector v = client.executeSqlQuery(sql, parameters, resourceName);
            return new Boolean(v.size() > 0);
        }
        catch (Exception e) {
            throw new ConfigurationException(getClass().getName(),
                                             "Error in testing existence", e);
View Full Code Here

Examples of net.sourceforge.jivalo.cnfmgr.persistent.client.PersistentConnectorClient

            + "CONFIG_PARAMETER_NAME, CONFIG_PARAMETER_TYPE, "
            + "CONFIG_PARAMETER_DISPLAY_FLAG) VALUES (?, ?, ?, ?)";

        String[] names = split(nodeName);
        try {
            PersistentConnectorClient client = new PersistentConnectorClient();
            PreparedStatementParameter[] parameters = new
                PreparedStatementParameter[4];
            parameters[0] = new PreparedStatementParameter(names[0],
                Types.VARCHAR);
            parameters[1] = new PreparedStatementParameter(names[1],
                Types.VARCHAR);
            parameters[2] = new PreparedStatementParameter(
                ( isUserNode.booleanValue()? USER_TYPE_NODE : SYSTEM_TYPE_NODE ),
                Types.INTEGER);
            parameters[3] = new PreparedStatementParameter(Boolean.TRUE,
                Types.BOOLEAN);

            client.executeSql(insertName, parameters, resourceName);
        }
        catch (Exception e) {
            throw new ConfigurationException(getClass().getName(),
                                             "Error in storing node", e);
        }
View Full Code Here

Examples of net.sourceforge.jivalo.cnfmgr.persistent.client.PersistentConnectorClient

            + "CONFIG_PARAMETER_DISPLAY_FLAG) VALUES (?, ?, ?, ?)";

        boolean isRootNode = nodeName.equals("/");

        try {
            PersistentConnectorClient client = new PersistentConnectorClient();
            // to keep the foreign key happy
            Vector v = client.executeSqlQuery(selectNames,
                                              new PreparedStatementParameter[] {
                                              new
                                              PreparedStatementParameter(
                isRootNode ?
                EMPTY_STRING :
                nodeName, Types.VARCHAR),
                                              new PreparedStatementParameter(
                ( isUserNode.booleanValue()? USER_TYPE_NODE : SYSTEM_TYPE_NODE ), Types.INTEGER)
            }
                , resourceName);
            List orphans = new LinkedList();
            for (Iterator i = v.iterator(); i.hasNext(); ) {
                PreparedStatementResult result = (PreparedStatementResult) i.
                    next();
                String existingName = (String) result.get(
                    "CONFIG_PARAMETER_NAME");
                boolean exists = childrenNames.remove(existingName);
                if (!exists && ! (isRootNode && isEmptyString(existingName))) {
                    orphans.add(existingName);
                }
            }

            PreparedStatementParameter[] parameters2 = new
                PreparedStatementParameter[2];
            parameters2[0] = new PreparedStatementParameter(isRootNode ?
                EMPTY_STRING :
                nodeName, Types.VARCHAR);

            // inserts the new children names
            for (Iterator i = childrenNames.iterator(); i.hasNext(); ) {
                String childName = (String) i.next();
                client.executeSql(insertNames, new PreparedStatementParameter[] {
                                  new PreparedStatementParameter(isRootNode ?
                    EMPTY_STRING : nodeName, Types.VARCHAR),
                                  new PreparedStatementParameter(childName,
                    Types.VARCHAR),
                                  new PreparedStatementParameter(
View Full Code Here

Examples of net.sourceforge.jivalo.cnfmgr.persistent.client.PersistentConnectorClient

            "INSERT INTO CONFIG_PARAMETER_VALUE_TBL (CONFIG_PARAMETER_PARENT, "
            + "CONFIG_PARAMETER_NAME, CONFIG_PARAMETER_VALUE, CONFIG_PARAMETER_START_DATE) "
            + "VALUES (?, ?, ?, ?)";

        try {
            PersistentConnectorClient client = new PersistentConnectorClient();

            client.executeSql(deleteValuesFromKey,
                              new PreparedStatementParameter[] {
                              new PreparedStatementParameter(nodeName,
                Types.VARCHAR),
                              new PreparedStatementParameter(
                ( isUserNode.booleanValue()? USER_TYPE_NODE : SYSTEM_TYPE_NODE ),
                Types.INTEGER)
            }
                , resourceName);
            client.executeSql(deleteValuesFromValue,
                              new PreparedStatementParameter[] {
                              new PreparedStatementParameter(nodeName,
                Types.VARCHAR)
            }
                , resourceName);

            for (Iterator i = entries.keySet().iterator(); i.hasNext(); ) {
                String key = (String) i.next();
                String value = (String) entries.get(key);
                String timestamp = null;
                Timestamp ts = null;
                if (key.indexOf(" <<") != -1) {
                  timestamp = key.substring(key.indexOf(" <<") + 3);
                  key = key.substring(0, key.indexOf(" <<"));
                  if (timestamp.indexOf(">>") != -1) {
                    timestamp = timestamp.substring(0, timestamp.indexOf(">>"));
                  }
                }
              if (timestamp != null) {
                try {
                  ts = convertStringToTimestamp(timestamp);
                }
                catch (Throwable th) {
                  ts = new Timestamp(System.currentTimeMillis());
                }
              }
              else {
                ts = new Timestamp(System.currentTimeMillis());
              }
                // fix for oracle empty string problem
                if (key.length() == 0) {
                    key = EMPTY_STRING;
                }
                if (value.length() == 0) {
                    value = EMPTY_STRING;
                }

                try {
                  client.executeSql(insertValuesToKey, new PreparedStatementParameter[] {
                                    new PreparedStatementParameter(nodeName,
                      Types.VARCHAR),
                                    new PreparedStatementParameter(key,
                      Types.VARCHAR),
                                    new PreparedStatementParameter(new Integer(2),
                      Types.INTEGER),
                                    new PreparedStatementParameter(Boolean.TRUE,
                      Types.BOOLEAN)
                  }, resourceName);
                }
                catch (Exception ex) {
                  // dublicate key possible
                }
               
                client.executeSql(insertValuesToValue, new PreparedStatementParameter[] {
                    new PreparedStatementParameter(nodeName, Types.VARCHAR),
                    new PreparedStatementParameter(key, Types.VARCHAR),
                    new PreparedStatementParameter(value, Types.VARCHAR),
                    new PreparedStatementParameter(ts, Types.TIMESTAMP)
                }, resourceName);
View Full Code Here

Examples of net.sourceforge.jivalo.cnfmgr.persistent.client.PersistentConnectorClient

      aCalendar.setLenient(false);
      return aCalendar;
    }

    public void refreshDataSources() throws BaseException {
      PersistentConnectorClient client = new PersistentConnectorClient();
      client.refreshDataSources();
    }
View Full Code Here

Examples of net.sourceforge.jivalo.cnfmgr.persistent.client.PersistentConnectorClient

            + "WHERE CONFIG_PARAMETER_PARENT = ? AND CONFIG_PARAMETER_TYPE = ?";

        boolean isRootNode = nodeName.equals("/");

        try {
            PersistentConnectorClient client = new PersistentConnectorClient();
            PreparedStatementParameter[] parameters = new
                PreparedStatementParameter[2];
            parameters[0] = new PreparedStatementParameter(isRootNode ?
                EMPTY_STRING : nodeName, Types.VARCHAR);
            parameters[1] = new PreparedStatementParameter(
                ( isUserNode.booleanValue()? USER_TYPE_NODE : SYSTEM_TYPE_NODE ),
                Types.INTEGER);

            Vector v = client.executeSqlQuery(sql, parameters, resourceName);
            Set childrenNames = new HashSet(v.size());
            for (Iterator i = v.iterator(); i.hasNext(); ) {
                PreparedStatementResult result = (PreparedStatementResult) i.
                    next();
                String name = (String) result.get("CONFIG_PARAMETER_NAME");
View Full Code Here

Examples of net.sourceforge.jivalo.cnfmgr.persistent.client.PersistentConnectorClient

            "WHERE CONFIG_PARAMETER_PARENT = ? AND CONFIG_PARAMETER_NAME = ? "
            + "AND CONFIG_PARAMETER_TYPE = ?";

        String[] names = split(nodeName);
        try {
            PersistentConnectorClient client = new PersistentConnectorClient();
            client.executeSql(deleteValuesFromValue,
                              new PreparedStatementParameter[] {
                              new PreparedStatementParameter(nodeName,
                Types.VARCHAR)
            }
                , resourceName);
            client.executeSql(deleteValuesFromKey,
                              new PreparedStatementParameter[] {
                              new PreparedStatementParameter(nodeName,
                Types.VARCHAR),
                              new PreparedStatementParameter(
               ( isUserNode.booleanValue()? USER_TYPE_NODE : SYSTEM_TYPE_NODE ),
                Types.INTEGER)
            }
                , resourceName);
            client.executeSql(deleteNode, new PreparedStatementParameter[] {
                              new PreparedStatementParameter(names[0],
                Types.VARCHAR),
                              new PreparedStatementParameter(names[1],
                Types.VARCHAR),
                              new PreparedStatementParameter(
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.