01: /*************************************************************************
02: * *
03: * EJBCA: The OpenSource Certificate Authority *
04: * *
05: * This software is free software; you can redistribute it and/or *
06: * modify it under the terms of the GNU Lesser General Public *
07: * License as published by the Free Software Foundation; either *
08: * version 2.1 of the License, or any later version. *
09: * *
10: * See terms of license at gnu.org. *
11: * *
12: *************************************************************************/package org.ejbca.core.protocol.xkms.common;
13:
14: /**
15: * Class that implement the mappings of specific for
16: * XML signatures, encryption and xkms.
17: */
18: import com.sun.xml.bind.marshaller.NamespacePrefixMapper;
19:
20: public class XKMSNamespacePrefixMapper extends NamespacePrefixMapper {
21:
22: @Override
23: public String getPreferredPrefix(String namespaceUri,
24: String suggestion, boolean requirePrefix) {
25: if (namespaceUri
26: .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: }
|