use of org.jboss.as.clustering.controller.Attribute in project wildfly by wildfly.
the class InfinispanSubsystemXMLWriter method writeCacheElements.
@SuppressWarnings("deprecation")
private static void writeCacheElements(XMLExtendedStreamWriter writer, ModelNode cache) throws XMLStreamException {
if (cache.hasDefined(LockingResourceDefinition.PATH.getKeyValuePair())) {
ModelNode locking = cache.get(LockingResourceDefinition.PATH.getKeyValuePair());
Set<LockingResourceDefinition.Attribute> attributes = EnumSet.allOf(LockingResourceDefinition.Attribute.class);
if (hasDefined(locking, attributes)) {
writer.writeStartElement(XMLElement.LOCKING.getLocalName());
writeAttributes(writer, locking, attributes);
writer.writeEndElement();
}
}
if (cache.hasDefined(TransactionResourceDefinition.PATH.getKeyValuePair())) {
ModelNode transaction = cache.get(TransactionResourceDefinition.PATH.getKeyValuePair());
Set<TransactionResourceDefinition.Attribute> attributes = EnumSet.allOf(TransactionResourceDefinition.Attribute.class);
if (hasDefined(transaction, attributes)) {
writer.writeStartElement(XMLElement.TRANSACTION.getLocalName());
writeAttributes(writer, transaction, attributes);
writer.writeEndElement();
}
}
if (cache.hasDefined(HeapMemoryResourceDefinition.PATH.getKeyValuePair())) {
ModelNode memory = cache.get(HeapMemoryResourceDefinition.PATH.getKeyValuePair());
Iterable<Attribute> attributes = new CompositeIterable<>(EnumSet.allOf(MemoryResourceDefinition.Attribute.class), EnumSet.allOf(HeapMemoryResourceDefinition.Attribute.class));
if (hasDefined(memory, attributes)) {
writer.writeStartElement(XMLElement.HEAP_MEMORY.getLocalName());
writeAttributes(writer, memory, attributes);
writer.writeEndElement();
}
} else if (cache.hasDefined(OffHeapMemoryResourceDefinition.PATH.getKeyValuePair())) {
ModelNode memory = cache.get(OffHeapMemoryResourceDefinition.PATH.getKeyValuePair());
Iterable<Attribute> attributes = new CompositeIterable<>(EnumSet.allOf(MemoryResourceDefinition.Attribute.class), EnumSet.allOf(OffHeapMemoryResourceDefinition.Attribute.class));
if (hasDefined(memory, attributes)) {
writer.writeStartElement(XMLElement.OFF_HEAP_MEMORY.getLocalName());
writeAttributes(writer, memory, attributes);
writer.writeEndElement();
}
}
if (cache.hasDefined(ExpirationResourceDefinition.PATH.getKeyValuePair())) {
ModelNode expiration = cache.get(ExpirationResourceDefinition.PATH.getKeyValuePair());
Set<ExpirationResourceDefinition.Attribute> attributes = EnumSet.allOf(ExpirationResourceDefinition.Attribute.class);
if (hasDefined(expiration, attributes)) {
writer.writeStartElement(XMLElement.EXPIRATION.getLocalName());
writeAttributes(writer, expiration, attributes);
writer.writeEndElement();
}
}
Set<StoreResourceDefinition.Attribute> storeAttributes = EnumSet.complementOf(EnumSet.of(StoreResourceDefinition.Attribute.PROPERTIES));
if (cache.hasDefined(CustomStoreResourceDefinition.PATH.getKeyValuePair())) {
ModelNode store = cache.get(CustomStoreResourceDefinition.PATH.getKeyValuePair());
writer.writeStartElement(XMLElement.STORE.getLocalName());
writeAttributes(writer, store, CustomStoreResourceDefinition.Attribute.class);
writeAttributes(writer, store, JDBCStoreResourceDefinition.Attribute.class);
writeAttributes(writer, store, storeAttributes);
writeAttributes(writer, store, StoreResourceDefinition.DeprecatedAttribute.class);
writeStoreElements(writer, store);
writer.writeEndElement();
}
if (cache.hasDefined(FileStoreResourceDefinition.PATH.getKeyValuePair())) {
ModelNode store = cache.get(FileStoreResourceDefinition.PATH.getKeyValuePair());
writer.writeStartElement(XMLElement.FILE_STORE.getLocalName());
writeAttributes(writer, store, FileStoreResourceDefinition.Attribute.class);
writeAttributes(writer, store, storeAttributes);
writeAttributes(writer, store, StoreResourceDefinition.DeprecatedAttribute.class);
writeStoreElements(writer, store);
writer.writeEndElement();
}
if (cache.hasDefined(BinaryKeyedJDBCStoreResourceDefinition.PATH.getKeyValuePair())) {
ModelNode store = cache.get(BinaryKeyedJDBCStoreResourceDefinition.PATH.getKeyValuePair());
writer.writeStartElement(XMLElement.BINARY_KEYED_JDBC_STORE.getLocalName());
writeAttributes(writer, store, JDBCStoreResourceDefinition.Attribute.class);
writeAttributes(writer, store, storeAttributes);
writeAttributes(writer, store, StoreResourceDefinition.DeprecatedAttribute.class);
writeStoreElements(writer, store);
writeJDBCStoreTable(writer, XMLElement.BINARY_KEYED_TABLE, store, BinaryTableResourceDefinition.PATH, BinaryTableResourceDefinition.Attribute.PREFIX);
writer.writeEndElement();
}
if (cache.hasDefined(StringKeyedJDBCStoreResourceDefinition.PATH.getKeyValuePair())) {
ModelNode store = cache.get(StringKeyedJDBCStoreResourceDefinition.PATH.getKeyValuePair());
writer.writeStartElement(XMLElement.JDBC_STORE.getLocalName());
writeAttributes(writer, store, JDBCStoreResourceDefinition.Attribute.class);
writeAttributes(writer, store, storeAttributes);
writeAttributes(writer, store, StoreResourceDefinition.DeprecatedAttribute.class);
writeStoreElements(writer, store);
writeJDBCStoreTable(writer, XMLElement.TABLE, store, StringTableResourceDefinition.PATH, StringTableResourceDefinition.Attribute.PREFIX);
writer.writeEndElement();
}
if (cache.hasDefined(MixedKeyedJDBCStoreResourceDefinition.PATH.getKeyValuePair())) {
ModelNode store = cache.get(MixedKeyedJDBCStoreResourceDefinition.PATH.getKeyValuePair());
writer.writeStartElement(XMLElement.MIXED_KEYED_JDBC_STORE.getLocalName());
writeAttributes(writer, store, JDBCStoreResourceDefinition.Attribute.class);
writeAttributes(writer, store, storeAttributes);
writeAttributes(writer, store, StoreResourceDefinition.DeprecatedAttribute.class);
writeStoreElements(writer, store);
writeJDBCStoreTable(writer, XMLElement.BINARY_KEYED_TABLE, store, BinaryTableResourceDefinition.PATH, BinaryTableResourceDefinition.Attribute.PREFIX);
writeJDBCStoreTable(writer, XMLElement.STRING_KEYED_TABLE, store, StringTableResourceDefinition.PATH, StringTableResourceDefinition.Attribute.PREFIX);
writer.writeEndElement();
}
if (cache.hasDefined(RemoteStoreResourceDefinition.PATH.getKeyValuePair())) {
ModelNode store = cache.get(RemoteStoreResourceDefinition.PATH.getKeyValuePair());
writer.writeStartElement(XMLElement.REMOTE_STORE.getLocalName());
writeAttributes(writer, store, RemoteStoreResourceDefinition.Attribute.class);
writeAttributes(writer, store, storeAttributes);
writeAttributes(writer, store, StoreResourceDefinition.DeprecatedAttribute.class);
writeStoreElements(writer, store);
writer.writeEndElement();
}
if (cache.hasDefined(HotRodStoreResourceDefinition.PATH.getKeyValuePair())) {
ModelNode store = cache.get(HotRodStoreResourceDefinition.PATH.getKeyValuePair());
writer.writeStartElement(XMLElement.HOTROD_STORE.getLocalName());
writeAttributes(writer, store, HotRodStoreResourceDefinition.Attribute.class);
writeAttributes(writer, store, storeAttributes);
writeAttributes(writer, store, StoreResourceDefinition.DeprecatedAttribute.class);
writeStoreElements(writer, store);
writer.writeEndElement();
}
if (cache.hasDefined(PartitionHandlingResourceDefinition.PATH.getKeyValuePair())) {
ModelNode partitionHandling = cache.get(PartitionHandlingResourceDefinition.PATH.getKeyValuePair());
EnumSet<PartitionHandlingResourceDefinition.Attribute> attributes = EnumSet.allOf(PartitionHandlingResourceDefinition.Attribute.class);
if (hasDefined(partitionHandling, attributes)) {
writer.writeStartElement(XMLElement.PARTITION_HANDLING.getLocalName());
writeAttributes(writer, partitionHandling, attributes);
writer.writeEndElement();
}
}
if (cache.hasDefined(StateTransferResourceDefinition.PATH.getKeyValuePair())) {
ModelNode stateTransfer = cache.get(StateTransferResourceDefinition.PATH.getKeyValuePair());
EnumSet<StateTransferResourceDefinition.Attribute> attributes = EnumSet.allOf(StateTransferResourceDefinition.Attribute.class);
if (hasDefined(stateTransfer, attributes)) {
writer.writeStartElement(XMLElement.STATE_TRANSFER.getLocalName());
writeAttributes(writer, stateTransfer, attributes);
writer.writeEndElement();
}
}
if (cache.hasDefined(BackupsResourceDefinition.PATH.getKeyValuePair())) {
ModelNode backups = cache.get(BackupsResourceDefinition.PATH.getKeyValuePair());
if (backups.hasDefined(BackupResourceDefinition.WILDCARD_PATH.getKey())) {
writer.writeStartElement(XMLElement.BACKUPS.getLocalName());
for (Property property : backups.get(BackupResourceDefinition.WILDCARD_PATH.getKey()).asPropertyList()) {
writer.writeStartElement(XMLElement.BACKUP.getLocalName());
writer.writeAttribute(XMLAttribute.SITE.getLocalName(), property.getName());
ModelNode backup = property.getValue();
writeAttributes(writer, backup, EnumSet.allOf(BackupResourceDefinition.Attribute.class));
EnumSet<BackupResourceDefinition.TakeOfflineAttribute> takeOfflineAttributes = EnumSet.allOf(BackupResourceDefinition.TakeOfflineAttribute.class);
if (hasDefined(backup, takeOfflineAttributes)) {
writer.writeStartElement(XMLElement.TAKE_OFFLINE.getLocalName());
writeAttributes(writer, backup, takeOfflineAttributes);
writer.writeEndElement();
}
writer.writeEndElement();
}
writer.writeEndElement();
}
}
}
use of org.jboss.as.clustering.controller.Attribute in project wildfly by wildfly.
the class InfinispanSubsystemXMLWriter method writeScheduledThreadPoolElements.
private static <P extends ScheduledThreadPoolDefinition & ResourceDefinitionProvider> void writeScheduledThreadPoolElements(XMLElement element, P pool, XMLExtendedStreamWriter writer, ModelNode container) throws XMLStreamException {
if (container.get(pool.getPathElement().getKey()).hasDefined(pool.getPathElement().getValue())) {
ModelNode threadPool = container.get(pool.getPathElement().getKeyValuePair());
Iterable<Attribute> attributes = Arrays.asList(pool.getMinThreads(), pool.getKeepAliveTime());
if (hasDefined(threadPool, attributes)) {
writer.writeStartElement(element.getLocalName());
writeAttributes(writer, threadPool, attributes);
writer.writeEndElement();
}
}
}
Aggregations