KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > core > protocol > xkms > common > XKMSNamespacePrefixMapper


1 /*************************************************************************
2  * *
3  * EJBCA: The OpenSource Certificate Authority *
4  * *
5  * This software is free software; you can redistribute it and/or *
6  * modify it under the terms of the GNU Lesser General Public *
7  * License as published by the Free Software Foundation; either *
8  * version 2.1 of the License, or any later version. *
9  * *
10  * See terms of license at gnu.org. *
11  * *
12  *************************************************************************/

13
14 package org.ejbca.core.protocol.xkms.common;
15
16 /**
17  * Class that implement the mappings of specific for
18  * XML signatures, encryption and xkms.
19  */

20 import com.sun.xml.bind.marshaller.NamespacePrefixMapper;
21
22 public class XKMSNamespacePrefixMapper extends NamespacePrefixMapper {
23
24     @Override JavaDoc
25     public String JavaDoc getPreferredPrefix(String JavaDoc namespaceUri, String JavaDoc suggestion, boolean requirePrefix) {
26         if( namespaceUri.equals("http://www.w3.org/2001/XMLSchema-instance") ){
27             return "xsi";
28         }
29         if(namespaceUri.equals("http://www.w3.org/2000/09/xmldsig#")){
30             return "ds";
31         }
32         if(namespaceUri.equals("http://www.w3.org/2001/04/xmlenc#")){
33             return "xenc";
34         }
35         if(namespaceUri.equals("http://www.w3.org/2002/03/xkms#")){
36             return "";
37         }
38         return suggestion;
39     }
40
41 }
42
Popular Tags