View Javadoc
1   /*
2    * Copyright (C) 2003-2008 eXo Platform SAS.
3    *
4    * This program is free software; you can redistribute it and/or
5    * modify it under the terms of the GNU Affero General Public License
6    * as published by the Free Software Foundation; either version 3
7    * of the License, or (at your option) any later version.
8    *
9    * This program is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   * GNU General Public License for more details.
13   *
14   * You should have received a copy of the GNU General Public License
15   * along with this program; if not, see<http://www.gnu.org/licenses/>.
16   */
17  package org.exoplatform.ecm.resolver;
18  
19  import java.io.ByteArrayInputStream;
20  import java.io.InputStream;
21  import java.net.URL;
22  import java.util.ArrayList;
23  import java.util.List;
24  
25  import org.exoplatform.resolver.ResourceResolver;
26  
27  /**
28   * Created by The eXo Platform SAS
29   * @author : Hoa.Pham
30   *          hoa.pham@exoplatform.com
31   * May 6, 2008
32   */
33  public class StringResourceResolver extends ResourceResolver {
34  
35    private String templateData ;
36  
37    public StringResourceResolver(String templateData) {
38      this.templateData = templateData ;
39    }
40  
41    public InputStream getInputStream(String template) throws Exception {
42      return new ByteArrayInputStream(templateData.getBytes());
43    }
44  
45    public List<InputStream> getInputStreams(String template) throws Exception {
46      List<InputStream> list = new ArrayList<InputStream>();
47      list.add(getInputStream(template)) ;
48      return list;
49    }
50  
51    @SuppressWarnings("unused")
52    public URL getResource(String arg0) throws Exception { return null; }
53  
54    @SuppressWarnings("unused")
55    public String getResourceScheme() { return null; }
56  
57    @SuppressWarnings("unused")
58    public List<URL> getResources(String arg0) throws Exception { return null; }
59  
60    @SuppressWarnings("unused")
61    public boolean isModified(String arg0, long arg1) { return false; }
62  
63  }