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


Java CityGMLWriteException类代码示例

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


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

示例1: close

import org.citygml4j.xml.io.writer.CityGMLWriteException; //导入依赖的package包/类
public void close() throws CityGMLWriteException {
	try {
		jaxbMarshaller = null;
		jaxbContext = null;
		featureSplitter = null;
		schemaHandler = null;

		validationSchemaHandler = null;
		validationEventHandler = null;

		if (writer != null)
			writer.close();
	} catch (SAXException e) {
		throw new CityGMLWriteException("Caused by: ", e);
	}
}
 
开发者ID:citygml4j,项目名称:citygml4j,代码行数:17,代码来源:AbstractJAXBWriter.java

示例2: JAXBModelWriter

import org.citygml4j.xml.io.writer.CityGMLWriteException; //导入依赖的package包/类
public JAXBModelWriter(SAXWriter writer, 
		JAXBOutputFactory factory, 
		ModuleContext moduleContext) throws CityGMLWriteException {
	super(writer, factory, moduleContext);

	initModuleCtx = new ModuleContext(moduleContext);
}
 
开发者ID:citygml4j,项目名称:citygml4j,代码行数:8,代码来源:JAXBModelWriter.java

示例3: close

import org.citygml4j.xml.io.writer.CityGMLWriteException; //导入依赖的package包/类
@Override
public void close() throws CityGMLWriteException {		
	if (documentState == DocumentState.START_DOCUMENT)
		writeEndDocument();

	cityModelInfo = null;
	initModuleCtx = null;

	super.close();
}
 
开发者ID:citygml4j,项目名称:citygml4j,代码行数:11,代码来源:JAXBModelWriter.java

示例4: createCityGMLWriter

import org.citygml4j.xml.io.writer.CityGMLWriteException; //导入依赖的package包/类
public CityGMLWriter createCityGMLWriter(File file, ModuleContext moduleContext) throws CityGMLWriteException {
	try {
		createParentDirectories(file.toPath());
		return new JAXBSimpleWriter(
				new SAXWriter(new OutputStreamWriter(new FileOutputStream(file))), 
				this, 
				moduleContext);
	} catch (IOException e) {
		throw new CityGMLWriteException("Caused by: ", e);
	}
}
 
开发者ID:citygml4j,项目名称:citygml4j,代码行数:12,代码来源:JAXBOutputFactory.java

示例5: createCityModelWriter

import org.citygml4j.xml.io.writer.CityGMLWriteException; //导入依赖的package包/类
public CityModelWriter createCityModelWriter(File file, ModuleContext moduleContext) throws CityGMLWriteException {
	try {
		createParentDirectories(file.toPath());
		return new JAXBModelWriter(
				new SAXWriter(new OutputStreamWriter(new FileOutputStream(file))), 
				this, 
				moduleContext);
	} catch (IOException e) {
		throw new CityGMLWriteException("Caused by: ", e);
	}
}
 
开发者ID:citygml4j,项目名称:citygml4j,代码行数:12,代码来源:JAXBOutputFactory.java

示例6: setTransformationTemplates

import org.citygml4j.xml.io.writer.CityGMLWriteException; //导入依赖的package包/类
public void setTransformationTemplates(Templates... transformationTemplates) throws CityGMLWriteException {
	if (transformationTemplates == null)
		throw new IllegalArgumentException("transformation templates may not be null.");

	try {
		if (transformerChainFactory == null)
			transformerChainFactory = new TransformerChainFactory(transformationTemplates);
		else
			transformerChainFactory.updateTemplates(transformationTemplates);
	} catch (TransformerConfigurationException e) {
		throw new CityGMLWriteException("Caused by: ", e);
	}
}
 
开发者ID:citygml4j,项目名称:citygml4j,代码行数:14,代码来源:JAXBOutputFactory.java

示例7: write

import org.citygml4j.xml.io.writer.CityGMLWriteException; //导入依赖的package包/类
public void write(AbstractFeature abstractFeature) throws CityGMLWriteException {
	if (featureWriteMode == FeatureWriteMode.SPLIT_PER_COLLECTION_MEMBER && featureSplitter != null)
		abstractFeature = split(abstractFeature);

	try {
		JAXBElement<?> jaxbElement = jaxbMarshaller.marshalJAXBElement(abstractFeature);
		if (jaxbElement != null) {
			Marshaller marshaller = jaxbContext.createMarshaller();
			
			// validate output
			if (useValidation) {
				marshaller.setSchema(validationSchemaHandler.getSchema());
				if (validationEventHandler != null)
					marshaller.setEventHandler(validationEventHandler);
			}
			
			// marshal output
			if (transformerChainFactory == null)				
				marshaller.marshal(jaxbElement, writer);
			else {
				// apply transformation before marshalling
				TransformerChain chain = transformerChainFactory.buildChain();
				chain.tail().setResult(new SAXResult(writer));
				marshaller.marshal(jaxbElement, chain.head());
			}
			
			writer.flush();
		}
	} catch (JAXBException | SAXException | TransformerConfigurationException e) {
		throw new CityGMLWriteException("Caused by: ", e);
	}
}
 
