use of org.jboss.as.controller.PathElement in project wildfly by wildfly.
the class IronJacamarResourceCreator method addConnectionDefinition.
private void addConnectionDefinition(final Resource parent, ConnectionDefinition connDef) {
final Resource connDefResource = new IronJacamarResource.IronJacamarRuntimeResource();
final ModelNode model = connDefResource.getModel();
setAttribute(model, Constants.JNDINAME, connDef.getJndiName());
if (connDef.getConfigProperties() != null) {
for (Map.Entry<String, String> config : connDef.getConfigProperties().entrySet()) {
addConfigProperties(connDefResource, config.getKey(), config.getValue());
}
}
setAttribute(model, CLASS_NAME, connDef.getClassName());
setAttribute(model, JNDINAME, connDef.getJndiName());
setAttribute(model, USE_JAVA_CONTEXT, connDef.isUseJavaContext());
setAttribute(model, ENABLED, connDef.isEnabled());
setAttribute(model, CONNECTABLE, connDef.isConnectable());
if (connDef.isTracking() != null) {
setAttribute(model, TRACKING, connDef.isTracking());
}
setAttribute(model, USE_CCM, connDef.isUseCcm());
setAttribute(model, SHARABLE, connDef.isSharable());
setAttribute(model, ENLISTMENT, connDef.isEnlistment());
final Pool pool = connDef.getPool();
if (pool != null) {
setAttribute(model, MAX_POOL_SIZE, pool.getMaxPoolSize());
setAttribute(model, MIN_POOL_SIZE, pool.getMinPoolSize());
setAttribute(model, INITIAL_POOL_SIZE, pool.getInitialPoolSize());
if (pool.getCapacity() != null) {
if (pool.getCapacity().getIncrementer() != null) {
setAttribute(model, CAPACITY_INCREMENTER_CLASS, pool.getCapacity().getIncrementer().getClassName());
if (pool.getCapacity().getIncrementer().getConfigPropertiesMap() != null) {
for (Map.Entry<String, String> config : pool.getCapacity().getIncrementer().getConfigPropertiesMap().entrySet()) {
model.get(CAPACITY_INCREMENTER_PROPERTIES.getName(), config.getKey()).set(config.getValue());
}
}
}
if (pool.getCapacity().getDecrementer() != null) {
setAttribute(model, CAPACITY_DECREMENTER_CLASS, pool.getCapacity().getDecrementer().getClassName());
if (pool.getCapacity().getDecrementer().getConfigPropertiesMap() != null) {
for (Map.Entry<String, String> config : pool.getCapacity().getDecrementer().getConfigPropertiesMap().entrySet()) {
model.get(CAPACITY_DECREMENTER_PROPERTIES.getName(), config.getKey()).set(config.getValue());
}
}
}
}
setAttribute(model, POOL_USE_STRICT_MIN, pool.isUseStrictMin());
if (pool.getFlushStrategy() != null)
setAttribute(model, POOL_FLUSH_STRATEGY, pool.getFlushStrategy().name());
setAttribute(model, POOL_PREFILL, pool.isPrefill());
setAttribute(model, POOL_FAIR, pool.isFair());
if (connDef.isXa()) {
assert connDef.getPool() instanceof XaPool;
XaPool xaPool = (XaPool) connDef.getPool();
setAttribute(model, WRAP_XA_RESOURCE, xaPool.isWrapXaResource());
setAttribute(model, SAME_RM_OVERRIDE, xaPool.isSameRmOverride());
setAttribute(model, PAD_XID, xaPool.isPadXid());
setAttribute(model, INTERLEAVING, xaPool.isInterleaving());
setAttribute(model, NOTXSEPARATEPOOL, xaPool.isNoTxSeparatePool());
}
}
final Security security = (Security) connDef.getSecurity();
if (security != null) {
setAttribute(model, APPLICATION, security.isApplication());
if (security.isElytronEnabled()) {
setAttribute(model, ELYTRON_ENABLED, true);
setAttribute(model, AUTHENTICATION_CONTEXT, security.getSecurityDomain());
setAttribute(model, AUTHENTICATION_CONTEXT_AND_APPLICATION, security.getSecurityDomainAndApplication());
} else {
setAttribute(model, SECURITY_DOMAIN, security.getSecurityDomain());
setAttribute(model, SECURITY_DOMAIN_AND_APPLICATION, security.getSecurityDomainAndApplication());
}
}
final TimeOut timeOut = connDef.getTimeOut();
if (timeOut != null) {
setAttribute(model, ALLOCATION_RETRY, timeOut.getAllocationRetry());
setAttribute(model, ALLOCATION_RETRY_WAIT_MILLIS, timeOut.getAllocationRetryWaitMillis());
setAttribute(model, BLOCKING_TIMEOUT_WAIT_MILLIS, timeOut.getBlockingTimeoutMillis());
setAttribute(model, IDLETIMEOUTMINUTES, timeOut.getIdleTimeoutMinutes());
setAttribute(model, XA_RESOURCE_TIMEOUT, timeOut.getXaResourceTimeout());
}
final Validation validation = connDef.getValidation();
if (validation != null) {
setAttribute(model, BACKGROUNDVALIDATIONMILLIS, validation.getBackgroundValidationMillis());
setAttribute(model, BACKGROUNDVALIDATION, validation.isBackgroundValidation());
setAttribute(model, USE_FAST_FAIL, validation.isUseFastFail());
setAttribute(model, VALIDATE_ON_MATCH, validation.isValidateOnMatch());
}
final Recovery recovery = connDef.getRecovery();
if (recovery != null) {
setAttribute(model, NO_RECOVERY, recovery.getNoRecovery());
final Extension recoverPlugin = recovery.getRecoverPlugin();
if (recoverPlugin != null) {
setAttribute(model, RECOVERLUGIN_CLASSNAME, recoverPlugin.getClassName());
if (recoverPlugin.getConfigPropertiesMap() != null) {
for (Map.Entry<String, String> config : recoverPlugin.getConfigPropertiesMap().entrySet()) {
model.get(RECOVERLUGIN_PROPERTIES.getName(), config.getKey()).set(config.getValue());
}
}
}
final Credential recoveryCredential = (Credential) recovery.getCredential();
if (recoveryCredential != null) {
setAttribute(model, RECOVERY_PASSWORD, recoveryCredential.getPassword());
if (recoveryCredential.isElytronEnabled()) {
setAttribute(model, RECOVERY_ELYTRON_ENABLED, true);
setAttribute(model, RECOVERY_AUTHENTICATION_CONTEXT, recoveryCredential.getSecurityDomain());
} else {
setAttribute(model, RECOVERY_SECURITY_DOMAIN, recoveryCredential.getSecurityDomain());
}
setAttribute(model, RECOVERY_USERNAME, recoveryCredential.getUserName());
}
}
final Resource statsResource = new IronJacamarResource.IronJacamarRuntimeResource();
connDefResource.registerChild(PathElement.pathElement(Constants.STATISTICS_NAME, "local"), statsResource);
final PathElement element = PathElement.pathElement(Constants.CONNECTIONDEFINITIONS_NAME, connDef.getJndiName());
parent.registerChild(element, connDefResource);
}
use of org.jboss.as.controller.PathElement in project wildfly by wildfly.
the class IronJacamarResourceCreator method execute.
public void execute(Resource parentResource, AS7MetadataRepository mdr, String name) {
// Get the iron-jacamar resource
final IronJacamarResource ironJacamarResource = new IronJacamarResource();
// Replace the current model with an updated one
final Resource storeModel = getIronJacamarResource(mdr, name);
ironJacamarResource.update(storeModel);
PathElement ijPe = PathElement.pathElement(Constants.IRONJACAMAR_NAME, Constants.IRONJACAMAR_NAME);
if (parentResource.getChild(ijPe) == null) {
parentResource.registerChild(ijPe, ironJacamarResource);
}
}
use of org.jboss.as.controller.PathElement in project wildfly by wildfly.
the class AbstractXMLDataSourceRuntimeHandler method getDataSourceConfig.
private T getDataSourceConfig(final PathAddress operationAddress) throws OperationFailedException {
final List<PathElement> relativeAddress = new ArrayList<PathElement>();
for (int i = operationAddress.size() - 1; i >= 0; i--) {
PathElement pe = operationAddress.getElement(i);
relativeAddress.add(0, pe);
if (ModelDescriptionConstants.DEPLOYMENT.equals(pe.getKey())) {
break;
}
}
final PathAddress pa = PathAddress.pathAddress(relativeAddress);
final T config;
if (operationAddress.getLastElement().getKey().equals(CONNECTION_PROPERTIES) || operationAddress.getLastElement().getKey().equals(XA_DATASOURCE_PROPERTIES)) {
config = dataSourceConfigs.get(pa.subAddress(0, pa.size() - 1));
} else {
config = dataSourceConfigs.get(pa);
}
if (config == null) {
String exceptionMessage = ConnectorLogger.ROOT_LOGGER.noDataSourceRegisteredForAddress(operationAddress);
throw new OperationFailedException(exceptionMessage);
}
return config;
}
use of org.jboss.as.controller.PathElement in project wildfly by wildfly.
the class LogStoreProbeHandler method addTransactions.
private void addTransactions(final Resource parent, Set<ObjectInstance> transactions, MBeanServer mbs) throws IntrospectionException, InstanceNotFoundException, IOException, ReflectionException, MalformedObjectNameException {
for (ObjectInstance oi : transactions) {
String transactionId = oi.getObjectName().getCanonicalName();
if (!transactionId.contains("puid") && transactionId.contains("itype")) {
final Resource transaction = new LogStoreResource.LogStoreRuntimeResource(oi.getObjectName());
final ModelNode model = transaction.getModel();
Map<String, String> tAttributes = getMBeanValues(mbs, oi.getObjectName(), LogStoreConstants.TXN_JMX_NAMES);
String txnId = tAttributes.get("Id");
addAttributes(model, LogStoreConstants.MODEL_TO_JMX_TXN_NAMES, tAttributes);
// model.get(LogStoreConstants.JMX_ON_ATTRIBUTE).set(transactionId);
String participantQuery = transactionId + ",puid=*";
Set<ObjectInstance> participants = mbs.queryMBeans(new ObjectName(participantQuery), null);
addParticipants(transaction, participants, mbs);
final PathElement element = PathElement.pathElement(LogStoreConstants.TRANSACTIONS, txnId);
parent.registerChild(element, transaction);
}
}
}
use of org.jboss.as.controller.PathElement in project wildfly by wildfly.
the class BackupsResourceDefinition method buildTransformation.
static void buildTransformation(ModelVersion version, ResourceTransformationDescriptionBuilder parent) {
PathAddressTransformer addressTransformer = new PathAddressTransformer() {
@Override
public PathAddress transform(PathElement current, Builder builder) {
return builder.next();
}
};
ResourceTransformationDescriptionBuilder builder = InfinispanModel.VERSION_4_0_0.requiresTransformation(version) ? parent.addChildRedirection(PATH, addressTransformer) : parent.addChildResource(PATH);
BackupResourceDefinition.buildTransformation(version, builder);
}
Aggregations