Examples of EncodedResource


Examples of org.springframework.core.io.support.EncodedResource

  protected void executeSqlScript(String sqlResourcePath, boolean continueOnError) throws DataAccessException {
    if (logger.isInfoEnabled()) {
      logger.info("Executing SQL script '" + sqlResourcePath + "'");
    }

    EncodedResource resource =
        new EncodedResource(getApplicationContext().getResource(sqlResourcePath), this.sqlScriptEncoding);
    long startTime = System.currentTimeMillis();
    List statements = new LinkedList();
    try {
      LineNumberReader lnr = new LineNumberReader(resource.getReader());
      String script = JdbcTestUtils.readScript(lnr);
      char delimiter = ';';
      if (!JdbcTestUtils.containsSqlScriptDelimiters(script, delimiter)) {
        delimiter = '\n';
      }
View Full Code Here

Examples of org.springframework.core.io.support.EncodedResource

   * @return the number of bean definitions found
   * @throws BeanDefinitionStoreException in case of loading or parsing errors
   * @see #loadBeanDefinitions(org.springframework.core.io.Resource, String)
   */
  public int loadBeanDefinitions(Resource resource) throws BeanDefinitionStoreException {
    return loadBeanDefinitions(new EncodedResource(resource), null);
  }
View Full Code Here

Examples of org.springframework.core.io.support.EncodedResource

   * (can be empty or <code>null</code>)
   * @return the number of bean definitions found
   * @throws BeanDefinitionStoreException in case of loading or parsing errors
   */
  public int loadBeanDefinitions(Resource resource, String prefix) throws BeanDefinitionStoreException {
    return loadBeanDefinitions(new EncodedResource(resource), prefix);
  }
View Full Code Here

Examples of org.springframework.core.io.support.EncodedResource

  protected void executeSqlScript(String sqlResourcePath, boolean continueOnError) throws DataAccessException {
    if (logger.isInfoEnabled()) {
      logger.info("Executing SQL script '" + sqlResourcePath + "'");
    }

    EncodedResource resource =
        new EncodedResource(getApplicationContext().getResource(sqlResourcePath), this.sqlScriptEncoding);
    long startTime = System.currentTimeMillis();
    List statements = new LinkedList();
    try {
      LineNumberReader lnr = new LineNumberReader(resource.getReader());
      String script = JdbcTestUtils.readScript(lnr);
      char delimiter = ';';
      if (!JdbcTestUtils.containsSqlScriptDelimiters(script, delimiter)) {
        delimiter = '\n';
      }
View Full Code Here

Examples of org.springframework.core.io.support.EncodedResource

   * and continueOnError was <code>false</code>
   */
  protected void executeSqlScript(String sqlResourcePath, boolean continueOnError) throws DataAccessException {

    Resource resource = this.applicationContext.getResource(sqlResourcePath);
    SimpleJdbcTestUtils.executeSqlScript(this.simpleJdbcTemplate, new EncodedResource(resource,
      this.sqlScriptEncoding), continueOnError);
  }
View Full Code Here

Examples of org.springframework.core.io.support.EncodedResource

   * @throws DataAccessException if there is an error executing a statement
   * and continueOnError was <code>false</code>
   */
  protected void executeSqlScript(String sqlResourcePath, boolean continueOnError) throws DataAccessException {
    Resource resource = this.applicationContext.getResource(sqlResourcePath);
    SimpleJdbcTestUtils.executeSqlScript(this.simpleJdbcTemplate, new EncodedResource(resource,
      this.sqlScriptEncoding), continueOnError);
  }
View Full Code Here

Examples of org.springframework.core.io.support.EncodedResource

  private EncodedResource applyEncodingIfNecessary(Resource script) {
    if (script instanceof EncodedResource) {
      return (EncodedResource) script;
    }
    else {
      return new EncodedResource(script, this.sqlScriptEncoding);
    }
  }
View Full Code Here

Examples of org.springframework.core.io.support.EncodedResource

  protected void executeSqlScript(String sqlResourcePath, boolean continueOnError)
      throws DataAccessException {

    Resource resource = this.applicationContext.getResource(sqlResourcePath);
    SimpleJdbcTestUtils.executeSqlScript(
        this.simpleJdbcTemplate, new EncodedResource(resource, this.sqlScriptEncoding), continueOnError);
  }
View Full Code Here

Examples of org.springframework.core.io.support.EncodedResource

  Document loadDocument(Resource resource) {

    Assert.notNull(resource);

    EncodedResource encodedResource = new EncodedResource(resource, "UTF-8");

    InputStream inputStream = null;
    try {
      // this will throw an IOException if the stream cannot be opened
      inputStream = encodedResource.getResource().getInputStream();
    }
    catch (IOException e) {
      throw new ConfigurationException(
          "Could not load module definition, as unable to obtain input stream for resource "
              + encodedResource.getResource(), e);
    }

    Document document = null;

    DefaultDocumentLoader loader = new DefaultDocumentLoader();
    try {
      InputSource inputSource = new InputSource(inputStream);
      inputSource.setEncoding(encodedResource.getEncoding());
      document = loader.loadDocument(inputSource, null, new SimpleSaxErrorHandler(logger),
          XmlBeanDefinitionReader.VALIDATION_NONE, false);
    }
    catch (Exception e) {
      throw new ConfigurationException("Unable to load XML module definition document from resource "
          + encodedResource.getResource(), e);
    }
    finally {
      try {
        if (inputStream != null)
          inputStream.close();
View Full Code Here

Examples of org.springframework.core.io.support.EncodedResource

   * @param resource the resource descriptor for the XML file
   * @return the number of bean definitions found
   * @throws BeanDefinitionStoreException in case of loading or parsing errors
   */
  public int loadBeanDefinitions(Resource resource) throws BeanDefinitionStoreException {
    return loadBeanDefinitions(new EncodedResource(resource));
  }
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.