当前位置: 首页>>代码示例>>Java>>正文


Java Resource.NoSuchResourceException方法代码示例

本文整理汇总了Java中org.jboss.as.controller.registry.Resource.NoSuchResourceException方法的典型用法代码示例。如果您正苦于以下问题:Java Resource.NoSuchResourceException方法的具体用法?Java Resource.NoSuchResourceException怎么用?Java Resource.NoSuchResourceException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jboss.as.controller.registry.Resource的用法示例。


在下文中一共展示了Resource.NoSuchResourceException方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeContent

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
private void removeContent(OperationContext context, List<byte[]> removedHashes, String name) {
    Set<String> newHash;
    try {
        newHash = DeploymentUtils.getDeploymentHexHash(context.readResource(PathAddress.EMPTY_ADDRESS, false).getModel());
    } catch (Resource.NoSuchResourceException ex) {
        newHash = Collections.emptySet();
    }
    for (byte[] hash : removedHashes) {
        try {
            if (newHash.isEmpty() || !newHash.contains(HashUtil.bytesToHexString(hash))) {
                contentRepository.removeContent(ModelContentReference.fromDeploymentName(name, hash));
            } else {
                ServerLogger.ROOT_LOGGER.undeployingDeploymentHasBeenRedeployed(name);
            }
        } catch (Exception e) {
            //TODO
            ServerLogger.ROOT_LOGGER.failedToRemoveDeploymentContent(e, HashUtil.bytesToHexString(hash));
        }
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:21,代码来源:DeploymentRemoveHandler.java

示例2: hasResource

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
private static boolean hasResource (OperationContext context) {
    try {
        context.readResource(PathAddress.EMPTY_ADDRESS, false);
        return true;
    } catch (Resource.NoSuchResourceException nsre) {
        return false;
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:9,代码来源:AuthenticationValidatingHandler.java

示例3: performRuntime

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
@Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
    PathAddress handlerAddress = SyslogAuditLogHandlerResourceDefinition.getAffectedHandlerAddress(context);
    try {
        Resource handleResource = context.readResourceFromRoot(handlerAddress);
        String name = Util.getNameFromAddress(handlerAddress);
        auditLogger.getUpdater().updateHandler(SyslogAuditLogHandlerResourceDefinition.createHandler(pathManager, context, name, handleResource, environmentReader));
    } catch (Resource.NoSuchResourceException ignored) {
        // WFCORE-810 handler resource has been removed in this same op, so we do nothing
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:12,代码来源:SyslogAuditLogProtocolResourceDefinition.java

示例4: createResource

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
@Override
protected Resource createResource(OperationContext context) {
    // If the resource is already there, just use it
    // We do this because RemotingSubsystemAdd/WorkerThreadPoolVsEndpointHandler will end up adding a resource if
    // one isn't added in the same op. So if a user adds one in a separate op, we're forgiving about it.
    // Mostly we do this to allow transformers tests to pass which call ModelTestUtils.checkFailedTransformedBootOperations
    // which calls this OSH in a separate op from the one that calls RemotingSubystemAdd
    try {
        return context.readResourceForUpdate(PathAddress.EMPTY_ADDRESS);
    } catch (Resource.NoSuchResourceException ignored) {
        //
    }
    return super.createResource(context);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:15,代码来源:RemotingEndpointAdd.java

示例5: doExecute

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
@Override
void doExecute(OperationContext context, ModelNode operation, FilteredData filteredData, boolean ignoreMissingResource) throws OperationFailedException {

    if (filteredData == null) {
        doExecuteInternal(context, operation, ignoreMissingResource);
    } else {
        try {
            if (overrideHandler == null) {
                doExecuteInternal(context, operation, ignoreMissingResource);
            } else {
                overrideHandler.execute(context, operation);
            }
        } catch (ResourceNotAddressableException rnae) {
            // Just report the failure to the filter and complete normally
            reportInaccesible(context, operation, filteredData);
            ControllerLogger.MGMT_OP_LOGGER.tracef("Caught ResourceNotAddressableException in %s", this);
        } catch (Resource.NoSuchResourceException nsre) {
            // It's possible this is a remote failure, in which case we
            // don't get ResourceNotAddressableException. So see if
            // it was due to any authorization denial
            AuthorizationResult.Decision decision = context.authorize(operation, EnumSet.of(Action.ActionEffect.ADDRESS)).getDecision();
            ControllerLogger.MGMT_OP_LOGGER.tracef("Caught NoSuchResourceException in %s. Authorization decision is %s", this ,decision);
            if (decision == AuthorizationResult.Decision.DENY) {
                // Just report the failure to the filter and complete normally
                reportInaccesible(context, operation, filteredData);
            } else if (!ignoreMissingResource) {
                throw nsre;
            }
        } catch (UnauthorizedException ue) {
            // Just report the failure to the filter and complete normally
            PathAddress pa = PathAddress.pathAddress(operation.get(OP_ADDR));
            filteredData.addReadRestrictedResource(pa);
            context.getResult().set(new ModelNode());
            ControllerLogger.MGMT_OP_LOGGER.tracef("Caught UnauthorizedException in %s", this);

        }
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:39,代码来源:ReadResourceHandler.java

示例6: executeSingleTargetChild

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
@Override
protected void executeSingleTargetChild(PathAddress base, PathElement currentElement, PathAddress newRemaining, OperationContext context, boolean ignoreMissing) {
    final PathAddress next = base.append(currentElement);
    // Either require the child or a remote target
    final Resource resource = context.readResource(base, false);
    final ImmutableManagementResourceRegistration nr = context.getResourceRegistration().getSubModel(next);
    if (resource.hasChild(currentElement) || (nr != null && nr.isRemote())) {
        safeExecute(next, newRemaining, context, nr, ignoreMissing);
    }
    //if we are on the wrong host no need to do anything
    else if(!resource.hasChild(currentElement)) {
       throw new Resource.NoSuchResourceException(currentElement);
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:15,代码来源:GlobalOperationHandlers.java

示例7: execute

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
    try {
        wrapped.execute(context, operation);
    } catch (Resource.NoSuchResourceException e) {
        availableResponse.unavailable = true;
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:9,代码来源:GlobalOperationHandlers.java

示例8: doExecute

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
void doExecute(OperationContext context, ModelNode operation, ReadResourceDescriptionAccessControlContext accessControlContext) throws OperationFailedException {
    if (accessControlContext.parentAddresses == null) {
        doExecuteInternal(context, operation, accessControlContext);
    } else {
        try {
            doExecuteInternal(context, operation, accessControlContext);
        } catch (Resource.NoSuchResourceException | UnauthorizedException nsre) {
            context.getResult().set(new ModelNode());
        }
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:12,代码来源:ReadResourceDescriptionHandler.java

示例9: addParentResource

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
private boolean addParentResource(OperationContext context, List<PathAddress> addresses, PathAddress address) {
    try {
        context.readResourceFromRoot(address);
    } catch (Resource.NoSuchResourceException nsre) {
        // Don't include the result
        return false;
    } catch (UnauthorizedException ue) {
        //We are not allowed to read it, but still we know it exists
    }
    return true;
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:12,代码来源:ReadResourceDescriptionHandler.java

示例10: testFailureDescription

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
/**
 * Test that the exception message is what we expect to prevent this exception
 * looking different from a non-authorization triggered exception
 */
@Test
public void testFailureDescription() {
    PathAddress pa = PathAddress.pathAddress(PathElement.pathElement("key", "value"));
    ResourceNotAddressableException rnae = new ResourceNotAddressableException(pa);
    @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
    Resource.NoSuchResourceException nsre = ControllerLogger.ROOT_LOGGER.managementResourceNotFound(pa);
    Assert.assertEquals(nsre.getFailureDescription(), rnae.getFailureDescription());
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:13,代码来源:ResourceNotAddressableExceptionTestCase.java

示例11: logFileNotFound

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
/**
 * Creates an exception indicating the file was found in the log directory.
 *
 * @param name              the name of the file that was not found
 * @param directoryProperty the name of the property used to resolved the log directory
 *
 * @return an {@link OperationFailedException} for the error
 */
@Message(id = 80, value = "File '%s' was not found and cannot be found in the %s directory.")
Resource.NoSuchResourceException logFileNotFound(String name, String directoryProperty);
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:11,代码来源:LoggingLogger.java

示例12: managementResourceNotFound

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
/**
 * Creates an exception indicating a resource cannot be found.
 *
 * @param pathAddress the address for the resource.
 *
 * @return an {@link OperationFailedRuntimeException} for the error.
 */
@Message(id = 216, value = "Management resource '%s' not found")
Resource.NoSuchResourceException managementResourceNotFound(PathAddress pathAddress);
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:10,代码来源:ControllerLogger.java


注:本文中的org.jboss.as.controller.registry.Resource.NoSuchResourceException方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。