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


Java BindingDirectory类代码示例

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


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

示例1: toXML

import org.jibx.runtime.BindingDirectory; //导入依赖的package包/类
public void toXML(ModelDefinition.XMLBindingType bindingType, OutputStream xml)
{
    try
    {
    	if(bindingType == null)
    	{
    		bindingType = ModelDefinition.XMLBindingType.DEFAULT;
    	}

    	String bindingName = bindingType.toString();
        IBindingFactory factory = (bindingName != null) ? BindingDirectory.getFactory(bindingName, M2Model.class) :
        	BindingDirectory.getFactory("default", M2Model.class);
        IMarshallingContext context = factory.createMarshallingContext();
        context.setIndent(4);
        context.marshalDocument(this, "UTF-8", null, xml);
    }
    catch(JiBXException e)
    {
        throw new DictionaryException(ERR_CREATE_M2MODEL_FAILURE, e);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:22,代码来源:M2Model.java

示例2: toStyle

import org.jibx.runtime.BindingDirectory; //导入依赖的package包/类
private SymbolizerTypeInfo toStyle(String sld) throws Exception {
	String style = "<StyledLayerDescriptor version=\"1.0.0\"\n" + 
			"    xsi:schemaLocation=\"http://www.opengis.net/sld StyledLayerDescriptor.xsd\" \n" + 
			"    xmlns=\"http://www.opengis.net/sld\" \n" + 
			"    xmlns:ogc=\"http://www.opengis.net/ogc\" \n" + 
			"    xmlns:xlink=\"http://www.w3.org/1999/xlink\" \n" + 
			"    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n" + 
			"  <NamedLayer>\n" + 
			"    <Name>test</Name>\n" + 
			"    <UserStyle>\n" + 
			"      <Title>test</Title>\n" + 
			"      <FeatureTypeStyle>\n" + 
			"        <Rule>\n" + 
			""+sld+"       </Rule>\n" + 
					"      </FeatureTypeStyle>\n" + 
					"    </UserStyle>\n" + 
					"  </NamedLayer>\n" + 
					"</StyledLayerDescriptor>";
	IBindingFactory bfact = BindingDirectory.getFactory(StyledLayerDescriptorInfo.class);
	IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
	Object object = uctx.unmarshalDocument(new StringReader(style), null);
	return ((StyledLayerDescriptorInfo) object).getChoiceList().get(0).getNamedLayer().getChoiceList().get(0)
			.getUserStyle().getFeatureTypeStyleList().get(0).getRuleList().get(0).getSymbolizerList().get(0);
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:25,代码来源:WorldPaintableDirectLayerTest.java

示例3: SimpleRulesData

import org.jibx.runtime.BindingDirectory; //导入依赖的package包/类
public SimpleRulesData(String ruleName, int width, int height) throws JiBXException {
	this.width = width;
	this.height = height;
	IBindingFactory bfact = BindingDirectory.getFactory(StyledLayerDescriptorInfo.class);
	IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
	Object object = uctx.unmarshalDocument(
			getClass().getResourceAsStream("/org/geomajas/testdata/sld/simple_rules.sld"), null);
	StyledLayerDescriptorInfo sld = (StyledLayerDescriptorInfo) object;
	NamedLayerInfo namedLayerInfo = sld.getChoiceList().get(0).getNamedLayer();
	UserStyleInfo userStyleInfo = namedLayerInfo.getChoiceList().get(0).getUserStyle();
	FeatureTypeStyleInfo featureTypeStyleInfo = userStyleInfo.getFeatureTypeStyleList().get(0);
	for (RuleInfo rule : featureTypeStyleInfo.getRuleList()) {
		if (ruleName.equals(rule.getName())) {
			ruleInfo = rule;
		}
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:18,代码来源:LegendGraphicServiceTest.java

示例4: unmarshalMessage

import org.jibx.runtime.BindingDirectory; //导入依赖的package包/类
/**
 * Unmarshal this xml Message to an object.
 * @param xml
 * @param system
 * @return
 */
public static Object unmarshalMessage(String xml, String version)
{
	String packageName = "org.dslforum." + version;
	String bindingName = "binding";

	try {
		IBindingFactory jc = BindingDirectory.getFactory(bindingName, packageName);
		IUnmarshallingContext unmarshaller = jc.createUnmarshallingContext();
		Reader inStream = new StringReader(xml);
		Object message = unmarshaller.unmarshalDocument( inStream, bindingName);
		return message;
	} catch (JiBXException e) {
		e.printStackTrace();
	}
	return null;
}
 
开发者ID:paraam,项目名称:tr069-simulator,代码行数:23,代码来源:JibxHelper.java

示例5: createSystemInfo

import org.jibx.runtime.BindingDirectory; //导入依赖的package包/类
/**
 * Create System Info from XML representation
 *  
 * @param xml  xml representation of system info
 * @return  the System Info
 */
public static SystemInfo createSystemInfo(InputStream xml)
{
    try
    {
        IBindingFactory factory = BindingDirectory.getFactory(SystemInfo.class);
        IUnmarshallingContext context = factory.createUnmarshallingContext();
        Object obj = context.unmarshalDocument(xml, null);
        return (SystemInfo)obj;
    }
    catch(JiBXException e)
    {
        throw new DictionaryException("Failed to parse System Info", e);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:SystemInfo.java

示例6: toXML

import org.jibx.runtime.BindingDirectory; //导入依赖的package包/类
/**
 * Create XML representation of System Info
 * 
 * @param xml  xml representation of system info
 */
public void toXML(OutputStream xml)
{
    try
    {
        IBindingFactory factory = BindingDirectory.getFactory(SystemInfo.class);
        IMarshallingContext context = factory.createMarshallingContext();
        context.setIndent(4);
        context.marshalDocument(this, "UTF-8", null, xml);    
    }
    catch(JiBXException e)
    {
        throw new DictionaryException("Failed to create System Info", e);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:SystemInfo.java

示例7: createModel

import org.jibx.runtime.BindingDirectory; //导入依赖的package包/类
public static M2Model createModel(String bindingName, InputStream xml)
{
    try
    {
        IBindingFactory factory = BindingDirectory.getFactory(bindingName, M2Model.class);
        IUnmarshallingContext context = factory.createUnmarshallingContext();
        Object obj = context.unmarshalDocument(xml, null);
        return (M2Model)obj;
    }
    catch(JiBXException e)
    {
        throw new DictionaryException(ERR_PARSE_FAILURE, e);
    }        
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:15,代码来源:M2Model.java

示例8: afterPropertiesSet

import org.jibx.runtime.BindingDirectory; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws JiBXException {
	if (this.targetClass != null) {
		if (StringUtils.hasLength(this.bindingName)) {
			if (logger.isInfoEnabled()) {
				logger.info("Configured for target class [" + this.targetClass + "] using binding [" + this.bindingName + "]");
			}
			this.bindingFactory = BindingDirectory.getFactory(this.bindingName, this.targetClass);
		}
		else {
			if (logger.isInfoEnabled()) {
				logger.info("Configured for target class [" + this.targetClass + "]");
			}
			this.bindingFactory = BindingDirectory.getFactory(this.targetClass);
		}
	}
	else if (this.targetPackage != null) {
		if (!StringUtils.hasLength(bindingName)) {
			bindingName = DEFAULT_BINDING_NAME;
		}
		if (logger.isInfoEnabled()) {
			logger.info("Configured for target package [" + this.targetPackage	+ "] using binding [" + this.bindingName + "]");
		}
		this.bindingFactory = BindingDirectory.getFactory(this.bindingName, this.targetPackage);
	}
	else {
		throw new IllegalArgumentException("Either 'targetClass' or 'targetPackage' is required");
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:30,代码来源:JibxMarshaller.java

示例9: createBindingFactory

import org.jibx.runtime.BindingDirectory; //导入依赖的package包/类
private IBindingFactory createBindingFactory(Class<?> clazz, String bindingName) throws JiBXException {
    if (bindingName == null) {
        return BindingDirectory.getFactory(clazz);
    } else {
        return BindingDirectory.getFactory(bindingName, clazz);
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:JibxDataFormat.java

示例10: parseXML

import org.jibx.runtime.BindingDirectory; //导入依赖的package包/类
public void parseXML() throws JiBXException{
	 IBindingFactory bfact = BindingDirectory.getFactory(DataExport.class);
	 IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
	 try {
		 m_export = (DataExport)uctx.unmarshalDocument (new FileInputStream(outXMLFileFullName), null);
	 } catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:glycoinfo,项目名称:eurocarbdb,代码行数:10,代码来源:GlycomeDBUpdateUtil.java

示例11: encode2Xml

import org.jibx.runtime.BindingDirectory; //导入依赖的package包/类
private String encode2Xml(Order order) throws JiBXException, IOException {
factory = BindingDirectory.getFactory(Order.class);
writer = new StringWriter();
IMarshallingContext mctx = factory.createMarshallingContext();
mctx.setIndent(2);
mctx.marshalDocument(order, CHARSET_NAME, null, writer);
String xmlStr = writer.toString();
writer.close();
System.out.println(xmlStr.toString());
return xmlStr;
   }
 
开发者ID:changyuefeng,项目名称:netty-book,代码行数:12,代码来源:TestOrder.java

示例12: decode0

import org.jibx.runtime.BindingDirectory; //导入依赖的package包/类
protected Object decode0(ChannelHandlerContext arg0, ByteBuf body)
    throws Exception {
factory = BindingDirectory.getFactory(clazz);
String content = body.toString(UTF_8);
if (isPrint)
    System.out.println("The body is : " + content);
reader = new StringReader(content);
IUnmarshallingContext uctx = factory.createUnmarshallingContext();
Object result = uctx.unmarshalDocument(reader);
reader.close();
reader = null;
return result;
   }
 
开发者ID:changyuefeng,项目名称:netty-book,代码行数:14,代码来源:AbstractHttpXmlDecoder.java

示例13: encode0

import org.jibx.runtime.BindingDirectory; //导入依赖的package包/类
protected ByteBuf encode0(ChannelHandlerContext ctx, Object body)
    throws Exception {
factory = BindingDirectory.getFactory(body.getClass());
writer = new StringWriter();
IMarshallingContext mctx = factory.createMarshallingContext();
mctx.setIndent(2);
mctx.marshalDocument(body, CHARSET_NAME, null, writer);
String xmlStr = writer.toString();
writer.close();
writer = null;
ByteBuf encodeBuf = Unpooled.copiedBuffer(xmlStr, UTF_8);
return encodeBuf;
   }
 
开发者ID:changyuefeng,项目名称:netty-book,代码行数:14,代码来源:AbstractHttpXmlEncoder.java

示例14: decode0

import org.jibx.runtime.BindingDirectory; //导入依赖的package包/类
protected Object decode0(ChannelHandlerContext arg0, ByteBuf body)
        throws Exception {
    factory = BindingDirectory.getFactory(clazz);
    String content = body.toString(UTF_8);
    if (isPrint)
        System.out.println("The body is : " + content);
    reader = new StringReader(content);
    IUnmarshallingContext uctx = factory.createUnmarshallingContext();
    Object result = uctx.unmarshalDocument(reader);
    reader.close();
    reader = null;
    return result;
}
 
开发者ID:Hope6537,项目名称:hope-tactical-equipment,代码行数:14,代码来源:AbstractHttpXmlDecoder.java

示例15: encode0

import org.jibx.runtime.BindingDirectory; //导入依赖的package包/类
protected ByteBuf encode0(ChannelHandlerContext ctx, Object body)
        throws Exception {
    factory = BindingDirectory.getFactory(body.getClass());
    writer = new StringWriter();
    IMarshallingContext mctx = factory.createMarshallingContext();
    mctx.setIndent(2);
    mctx.marshalDocument(body, CHARSET_NAME, null, writer);
    String xmlStr = writer.toString();
    writer.close();
    writer = null;
    ByteBuf encodeBuf = Unpooled.copiedBuffer(xmlStr, UTF_8);
    return encodeBuf;
}
 
开发者ID:Hope6537,项目名称:hope-tactical-equipment,代码行数:14,代码来源:AbstractHttpXmlEncoder.java


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