public ServerPathAdd(PathElementUpdate update) { if(update == null) { throw new IllegalArgumentException("null path element update"); } if(update.getPath() == null) { throw new IllegalArgumentException("null path for path element " + update.getName()); } this.update = update; }
/** {@inheritDoc} */ @Override public AbstractDomainModelUpdate<?> getCompensatingUpdate(DomainModel original) { return new DomainPathRemove(update.getName()); }
/** {@inheritDoc} */ @Override public ServerElementPathRemove getCompensatingUpdate(ServerElement original) { return new ServerElementPathRemove(update.getName()); }
/** {@inheritDoc} */ @Override public AbstractHostModelUpdate<?> getCompensatingUpdate(HostModel original) { return new HostPathRemove(update.getName()); }
public ServerElementPathAdd(PathElementUpdate update) { if(update == null) { throw new IllegalArgumentException("null path element update"); } if(update.getPath() == null) { throw new IllegalArgumentException("null path for path element " + update.getName()); } this.update = update; }
public HostPathAdd(PathElementUpdate update) { if(update == null) { throw new IllegalArgumentException("null path element update"); } if(update.getPath() == null) { throw new IllegalArgumentException("null path for path element " + update.getName()); } this.update = update; }
/** {@inheritDoc} */ public AbstractServerModelUpdate<?> getCompensatingUpdate(ServerModel original) { return new ServerPathRemove(update.getName()); }
/** {@inheritDoc} */ protected void applyUpdate(ServerModel element) throws UpdateFailedException { final PathElement pathElement = element.addPath(update.getName()); if(pathElement == null) { throw new UpdateFailedException("duplicate path definition " + update.getName()); } update.applyUpdate(pathElement); }
@Override public List<String> getAffectedServers(HostModel hostModel) { String pathName = update.getName(); List<String> activeServers = hostModel.getActiveServerNames(); // Remove any server that directly overrides the path for (Iterator<String> it = activeServers.iterator(); it.hasNext();) { ServerElement server = hostModel.getServer(it.next()); if (server.getPath(pathName) != null) { it.remove(); } } return activeServers; }
@Override public List<String> getAffectedServers(DomainModel domainModel, HostModel hostModel) throws UpdateFailedException { String pathName = update.getName(); if (hostModel.getPath(pathName) != null) { // This path is overridden on host and thus on all servers, // so no servers are affected by this change return Collections.emptyList(); } List<String> activeServers = hostModel.getActiveServerNames(); // Remove any server that directly overrides the path for (Iterator<String> it = activeServers.iterator(); it.hasNext();) { ServerElement server = hostModel.getServer(it.next()); if (server.getPath(pathName) != null) { it.remove(); } } return activeServers; }
BatchServiceBuilder<String> createService(final BatchBuilder batch) { if(update.isAbsolutePath()) { return AbsolutePathService.addService(update.getName(), update.getPath(), batch); } else { return RelativePathService.addService(update.getName(), update.getPath(), update.getRelativeTo(), batch); } }
static Collection<PathElementUpdate> parsePaths(final XMLExtendedStreamReader reader, final boolean requirePath) throws XMLStreamException { final Set<String> pathNames = new LinkedHashSet<String>(); final List<PathElementUpdate> updates = new ArrayList<PathElementUpdate>(); while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { switch (Namespace.forUri(reader.getNamespaceURI())) { case DOMAIN_1_0: { final Element element = Element.forName(reader.getLocalName()); switch (element) { case PATH: { final PathElementUpdate update = parsePath(reader, requirePath); if(! pathNames.add(update.getName())) { throw new XMLStreamException(update.getName() + " already defined", reader.getLocation()); } updates.add(update); break; } default: { throw unexpectedElement(reader); } } break; } default: { throw unexpectedElement(reader); } } } return updates; }