org.infinispan.commons.configuration.attributes.AttributeSet类的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(83)

本文整理了Java中org.infinispan.commons.configuration.attributes.AttributeSet类的一些代码示例,展示了AttributeSet类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AttributeSet类的具体详情如下:
包路径:org.infinispan.commons.configuration.attributes.AttributeSet
类名称:AttributeSet

AttributeSet介绍

[英]AttributeSet is a container for Attributes. It is constructed by passing in a list of AttributeDefinitions. AttributeSets are initially unprotected, which means that the contained attributes can be modified. If the #protect() method is invoked then only attributes which are not AttributeDefinition#isImmutable() can be modified from then on.
[中]AttributeSet是属性的容器。它是通过传入AttributeDefinitions列表来构造的。属性集最初是不受保护的,这意味着可以修改包含的属性。如果调用了#protect()方法,则从那时起只能修改非AttributeDefinition#isImmutable()的属性。

代码示例

代码示例来源:origin: wildfly/wildfly

public HotRodStoreConfigurationBuilder cacheConfiguration(String cacheConfiguration) {
  this.attributes.attribute(CACHE_CONFIGURATION).set(cacheConfiguration);
  return this;
}

代码示例来源:origin: wildfly/wildfly

@SuppressWarnings("deprecation")
@Override
public HotRodStoreConfiguration create() {
  return new HotRodStoreConfiguration(this.attributes.protect(), this.async.create(), this.singletonStore.create());
}

代码示例来源:origin: wildfly/wildfly

public HotRodStoreConfigurationBuilder(PersistenceConfigurationBuilder builder) {
  super(builder, new AttributeSet(HotRodStoreConfiguration.class, AbstractStoreConfiguration.attributeDefinitionSet(), CACHE_CONFIGURATION, REMOTE_CACHE_CONTAINER));
}

代码示例来源:origin: org.infinispan/infinispan-persistence-soft-index

@Override
public SoftIndexFileStoreConfiguration newConfigurationFrom(int segment) {
 AttributeSet set = SoftIndexFileStoreConfiguration.attributeDefinitionSet();
 set.read(attributes);
 String dataLocation = set.attribute(DATA_LOCATION).get();
 set.attribute(DATA_LOCATION).set(fileLocationTransform(dataLocation, segment));
 String indexLocation = set.attribute(INDEX_LOCATION).get();
 set.attribute(INDEX_LOCATION).set(fileLocationTransform(indexLocation, segment));
 return new SoftIndexFileStoreConfiguration(set.protect(), async(), singletonStore());
}

代码示例来源:origin: org.infinispan/infinispan-commons

/**
* @deprecated use {@link AbstractTypedPropertiesConfiguration#AbstractTypedPropertiesConfiguration(AttributeSet)} instead
*/
@Deprecated
protected AbstractTypedPropertiesConfiguration(Properties properties) {
 this.attributes = attributeSet();
 this.attributes = attributes.protect();
 this.properties = this.attributes.attribute(PROPERTIES);
 this.attributes.attribute(PROPERTIES).set(immutableTypedProperties(TypedProperties.toTypedProperties(properties)));
}

代码示例来源:origin: org.infinispan/infinispan-commons

@Test
public void testDefaultAttributeCopy() {
 AttributeDefinition<Boolean> def = AttributeDefinition.builder("test", false).build();
 AttributeSet set1 = new AttributeSet("set", def);
 set1.attribute(def).set(true);
 AttributeSet set2 = new AttributeSet("set", def);
 set2.read(set1);
 assertEquals(set1.attribute(def).get(), set2.attribute(def).get());
}

代码示例来源:origin: org.infinispan/infinispan-commons

protected AbstractTypedPropertiesConfiguration(AttributeSet attributes) {
 this.attributes = attributes.checkProtection();
 this.properties = this.attributes.attribute(PROPERTIES);
 if (properties.isModified()) {
   properties.set(immutableTypedProperties(properties.get()));
 }
}

代码示例来源:origin: org.infinispan/infinispan-core

protected void compareAttributeSets(String name, AttributeSet before, AttributeSet after, String... exclude) {
   List<String> exclusions = exclude != null ? Arrays.asList(exclude) : Collections.emptyList();
   for (Attribute<?> attribute : before.attributes()) {
     if (!exclusions.contains(attribute.name())) {
      assertEquals("Configuration " + name, attribute, after.attribute(attribute.name()));
     }
   }
  }
}

代码示例来源:origin: org.infinispan/infinispan-commons

/**
* Writer a single attribute to the specified {@link XMLStreamWriter} using the supplied name
* @param writer the writer
* @param def the Attribute definition
* @param name the XML tag name for the attribute
* @throws XMLStreamException
*/
public void write(XMLStreamWriter writer, AttributeDefinition<?> def, Enum<?> name) throws XMLStreamException {
 write(writer, def, name.toString());
}

