KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > pentaho > core > util > SolutionURIResolver


1 /*
2  * Copyright 2006 Pentaho Corporation. All rights reserved.
3  * This software was developed by Pentaho Corporation and is provided under the terms
4  * of the Mozilla Public License, Version 1.1, or any later version. You may not use
5  * this file except in compliance with the license. If you need a copy of the license,
6  * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho
7  * BI Platform. The Initial Developer is Pentaho Corporation.
8  *
9  * Software distributed under the Mozilla Public License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
11  * the license for the specific language governing your rights and limitations.
12  *
13  * @created Jul 13, 2005
14  * @author James Dixon
15  *
16  */

17
18 package org.pentaho.core.util;
19
20 import java.io.InputStream JavaDoc;
21
22 import javax.xml.transform.Source JavaDoc;
23 import javax.xml.transform.URIResolver JavaDoc;
24 import javax.xml.transform.stream.StreamSource JavaDoc;
25
26 import org.pentaho.core.repository.ISolutionRepository;
27 import org.pentaho.core.session.IPentahoSession;
28 import org.pentaho.core.system.PentahoSystem;
29
30 public class SolutionURIResolver implements URIResolver JavaDoc {
31
32     IPentahoSession session = null;
33     
34     public SolutionURIResolver(IPentahoSession session) {
35         super();
36         this.session = session;
37     }
38
39
40     /*
41      * (non-Javadoc)
42      *
43      * @see javax.xml.transform.URIResolver#resolve(java.lang.String,
44      * java.lang.String)
45      */

46     public Source JavaDoc resolve(String JavaDoc href, String JavaDoc base) {
47             
48         ISolutionRepository repository = PentahoSystem.getSolutionRepository(session);
49         StreamSource JavaDoc xslSrc = null;
50         if (repository != null) {
51                 InputStream JavaDoc xslIS = repository.getResourceInputStream(href);
52                 xslSrc = new StreamSource JavaDoc(xslIS);
53         }
54
55         return xslSrc;
56     }
57 }
58
Popular Tags