Package org.springmodules.lucene.index.resource

Examples of org.springmodules.lucene.index.resource.NameMatchResourceAttributeSource


  private void configureAttributes(Element element,
      RootBeanDefinition resourceAdviceBeanDefinition, ParserContext parserContext) {
    Element attrsElement = DomUtils.getChildElementByTagName(element, ATTRIBUTES_TAG);
    List methodElements = DomUtils.getChildElementsByTagName(attrsElement, METHOD_TAG);
    NameMatchResourceAttributeSource resourceAttributeSource = new NameMatchResourceAttributeSource();
    Map attributes = new HashMap();
    for(Iterator i = methodElements.iterator(); i.hasNext(); ) {
      Element methodElement = (Element)i.next();
      String methodName = methodElement.getAttribute(NAME_ATTRIBUTE);
      RuleBasedResourceAttribute attr = new RuleBasedResourceAttribute();

      methodName = methodName.trim();
      String writerOpen = methodElement.getAttribute(WRITER_OPEN_ATTRIBUTE);
      writerOpen = writerOpen.trim();
      String readerOpen = methodElement.getAttribute(READER_OPEN_ATTRIBUTE);
      readerOpen = readerOpen.trim();
      String writerWritingEnabled = methodElement.getAttribute(WRITER_WRITING_ENABLED_ATTRIBUTE);
      writerWritingEnabled = writerWritingEnabled.trim();
      String readerWritingEnabled = methodElement.getAttribute(READER_WRITING_ENABLED_ATTRIBUTE);
      readerWritingEnabled = readerWritingEnabled.trim();

      attr.setIndexWriterOpen(TRUE_VALUE.equals(writerOpen));
      attr.setIndexReaderOpen(TRUE_VALUE.equals(readerOpen));
      attr.setWriteOperationsForIndexWriterAuthorized(TRUE_VALUE.equals(writerWritingEnabled));
      attr.setWriteOperationsForIndexReaderAuthorized(TRUE_VALUE.equals(readerWritingEnabled));
     
      attributes.put(methodName, attr);
    }

    resourceAttributeSource.setResourceAttributes(attributes);
    resourceAdviceBeanDefinition.getPropertyValues()
        .addPropertyValue(RESOURCE_ATTRIBUTES_SOURCE_ATTRIBUTE, resourceAttributeSource);
  }
View Full Code Here

TOP

Related Classes of org.springmodules.lucene.index.resource.NameMatchResourceAttributeSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.