@Deprecated public static boolean isAbsoluteUnixOrWindowsPath(final String path) { return org.jboss.as.controller.services.path.AbstractPathService.isAbsoluteUnixOrWindowsPath(path); } }
@Deprecated public static boolean isAbsoluteUnixOrWindowsPath(final String path) { return org.jboss.as.controller.services.path.AbstractPathService.isAbsoluteUnixOrWindowsPath(path); } }
/** * Install an {@code Service<String>} for the given path. * @param serviceTarget the service target associated with the management operation making this request. Cannot be {@code null} * @param pathName the name of the relevant path. 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 possiblyAbsolute {@code true} if the path may be absolute and a check should be performed before installing * a service variant that depends on the service associated with {@code relativeTo} * @param relativeTo the name of the path this path is relative to. If {@code null} this is an absolute path * @return the service controller for the {@code Service<String>} */ final ServiceController<?> addRelativePathService(final ServiceTarget serviceTarget, final String pathName, final String path, final boolean possiblyAbsolute, final String relativeTo) { if (possiblyAbsolute && AbstractPathService.isAbsoluteUnixOrWindowsPath(path)) { return addAbsolutePathService(serviceTarget, pathName, path); } else { return RelativePathService.addService(AbstractPathService.pathNameOf(pathName), path, possiblyAbsolute, relativeTo, serviceTarget); } }
/** * Install an {@code Service<String>} for the given path. * @param serviceTarget the service target associated with the management operation making this request. Cannot be {@code null} * @param pathName the name of the relevant path. 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 possiblyAbsolute {@code true} if the path may be absolute and a check should be performed before installing * a service variant that depends on the service associated with {@code relativeTo} * @param relativeTo the name of the path this path is relative to. If {@code null} this is an absolute path * @return the service controller for the {@code Service<String>} */ final ServiceController<?> addRelativePathService(final ServiceTarget serviceTarget, final String pathName, final String path, final boolean possiblyAbsolute, final String relativeTo) { if (possiblyAbsolute && AbstractPathService.isAbsoluteUnixOrWindowsPath(path)) { return addAbsolutePathService(serviceTarget, pathName, path); } else { return RelativePathService.addService(AbstractPathService.pathNameOf(pathName), path, possiblyAbsolute, relativeTo, serviceTarget); } }
@Override public ModelNode correct(final ModelNode newValue, final ModelNode currentValue) { if (newValue.getType() == ModelType.UNDEFINED) { return newValue; } if (newValue.getType() != ModelType.OBJECT || currentValue.getType() != ModelType.OBJECT) { return newValue; } final ModelNode newPath = newValue.get(PATH.getName()); if (newPath.isDefined() && !AbstractPathService.isAbsoluteUnixOrWindowsPath(newPath.asString())) { if (currentValue.hasDefined(RELATIVE_TO.getName()) && !newValue.hasDefined(RELATIVE_TO.getName())) { newValue.get(RELATIVE_TO.getName()).set(currentValue.get(RELATIVE_TO.getName())); } } return newValue; } }
@Override public ModelNode correct(final ModelNode newValue, final ModelNode currentValue) { if (newValue.getType() == ModelType.UNDEFINED) { return newValue; } if (newValue.getType() != ModelType.OBJECT || currentValue.getType() != ModelType.OBJECT) { return newValue; } final ModelNode newPath = newValue.get(PATH.getName()); if (newPath.isDefined() && !AbstractPathService.isAbsoluteUnixOrWindowsPath(newPath.asString())) { if (currentValue.hasDefined(RELATIVE_TO.getName()) && !newValue.hasDefined(RELATIVE_TO.getName())) { newValue.get(RELATIVE_TO.getName()).set(currentValue.get(RELATIVE_TO.getName())); } } return newValue; } }
@Override public ModelNode correct(final ModelNode newValue, final ModelNode currentValue) { if (newValue.getType() == ModelType.UNDEFINED) { return newValue; } if (newValue.getType() != ModelType.OBJECT || currentValue.getType() != ModelType.OBJECT) { return newValue; } final ModelNode newPath = newValue.get(PATH.getName()); if (newPath.isDefined() && !AbstractPathService.isAbsoluteUnixOrWindowsPath(newPath.asString())) { if (currentValue.hasDefined(RELATIVE_TO.getName()) && !newValue.hasDefined(RELATIVE_TO.getName())) { newValue.get(RELATIVE_TO.getName()).set(currentValue.get(RELATIVE_TO.getName())); } } return newValue; } }
final ServiceController<?> addRelativePathService(final ServiceTarget serviceTarget, final String pathName, final String path, final boolean possiblyAbsolute, final String relativeTo, final ServiceVerificationHandler verificationHandler) { if (possiblyAbsolute && AbstractPathService.isAbsoluteUnixOrWindowsPath(path)) { return addAbsolutePathService(serviceTarget, pathName, path, verificationHandler); } else { if (verificationHandler == null) { return RelativePathService.addService(AbstractPathService.pathNameOf(pathName), path, possiblyAbsolute, relativeTo, serviceTarget, null, NO_LISTENERS); } else { return RelativePathService.addService(AbstractPathService.pathNameOf(pathName), path, possiblyAbsolute, relativeTo, serviceTarget, null, verificationHandler); } } }
final ServiceController<?> addRelativePathService(final ServiceTarget serviceTarget, final String pathName, final String path, final boolean possiblyAbsolute, final String relativeTo, final ServiceVerificationHandler verificationHandler) { if (possiblyAbsolute && AbstractPathService.isAbsoluteUnixOrWindowsPath(path)) { return addAbsolutePathService(serviceTarget, pathName, path, verificationHandler); } else { if (verificationHandler == null) { return RelativePathService.addService(AbstractPathService.pathNameOf(pathName), path, possiblyAbsolute, relativeTo, serviceTarget, null, NO_LISTENERS); } else { return RelativePathService.addService(AbstractPathService.pathNameOf(pathName), path, possiblyAbsolute, relativeTo, serviceTarget, null, verificationHandler); } } }
@Override public void validateParameter(final String parameterName, final ModelNode value) throws OperationFailedException { super.validateParameter(parameterName, value); final ModelNode clone = value.clone(); RELATIVE_TO.getValidator().validateParameter(parameterName, clone.get(RELATIVE_TO.getName())); PATH.getValidator().validateParameter(parameterName, clone.get(PATH.getName())); if (value.isDefined()) { // Could have relative-to if (value.hasDefined(RELATIVE_TO.getName())) { final String relativeTo = value.get(RELATIVE_TO.getName()).asString(); // Can't be an absolute path if (AbstractPathService.isAbsoluteUnixOrWindowsPath(relativeTo)) { throw createOperationFailure(LoggingLogger.ROOT_LOGGER.invalidRelativeTo(relativeTo)); } } } } }
@Override public void validateParameter(final String parameterName, final ModelNode value) throws OperationFailedException { super.validateParameter(parameterName, value); final ModelNode clone = value.clone(); RELATIVE_TO.getValidator().validateParameter(parameterName, clone.get(RELATIVE_TO.getName())); PATH.getValidator().validateParameter(parameterName, clone.get(PATH.getName())); if (value.isDefined()) { // Could have relative-to if (value.hasDefined(RELATIVE_TO.getName())) { final String relativeTo = value.get(RELATIVE_TO.getName()).asString(); // Can't be an absolute path if (AbstractPathService.isAbsoluteUnixOrWindowsPath(relativeTo)) { throw createOperationFailure(MESSAGES.invalidRelativeTo(relativeTo)); } } } } }
@Override public void validateParameter(final String parameterName, final ModelNode value) throws OperationFailedException { super.validateParameter(parameterName, value); final ModelNode clone = value.clone(); RELATIVE_TO.getValidator().validateParameter(parameterName, clone.get(RELATIVE_TO.getName())); PATH.getValidator().validateParameter(parameterName, clone.get(PATH.getName())); if (value.isDefined()) { // Could have relative-to if (value.hasDefined(RELATIVE_TO.getName())) { final String relativeTo = value.get(RELATIVE_TO.getName()).asString(); // Can't be an absolute path if (AbstractPathService.isAbsoluteUnixOrWindowsPath(relativeTo)) { throw createOperationFailure(LoggingLogger.ROOT_LOGGER.invalidRelativeTo(relativeTo)); } } } } }