use of com.hazelcast.config.IndexType in project hazelcast by hazelcast.
the class IndexUtils method getIndexConfigFromXml.
public static IndexConfig getIndexConfigFromXml(Node indexNode, boolean domLevel3, boolean strict) {
NamedNodeMap attrs = indexNode.getAttributes();
String name = getTextContent(attrs.getNamedItem("name"), domLevel3);
if (name.isEmpty()) {
name = null;
}
String typeStr = getTextContent(attrs.getNamedItem("type"), domLevel3);
IndexType type = getIndexTypeFromXmlName(typeStr);
IndexConfig res = new IndexConfig().setName(name).setType(type);
for (Node attributesNode : childElements(indexNode)) {
if ("attributes".equals(cleanNodeName(attributesNode))) {
for (Node attributeNode : childElements(attributesNode)) {
if ("attribute".equals(cleanNodeName(attributeNode))) {
String attribute = getTextContent(attributeNode, domLevel3);
res.addAttribute(attribute);
}
}
}
}
if (type == IndexType.BITMAP) {
Node optionsNode = childElementWithName(indexNode, "bitmap-index-options", strict);
if (optionsNode != null) {
Node uniqueKeyNode = childElementWithName(optionsNode, "unique-key", strict);
String uniqueKeyText = getTextContent(uniqueKeyNode, domLevel3);
String uniqueKey = isNullOrEmpty(uniqueKeyText) ? BitmapIndexOptions.DEFAULT_UNIQUE_KEY : uniqueKeyText;
Node uniqueKeyTransformationNode = childElementWithName(optionsNode, "unique-key-transformation", strict);
String uniqueKeyTransformationText = getTextContent(uniqueKeyTransformationNode, domLevel3);
UniqueKeyTransformation uniqueKeyTransformation = isNullOrEmpty(uniqueKeyTransformationText) ? BitmapIndexOptions.DEFAULT_UNIQUE_KEY_TRANSFORMATION : UniqueKeyTransformation.fromName(uniqueKeyTransformationText);
res.getBitmapIndexOptions().setUniqueKey(uniqueKey);
res.getBitmapIndexOptions().setUniqueKeyTransformation(uniqueKeyTransformation);
}
}
return res;
}
use of com.hazelcast.config.IndexType in project hazelcast by hazelcast.
the class IndexUtils method getIndexConfigFromYaml.
public static IndexConfig getIndexConfigFromYaml(Node indexNode, boolean domLevel3, boolean strict) {
NamedNodeMap attrs = indexNode.getAttributes();
String name = getTextContent(attrs.getNamedItem("name"), domLevel3);
if (name.isEmpty()) {
name = null;
}
String typeStr = getTextContent(attrs.getNamedItem("type"), domLevel3);
if (typeStr.isEmpty()) {
typeStr = IndexConfig.DEFAULT_TYPE.name();
}
IndexType type = getIndexTypeFromXmlName(typeStr);
IndexConfig res = new IndexConfig().setName(name).setType(type);
Node attributesNode = attrs.getNamedItem("attributes");
for (Node attributeNode : childElements(attributesNode)) {
String attribute = attributeNode.getNodeValue();
res.addAttribute(attribute);
}
if (type == IndexType.BITMAP) {
Node optionsNode = childElementWithName(indexNode, "bitmap-index-options", strict);
if (optionsNode != null) {
Node uniqueKeyNode = childElementWithName(optionsNode, "unique-key", strict);
String uniqueKeyText = getTextContent(uniqueKeyNode, domLevel3);
String uniqueKey = isNullOrEmpty(uniqueKeyText) ? BitmapIndexOptions.DEFAULT_UNIQUE_KEY : uniqueKeyText;
Node uniqueKeyTransformationNode = childElementWithName(optionsNode, "unique-key-transformation", strict);
String uniqueKeyTransformationText = getTextContent(uniqueKeyTransformationNode, domLevel3);
UniqueKeyTransformation uniqueKeyTransformation = isNullOrEmpty(uniqueKeyTransformationText) ? BitmapIndexOptions.DEFAULT_UNIQUE_KEY_TRANSFORMATION : UniqueKeyTransformation.fromName(uniqueKeyTransformationText);
res.getBitmapIndexOptions().setUniqueKey(uniqueKey);
res.getBitmapIndexOptions().setUniqueKeyTransformation(uniqueKeyTransformation);
}
}
return res;
}
use of com.hazelcast.config.IndexType in project hazelcast by hazelcast.
the class IndexCreateTest method parameters.
@Parameterized.Parameters(name = "Executing: {0}, {1}")
public static Collection<Object[]> parameters() {
List<Object[]> res = new ArrayList<>();
for (IndexType type : IndexType.values()) {
res.add(new Object[] { new StaticMapMemberHandler(), type });
res.add(new Object[] { new DynamicMapMemberHandler(), type });
res.add(new Object[] { new DynamicIndexMemberHandler(), type });
res.add(new Object[] { new DynamicMapClientHandler(), type });
res.add(new Object[] { new DynamicIndexClientHandler(), type });
}
return res;
}
Aggregations