当前位置: 首页>>代码示例>>Java>>正文


Java ExtensionFunctionDefinition类代码示例

本文整理汇总了Java中net.sf.saxon.lib.ExtensionFunctionDefinition的典型用法代码示例。如果您正苦于以下问题:Java ExtensionFunctionDefinition类的具体用法?Java ExtensionFunctionDefinition怎么用?Java ExtensionFunctionDefinition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ExtensionFunctionDefinition类属于net.sf.saxon.lib包,在下文中一共展示了ExtensionFunctionDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: compile

import net.sf.saxon.lib.ExtensionFunctionDefinition; //导入依赖的package包/类
public CrigttXsltExecutable compile(Source src, @Nullable ExtensionFunctionDefinition ... extFuncs) throws SaxonApiException {
    CrigttProcessor proc = this.getProcessor();
    CompilerInfo compilerInfo = this.getUnderlyingCompilerInfo();

    if (!ArrayUtils.isEmpty(extFuncs)) {
        IntegratedFunctionLibrary extFuncLib = new IntegratedFunctionLibrary();

        Stream.of(extFuncs).forEach(extFuncLib::registerFunction);

        compilerInfo.setExtensionFunctionLibrary(extFuncLib);
    }

    try {
        PreparedStylesheet preparedStylesheet = Compilation.compileSingletonPackage(proc.getUnderlyingConfiguration(), compilerInfo, src);

        return new CrigttXsltExecutable(proc, preparedStylesheet, compilerInfo);
    } catch (XPathException e) {
        throw new SaxonApiException(e);
    }
}
 
开发者ID:esacinc,项目名称:crigtt,代码行数:21,代码来源:CrigttXsltCompiler.java

示例2: registerEXPathFunction

