01: /*
02: * Copyright 2005-2006 The Kuali Foundation.
03: *
04: *
05: * Licensed under the Educational Community License, Version 1.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.opensource.org/licenses/ecl1.php
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package edu.iu.uis.eden.edl;
18:
19: import java.io.StringReader;
20:
21: import javax.xml.transform.Source;
22: import javax.xml.transform.URIResolver;
23: import javax.xml.transform.stream.StreamSource;
24:
25: import org.apache.log4j.Logger;
26:
27: import edu.iu.uis.eden.KEWServiceLocator;
28:
29: /**
30: * Imported into client style sheets to import other style sheets in our database into their stylesheet.
31: *
32: * @author rkirkend
33: *
34: */
35: public class WidgetURIResolver implements URIResolver {
36:
37: private static final Logger LOG = Logger
38: .getLogger(WidgetURIResolver.class);
39:
40: public Source resolve(String href, String base) {
41:
42: try {
43: EDocLiteService eDocSvc = KEWServiceLocator
44: .getEDocLiteService();
45: EDocLiteStyle widgetStyle = eDocSvc.getEDocLiteStyle(href);
46: return new StreamSource(new StringReader(widgetStyle
47: .getXmlContent()));
48:
49: } catch (Exception e) {
50: LOG.error("Error ocurred getting style " + href, e);
51: }
52: return null;
53: }
54:
55: }
|