001/**
002 * Copyright 2005-2014 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.kew.transformation;
017
018import javax.xml.transform.Source;
019import javax.xml.transform.URIResolver;
020import javax.xml.transform.sax.SAXSource;
021
022import org.apache.log4j.Logger;
023import org.xml.sax.InputSource;
024
025public class WidgetURITestResolver implements URIResolver {
026        
027        private static final Logger LOG = Logger.getLogger(WidgetURITestResolver.class);
028        
029        public Source resolve(String href, String base) {
030                   
031            try {
032                        //EDocLiteService eDocSvc=SpringServiceLocator.getEDocLiteService();
033                        //EDocLiteStyle widgetStyle = eDocSvc.getEDocLiteStyle(href);
034                        //LOG.debug("Widgets: \n" + widgetStyle.getXmlContent());
035                        //return new StreamSource(new StringReader(widgetStyle.getXmlContent()));
036                        return new SAXSource(new InputSource(WidgetURITestResolver.class.getResourceAsStream("widgets_pipeTest.xml")));
037                        
038            }
039            catch (Exception e) {
040                LOG.error("Error ocurred getting style " + href, e);
041              //e.printStackTrace();
042            }
043            return null;
044          }
045
046}