@Override public void write(NettyAssociationImpl association, javolution.xml.XMLFormat.OutputElement xml) throws XMLStreamException { xml.setAttribute(NAME, association.name); xml.setAttribute(ASSOCIATION_TYPE, association.type.getType()); xml.setAttribute(HOST_ADDRESS, association.hostAddress); xml.setAttribute(HOST_PORT, association.hostPort); xml.setAttribute(PEER_ADDRESS, association.peerAddress); xml.setAttribute(PEER_PORT, association.peerPort); xml.setAttribute(SERVER_NAME, association.serverName); xml.setAttribute(IPCHANNEL_TYPE, association.ipChannelType.getCode()); xml.setAttribute(EXTRA_HOST_ADDRESS_SIZE, association.extraHostAddresses != null ? association.extraHostAddresses.length : 0); if (association.extraHostAddresses != null) { for (String s : association.extraHostAddresses) { xml.add(s, EXTRA_HOST_ADDRESS, String.class); } } } };
@SuppressWarnings("unchecked") @Override public void read(javolution.xml.XMLFormat.InputElement xml, AssociationImpl association) throws XMLStreamException { association.name = xml.getAttribute(NAME, ""); association.type = AssociationType.getAssociationType(xml.getAttribute(ASSOCIATION_TYPE, "")); association.hostAddress = xml.getAttribute(HOST_ADDRESS, ""); association.hostPort = xml.getAttribute(HOST_PORT, 0); association.peerAddress = xml.getAttribute(PEER_ADDRESS, ""); association.peerPort = xml.getAttribute(PEER_PORT, 0); association.serverName = xml.getAttribute(SERVER_NAME, ""); association.ipChannelType = IpChannelType.getInstance(xml.getAttribute(IPCHANNEL_TYPE, IpChannelType.SCTP.getCode())); if (association.ipChannelType == null) association.ipChannelType = IpChannelType.SCTP; int extraHostAddressesSize = xml.getAttribute(EXTRA_HOST_ADDRESS_SIZE, 0); association.extraHostAddresses = new String[extraHostAddressesSize]; for (int i = 0; i < extraHostAddressesSize; i++) { association.extraHostAddresses[i] = xml.get(EXTRA_HOST_ADDRESS, String.class); } }
@SuppressWarnings("unchecked") @Override public void read(javolution.xml.XMLFormat.InputElement xml, NettyAssociationImpl association) throws XMLStreamException { association.name = xml.getAttribute(NAME, ""); association.type = AssociationType.getAssociationType(xml.getAttribute(ASSOCIATION_TYPE, "")); association.hostAddress = xml.getAttribute(HOST_ADDRESS, ""); association.hostPort = xml.getAttribute(HOST_PORT, 0); association.peerAddress = xml.getAttribute(PEER_ADDRESS, ""); association.peerPort = xml.getAttribute(PEER_PORT, 0); association.serverName = xml.getAttribute(SERVER_NAME, ""); association.ipChannelType = IpChannelType .getInstance(xml.getAttribute(IPCHANNEL_TYPE, IpChannelType.SCTP.getCode())); if (association.ipChannelType == null) association.ipChannelType = IpChannelType.SCTP; int extraHostAddressesSize = xml.getAttribute(EXTRA_HOST_ADDRESS_SIZE, 0); association.extraHostAddresses = new String[extraHostAddressesSize]; for (int i = 0; i < extraHostAddressesSize; i++) { association.extraHostAddresses[i] = xml.get(EXTRA_HOST_ADDRESS, String.class); } }
@Override public void write(AssociationImpl association, javolution.xml.XMLFormat.OutputElement xml) throws XMLStreamException { xml.setAttribute(NAME, association.name); xml.setAttribute(ASSOCIATION_TYPE, association.type.getType()); xml.setAttribute(HOST_ADDRESS, association.hostAddress); xml.setAttribute(HOST_PORT, association.hostPort); xml.setAttribute(PEER_ADDRESS, association.peerAddress); xml.setAttribute(PEER_PORT, association.peerPort); xml.setAttribute(SERVER_NAME, association.serverName); xml.setAttribute(IPCHANNEL_TYPE, association.ipChannelType.getCode()); xml.setAttribute(EXTRA_HOST_ADDRESS_SIZE, association.extraHostAddresses != null ? association.extraHostAddresses.length : 0); if (association.extraHostAddresses != null) { for (String s : association.extraHostAddresses) { xml.add(s, EXTRA_HOST_ADDRESS, String.class); } } } };