KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > services > xml > resolving > impl > simple > SimpleDirResolvingServiceImpl


1 /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

5
6 package org.exoplatform.services.xml.resolving.impl.simple;
7
8 import java.io.IOException JavaDoc;
9 import org.xml.sax.EntityResolver JavaDoc;
10 import org.apache.commons.logging.Log;
11 import org.exoplatform.services.log.LogService;
12 import org.exoplatform.services.xml.resolving.SimpleResolvingService;
13
14 /**
15  * Created by The eXo Platform SARL .
16  *
17  * Simple Catalog resolving service - all DTDs
18  * in one local directory (/dtd).
19  * Resolver just checks DTD file name.
20  * To add new - just copy *.dtd to /dtd directory and rebuild service
21  * @author <a HREF="mailto:geaz@users.sourceforge.net">Gennady Azarenkov</a>
22  * @version $Id: SimpleDirResolvingServiceImpl.java 566 2005-01-25 12:50:49Z kravchuk $
23  */

24
25 public class SimpleDirResolvingServiceImpl implements SimpleResolvingService
26 {
27    private static final String JavaDoc DIR_NAME = "/dtd";
28    private String JavaDoc dtdName;
29    private Log log;
30
31    public SimpleDirResolvingServiceImpl(LogService logService)
32    {
33         log = logService.getLog("SimpleDirResolvingServiceImpl");
34    }
35
36   /**
37    * XmlResolvingService method
38    * @return EntityResolver object if found or null (systemId will be used)
39    */

40
41    public EntityResolver JavaDoc getEntityResolver()
42    {
43        try {
44
45           EntityResolver JavaDoc resolver = new SimpleResolver(DIR_NAME);
46 // log.debug("resolver is null-"+(resolver==null));
47
// if(resolver == null)
48
// log.info("Local entity definitions not found in <"+DIR_NAME+">");
49
// else
50
// log.info("Local entity definitions found in <"+DIR_NAME+">");
51

52           return resolver;
53
54        } catch (Exception JavaDoc e) {
55           log.info("Error on get SimpleResolver",e);
56           return null;
57        }
58    }
59
60 }
61
Popular Tags