开发者ID:citygml4j,项目名称:citygml4j,代码行数:33,代码来源:JAXBSimpleWriter.java

示例8: AbstractJAXBWriter

import org.citygml4j.xml.io.writer.CityGMLWriteException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public AbstractJAXBWriter(SAXWriter writer, JAXBOutputFactory factory, ModuleContext moduleContext) throws CityGMLWriteException {
	this.writer = writer;

	jaxbMarshaller = factory.builder.createJAXBMarshaller(new ModuleContext(moduleContext));
	jaxbContext = factory.builder.getJAXBContext();
	schemaHandler = factory.getSchemaHandler();
	transformerChainFactory = factory.getTransformerChainFactory();

	featureWriteMode = (FeatureWriteMode)factory.getProperty(CityGMLOutputFactory.FEATURE_WRITE_MODE);
	useValidation = (Boolean)factory.getProperty(CityGMLOutputFactory.USE_VALIDATION);

	if (featureWriteMode == FeatureWriteMode.SPLIT_PER_COLLECTION_MEMBER) {
		featureSplitter = new FeatureSplitter()
				.setSchemaHandler(schemaHandler)
				.setGMLIdManager(factory.getGMLIdManager())
				.setSplitMode(FeatureSplitMode.SPLIT_PER_COLLECTION_MEMBER)
				.keepInlineAppearance((Boolean)factory.getProperty(CityGMLOutputFactory.KEEP_INLINE_APPEARANCE))
				.splitCopy((Boolean)factory.getProperty(CityGMLOutputFactory.SPLIT_COPY))
				.exclude((Set<Class<? extends CityGML>>)factory.getProperty(CityGMLOutputFactory.EXCLUDE_FROM_SPLITTING));
	}

	if (useValidation) {
		if (schemaHandler == null) {
			try {
				schemaHandler = factory.builder.getDefaultSchemaHandler();
			} catch (CityGMLBuilderException e) {
				throw new CityGMLWriteException("Caused by: ", e);
			}
		}

		validationSchemaHandler = new ValidationSchemaHandler(schemaHandler);
		validationEventHandler = factory.getValidationEventHandler();
	}		
}
 
开发者ID:citygml4j,项目名称:citygml4j,代码行数:36,代码来源:AbstractJAXBWriter.java

示例9: flush

import org.citygml4j.xml.io.writer.CityGMLWriteException; //导入依赖的package包/类
public void flush() throws CityGMLWriteException {
	try {
		if (writer != null)
			writer.flush();
	} catch (SAXException e) {
		throw new CityGMLWriteException("Caused by: ", e);
	}
}
 
开发者ID:citygml4j,项目名称:citygml4j,代码行数:9,代码来源:AbstractJAXBWriter.java

示例10: print

import org.citygml4j.xml.io.writer.CityGMLWriteException; //导入依赖的package包/类
public void print(AbstractFeature abstractFeature) throws CityGMLWriteException {
	FeatureProperty<? extends AbstractFeature> member = null;

	// wrap feature with a feature property element
	if (abstractFeature instanceof AbstractCityObject) {
		member = new CityObjectMemberImpl();
		((CityObjectMember)member).setCityObject((AbstractCityObject)abstractFeature);
	} 

	else if (abstractFeature instanceof Appearance) {
		member = new AppearanceMemberImpl();
		((AppearanceMember)member).setAppearance((Appearance)abstractFeature);
	} 

	else {
		member = new FeatureMemberImpl();
		((FeatureMember)member).setFeature(abstractFeature);
	}

	if (member != null) {
		try {
			SAXEventBuffer buffer = new SAXEventBuffer();
			Marshaller marshaller = jaxbBuilder.getJAXBContext().createMarshaller();
			marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);

			JAXBElement<?> jaxbElement = jaxbMarshaller.marshalJAXBElement(member);
			if (jaxbElement != null)
				marshaller.marshal(jaxbElement, buffer);

			if (!buffer.isEmpty())
				ioWriterPool.addWork(buffer);
		} catch (JAXBException e) {
			throw new CityGMLWriteException("Caused by: ", e);
		}
	}		
}
 
开发者ID:3dcitydb,项目名称:importer-exporter-oracle,代码行数:37,代码来源:DBExporterManager.java

示例11: writeFeatureMember

import org.citygml4j.xml.io.writer.CityGMLWriteException; //导入依赖的package包/类
public void writeFeatureMember(AbstractFeature feature) throws CityGMLWriteException {
	writeModelMember(feature);		
}
 
