final void changePath(String pathName, String path) { PathEntry pathEntry = findPathEntry(pathName); pathEntry.setPath(path); triggerCallbacksForEvent(pathEntry, Event.UPDATED); }
final void changePath(String pathName, String path) { PathEntry pathEntry = findPathEntry(pathName); pathEntry.setPath(path); triggerCallbacksForEvent(pathEntry, Event.UPDATED); }
/** * Updates the {@link PathEntry#getPath() path} value for an entry and sends an * {@link org.jboss.as.controller.services.path.PathManager.Event#UPDATED} * notification to any registered * {@linkplain org.jboss.as.controller.services.path.PathManager.Callback#pathEvent(Event, PathEntry) callbacks}. * @param pathName the logical name of the path within the model. Cannot be {@code null} * @param path the value of the path within the model. This is either an absolute path or * the relative portion of the path. Cannot be {@code null} */ final void changePath(String pathName, String path) { PathEntry pathEntry = findPathEntry(pathName); pathEntry.setPath(path); triggerCallbacksForEvent(pathEntry, Event.UPDATED); }
/** * Updates the {@link PathEntry#getPath() path} value for an entry and sends an * {@link org.jboss.as.controller.services.path.PathManager.Event#UPDATED} * notification to any registered * {@linkplain org.jboss.as.controller.services.path.PathManager.Callback#pathEvent(Event, PathEntry) callbacks}. * @param pathName the logical name of the path within the model. Cannot be {@code null} * @param path the value of the path within the model. This is either an absolute path or * the relative portion of the path. Cannot be {@code null} */ final void changePath(String pathName, String path) { PathEntry pathEntry = findPathEntry(pathName); pathEntry.setPath(path); triggerCallbacksForEvent(pathEntry, Event.UPDATED); }
final PathEntry addPathEntry(final String pathName, final String path, final String relativeTo, final boolean readOnly) { PathEntry pathEntry; synchronized (pathEntries) { if (pathEntries.containsKey(pathName)) { throw MESSAGES.pathEntryAlreadyExists(pathName); } pathEntry = new PathEntry(pathName, path, relativeTo, readOnly, relativeTo == null ? absoluteResolver : relativeResolver); pathEntries.put(pathName, pathEntry); if (relativeTo != null) { addDependent(pathName, relativeTo); } } triggerCallbacksForEvent(pathEntry, Event.ADDED); return pathEntry; }
final PathEntry addPathEntry(final String pathName, final String path, final String relativeTo, final boolean readOnly) { PathEntry pathEntry; synchronized (pathEntries) { if (pathEntries.containsKey(pathName)) { throw MESSAGES.pathEntryAlreadyExists(pathName); } pathEntry = new PathEntry(pathName, path, relativeTo, readOnly, relativeTo == null ? absoluteResolver : relativeResolver); pathEntries.put(pathName, pathEntry); if (relativeTo != null) { addDependent(pathName, relativeTo); } } triggerCallbacksForEvent(pathEntry, Event.ADDED); return pathEntry; }
/** * Adds an entry for a path and sends an {@link org.jboss.as.controller.services.path.PathManager.Event#ADDED} * notification to any registered {@linkplain org.jboss.as.controller.services.path.PathManager.Callback callbacks}. * * @param pathName the logical name of the path within the model. Cannot be {@code null} * @param path the value of the path within the model. This is either an absolute path or * the relative portion of the path. Cannot be {@code null} * @param relativeTo the name of the path this path is relative to. If {@code null} this is an absolute path * @param readOnly {@code true} if the path is immutable, and cannot be removed or modified via a management operation * @return the entry that represents the path * * @throws RuntimeException if an entry with the given {@code pathName} is already registered */ final PathEntry addPathEntry(final String pathName, final String path, final String relativeTo, final boolean readOnly) { PathEntry pathEntry; synchronized (pathEntries) { if (pathEntries.containsKey(pathName)) { throw ControllerLogger.ROOT_LOGGER.pathEntryAlreadyExists(pathName); } pathEntry = new PathEntry(pathName, path, relativeTo, readOnly, relativeTo == null ? absoluteResolver : relativeResolver); pathEntries.put(pathName, pathEntry); if (relativeTo != null) { addDependent(pathName, relativeTo); } } triggerCallbacksForEvent(pathEntry, Event.ADDED); return pathEntry; }
/** * Adds an entry for a path and sends an {@link org.jboss.as.controller.services.path.PathManager.Event#ADDED} * notification to any registered {@linkplain org.jboss.as.controller.services.path.PathManager.Callback callbacks}. * * @param pathName the logical name of the path within the model. Cannot be {@code null} * @param path the value of the path within the model. This is either an absolute path or * the relative portion of the path. Cannot be {@code null} * @param relativeTo the name of the path this path is relative to. If {@code null} this is an absolute path * @param readOnly {@code true} if the path is immutable, and cannot be removed or modified via a management operation * @return the entry that represents the path * * @throws RuntimeException if an entry with the given {@code pathName} is already registered */ final PathEntry addPathEntry(final String pathName, final String path, final String relativeTo, final boolean readOnly) { PathEntry pathEntry; synchronized (pathEntries) { if (pathEntries.containsKey(pathName)) { throw ControllerLogger.ROOT_LOGGER.pathEntryAlreadyExists(pathName); } pathEntry = new PathEntry(pathName, path, relativeTo, readOnly, relativeTo == null ? absoluteResolver : relativeResolver); pathEntries.put(pathName, pathEntry); if (relativeTo != null) { addDependent(pathName, relativeTo); } } triggerCallbacksForEvent(pathEntry, Event.ADDED); return pathEntry; }
final void removePathEntry(final String pathName, boolean check) throws OperationFailedException{ synchronized (pathEntries) { PathEntry pathEntry = pathEntries.get(pathName); if (pathEntry.isReadOnly()) { throw MESSAGES.pathEntryIsReadOnly(pathName); } Set<String> dependents = dependenctRelativePaths.get(pathName); if (check && dependents != null) { throw MESSAGES.cannotRemovePathWithDependencies(pathName, dependents); } pathEntries.remove(pathName); triggerCallbacksForEvent(pathEntry, Event.REMOVED); if (pathEntry.getRelativeTo() != null) { dependents = dependenctRelativePaths.get(pathEntry.getRelativeTo()); if (dependents != null) { dependents.remove(pathEntry.getName()); if (dependents.size() == 0) { dependenctRelativePaths.remove(pathEntry.getRelativeTo()); } } } } }
final void removePathEntry(final String pathName, boolean check) throws OperationFailedException{ synchronized (pathEntries) { PathEntry pathEntry = pathEntries.get(pathName); if (pathEntry.isReadOnly()) { throw MESSAGES.pathEntryIsReadOnly(pathName); } Set<String> dependents = dependenctRelativePaths.get(pathName); if (check && dependents != null) { throw MESSAGES.cannotRemovePathWithDependencies(pathName, dependents); } pathEntries.remove(pathName); triggerCallbacksForEvent(pathEntry, Event.REMOVED); if (pathEntry.getRelativeTo() != null) { dependents = dependenctRelativePaths.get(pathEntry.getRelativeTo()); if (dependents != null) { dependents.remove(pathEntry.getName()); if (dependents.size() == 0) { dependenctRelativePaths.remove(pathEntry.getRelativeTo()); } } } } }
triggerCallbacksForEvent(pathEntry, Event.REMOVED); if (pathEntry.getRelativeTo() != null) { dependents = dependenctRelativePaths.get(pathEntry.getRelativeTo());
triggerCallbacksForEvent(pathEntry, Event.REMOVED); if (pathEntry.getRelativeTo() != null) { dependents = dependenctRelativePaths.get(pathEntry.getRelativeTo());
final void changeRelativePath(String pathName, String relativePath, boolean check) throws OperationFailedException { PathEntry pathEntry = findPathEntry(pathName); synchronized (pathEntries) { if (pathEntry.getRelativeTo() != null) { Set<String> dependents = dependenctRelativePaths.get(pathEntry.getRelativeTo()); dependents.remove(pathEntry.getName()); } if (check && relativePath != null && pathEntries.get(relativePath) == null) { throw MESSAGES.pathEntryNotFound(pathName); } pathEntry.setRelativeTo(relativePath); pathEntry.setPathResolver(relativePath == null ? absoluteResolver : relativeResolver); addDependent(pathEntry.getName(), pathEntry.getRelativeTo()); } triggerCallbacksForEvent(pathEntry, Event.UPDATED); }
final void changeRelativePath(String pathName, String relativePath, boolean check) throws OperationFailedException { PathEntry pathEntry = findPathEntry(pathName); synchronized (pathEntries) { if (pathEntry.getRelativeTo() != null) { Set<String> dependents = dependenctRelativePaths.get(pathEntry.getRelativeTo()); dependents.remove(pathEntry.getName()); } if (check && relativePath != null && pathEntries.get(relativePath) == null) { throw MESSAGES.pathEntryNotFound(pathName); } pathEntry.setRelativeTo(relativePath); pathEntry.setPathResolver(relativePath == null ? absoluteResolver : relativeResolver); addDependent(pathEntry.getName(), pathEntry.getRelativeTo()); } triggerCallbacksForEvent(pathEntry, Event.UPDATED); }
/** * Updates the {@link PathEntry#getRelativeTo() relative to} value for an entry and sends an * {@link org.jboss.as.controller.services.path.PathManager.Event#UPDATED} * notification to any registered * {@linkplain org.jboss.as.controller.services.path.PathManager.Callback#pathEvent(Event, PathEntry) callbacks}. * @param pathName the logical name of the path within the model. Cannot be {@code null} * @param relativePath the new name of the path this path is relative to. If {@code null} this is an absolute path * @param check {@code true} if a check for the existence of an entry for the new {@code relativePath} value * should be performed * @throws OperationFailedException if {@code check} is {@code true} and no path exists whose name matches {@code relativePath} */ final void changeRelativePath(String pathName, String relativePath, boolean check) throws OperationFailedException { PathEntry pathEntry = findPathEntry(pathName); synchronized (pathEntries) { if (check && relativePath != null && pathEntries.get(relativePath) == null) { // TODO per method signature and usage in PathWriteAttributeHandler this should throw OFE. // But leave it for now as a better way to deal with this is to have capabilities for paths // and use capability resolution to detect invalid references throw ControllerLogger.ROOT_LOGGER.pathEntryNotFound(pathName); } if (pathEntry.getRelativeTo() != null) { Set<String> dependents = dependenctRelativePaths.get(pathEntry.getRelativeTo()); dependents.remove(pathEntry.getName()); } pathEntry.setRelativeTo(relativePath); pathEntry.setPathResolver(relativePath == null ? absoluteResolver : relativeResolver); addDependent(pathEntry.getName(), pathEntry.getRelativeTo()); } triggerCallbacksForEvent(pathEntry, Event.UPDATED); }
/** * Updates the {@link PathEntry#getRelativeTo() relative to} value for an entry and sends an * {@link org.jboss.as.controller.services.path.PathManager.Event#UPDATED} * notification to any registered * {@linkplain org.jboss.as.controller.services.path.PathManager.Callback#pathEvent(Event, PathEntry) callbacks}. * @param pathName the logical name of the path within the model. Cannot be {@code null} * @param relativePath the new name of the path this path is relative to. If {@code null} this is an absolute path * @param check {@code true} if a check for the existence of an entry for the new {@code relativePath} value * should be performed * @throws OperationFailedException if {@code check} is {@code true} and no path exists whose name matches {@code relativePath} */ final void changeRelativePath(String pathName, String relativePath, boolean check) throws OperationFailedException { PathEntry pathEntry = findPathEntry(pathName); synchronized (pathEntries) { if (check && relativePath != null && pathEntries.get(relativePath) == null) { // TODO per method signature and usage in PathWriteAttributeHandler this should throw OFE. // But leave it for now as a better way to deal with this is to have capabilities for paths // and use capability resolution to detect invalid references throw ControllerLogger.ROOT_LOGGER.pathEntryNotFound(pathName); } if (pathEntry.getRelativeTo() != null) { Set<String> dependents = dependenctRelativePaths.get(pathEntry.getRelativeTo()); dependents.remove(pathEntry.getName()); } pathEntry.setRelativeTo(relativePath); pathEntry.setPathResolver(relativePath == null ? absoluteResolver : relativeResolver); addDependent(pathEntry.getName(), pathEntry.getRelativeTo()); } triggerCallbacksForEvent(pathEntry, Event.UPDATED); }