OSDN Git Service

srcディレクトリとdocディレクトリを作成
[xdf/git-repos.git] / src / xdf / src / main / java / jp / ac / aiit / xdf / component / common / CommonTagReferences.java
1 package jp.ac.aiit.xdf.component.common;
2
3 import java.io.File;
4 import java.net.URISyntaxException;
5 import java.net.URL;
6 import java.util.Map;
7
8 import jp.ac.aiit.xdf.application.TagReferences;
9 import jp.ac.aiit.xdf.core.exceptions.UnexpectedBehaviorException;
10 import jp.ac.aiit.xdf.core.tags.TagLoader;
11 import jp.ac.aiit.xdf.core.tags.Tagdef.Tag;
12
13 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory;
15
16 /**
17  * 共通タグ定義クラス
18  * @author Pin.Yuan
19  */
20 public class CommonTagReferences implements TagReferences {
21         private static final Logger log = LoggerFactory.getLogger(CommonTagReferences.class);
22         private static final String COMMON_TAGS = "xdf-commontags.xml";
23         
24         @Override
25         public Map<String, Tag> getDefinedTags() {
26                 try {
27                         URL url = ClassLoader.getSystemResource(COMMON_TAGS);
28                         
29                         TagLoader loader = new TagLoader();
30                         return loader.load(new File(url.toURI()));
31                 } catch(URISyntaxException e) {
32                         log.error("Common用タグ定義ファイルがロードできません。", e);
33                         throw new UnexpectedBehaviorException("Common用タグ定義ファイルがロードできません。", e);
34                 }
35         }
36
37         @Override
38         public String getReferenceId() {
39                 return "common";
40         }
41
42
43 }