代码示例来源:origin: org.infinispan/infinispan-commons

/**
* Writes this attributeset to the specified XMLStreamWriter as an element
* @param writer
*/
public void write(XMLStreamWriter writer, String xmlElementName) throws XMLStreamException {
 if (isModified()) {
   writer.writeStartElement(xmlElementName);
   write(writer);
   writer.writeEndElement();
 }
}

代码示例来源:origin: org.infinispan/infinispan-clustered-lock

@Override
public Builder<?> read(ClusteredLockConfiguration template) {
 this.attributes.read(template.attributes());
 return this;
}

代码示例来源:origin: org.infinispan/infinispan-core

@Override
public DummyInMemoryStoreConfiguration newConfigurationFrom(int segment) {
 AttributeSet set = DummyInMemoryStoreConfiguration.attributeDefinitionSet();
 set.read(attributes);
 String storeName = set.attribute(STORE_NAME).get();
 if (storeName != null) {
   set.attribute(STORE_NAME).set(storeName + "-" + segment);
 }
 return new DummyInMemoryStoreConfiguration(set.protect(), async(), singletonStore());
}

代码示例来源:origin: org.infinispan/infinispan-cachestore-jdbc

private void writeJDBCStoreColumn(XMLExtendedStreamWriter writer, Element element, AttributeSet attributes, AttributeDefinition<?> columnName,
     AttributeDefinition<?> columnType) throws XMLStreamException {
   writer.writeStartElement(element);
   attributes.write(writer, columnName, Attribute.NAME);
   attributes.write(writer, columnType, Attribute.TYPE);
   writer.writeEndElement();
  }
}

代码示例来源:origin: org.infinispan/infinispan-cachestore-jdbc

@Override
public Builder<?> read(TableManipulationConfiguration template) {
 attributes.read(template.attributes());
 return this;
}

代码示例来源:origin: wildfly/wildfly

public HotRodStoreConfigurationBuilder remoteCacheContainer(RemoteCacheContainer remoteCacheContainer) {
  this.attributes.attribute(REMOTE_CACHE_CONTAINER).set(remoteCacheContainer);
  return this;
}

代码示例来源:origin: wildfly/wildfly

@SuppressWarnings("deprecation")
@Override
public CustomStoreConfiguration create() {
  return new CustomStoreConfiguration(this.attributes.protect(), this.async.create(), this.singletonStore.create());
}

代码示例来源:origin: stackoverflow.com

AttributeSet attrs = new AttributeSet(){
   @Override
   public int getAttributeCount() {

代码示例来源:origin: org.infinispan/infinispan-commons

/**
* Writer a single attribute to the specified {@link XMLStreamWriter} using the attribute's xmlName
* @param writer the writer
* @param def the Attribute definition
* @throws XMLStreamException
*/
public void write(XMLStreamWriter writer, AttributeDefinition<?> def) throws XMLStreamException {
 write(writer, def, def.xmlName());
}

代码示例来源:origin: org.infinispan/infinispan-clustered-lock

@Override
public Builder<?> read(ClusteredLockManagerConfiguration template) {
 this.attributes.read(template.attributes());
 return this;
}

代码示例来源:origin: wildfly/wildfly

@SuppressWarnings("deprecation")
  @Override
  public void accept(ConfigurationBuilder builder) {
    ClusteringConfigurationBuilder clustering = builder.clustering();
    CacheMode mode = clustering.cacheMode();
    clustering.cacheMode(mode.needsStateTransfer() ? CacheMode.REPL_SYNC : CacheMode.LOCAL);
    // don't use DefaultConsistentHashFactory for REPL caches (WFLY-9276)
    clustering.hash().consistentHashFactory(null);
    clustering.l1().disable();
    // Workaround for ISPN-8722
    AttributeSet attributes = TemplateConfigurationServiceConfigurator.getAttributes(clustering);
    attributes.attribute(ClusteringConfiguration.BIAS_ACQUISITION).reset();
    attributes.attribute(ClusteringConfiguration.BIAS_LIFESPAN).reset();
    attributes.attribute(ClusteringConfiguration.INVALIDATION_BATCH_SIZE).reset();
    // Ensure we use the default data container
    builder.dataContainer().dataContainer(null);
    // Disable expiration
    builder.expiration().lifespan(-1).maxIdle(-1);
    // Disable eviction
    builder.memory().size(-1).evictionStrategy(EvictionStrategy.MANUAL);
    builder.persistence().clearStores();
    StateTransferConfigurationBuilder stateTransfer = clustering.stateTransfer().fetchInMemoryState(mode.needsStateTransfer());
    attributes = TemplateConfigurationServiceConfigurator.getAttributes(stateTransfer);
    attributes.attribute(StateTransferConfiguration.AWAIT_INITIAL_TRANSFER).reset();
    attributes.attribute(StateTransferConfiguration.TIMEOUT).reset();
  }
}

相关文章