@Override protected void updateModel(final OperationContext context, final ModelNode model, final WildFlyJobOperator jobOperator, final String jobName) throws OperationFailedException { final ModelNode list = model.setEmptyList(); for (String jobXmlName : jobOperator.getJobXmlNames(jobName)) { list.add(jobXmlName); } } });
private String obtainServerUUID() throws OperationFailedException { try { ModelNode operation = Operations.createReadAttributeOperation(new ModelNode().setEmptyList(), UUID); operation.get(INCLUDE_RUNTIME).set(true); ModelControllerClient client = env.getClient(); if (client == null) { client = env.getCli().getCommandContext().getModelControllerClient(); } ModelNode result = client.execute(operation); if (Operations.isSuccessfulOutcome(result)) { return Operations.readResult(result).asString(); } return null; } catch (IOException ex) { return null; } }
protected void executeReadAttribute(final String attributeName, final OperationContext context, final T component, final PathAddress address) { final boolean hasPool = componentType.hasPool(); if (COMPONENT_CLASS_NAME.getName().equals(attributeName)) { context.getResult().set(component.getComponentName()); } else if (SECURITY_DOMAIN.getName().equals(attributeName)) { final ModelNode result = context.getResult(); EJBSecurityMetaData md = component.getSecurityMetaData(); if (md != null && md.getSecurityDomain() != null) { result.set(md.getSecurityDomain()); EJBSecurityMetaData md = component.getSecurityMetaData(); if (md != null && md.getRunAs() != null) { result.set(md.getRunAs()); EJBSecurityMetaData md = component.getSecurityMetaData(); if (md != null) { result.setEmptyList(); Set<String> roles = md.getDeclaredRoles(); if (roles != null) { for (String role : roles) { result.add(role);
ModelNode toModelNode() { ModelNode result = new ModelNode(); result.setEmptyList(); for (StringPair pair : address) { result.add(pair.key, pair.value); } return result; }
@Override public void parseAndSetParameter(AttributeDefinition attribute, String value, ModelNode operation, XMLStreamReader reader) throws XMLStreamException { if (value == null) return; final ModelNode node = operation.get(attribute.getName()).setEmptyList(); if (!value.isEmpty()) { for (final String element : value.split("\\s+")) { node.add(parse(attribute, element, reader)); } } } };
@Override public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException { final ModelNode address; final PathAddress pa = context.getCurrentAddress(); AuthorizationResult authResult = context.authorize(operation, DESCRIBE_EFFECTS); if (authResult.getDecision() != AuthorizationResult.Decision.PERMIT) { throw ControllerLogger.ROOT_LOGGER.unauthorized(operation.require(OP).asString(), pa, authResult.getExplanation()); } if (pa.size() > 0) { address = new ModelNode().add(pa.getLastElement().getKey(), pa.getLastElement().getValue()); } else { address = new ModelNode().setEmptyList(); } final Resource resource = context.readResource(PathAddress.EMPTY_ADDRESS); final ModelNode result = context.getResult(); describe(context.getAttachment(OrderedChildTypesAttachment.KEY), resource, address, result, context.getResourceRegistration()); }
String name = modelNode.get(OP).asString(); result.setEmptyList(); Set<String> sessions = sessionManager.getAllSessions(); for (String s : sessions) { result.add(s); operationContext.getResult().set(result); return; String sessionId = SESSIOND_ID.resolveModelAttribute(operationContext, modelNode).asString(); Session session = sessionManager.getSession(sessionId); if (session == null && !name.equals(Constants.INVALIDATE_SESSION)) { result.setEmptyList(); Set<String> sessions = session.getAttributeNames(); for (String s : sessions) { result.add(s); result.setEmptyList(); Set<String> sessions = session.getAttributeNames(); for (String s : sessions) { Object attribute = session.getAttribute(s); ModelNode m = new ModelNode(); result.add(new Property(s, m));
@Override public ModelNode writeListAttribute(Address address, String attributeName, int... attributeValue) { ModelNode listAttributeValue = new ModelNode().setEmptyList(); for (int singleValue : attributeValue) { listAttributeValue.add(singleValue); } return writeAttribute(address, attributeName, listAttributeValue); }
@Override public void parseAndSetParameter(AttributeDefinition attribute, String value, ModelNode operation, XMLStreamReader reader) throws XMLStreamException { if (value == null) return; final ModelNode node = operation.get(attribute.getName()).setEmptyList(); if (!value.isEmpty()) { for (String element : value.split(",")) { node.add(parse(attribute, element, reader)); } } } };
@Override protected void execute(final OperationContext context, final ModelNode operation, final WildFlyJobOperator jobOperator) throws OperationFailedException { final ModelNode list = context.getResult().setEmptyList(); for (String jobXmlName : jobOperator.getJobXmlNames()) { list.add(jobXmlName); } } });
private String obtainProductName() { try { ModelNode operation = Operations.createReadAttributeOperation(new ModelNode().setEmptyList(), PRODUCT_NAME); operation.get(INCLUDE_RUNTIME).set(false); ModelControllerClient client = env.getClient(); if (client == null) { client = env.getCli().getCommandContext().getModelControllerClient(); } ModelNode result = client.execute(operation); if (Operations.isSuccessfulOutcome(result)) { return Operations.readResult(result).asString(); } return "undefined"; } catch (IOException e) { // This should not be needed since a product name is always returned, even if it doesn't exist. // In that case "undefined" is returned return "undefined"; } }
@Override public ModelNode writeListAttribute(Address address, String attributeName, String... attributeValue) { ModelNode listAttributeValue = new ModelNode().setEmptyList(); for (String singleValue : attributeValue) { listAttributeValue.add(singleValue); } return writeAttribute(address, attributeName, listAttributeValue); }
@Override public void parseAndSetParameter(AttributeDefinition attribute, String value, ModelNode operation, XMLStreamReader reader) throws XMLStreamException { if (value == null) return; final ModelNode node = operation.get(attribute.getName()).setEmptyList(); if (!value.isEmpty()) { for (final String element : value.split("\\s+")) { node.add(parse(attribute, element, reader)); } } } };
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { ModelNode result = context.getResult(); result.setEmptyList(); for (String impl : JSFModuleIdFactory.getInstance().getActiveJSFVersions()) { result.add(impl); } context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER); }
private String obtainProductVersion() { try { ModelNode operation = Operations.createReadAttributeOperation(new ModelNode().setEmptyList(), PRODUCT_VERSION); operation.get(INCLUDE_RUNTIME).set(false); ModelControllerClient client = env.getClient(); if (client == null) { client = env.getCli().getCommandContext().getModelControllerClient(); } ModelNode result = client.execute(operation); if (Operations.isSuccessfulOutcome(result)) { return Operations.readResult(result).asString(); } return "undefined"; } catch (IOException e) { // This should not be needed since a product version is always returned, even if it doesn't exist. // In that case "undefined" is returned return "undefined"; } } }
@Override public ModelNode writeListAttribute(Address address, String attributeName, boolean... attributeValue) { ModelNode listAttributeValue = new ModelNode().setEmptyList(); for (boolean singleValue : attributeValue) { listAttributeValue.add(singleValue); } return writeAttribute(address, attributeName, listAttributeValue); }
@Override public void parseSingleElement(MapAttributeDefinition attribute, XMLExtendedStreamReader reader, ModelNode operation) throws XMLStreamException { final String[] array = requireAttributes(reader, FROM, TO); ModelNode paramVal = operation.get(attribute.getName()).get(array[0]).setEmptyList(); for (String role : array[1].split("\\s+")) { paramVal.add(role); } ParseUtils.requireNoContent(reader); }
public static void addTimers(final EJBComponent ejb, final ModelNode response) { response.setEmptyList(); final String name = ejb.getComponentName(); TimerService ts = ejb.getTimerService(); if (ts != null) { for (Timer timer : ts.getTimers()) { ModelNode timerNode = response.add(); addTimeRemaining(timer, timerNode, name); addNextTimeout(timer, timerNode, name); addCalendarTimer(timer, timerNode, name); addPersistent(timer, timerNode, name); addSchedule(timer, timerNode, name); } } }
warnings.add(JacORBLogger.ROOT_LOGGER.cannotEmulatePropertiesWarning(unsupportedProperties)); for(String unsupportedProperty : unsupportedProperties){ jacorbModel.get(unsupportedProperty).clear(); ModelNode result = new ModelNode(); result.get(MIGRATION_OPERATIONS).set(values); ModelNode rw = new ModelNode().setEmptyList(); for (String warning : warnings) { rw.add(warning); result.get(MIGRATION_WARNINGS).set(rw); context.getResult().set(result); } else {
public Values andList(String name, String... value) { ModelNode listValue = new ModelNode().setEmptyList(); for (String singleValue : value) { listValue.add(singleValue); } List<Property> newList = new ArrayList<Property>(namedValues); newList.add(new Property(name, listValue)); return new Values(newList); }