01: /* Copyright 2003 The JA-SIG Collaborative. All rights reserved.
02: * See license distributed with this file and
03: * available online at http://www.uportal.org/license.html
04: */
05:
06: package org.jasig.portal.tools.chanpub;
07:
08: import java.io.InputStream;
09:
10: import org.jasig.portal.utils.ResourceLoader;
11: import org.xml.sax.EntityResolver;
12: import org.xml.sax.InputSource;
13:
14: /**
15: * Resolves the channelDefinition.dtd
16: * @author Ken Weiner, kweiner@unicon.net
17: * @version $Revision: 35418 $
18: */
19: public class ChannelDefDtdResolver implements EntityResolver {
20:
21: public ChannelDefDtdResolver() {
22: super ();
23: }
24:
25: /**
26: * Sets the input source to the channel definition dtd.
27: * @param publicId the public ID
28: * @param systemId the system ID
29: * @return an input source based on the channel definition dtd
30: */
31: public InputSource resolveEntity(String publicId, String systemId) {
32: InputSource inputSource = null;
33:
34: try {
35: InputStream inStream = ResourceLoader
36: .getResourceAsStream(this .getClass(),
37: "/properties/chanpub/chandefs/channelDefinition.dtd");
38: if (inStream != null) {
39: inputSource = new InputSource(inStream);
40: }
41: } catch (Exception e) {
42: throw new RuntimeException(e);
43: }
44:
45: return inputSource;
46: }
47: }
|