Package org.springframework.core.io

Examples of org.springframework.core.io.Resource


  public void testRMISecurityManager() throws Exception {
    SecurityManager securityManager = System.getSecurityManager();

    try {
      Resource policy = new ClassPathResource("policy");
      System.out.println("policy is " + policy);
      System.setProperty("java.security.policy", policy.getFile().getAbsolutePath());
      System.setSecurityManager(new RMISecurityManager());
      System.setSecurityManager(null);
    }
    finally {
      System.setSecurityManager(securityManager);
View Full Code Here


    dsControl.replay();
    conControl.replay();

    // run scenario
    Resource config = new ClassPathResource("org/springmodules/orm/orbroker/broker.xml");
    Broker broker = new Broker(config.getInputStream(), ds);
    BrokerTemplate brokerTemplate = new BrokerTemplate();
    brokerTemplate.setBroker(broker);
    brokerTemplate.afterPropertiesSet();

    Object result = brokerTemplate.execute(new BrokerCallback() {
View Full Code Here

   * @param element
   *          the XML element to parse
   * @return the value of the property <code>configLocation</code>
   */
  private PropertyValue parseConfigLocationProperty(Element element) {
    Resource resource = null;

    String configLocation = element.getAttribute("configLocation");
    if (StringUtils.hasText(configLocation)) {
      ResourceEditor resourceEditor = new ResourceEditor();
      resourceEditor.setAsText(configLocation);
View Full Code Here

    expectGetCacheManagerClass();
    parserControl.replay();

    parser.doParse(BeanName.CACHE_PROVIDER_FACADE, element, registry);
    Resource configLocation = getConfigLocationFromCacheManager();

    ResourceEditor editor = new ResourceEditor();
    editor.setAsText(configElementBuilder.configLocation);
    String expectedContent = getResourceContent((Resource) editor.getValue());
    String actualContent = getResourceContent(configLocation);
View Full Code Here

    }
  }
 
  public void testLoadResource() throws Exception
  {
    Resource config = new ClassPathResource("org/springmodules/workflow/jbpm31/simpleWorkflow.xml");
    definition.setDefinitionLocation(config);
    definition.afterPropertiesSet();
    assertNotNull(definition.getObject());
    // can't verify since equals is not yet implemented
    //assertEquals(ProcessDefinition.parseXmlReader(new FileReader(configurationResource.getFile())), definition.getObject());
View Full Code Here

    return of.get(cfg);
  }

  public void testDeployDefinitions() throws Exception {

    Resource definitionLocation = new ClassPathResource("org/springmodules/workflow/jbpm31/simpleWorkflow.xml");
    ProcessDefinitionFactoryBean definition = new ProcessDefinitionFactoryBean();
    definition.setDefinitionLocation(definitionLocation);
    definition.afterPropertiesSet();

    MockControl sfCtrl = MockControl.createControl(SessionFactory.class);
View Full Code Here

  /**
   * Loads a <code>WorkflowDescriptor</code> from the specified location
   * using the <code>WorkflowLoader</code> class.
   */
  protected WorkflowDescriptor loadWorkflowDescriptor(String resourceLocation, String name) {
    Resource resource = this.resourceLoader.getResource(resourceLocation);
    WorkflowDescriptor workflowDescriptor = null;
    try {
      workflowDescriptor = this.invokeLoader(resource);
    }
    catch (IOException ex) {
View Full Code Here

     * @param object The given template {@link Resource}.
     * @return The last modified timestamp (in milli-seconds) of the given resource.
     * @see TemplateLoader#getLastModified(Object)
     */
    public long getLastModified(Object object) {
        Resource resource = (Resource)object;
        File file = getResourceFile(resource);
        return (file != null) ? file.lastModified() : 0;
    }
View Full Code Here

        File file = getResourceFile(resource);
        return (file != null) ? file.lastModified() : 0;
    }

    public Reader getReader(Object templateSource, String encoding) throws IOException {
        Resource resource = (Resource)templateSource;
        return new InputStreamReader(resource.getInputStream(), encoding);
    }
View Full Code Here

   * @see AbstractCacheManagerFactoryBean#createCacheManager()
   */
  protected void createCacheManager() throws Exception {
    treeCache = new TreeCache();

    Resource configLocation = getConfigLocation();

    if (configLocation != null) {
      PropertyConfigurator configurator = new PropertyConfigurator();
      configurator.configure(treeCache, configLocation.getInputStream());
    }

    treeCache.createService();
    treeCache.startService();
  }
View Full Code Here

TOP

Related Classes of org.springframework.core.io.Resource

Copyright © 2018 www.massapicom. 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.