private static void handleMethodReference(Configuration configuration, Element element) { String className = element.getAttributes().getNamedItem("class-name").getTextContent(); ConfigurationMethodRef configMethodRef = new ConfigurationMethodRef(); configuration.addMethodRef(className, configMethodRef); DOMElementIterator nodeIterator = new DOMElementIterator(element.getChildNodes()); while (nodeIterator.hasNext()) { Element subElement = nodeIterator.next(); if (subElement.getNodeName().equals("expiry-time-cache")) { String maxAge = subElement.getAttributes().getNamedItem("max-age-seconds").getTextContent(); String purgeInterval = subElement.getAttributes().getNamedItem("purge-interval-seconds").getTextContent(); ConfigurationCacheReferenceType refTypeEnum = ConfigurationCacheReferenceType.getDefault(); if (subElement.getAttributes().getNamedItem("ref-type") != null) { String refType = subElement.getAttributes().getNamedItem("ref-type").getTextContent(); refTypeEnum = ConfigurationCacheReferenceType.valueOf(refType.toUpperCase()); } configMethodRef.setExpiryTimeCache(Double.parseDouble(maxAge), Double.parseDouble(purgeInterval), refTypeEnum); } else if (subElement.getNodeName().equals("lru-cache")) { String size = subElement.getAttributes().getNamedItem("size").getTextContent(); configMethodRef.setLRUCache(Integer.parseInt(size)); } } }
public EPLManager addMethods(com.espertech.esper.client.Configuration configuration) { this.allMethods = DBUtils.qetAllMethods(); Collection<Method> methods = this.allMethods.values(); for(Method method : methods) { ConfigurationMethodRef methodRef = new ConfigurationMethodRef(); ConfigurationCacheReferenceType cacheReferenceType = null; if("WEAK".equals(method.getCacheReferenceType())) { cacheReferenceType = ConfigurationCacheReferenceType.WEAK; } else if("SOFT".equals(method.getCacheReferenceType())) { cacheReferenceType = ConfigurationCacheReferenceType.SOFT; } else { cacheReferenceType = ConfigurationCacheReferenceType.HARD; } methodRef.setExpiryTimeCache(method.getMaxAgeSeconds(), method.getPurgeIntervalSeconds(), cacheReferenceType); Class clazz = null; try { clazz = Class.forName(method.getMethodName()); } catch (ClassNotFoundException e) { e.printStackTrace(); } if(clazz == null) continue; LOG.info("Add customer method : " + method.getMethodName()); this.configuration.addMethodRef(clazz, methodRef); this.configuration.addImport(method.getMethodName()); } return this; }
public AlarmEPLManager addMethods(Configuration configuration) { this.allMethods = DBUtils.qetAllMethods(); Collection<Method> methods = this.allMethods.values(); for(Method method : methods) { ConfigurationMethodRef methodRef = new ConfigurationMethodRef(); ConfigurationCacheReferenceType cacheReferenceType = null; if("WEAK".equals(method.getCacheReferenceType())) { cacheReferenceType = ConfigurationCacheReferenceType.WEAK; } else if("SOFT".equals(method.getCacheReferenceType())) { cacheReferenceType = ConfigurationCacheReferenceType.SOFT; } else { cacheReferenceType = ConfigurationCacheReferenceType.HARD; } methodRef.setExpiryTimeCache(method.getMaxAgeSeconds(), method.getPurgeIntervalSeconds(), cacheReferenceType); Class clazz = null; try { clazz = Class.forName(method.getMethodName()); } catch (ClassNotFoundException e) { e.printStackTrace(); } if(clazz == null) continue; this.configuration.addMethodRef(clazz, methodRef); this.configuration.addImport(method.getMethodName()); } return this; }
public void recreateMethod(Method method) { Method md = this.allMethods.get(method.getMethodName()); if(md != null) this.configuration.removeImport(md.getMethodName()); ConfigurationMethodRef methodRef = new ConfigurationMethodRef(); ConfigurationCacheReferenceType cacheReferenceType = null; if("WEAK".equals(method.getCacheReferenceType())) { cacheReferenceType = ConfigurationCacheReferenceType.WEAK; } else if("SOFT".equals(method.getCacheReferenceType())) { cacheReferenceType = ConfigurationCacheReferenceType.SOFT; } else { cacheReferenceType = ConfigurationCacheReferenceType.HARD; } methodRef.setExpiryTimeCache(method.getMaxAgeSeconds(), method.getPurgeIntervalSeconds(), cacheReferenceType); Class clazz = null; try { clazz = Class.forName(method.getMethodName()); } catch (ClassNotFoundException e) { e.printStackTrace(); } this.configuration.addMethodRef(clazz, methodRef); this.configuration.addImport(method.getMethodName()); LOG.info("Recreate Method : " + method.getMethodName()); }
public void recreateMethod(Method method) { Method md = this.allMethods.get(method.getMethodName()); if(md != null) this.configuration.removeImport(md.getMethodName()); ConfigurationMethodRef methodRef = new ConfigurationMethodRef(); ConfigurationCacheReferenceType cacheReferenceType = null; if("WEAK".equals(method.getCacheReferenceType())) { cacheReferenceType = ConfigurationCacheReferenceType.WEAK; } else if("SOFT".equals(method.getCacheReferenceType())) { cacheReferenceType = ConfigurationCacheReferenceType.SOFT; } else { cacheReferenceType = ConfigurationCacheReferenceType.HARD; } methodRef.setExpiryTimeCache(method.getMaxAgeSeconds(), method.getPurgeIntervalSeconds(), cacheReferenceType); Class clazz = null; try { clazz = Class.forName(method.getMethodName()); } catch (ClassNotFoundException e) { e.printStackTrace(); } this.configuration.addMethodRef(clazz, methodRef); this.configuration.addImport(method.getMethodName()); LOG.info("Recreate Method : " + method.getMethodName()); }