Search in sources :

Example 1 with ConfigProperty

use of org.apache.geode.internal.datasource.ConfigProperty in project geode by apache.

the class CacheXmlParser method startElement.

public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
    if (qName.equals(CACHE)) {
        startCache(atts);
    } else if (qName.equals(CLIENT_CACHE)) {
        startClientCache(atts);
    } else if (qName.equals(BRIDGE_SERVER)) {
        startCacheServer(atts);
    } else if (qName.equals(CACHE_SERVER)) {
        startCacheServer(atts);
    } else if (qName.equals(LOAD_PROBE)) {
    } else if (qName.equals(CONNECTION_POOL)) {
        startPool(atts);
    } else if (qName.equals(CLIENT_SUBSCRIPTION)) {
        startClientHaQueue(atts);
    } else if (qName.equals(DYNAMIC_REGION_FACTORY)) {
        startDynamicRegionFactory(atts);
    } else if (qName.equals(GATEWAY_SENDER)) {
        startGatewaySender(atts);
    } else if (qName.equals(GATEWAY_RECEIVER)) {
        startGatewayReceiver(atts);
    } else if (qName.equals(GATEWAY_EVENT_FILTER)) {
    } else if (qName.equals(GATEWAY_TRANSPORT_FILTER)) {
    } else if (qName.equals(GATEWAY_EVENT_LISTENER)) {
    } else if (qName.equals(GATEWAY_EVENT_SUBSTITUTION_FILTER)) {
    } else if (qName.equals(ASYNC_EVENT_QUEUE)) {
        startAsyncEventQueue(atts);
    } else if (qName.equals(GATEWAY_CONFLICT_RESOLVER)) {
    } else if (qName.equals(LOCATOR)) {
        doLocator(atts);
    } else if (qName.equals(REGION)) {
        startRegion(atts);
    } else if (qName.equals(VM_ROOT_REGION)) {
        startRegion(atts);
    } else if (qName.equals(REGION_ATTRIBUTES)) {
        startRegionAttributes(atts);
    } else if (qName.equals(DISK_STORE)) {
        startDiskStore(atts);
    } else if (qName.equals(KEY_CONSTRAINT)) {
    } else if (qName.equals(VALUE_CONSTRAINT)) {
    } else if (qName.equals(INDEX_UPDATE_TYPE)) {
    } else if (qName.equals(REGION_TIME_TO_LIVE)) {
    } else if (qName.equals(REGION_IDLE_TIME)) {
    } else if (qName.equals(ENTRY_TIME_TO_LIVE)) {
    } else if (qName.equals(ENTRY_IDLE_TIME)) {
    } else if (qName.equals(EXPIRATION_ATTRIBUTES)) {
        startExpirationAttributes(atts);
    } else if (qName.equals(SERVER)) {
        doServer(atts);
    } else if (qName.equals(CUSTOM_EXPIRY)) {
    } else if (qName.equals(SUBSCRIPTION_ATTRIBUTES)) {
        startSubscriptionAttributes(atts);
    } else if (qName.equals(ENTRY)) {
    } else if (qName.equals(CLASS_NAME)) {
    } else if (qName.equals(PARAMETER)) {
        startParameter(atts);
    } else if (qName.equals(DISK_WRITE_ATTRIBUTES)) {
        startDiskWriteAttributes(atts);
    } else if (qName.equals(SYNCHRONOUS_WRITES)) {
        startSynchronousWrites();
    } else if (qName.equals(ASYNCHRONOUS_WRITES)) {
        startAsynchronousWrites(atts);
    } else if (qName.equals(DISK_DIRS)) {
    } else if (qName.equals(DISK_DIR)) {
        startDiskDir(atts);
    } else if (qName.equals(GROUP)) {
    } else if (qName.equals(PARTITION_ATTRIBUTES)) {
        startPartitionAttributes(atts);
    } else if (qName.equals(FIXED_PARTITION_ATTRIBUTES)) {
        startFixedPartitionAttributes(atts);
    } else if (qName.equals(REQUIRED_ROLE)) {
        startRequiredRole(atts);
    } else if (qName.equals(MEMBERSHIP_ATTRIBUTES)) {
        startMembershipAttributes(atts);
    } else if (qName.equals(LOCAL_PROPERTIES)) {
        startPartitionProperties(atts, LOCAL_PROPERTIES);
    } else if (qName.equals(GLOBAL_PROPERTIES)) {
        startPartitionProperties(atts, GLOBAL_PROPERTIES);
    } else if (qName.equals(CACHE_LOADER)) {
    } else if (qName.equals(CACHE_WRITER)) {
    } else if (qName.equals(EVICTION_ATTRIBUTES)) {
    } else if (qName.equals(LRU_ENTRY_COUNT)) {
        // internal to eviction-attributes
        startLRUEntryCount(atts);
    } else if (qName.equals(LRU_MEMORY_SIZE)) {
        // internal to eviction-attributes
        // Visit endLRUMemorySize() to know the completion
        // of lru-memory-size eviction configuration
        startLRUMemorySize(atts);
    } else if (qName.equals(LRU_HEAP_PERCENTAGE)) {
        // internal to eviction-attributes
        startLRUHeapPercentage(atts);
    } else if (qName.equals(CACHE_LISTENER)) {
    } else if (qName.equals(ASYNC_EVENT_LISTENER)) {
    } else if (qName.equals(KEY)) {
    } else if (qName.equals(VALUE)) {
    } else if (qName.equals(STRING)) {
    } else if (qName.equals(DECLARABLE)) {
    } else if (qName.equals(INDEX)) {
        // Asif: Create an object of type IndexCreationData &
        // push it in stack
        startIndex(atts);
    // this.stack.push(new IndexCreationData(atts.getValue(NAME)));
    } else if (qName.equals(FUNCTIONAL)) {
        startFunctionalIndex(atts);
    } else if (qName.equals(PRIMARY_KEY)) {
        startPrimaryKeyIndex(atts);
    } else if (qName.equals(TRANSACTION_MANAGER)) {
        startCacheTransactionManager();
    } else if (qName.equals(TRANSACTION_LISTENER)) {
    } else if (qName.equals(TRANSACTION_WRITER)) {
    } else if (qName.equals(JNDI_BINDINGS)) {
    // added by Nand Kishor
    } else if (qName.equals(JNDI_BINDING)) {
        // added by Nand Kishor
        // Asif: Push the BindingCreation object in the stack
        Map gfSpecific = new HashMap();
        mapJNDI(atts, gfSpecific);
        List vendorSpecific = new ArrayList();
        this.stack.push(new BindingCreation(gfSpecific, vendorSpecific));
    } else if (qName.equals(CONFIG_PROPERTY_BINDING)) {
        // Asif : Peek at the BindingCreation object from stack
        // & get the vendor specific data map
        BindingCreation bc = (BindingCreation) this.stack.peek();
        List vendorSpecific = bc.getVendorSpecificList();
        // Rohit: Add a ConfigProperty Data Object to the list.
        vendorSpecific.add(new ConfigProperty());
    } else if (qName.equals(CONFIG_PROPERTY_NAME)) {
    } else if (qName.equals(CONFIG_PROPERTY_VALUE)) {
    } else if (qName.equals(CONFIG_PROPERTY_TYPE)) {
    } else if (qName.equals(PARTITION_RESOLVER)) {
    } else if (qName.equals(PARTITION_LISTENER)) {
    } else if (qName.equals(FUNCTION_SERVICE)) {
        startFunctionService();
    } else if (qName.equals(FUNCTION)) {
    } else if (qName.equals(TOP_SERIALIZER_REGISTRATION)) {
        startSerializerRegistration();
    } else if (qName.equals(INITIALIZER)) {
        startInitializer();
    } else if (qName.equals(INSTANTIATOR_REGISTRATION)) {
        startInstantiator(atts);
    } else if (qName.equals(SERIALIZER_REGISTRATION)) {
    // do nothing
    } else if (qName.equals(RESOURCE_MANAGER)) {
        startResourceManager(atts);
    } else if (qName.equals(BACKUP)) {
    // do nothing
    } else if (qName.equals(PDX)) {
        startPdx(atts);
    } else if (qName.equals(PDX_SERIALIZER)) {
    // do nothing
    } else if (qName.equals(COMPRESSOR)) {
    } else {
        final XmlParser delegate = getDelegate(namespaceURI);
        if (null == delegate) {
            throw new CacheXmlException(LocalizedStrings.CacheXmlParser_UNKNOWN_XML_ELEMENT_0.toLocalizedString(qName));
        }
        delegate.startElement(namespaceURI, localName, qName, atts);
    }
}
Also used : CacheXmlException(org.apache.geode.cache.CacheXmlException) HashMap(java.util.HashMap) ConfigProperty(org.apache.geode.internal.datasource.ConfigProperty) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Map(java.util.Map) HashMap(java.util.HashMap)

