CredentialsConfig.java
1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* javax.jcr.Credentials
*/
package com.day.jcr.vault.fs.config;
import com.day.jcr.vault.fs.config.ConfigurationException;
import com.day.jcr.vault.fs.config.SimpleCredentialsConfig;
import javax.jcr.Credentials;
import org.w3c.dom.Element;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
public abstract class CredentialsConfig {
public final String type;
public static final String ATTR_TYPE = "type";
public static final String ELEM_CREDETIALS = "credentials";
public CredentialsConfig(String type) {
this.type = type;
}
public static CredentialsConfig load(Element elem) throws ConfigurationException {
assert (elem.getNodeName().equals("credentials"));
String type = elem.getAttribute("type");
if (type == null || type.equals("simple")) {
return SimpleCredentialsConfig.load(elem);
}
throw new ConfigurationException("unknown credentials type: " + type);
}
public abstract Credentials getCredentials();
public void write(ContentHandler handler) throws SAXException {
AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", "type", "", "CDATA", this.type);
handler.startElement("", "credentials", "", attrs);
this.writeInner(handler);
handler.endElement("", "credentials", "");
}
protected abstract void writeInner(ContentHandler var1) throws SAXException;
}