本文整理了Java中org.n52.svalbard.decode.XmlNamespaceDecoderKey.<init>()
方法的一些代码示例,展示了XmlNamespaceDecoderKey.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlNamespaceDecoderKey.<init>()
方法的具体详情如下:
包路径:org.n52.svalbard.decode.XmlNamespaceDecoderKey
类名称:XmlNamespaceDecoderKey
方法名:<init>
暂无
代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans
public AbstractSoapDecoder(String namespace) {
this.decoderKeys = Collections.<DecoderKey> singleton(new XmlNamespaceDecoderKey(namespace, XmlObject.class));
}
代码示例来源:origin: org.n52.svalbard/svalbard
public static Set<DecoderKey> decoderKeysForElements(String namespace, Class<?>... elements) {
HashSet<DecoderKey> keys = new HashSet<>(elements.length);
for (Class<?> x : elements) {
keys.add(new XmlNamespaceDecoderKey(namespace, x));
}
return keys;
}
代码示例来源:origin: org.n52.arctic-sea/svalbard
public static Set<DecoderKey> decoderKeysForElements(String namespace, Class<?>... elements) {
HashSet<DecoderKey> keys = new HashSet<>(elements.length);
for (Class<?> x : elements) {
keys.add(new XmlNamespaceDecoderKey(namespace, x));
}
return keys;
}
代码示例来源:origin: org.n52.arctic-sea/svalbard-json
protected Decoder<?, XmlObject> getProcedureDescriptionDecoder(String pdf, XmlObject xb) {
return getDecoder(new XmlNamespaceDecoderKey(pdf, xb.getClass()));
}
}
代码示例来源:origin: org.n52.arctic-sea/svalbard
public static DecoderKey getDecoderKey(final XmlObject doc) {
return new XmlNamespaceDecoderKey(XmlHelper.getNamespace(doc), doc.getClass());
}
代码示例来源:origin: org.n52.arctic-sea/svalbard
public static <T extends XmlObject> DecoderKey getDecoderKey(T[] doc) {
return new XmlNamespaceDecoderKey(XmlHelper.getNamespace(doc[0]), doc.getClass());
}
代码示例来源:origin: org.n52.svalbard/svalbard
public static DecoderKey getDecoderKey(final XmlObject doc) {
return new XmlNamespaceDecoderKey(XmlHelper.getNamespace(doc), doc.getClass());
}
代码示例来源:origin: org.n52.svalbard/svalbard
public static <T extends XmlObject> DecoderKey getDecoderKey(T[] doc) {
return new XmlNamespaceDecoderKey(XmlHelper.getNamespace(doc[0]), doc.getClass());
}
代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans
public DecoderKey getDecoderKey(XmlObject doc) {
Node domNode = doc.getDomNode();
String namespaceURI = domNode.getNamespaceURI();
if (namespaceURI == null && domNode.getFirstChild() != null) {
namespaceURI = domNode.getFirstChild().getNamespaceURI();
}
/*
* if document starts with a comment, get next sibling (and ignore
* initial comment)
*/
if (namespaceURI == null &&
domNode.getFirstChild() != null &&
domNode.getFirstChild().getNextSibling() != null) {
namespaceURI = domNode.getFirstChild().getNextSibling().getNamespaceURI();
}
return new XmlNamespaceDecoderKey(namespaceURI, doc.getClass());
}
代码示例来源:origin: 52North/SOS
private DecoderKey getDecoderKey(XmlObject doc) {
Node domNode = doc.getDomNode();
String namespaceURI = domNode.getNamespaceURI();
if (namespaceURI == null && domNode.getFirstChild() != null) {
namespaceURI = domNode.getFirstChild().getNamespaceURI();
}
/*
* if document starts with a comment, get next sibling (and ignore
* initial comment)
*/
if (namespaceURI == null &&
domNode.getFirstChild() != null &&
domNode.getFirstChild().getNextSibling() != null) {
namespaceURI = domNode.getFirstChild().getNextSibling().getNamespaceURI();
}
return new XmlNamespaceDecoderKey(namespaceURI, doc.getClass());
}
}
代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans
try {
Decoder<?, List<SOAPHeaderElement>> decoder =
getDecoder(new XmlNamespaceDecoderKey(namespace, SOAPHeaderElement.class));
if (decoder != null) {
Object object = decoder.decode(headersByNamespace.get(namespace));
代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans
@Override
public OwsServiceCommunicationObject decode(XmlObject objectToDecode) throws DecodingException {
DecoderKey key = new XmlNamespaceDecoderKey(XmlHelper.getNamespace(objectToDecode), XmlObject.class);
Decoder<OwsServiceCommunicationObject, XmlObject> decoder = this.decoderRepository.getDecoder(key);
return decoder.decode(objectToDecode);
}
代码示例来源:origin: org.n52.sensorweb.sos/hibernate-common
private <T> T decodeXmlObject(XmlObject xbObject)
throws DecodingException {
DecoderKey key = CodingHelper.getDecoderKey(xbObject);
Decoder<T, XmlObject> decoder = decoderRepository.getDecoder(key);
if (decoder == null) {
DecoderKey schemaTypeKey = new XmlNamespaceDecoderKey(xbObject.schemaType().getName().getNamespaceURI(),
xbObject.getClass());
decoder = decoderRepository.getDecoder(schemaTypeKey);
}
if (decoder == null) {
throw new NoDecoderForKeyException(key);
}
return decoder.decode(xbObject);
}
代码示例来源:origin: org.n52.arctic-sea/svalbard-json
private SosProcedureDescription<?> parseProcedureDesciption(String xml, String pdf)
throws DecodingException {
try {
final XmlObject xb = XmlObject.Factory.parse(xml);
Decoder<?, XmlObject> decoder = getDecoder(new XmlNamespaceDecoderKey(pdf, xb.getClass()));
if (decoder == null) {
throw new DecodingException(JSONConstants.PROCEDURE_DESCRIPTION_FORMAT,
"The requested %s is not supported!", JSONConstants.PROCEDURE_DESCRIPTION_FORMAT);
}
Object decode = decoder.decode(xb);
if (decode instanceof SosProcedureDescription<?>) {
return (SosProcedureDescription<?>) decode;
} else if (decode instanceof AbstractFeature) {
return new SosProcedureDescription<AbstractFeature>((AbstractFeature) decode);
} else {
throw new DecodingException("The decoded element {} is not of type {}!", decode.getClass().getName(),
AbstractFeature.class.getName());
}
} catch (XmlException xmle) {
throw new DecodingException("Error while parsing procedure description of InsertSensor request!", xmle);
}
}
}
代码示例来源:origin: 52North/SOS
private <T> T decodeXmlObject(XmlObject xbObject)
throws DecodingException {
DecoderKey key = CodingHelper.getDecoderKey(xbObject);
Decoder<T, XmlObject> decoder = decoderRepository.getDecoder(key);
if (decoder == null) {
DecoderKey schemaTypeKey = new XmlNamespaceDecoderKey(xbObject.schemaType().getName().getNamespaceURI(),
xbObject.getClass());
decoder = decoderRepository.getDecoder(schemaTypeKey);
}
if (decoder == null) {
throw new NoDecoderForKeyException(key);
}
return decoder.decode(xbObject);
}
代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans
public <T> T decodeXmlObject(XmlObject xbObject) throws DecodingException {
DecoderKey key = getDecoderKey(xbObject);
Decoder<T, XmlObject> decoder = getDecoderRepository().getDecoder(key);
if (decoder == null) {
DecoderKey schemaTypeKey = new XmlNamespaceDecoderKey(xbObject.schemaType().getName().getNamespaceURI(),
xbObject.getClass());
decoder = getDecoderRepository().getDecoder(schemaTypeKey);
}
if (decoder == null) {
throw new NoDecoderForKeyException(key);
}
return decoder.decode(xbObject);
}
代码示例来源:origin: 52North/SOS
private <T> T decodeXmlObject(XmlObject xbObject) throws DecodingException {
DecoderKey key = getDecoderKey(xbObject);
Decoder<T, XmlObject> decoder = getDecoderRepository().getDecoder(key);
if (decoder == null) {
DecoderKey schemaTypeKey = new XmlNamespaceDecoderKey(xbObject.schemaType().getName().getNamespaceURI(),
xbObject.getClass());
decoder = getDecoderRepository().getDecoder(schemaTypeKey);
}
if (decoder == null) {
throw new NoDecoderForKeyException(key);
}
return decoder.decode(xbObject);
}
代码示例来源:origin: org.n52.arctic-sea/svalbard-json
private void encodeResultEncoding(GetResultTemplateResponse t, ObjectNode json)
throws EncodingException {
ObjectNode jre = json.putObject(JSONConstants.RESULT_ENCODING);
SweAbstractEncoding encoding = null;
SosResultEncoding re = t.getResultEncoding();
if (re.isDecoded()) {
encoding = t.getResultEncoding().get().get();
} else {
try {
XmlNamespaceDecoderKey key =
new XmlNamespaceDecoderKey(SweConstants.NS_SWE_20, SweAbstractEncoding.class);
Decoder<SweAbstractEncoding, XmlObject> decoder = this.decoderRepository.getDecoder(key);
if (decoder == null) {
throw new NoDecoderForKeyException(key);
}
encoding = decoder.decode(XmlObject.Factory.parse(re.getXml().get()));
} catch (XmlException | DecodingException ex) {
throw new EncodingException(ex);
}
}
if (encoding instanceof SweTextEncoding) {
encodeSweTextEncoding(encoding, jre);
} else {
LOG.warn("Unsupported encoding: {}", encoding == null ? null : encoding.getClass());
}
}
代码示例来源:origin: org.n52.arctic-sea/svalbard-json
private void encodeResultStructure(GetResultTemplateResponse t, ObjectNode json)
throws EncodingException {
ObjectNode jrs = json.putObject(JSONConstants.RESULT_STRUCTURE);
SweAbstractDataComponent structure;
SosResultStructure rs = t.getResultStructure();
if (rs.isDecoded()) {
structure = t.getResultStructure().get().get();
} else {
try {
XmlNamespaceDecoderKey key =
new XmlNamespaceDecoderKey(SweConstants.NS_SWE_20, SweAbstractDataComponent.class);
Decoder<SweAbstractDataComponent, XmlObject> decoder = this.decoderRepository.getDecoder(key);
if (decoder == null) {
throw new NoDecoderForKeyException(key);
}
structure = decoder.decode(XmlObject.Factory.parse(rs.getXml().get()));
} catch (XmlException | DecodingException ex) {
throw new EncodingException(ex);
}
}
if (structure instanceof SweDataRecord) {
encodeSweDataRecord(structure, jrs);
} else {
LOG.warn("Unsupported structure: {}", structure == null ? null : structure.getClass());
}
}
代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans
XmlHelper.getNamespace(xbProcedureDescription));
final Decoder<?, XmlObject> decoder =
getDecoder(new XmlNamespaceDecoderKey(xbInsertSensor.getProcedureDescriptionFormat(),
xbProcedureDescription.getClass()));
if (decoder != null) {
内容来源于网络,如有侵权,请联系作者删除!