本文整理汇总了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;
}
示例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;
}
示例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();
}
}