开发者ID:citygml4j,项目名称:citygml4j,代码行数:4,代码来源:JAXBModelWriter.java

示例12: writeEndDocument

import org.citygml4j.xml.io.writer.CityGMLWriteException; //导入依赖的package包/类
public void writeEndDocument() throws CityGMLWriteException {
	switch (documentState) {
	case END_DOCUMENT:
		throw new IllegalStateException("CityModel end element can only be written once.");
	case INITIAL:
		writeStartDocument();
	case START_DOCUMENT:
		break;
	default:
		throw new IllegalStateException("Unknown document state '" + documentState + "'");
	}

	try {
		CityModel cityModel = new CityModel();

		if (cityModelInfo != null) {
			if (cityModelInfo.isSetGenericApplicationPropertyOfCityModel())
				cityModel.setGenericApplicationPropertyOfCityModel(
						cityModelInfo.getGenericApplicationPropertyOfCityModel());

			if (cityModelInfo.isSetGenericADEElement())
				cityModel.setGenericADEElement(
						cityModelInfo.getGenericADEElement());
		}		

		ModuleContext tmp = jaxbMarshaller.getModuleContext();
		jaxbMarshaller.setModuleContext(initModuleCtx);

		JAXBElement<?> jaxbElement = jaxbMarshaller.marshalJAXBElement(cityModel);
		if (jaxbElement != null) {
			SAXFragmentWriter fragmentWriter = new SAXFragmentWriter(
					new QName(jaxbMarshaller.getModuleContext().getModule(CityGMLModuleType.CORE).getNamespaceURI(), "CityModel"), writer, WriteMode.TAIL);
			createMarshaller(true).marshal(jaxbElement, fragmentWriter);
		}

		jaxbMarshaller.setModuleContext(tmp);
		documentState = DocumentState.END_DOCUMENT;

	} catch (JAXBException e) {
		throw new CityGMLWriteException("Caused by: ", e);
	}
}
 
开发者ID:citygml4j,项目名称:citygml4j,代码行数:43,代码来源:JAXBModelWriter.java

示例13: writeFeatureMembers

import org.citygml4j.xml.io.writer.CityGMLWriteException; //导入依赖的package包/类
public void writeFeatureMembers(List<ModelObject> features) throws CityGMLWriteException {
	switch (documentState) {
	case END_DOCUMENT:
		throw new IllegalStateException("CityModel members cannot be written after document end.");
	case INITIAL:
		writeStartDocument();
		break;
	case START_DOCUMENT:
		break;
	default:
		throw new IllegalStateException("Unknown document state '" + documentState + "'");
	}

	FeatureArrayProperty members = new FeatureArrayProperty();
	List<FeatureProperty<? extends AbstractFeature>> featureArray = new ArrayList<FeatureProperty<? extends AbstractFeature>>();

	for (ModelObject feature : features) {
		if (feature instanceof AbstractFeature || feature instanceof ADEComponent) {
			if (featureWriteMode == FeatureWriteMode.SPLIT_PER_COLLECTION_MEMBER)
				featureArray.addAll(split(feature));				
			else
				featureArray.add(wrap(feature));
		}
	}	

	for (FeatureProperty<? extends AbstractFeature> member : featureArray) {
		if (member != null) {
			if (member.isSetFeature())
				members.addFeature(member.getFeature());
			else if (member.isSetGenericADEElement())
				members.addGenericADEElement(member.getGenericADEElement());
		}
	}

	try {
		JAXBElement<?> jaxbElement = jaxbMarshaller.marshalJAXBElement(members);
		if (jaxbElement != null) {
			Marshaller marshaller = createMarshaller(true);
			
			if (transformerChainFactory == null)
				marshaller.marshal(jaxbElement, writer);
			else {
				// apply transformation before marshalling
				TransformerChain chain = transformerChainFactory.buildChain();
				chain.tail().setResult(new SAXResult(writer));
				chain.head().startDocument();
				marshaller.marshal(jaxbElement, chain.head());
				chain.head().endDocument();
			}
		}
	} catch (JAXBException | SAXException | TransformerConfigurationException e) {
		throw new CityGMLWriteException("Caused by: ", e);
	}
}
 
开发者ID:citygml4j,项目名称:citygml4j,代码行数:55,代码来源:JAXBModelWriter.java

示例14: JAXBSimpleWriter

import org.citygml4j.xml.io.writer.CityGMLWriteException; //导入依赖的package包/类
public JAXBSimpleWriter(SAXWriter writer, JAXBOutputFactory factory, ModuleContext moduleContext) throws CityGMLWriteException {
	super(writer, factory, moduleContext);
}
 
开发者ID:citygml4j,项目名称:citygml4j,代码行数:4,代码来源:JAXBSimpleWriter.java


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