import net.sf.saxon.lib.ExtensionFunctionDefinition; //导入依赖的package包/类
private void registerEXPathFunction(ExtensionFunctionDefinition function, Configuration configuration) {
  if (function instanceof EXPathFunctionDefinition) {
    ((EXPathFunctionDefinition) function).setConfiguration(configuration);
  }              
  configuration.registerExtensionFunction(function);
  functionClassNames.add(function.getClass().getName());
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:8,代码来源:XSLWebInitializer.java

示例3: addFunction

import net.sf.saxon.lib.ExtensionFunctionDefinition; //导入依赖的package包/类
@Override
@SuppressWarnings({ CompilerWarnings.UNCHECKED })
public T addFunction(ExtensionFunctionDefinition func) {
    this.funcs.add(func);

    return ((T) this);
}
 
开发者ID:esacinc,项目名称:sdcct,代码行数:8,代码来源:AbstractStaticXmlTransformOptions.java

示例4: setFunctions

import net.sf.saxon.lib.ExtensionFunctionDefinition; //导入依赖的package包/类
@Override
@SuppressWarnings({ CompilerWarnings.UNCHECKED })
public T setFunctions(@Nullable List<ExtensionFunctionDefinition> funcs) {
    this.funcs.clear();

    if (!CollectionUtils.isEmpty(funcs)) {
        this.funcs.addAll(funcs);
    }

    return ((T) this);
}
 
开发者ID:esacinc,项目名称:sdcct,代码行数:12,代码来源:AbstractStaticXmlTransformOptions.java

示例5: registerExtensions

import net.sf.saxon.lib.ExtensionFunctionDefinition; //导入依赖的package包/类
static void registerExtensions(Configuration config, Collection<Library> libraries) {
	for (Library lib: libraries) {
		for (Function func: lib.getFunctions()) {
			try {
				ExtensionFunctionDefinition efd = new StaticFunctionExtension(func, config);
				logger.trace("registerExtensions; funtion {} registered as {}", func.toString(), efd.getFunctionQName()); 
				config.registerExtensionFunction(efd);
			} catch (Exception ex) {
				logger.warn("registerExtensions; error registering function {}: {}; skipped", func.toString(), ex.getMessage());
			}
		}
	}
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:14,代码来源:XQCompilerImpl.java

示例6: close

import net.sf.saxon.lib.ExtensionFunctionDefinition; //导入依赖的package包/类
public void close() throws Exception {        
  if (isClosed) {
    return;
  }
  
  isClosed = true;
  
  logger.info(String.format("Closing webapp \"%s\" ...", name));

  logger.info("Stopping file alteration monitor ...");
  monitor.stop();
  
  if (scheduler != null) {
    logger.info("Shutting down Quartz scheduler ...");
    if (waitForJobsAtClose) {
      /* Unschedule all jobs: */
      for (String triggerName : scheduler.getTriggerGroupNames()) {
        for (TriggerKey triggerKey : scheduler.getTriggerKeys(GroupMatcher.triggerGroupEquals(triggerName))) {
          scheduler.unscheduleJob(triggerKey);
        }
      }
      if (jobRequestCount > 0) {
        logger.info("Wait for running jobs to finish ...");
        while (jobRequestCount > 0) {
          Thread.sleep(250);
        }
        logger.info("All jobs finished");
      }
    }
    scheduler.shutdown(false);
    logger.info("Shutdown of Quartz scheduler complete.");
  }
  
  logger.info("Closing XPath extension functions ...");
  Iterator<ExtensionFunctionDefinition> functions = configuration.getRegisteredExtensionFunctions();
  while (functions.hasNext()) {
    ExtensionFunctionDefinition function = functions.next();
    if (function instanceof Closeable) {
      ((Closeable) function).close();
    }
  }
  
  if (httpClient != null) {
    logger.debug("Closing HTTP client ...");
    httpClient.close();
    httpClient = null;
  }
  
  if (!dataSourceCache.isEmpty()) {
    logger.info("Closing Datasources ...");
    for (ComboPooledDataSource cpds : dataSourceCache.values()) {
      cpds.close();
    }
  }
  
  logger.info("Stopping queueing services ...");
  for (ExecutorService service : executorServiceCache.values()) {
    service.shutdownNow();
  }
  
  logger.info("Clearing compiled XSLT stylesheet cache ...");
  xsltExecutableCache.clear();
  
  logger.info("Clearing compiled STX stylesheet cache ...");
  templatesCache.clear();
  
  logger.info("Clearing compiled XQuery cache ...");
  xqueryExecutableCache.clear();
  
  logger.info("Clearing compiled XML Schema cache ...");
  schemaCache.clear();
  
  Thread.sleep(250);
  
  logger.info(String.format("Webapp \"%s\" closed.", name));
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:77,代码来源:WebApp.java

示例7: addCustomExtensionFunctions

import net.sf.saxon.lib.ExtensionFunctionDefinition; //导入依赖的package包/类
private void addCustomExtensionFunctions(WebApp webApp) throws Exception {            
  File libDir = new File(webApp.getHomeDir(), "lib");
  if (!libDir.isDirectory()) {
    return;
  }
  List<File> classPath = new ArrayList<File>();                
  classPath.addAll(FileUtils.listFiles(libDir, new WildcardFileFilter("*.jar"), DirectoryFileFilter.DIRECTORY));
  if (classPath.isEmpty() && !XSLWebUtils.hasSubDirectories(libDir)) {
    return;
  }
  classPath.add(libDir);
  Collection<File> saxonJars = FileUtils.listFiles(new File(Context.getInstance().getWebInfDir(), "lib"), 
      new WildcardFileFilter("*saxon*.jar", IOCase.INSENSITIVE), FalseFileFilter.INSTANCE);    
  classPath.addAll(saxonJars);
  
  logger.info("Initializing custom extension functions ...");
  
  ClassFinder finder = new ClassFinder();
  finder.add(classPath);    
  
  ClassFilter filter =
      new AndClassFilter(            
          // Must extend ExtensionFunctionDefinition class
          new SubclassClassFilter (ExtensionFunctionDefinition.class),
          // Must not be abstract
          new NotClassFilter (new AbstractClassFilter()));
  
  Collection<ClassInfo> foundClasses = new ArrayList<ClassInfo>();    
  finder.findClasses(foundClasses, filter);
  if (foundClasses.isEmpty()) {
    logger.info("No custom extension functions found.");
    return;
  }    
  ClassLoaderBuilder builder = new ClassLoaderBuilder();    
  builder.add(classPath);    
  ClassLoader classLoader = builder.createClassLoader();    
  for (ClassInfo classInfo : foundClasses) { 
    String className = classInfo.getClassName();
    if (initializer.isFunctionRegistered(className) || saxonJars.contains(classInfo.getClassLocation())) {
      continue;
    }      
    Class<?> clazz = classLoader.loadClass(className);
    logger.info(String.format("Adding custom extension function class \"%s\" ...", className));     
    registerExtensionFunction((ExtensionFunctionDefinition) clazz.newInstance());      
  }
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:47,代码来源:XSLWebConfiguration.java

示例8: registerExtensionFunction

import net.sf.saxon.lib.ExtensionFunctionDefinition; //导入依赖的package包/类
public void registerExtensionFunction(ExtensionFunctionDefinition function) {    
  config.registerExtensionFunction(function);
  if (extensionFunctions != null) {
    extensionFunctions.add(function);
  }
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:7,代码来源:XSLWebConfiguration.java

示例9: getRegisteredExtensionFunctions

import net.sf.saxon.lib.ExtensionFunctionDefinition; //导入依赖的package包/类
public Iterator<ExtensionFunctionDefinition> getRegisteredExtensionFunctions() {
  return extensionFunctions.iterator();
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:4,代码来源:XSLWebConfiguration.java

示例10: parseStaticOptions

import net.sf.saxon.lib.ExtensionFunctionDefinition; //导入依赖的package包/类
protected AbstractBeanDefinition parseStaticOptions(ParserContext parserContext, BeanDefinitionRegistry beanDefRegistry, Element elem, String elemNsPrefix,
    String elemNsUri, String elemLocalName, AbstractBeanDefinition beanDef) throws Exception {
    super.parseDefinition(parserContext, beanDefRegistry, elem, elemNsPrefix, elemNsUri, elemLocalName, beanDef);

    MutablePropertyValues staticOptsPropValues = beanDef.getPropertyValues();
    List<Element> staticFuncElems = SdcctDomUtils.findChildElements(elem, elemNsUri, STATIC_FUNC_ELEM_LOCAL_NAME);

    if (!staticFuncElems.isEmpty()) {
        ManagedList<Object> staticFuncs = new ManagedList<>(staticFuncElems.size());
        staticFuncs.setMergeEnabled(true);
        staticFuncs.setElementTypeName(ExtensionFunctionDefinition.class.getName());

        staticFuncElems
            .forEach(staticFuncElem -> staticFuncs.add(new RuntimeBeanReference(staticFuncElem.getAttribute(BeanDefinitionParserDelegate.REF_ATTRIBUTE))));

        staticOptsPropValues.addPropertyValue(FUNCS_PROP_NAME, staticFuncs);
    }

    List<Element> staticNsElems = SdcctDomUtils.findChildElements(elem, elemNsUri, STATIC_NS_ELEM_LOCAL_NAME);

    if (!staticNsElems.isEmpty()) {
        ManagedMap<String, String> staticNamespaces = new ManagedMap<>(staticNsElems.size());
        staticNamespaces.setMergeEnabled(true);

        for (Element staticNsElem : staticNsElems) {
            staticNamespaces.put(staticNsElem.getAttribute(PREFIX_ATTR_NAME), DomUtils.getTextValue(staticNsElem).trim());
        }

        staticOptsPropValues.addPropertyValue(NAMESPACES_PROP_NAME, staticNamespaces);
    }

    List<Element> staticVarElems = SdcctDomUtils.findChildElements(elem, elemNsUri, STATIC_VAR_ELEM_LOCAL_NAME);

    if (!staticVarElems.isEmpty()) {
        ManagedMap<QName, Object> staticVars = new ManagedMap<>(staticVarElems.size());
        staticVars.setMergeEnabled(true);
        staticVars.setValueTypeName(XdmValue.class.getName());

        for (Element staticVarElem : staticVarElems) {
            staticVars.put(new QName(staticVarElem.getAttribute(NAME_ATTRIBUTE)), DomUtils.getTextValue(staticVarElem).trim());
        }

        staticOptsPropValues.addPropertyValue(VARS_PROP_NAME, staticVars);
    }

    List<Element> staticPooledDocElems = SdcctDomUtils.findChildElements(elem, elemNsUri, STATIC_POOLED_DOC_ELEM_LOCAL_NAME);

    if (!staticPooledDocElems.isEmpty()) {
        XdmDocumentBeanDefinitionParser docBeanDefParser =
            ((XdmDocumentBeanDefinitionParser) this.nsHandler.getBeanDefinitionParsers().get(XdmDocumentBeanDefinitionParser.DOC_ELEM_LOCAL_NAME));

        ManagedList<Object> staticPooledDocs = new ManagedList<>(staticPooledDocElems.size());
        staticPooledDocs.setMergeEnabled(true);
        staticPooledDocs.setElementTypeName(XdmDocument.class.getName());

        for (Element staticPooledDocElem : staticPooledDocElems) {
            staticPooledDocs.add(
                docBeanDefParser.parse(staticPooledDocElem, new ParserContext(parserContext.getReaderContext(), parserContext.getDelegate(), beanDef)));
        }

        staticOptsPropValues.addPropertyValue(POOLED_DOCS_PROP_NAME, staticPooledDocs);
    }

    return beanDef;
}
 
开发者ID:esacinc,项目名称:sdcct,代码行数:66,代码来源:AbstractXmlTransformBeanDefinitionParser.java

示例11: getFunctions

import net.sf.saxon.lib.ExtensionFunctionDefinition; //导入依赖的package包/类
@Override
public List<ExtensionFunctionDefinition> getFunctions() {
    return this.funcs;
}
 
开发者ID:esacinc,项目名称:sdcct,代码行数:5,代码来源:AbstractStaticXmlTransformOptions.java

示例12: getExtensionFunctions

import net.sf.saxon.lib.ExtensionFunctionDefinition; //导入依赖的package包/类
@Override
public ExtensionFunctionDefinition[] getExtensionFunctions() {
    return this.extFuncs;
}
 
开发者ID:esacinc,项目名称:crigtt,代码行数:5,代码来源:ValidatorSchematronImpl.java

示例13: setExtensionFunctions

import net.sf.saxon.lib.ExtensionFunctionDefinition; //导入依赖的package包/类
@Override
public void setExtensionFunctions(ExtensionFunctionDefinition ... extFuncs) {
    this.extFuncs = extFuncs;
}
 
开发者ID:esacinc,项目名称:crigtt,代码行数:5,代码来源:ValidatorSchematronImpl.java

示例14: addFunction

import net.sf.saxon.lib.ExtensionFunctionDefinition; //导入依赖的package包/类
public T addFunction(ExtensionFunctionDefinition funcDef); 
开发者ID:esacinc,项目名称:sdcct,代码行数:2,代码来源:StaticXmlTransformOptions.java

示例15: getFunctions

import net.sf.saxon.lib.ExtensionFunctionDefinition; //导入依赖的package包/类
public List<ExtensionFunctionDefinition> getFunctions(); 
开发者ID:esacinc,项目名称:sdcct,代码行数:2,代码来源:StaticXmlTransformOptions.java


注:本文中的net.sf.saxon.lib.ExtensionFunctionDefinition类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。