/** * Construct from default paxml entity registry. * * @param processId * the processId */ public Paxml(long processId, long sessionId) { this(EntityFactoryRegistry.getDefaultRegistry(), processId, sessionId); }
/** * Create a default registry. * * @return the new default registry. */ public static EntityFactoryRegistry getDefaultRegistry() { EntityFactoryRegistry registry = new EntityFactoryRegistry(); registry.register(new ScenarioEntityFactory()); registry.register(new DataSetEntityFactory()); registry.register(new SpringXmlEntityFactory()); registry.register(new PlanEntityFactory()); return registry; }
/** * Parse an xml root element. * * @param root * the root ele * @param resource * the resource containing the root ele * @param context * the parser context * @return the paxml entity, return null if root tag is unknown. */ public IEntity parseXml(OMElement root, PaxmlResource resource, IParserContext context) { if (context == null) { context = AbstractPaxmlEntityFactory.createParserContext(root, resource, getResourceLocator()); } String tagName = root.getQName().getLocalPart(); IEntityFactory factory = registry.lookup(tagName); if (factory == null) { if (log.isWarnEnabled()) { log.warn("Entity factory not found for root tag <" + tagName + "> in resource: " + resource); } return null; } IEntity entity = factory.create(root, context); return entity; }
/** * Create a default registry. * * @return the new default registry. */ public static EntityFactoryRegistry getDefaultRegistry() { EntityFactoryRegistry registry = new EntityFactoryRegistry(); registry.register(new ScenarioEntityFactory()); registry.register(new DataSetEntityFactory()); registry.register(new SpringXmlEntityFactory()); registry.register(new PlanEntityFactory()); return registry; }
/** * Parse an xml root element. * * @param root * the root ele * @param resource * the resource containing the root ele * @param context * the parser context * @return the paxml entity, return null if root tag is unknown. */ public IEntity parseXml(OMElement root, PaxmlResource resource, IParserContext context) { if (context == null) { context = AbstractPaxmlEntityFactory.createParserContext(root, resource, getResourceLocator()); } String tagName = root.getQName().getLocalPart(); IEntityFactory factory = registry.lookup(tagName); if (factory == null) { if (log.isWarnEnabled()) { log.warn("Entity factory not found for root tag <" + tagName + "> in resource: " + resource); } return null; } IEntity entity = factory.create(root, context); return entity; }
/** * Construct from default paxml entity registry. * * @param processId * the processId */ public Paxml(long processId) { this(EntityFactoryRegistry.getDefaultRegistry(), processId); }