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


Java Resource.clone方法代码示例

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


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

示例1: cloneRootResource

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
/**
 * Creates a new {@code ManagementModelImpl} that uses a clone of this one's root {@link Resource}.
 * The caller can safely modify that {@code Resource} without changes being exposed
 * to other callers. Use {@link ModelControllerImpl#writeModel(ManagementModelImpl, Set, boolean, boolean, boolean)}
 * to publish changes.
 *
 * @return the new {@code ManagementModelImpl}. Will not return {@code null}
 */
ManagementModelImpl cloneRootResource() {
    ManagementResourceRegistration mrr;
    Resource currentResource;
    CapabilityRegistry currentCaps;
    if (published) {
        // This is the first clone since this was published. Use the current stuff as the basis
        // to ensure that the clone is based on the latest even if we are not the latest.
        ManagementModelImpl currentPublished = ModelControllerImpl.this.managementModel.get();
        mrr = currentPublished.resourceRegistration;
        currentResource = currentPublished.rootResource;
        currentCaps = currentPublished.capabilityRegistry;
    } else {
        // We've already been cloned, which means the thread calling this has the controller lock
        // and our stuff hasn't been superceded by another thread. So use our stuff
        mrr = resourceRegistration;
        currentResource = rootResource;
        currentCaps = capabilityRegistry;
    }
    Resource clone = currentResource.clone();
    ManagementModelImpl result = new ManagementModelImpl(mrr, clone, currentCaps);
    ControllerLogger.MGMT_OP_LOGGER.tracef("cloned to %s to create %s and %s", currentResource, clone, result);
    return result;
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:32,代码来源:ModelControllerImpl.java

示例2: OriginalModel

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
OriginalModel(Resource original, RunningMode mode, ProcessType type, TransformationTarget target, ImmutableManagementResourceRegistration registration) {
    this.original = original.clone();
    this.mode = mode;
    this.type = type;
    this.target = target;
    this.registration = registration;
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:8,代码来源:ResourceTransformationContextImpl.java

示例3: readResourceFromRoot

import org.jboss.as.controller.registry.Resource; //导入方法依赖的package包/类
@Override
Resource readResourceFromRoot(ManagementModel managementModel, PathAddress address, boolean recursive) {
    //
    // TODO double check authorization checks for this!
    //
    Resource model = managementModel.getRootResource();
    final Iterator<PathElement> iterator = address.iterator();
    while(iterator.hasNext()) {
        final PathElement element = iterator.next();
        // Allow wildcard navigation for the last element
        if(element.isWildcard() && ! iterator.hasNext()) {
            final Set<Resource.ResourceEntry> children = model.getChildren(element.getKey());
            if(children.isEmpty()) {
                final PathAddress parent = address.subAddress(0, address.size() -1);
                final Set<String> childrenTypes = managementModel.getRootResourceRegistration().getChildNames(parent);
                if(! childrenTypes.contains(element.getKey())) {
                    throw ControllerLogger.ROOT_LOGGER.managementResourceNotFound(address);
                }
                // Return an empty model
                return Resource.Factory.create();
            }
            model = Resource.Factory.create();
            for(final Resource.ResourceEntry entry : children) {
                model.registerChild(entry.getPathElement(), entry);
            }
        } else {
            model = requireChild(model, element, address);
        }
    }
    if(recursive) {
        return model.clone();
    } else {
        return model.shallowCopy();
    }
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:36,代码来源:OperationContextImpl.java


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