<authorize username="USERNAME" password="PASSWORD">
<!-- Single authorized connection -->
- <remote-server servername="localhost">
+ <connection name="localhost">
<protocol>vnc</protocol>
<param name="hostname">localhost</param>
<param name="port">5900</param>
<param name="password">VNCPASS</param>
- </remote-server>
+ </connection>
</authorize>
encoding="md5">
<!-- First authorized connection -->
- <remote-server servername="localhost">
+ <connection name="localhost">
<protocol>vnc</protocol>
<param name="hostname">localhost</param>
<param name="port">5901</param>
<param name="password">VNCPASS</param>
- </remote-server>
+ </connection>
<!-- Second authorized connection -->
- <remote-server servername="otherhost">
+ <connection name="otherhost">
<protocol>vnc</protocol>
<param name="hostname">otherhost</param>
<param name="port">5900</param>
<param name="password">VNCPASS</param>
- </remote-server>
+ </connection>
</authorize>
private enum State {
ROOT,
USER_MAPPING,
- REMOTE_SERVER,
+ CONNECTION,
AUTH_INFO,
PROTOCOL,
PARAMETER,
private State state = State.ROOT;
private AuthInfo current = null;
private String currentParameter = null;
- private String currentRemoteServer = null;
+ private String currentConnection = null;
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
break;
- case REMOTE_SERVER:
+ case CONNECTION:
- if (localName.equals("remote-server")) {
+ if (localName.equals("connection")) {
state = State.AUTH_INFO;
return;
}
case PROTOCOL:
if (localName.equals("protocol")) {
- state = State.REMOTE_SERVER;
+ state = State.CONNECTION;
return;
}
case PARAMETER:
if (localName.equals("param")) {
- state = State.REMOTE_SERVER;
+ state = State.CONNECTION;
return;
}
case AUTH_INFO:
- if (localName.equals("remote-server")) {
+ if (localName.equals("connection")) {
- currentRemoteServer = attributes.getValue("servername");
- if (currentRemoteServer == null)
- throw new SAXException("Attribute \"servername\" required for param tag.");
+ currentConnection = attributes.getValue("name");
+ if (currentConnection == null)
+ throw new SAXException("Attribute \"name\" required for param tag.");
- current.addConfiguration(currentRemoteServer);
+ current.addConfiguration(currentConnection);
// Next state
- state = State.REMOTE_SERVER;
+ state = State.CONNECTION;
return;
}
break;
- case REMOTE_SERVER:
+ case CONNECTION:
if (localName.equals("protocol")) {
// Next state
switch (state) {
case PROTOCOL:
- current.getConfiguration(currentRemoteServer)
+ current.getConfiguration(currentConnection)
.setProtocol(str);
return;
case PARAMETER:
- current.getConfiguration(currentRemoteServer)
+ current.getConfiguration(currentConnection)
.setParameter(currentParameter, str);
return;