示例#1
0
 static Object replaceInvalidCharacters(
     EdmSimpleType expectedType, Object value, String invalidCharacterReplacement) {
   if (expectedType != EdmSimpleType.STRING || invalidCharacterReplacement == null) {
     return value;
   }
   if (value instanceof Character) {
     value = value.toString();
   }
   String s = (String) value;
   StringBuilder result = null;
   for (int i = 0; i < s.length(); i++) {
     char c = s.charAt(i);
     if (c <= 0x0020 && c != ' ' && c != '\n' && c != '\t' && c != '\r') {
       if (result == null) {
         result = new StringBuilder();
         result.append(s.substring(0, i));
       }
       result.append(invalidCharacterReplacement);
     } else if (result != null) {
       result.append(c);
     }
   }
   if (result == null) {
     return value;
   }
   return result.toString();
 }
示例#2
0
 public LocalClient(String vdbName, int vdbVersion, Properties props) {
   this.vdbName = vdbName;
   this.vdbVersion = vdbVersion;
   this.batchSize =
       PropertiesUtils.getIntProperty(
           props, BATCH_SIZE, BufferManagerImpl.DEFAULT_PROCESSOR_BATCH_SIZE);
   this.cacheTime = PropertiesUtils.getLongProperty(props, SKIPTOKEN_TIME, 300000L);
   this.invalidCharacterReplacement = props.getProperty(INVALID_CHARACTER_REPLACEMENT);
   StringBuilder sb = new StringBuilder();
   sb.append("jdbc:teiid:")
       .append(this.vdbName)
       .append(".")
       .append(this.vdbVersion)
       .append(";"); // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
   this.initProperties = props;
   if (this.initProperties.getProperty(TeiidURL.CONNECTION.PASSTHROUGH_AUTHENTICATION) == null) {
     this.initProperties.put(
         TeiidURL.CONNECTION.PASSTHROUGH_AUTHENTICATION, "true"); // $NON-NLS-1$
   }
   if (this.initProperties.getProperty(EmbeddedProfile.TRANSPORT_NAME) == null) {
     this.initProperties.setProperty(EmbeddedProfile.TRANSPORT_NAME, "odata");
   }
   if (this.initProperties.getProperty(EmbeddedProfile.WAIT_FOR_LOAD) == null) {
     this.initProperties.put(EmbeddedProfile.WAIT_FOR_LOAD, "0"); // $NON-NLS-1$
   }
   this.connectionString = sb.toString();
 }