Example 2 with ConfigProperty

use of org.apache.geode.internal.datasource.ConfigProperty in project geode by apache.

the class CacheXmlParser method endElement.

public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
    try {
        // + "; localName = " + localName + "; qName = " + qName);
        if (qName.equals(CACHE)) {
            endCache();
        } else if (qName.equals(CLIENT_CACHE)) {
            endClientCache();
        } else if (qName.equals(BRIDGE_SERVER)) {
            endCacheServer();
        } else if (qName.equals(CACHE_SERVER)) {
            endCacheServer();
        } else if (qName.equals(LOAD_PROBE)) {
            endLoadProbe();
        } else if (qName.equals(CLIENT_SUBSCRIPTION)) {
            endClientHaQueue();
        } else if (qName.equals(CONNECTION_POOL)) {
            endPool();
        } else if (qName.equals(DYNAMIC_REGION_FACTORY)) {
            endDynamicRegionFactory();
        } else if (qName.equals(GATEWAY_SENDER)) {
            endSerialGatewaySender();
        } else if (qName.equals(GATEWAY_RECEIVER)) {
            endGatewayReceiver();
        } else if (qName.equals(GATEWAY_EVENT_FILTER)) {
            endGatewayEventFilter();
        } else if (qName.equals(GATEWAY_EVENT_SUBSTITUTION_FILTER)) {
            endGatewayEventSubstitutionFilter();
        } else if (qName.equals(GATEWAY_TRANSPORT_FILTER)) {
            endGatewayTransportFilter();
        } else if (qName.equals(ASYNC_EVENT_QUEUE)) {
            endAsyncEventQueue();
        } else if (qName.equals(REGION)) {
            endRegion();
        } else if (qName.equals(GATEWAY_CONFLICT_RESOLVER)) {
            endGatewayConflictResolver();
        } else if (qName.equals(VM_ROOT_REGION)) {
            endRegion();
        } else if (qName.equals(REGION_ATTRIBUTES)) {
            endRegionAttributes();
        } else if (qName.equals(DISK_STORE)) {
            endDiskStore();
        } else if (qName.equals(KEY_CONSTRAINT)) {
            endKeyConstraint();
        } else if (qName.equals(VALUE_CONSTRAINT)) {
            endValueConstraint();
        } else if (qName.equals(REGION_TIME_TO_LIVE)) {
            endRegionTimeToLive();
        } else if (qName.equals(REGION_IDLE_TIME)) {
            endRegionIdleTime();
        } else if (qName.equals(ENTRY_TIME_TO_LIVE)) {
            endEntryTimeToLive();
        } else if (qName.equals(ENTRY_IDLE_TIME)) {
            endEntryIdleTime();
        } else if (qName.equals(CUSTOM_EXPIRY)) {
            endCustomExpiry();
        } else if (qName.equals(DISK_WRITE_ATTRIBUTES)) {
            endDiskWriteAttributes();
        } else if (qName.equals(SYNCHRONOUS_WRITES)) {
        } else if (qName.equals(ASYNCHRONOUS_WRITES)) {
        } else if (qName.equals(DISK_DIRS)) {
            endDiskDirs();
        } else if (qName.equals(DISK_DIR)) {
            endDiskDir();
        } else if (qName.equals(GROUP)) {
            endGroup();
        } else if (qName.equals(PARTITION_ATTRIBUTES)) {
            endPartitionAttributes();
        } else if (qName.equals(FIXED_PARTITION_ATTRIBUTES)) {
            endFixedPartitionAttributes();
        } else if (qName.equals(LOCAL_PROPERTIES)) {
            endPartitionProperites(LOCAL_PROPERTIES);
        } else if (qName.equals(GLOBAL_PROPERTIES)) {
            endPartitionProperites(GLOBAL_PROPERTIES);
        } else if (qName.equals(MEMBERSHIP_ATTRIBUTES)) {
            endMembershipAttributes();
        } else if (qName.equals(REQUIRED_ROLE)) {
            endRequiredRole();
        } else if (qName.equals(EXPIRATION_ATTRIBUTES)) {
        } else if (qName.equals(CUSTOM_EXPIRY)) {
            endCustomExpiry();
        } else if (qName.equals(SUBSCRIPTION_ATTRIBUTES)) {
        } else if (qName.equals(ENTRY)) {
            endEntry();
        } else if (qName.equals(CLASS_NAME)) {
            endClassName();
        } else if (qName.equals(PARAMETER)) {
            endParameter();
        } else if (qName.equals(CACHE_LOADER)) {
            endCacheLoader();
        } else if (qName.equals(CACHE_WRITER)) {
            endCacheWriter();
        } else if (qName.equals(EVICTION_ATTRIBUTES)) {
        } else if (qName.equals(LRU_ENTRY_COUNT)) {
        // internal to eviction-attributes
        } else if (qName.equals(LRU_MEMORY_SIZE)) {
            // internal to eviction-attributes
            endLRUMemorySize();
        } else if (qName.equals(LRU_HEAP_PERCENTAGE)) {
            // internal to eviction-attributes
            endLRUHeapPercentage();
        } else if (qName.equals(CACHE_LISTENER)) {
            endCacheListener();
        } else if (qName.equals(ASYNC_EVENT_LISTENER)) {
            endAsyncEventListener();
        } else if (qName.equals(KEY)) {
        } else if (qName.equals(VALUE)) {
        } else if (qName.equals(STRING)) {
            endString();
        } else if (qName.equals(DECLARABLE)) {
            endDeclarable();
        } else if (qName.equals(FUNCTIONAL)) {
        } else if (qName.equals(INDEX)) {
            endIndex();
        } else if (qName.equals(PRIMARY_KEY)) {
        } else if (qName.equals(TRANSACTION_MANAGER)) {
            endCacheTransactionManager();
        } else if (qName.equals(TRANSACTION_LISTENER)) {
            endTransactionListener();
        } else if (qName.equals(TRANSACTION_WRITER)) {
            endTransactionWriter();
        } else if (qName.equals(JNDI_BINDINGS)) {
        } else if (qName.equals(JNDI_BINDING)) {
            // Asif Pop the BindingCreation object
            BindingCreation bc = (BindingCreation) this.stack.pop();
            JNDIInvoker.mapDatasource(bc.getGFSpecificMap(), bc.getVendorSpecificList());
        } else if (qName.equals(CONFIG_PROPERTY_BINDING)) {
        } else if (qName.equals(CONFIG_PROPERTY_NAME)) {
            String name = null;
            if (this.stack.peek() instanceof StringBuffer)
                // Pop the config-property-name element value from the stack.
                name = ((StringBuffer) this.stack.pop()).toString();
            BindingCreation bc = (BindingCreation) this.stack.peek();
            List vsList = bc.getVendorSpecificList();
            ConfigProperty cp = (ConfigProperty) vsList.get(vsList.size() - 1);
            if (name == null) {
                String excep = LocalizedStrings.CacheXmlParser_EXCEPTION_IN_PARSING_ELEMENT_0_THIS_IS_A_REQUIRED_FIELD.toLocalizedString(qName);
                throw new CacheXmlException(excep);
            } else {
                // set the name.
                cp.setName(name);
            }
        } else if (qName.equals(CONFIG_PROPERTY_VALUE)) {
            String value = null;
            // Pop the config-property-value element value from the stack.
            if (this.stack.peek() instanceof StringBuffer)
                value = ((StringBuffer) this.stack.pop()).toString();
            BindingCreation bc = (BindingCreation) this.stack.peek();
            List vsList = bc.getVendorSpecificList();
            ConfigProperty cp = (ConfigProperty) vsList.get(vsList.size() - 1);
            // Set the value to the ConfigProperty Data Object.
            cp.setValue(value);
        } else if (qName.equals(CONFIG_PROPERTY_TYPE)) {
            String type = null;
            if (this.stack.peek() instanceof StringBuffer)
                type = ((StringBuffer) this.stack.pop()).toString();
            BindingCreation bc = (BindingCreation) this.stack.peek();
            List vsList = bc.getVendorSpecificList();
            ConfigProperty cp = (ConfigProperty) vsList.get(vsList.size() - 1);
            if (type == null) {
                String excep = LocalizedStrings.CacheXmlParser_EXCEPTION_IN_PARSING_ELEMENT_0_THIS_IS_A_REQUIRED_FIELD.toLocalizedString(qName);
                throw new CacheXmlException(excep);
            } else {
                cp.setType(type);
            }
        } else if (qName.equals(LRU_MEMORY_SIZE)) {
            // internal to eviction-attributes
            // Visit startLRUMemorySize() to know the begining
            // of lru-memory-size eviction configuration
            endLRUMemorySize();
        } else if (qName.equals(LOCATOR)) {
        // nothing needed
        } else if (qName.equals(SERVER)) {
        // nothing needed
        } else if (qName.equals(PARTITION_RESOLVER)) {
            endPartitionResolver();
        } else if (qName.equals(PARTITION_LISTENER)) {
            endPartitionListener();
        } else if (qName.equals(FUNCTION)) {
            endFunctionName();
        } else if (qName.equals(FUNCTION_SERVICE)) {
            endFunctionService();
        } else if (qName.equals(TOP_SERIALIZER_REGISTRATION)) {
            endSerializerRegistration();
        } else if (qName.equals(INITIALIZER)) {
            endInitializer();
        } else if (qName.equals(SERIALIZER_REGISTRATION)) {
            endSerializer();
        } else if (qName.equals(INSTANTIATOR_REGISTRATION)) {
            endInstantiator();
        } else if (qName.equals(RESOURCE_MANAGER)) {
            endResourceManager();
        } else if (qName.equals(BACKUP)) {
            endBackup();
        } else if (qName.equals(PDX)) {
        // nothing needed
        } else if (qName.equals(PDX_SERIALIZER)) {
            endPdxSerializer();
        } else if (qName.equals(COMPRESSOR)) {
            endCompressor();
        } else {
            final XmlParser delegate = getDelegate(namespaceURI);
            if (null == delegate) {
                throw new CacheXmlException(LocalizedStrings.CacheXmlParser_UNKNOWN_XML_ELEMENT_0.toLocalizedString(qName));
            }
            delegate.endElement(namespaceURI, localName, qName);
        }
    } catch (CacheException ex) {
        throw new SAXException(LocalizedStrings.CacheXmlParser_A_CACHEEXCEPTION_WAS_THROWN_WHILE_PARSING_XML.toLocalizedString(), ex);
    }
}
Also used : CacheXmlException(org.apache.geode.cache.CacheXmlException) CacheException(org.apache.geode.cache.CacheException) ConfigProperty(org.apache.geode.internal.datasource.ConfigProperty) ArrayList(java.util.ArrayList) List(java.util.List) SAXException(org.xml.sax.SAXException)

Aggregations

ArrayList (java.util.ArrayList)2 List (java.util.List)2 CacheXmlException (org.apache.geode.cache.CacheXmlException)2 ConfigProperty (org.apache.geode.internal.datasource.ConfigProperty)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 CacheException (org.apache.geode.cache.CacheException)1 SAXException (org.xml.sax.SAXException)1