/** * @return the Eclipselink orm project. */ public static XMLContext getEclipseLinkOrmProject() { if (m_eclipseLinkOrmProject == null) { m_eclipseLinkOrmProject = new XMLContext(new XMLEntityMappingsMappingProject(ECLIPSELINK_ORM_NAMESPACE, ECLIPSELINK_ORM_XSD)); } return m_eclipseLinkOrmProject; }
public XMLBinder(XMLContext context, XMLMarshaller marshaller, XMLUnmarshaller unmarshaller) { this.context = new XMLContext(context.getXMLContextState()); this.marshaller = marshaller; this.unmarshaller = unmarshaller; initialize(); }
/** * @return the JPA 2.1 orm project. */ public static XMLContext getOrm2_1Project() { if (m_orm2_1Project == null) { m_orm2_1Project = new XMLContext(new XMLEntityMappingsMappingProject(ORM_2_1_NAMESPACE, ORM_2_1_XSD)); } return m_orm2_1Project; }
public XMLBinder(XMLContext context, XMLMarshaller marshaller, XMLUnmarshaller unmarshaller) { this.context = new XMLContext(context.getXMLContextState()); this.marshaller = marshaller; this.unmarshaller = unmarshaller; initialize(); }
/** * @return the JPA 2.0 orm project. */ public static XMLContext getOrm2_0Project() { if (m_orm2_0Project == null) { m_orm2_0Project = new XMLContext(new XMLEntityMappingsMappingProject(ORM_2_0_NAMESPACE, ORM_2_0_XSD)); } return m_orm2_0Project; }
/** * @return the JPA 1.0 orm project. */ public static XMLContext getOrm1_0Project() { if (m_orm1_0Project == null) { m_orm1_0Project = new XMLContext(new XMLEntityMappingsMappingProject(ORM_1_0_NAMESPACE, ORM_1_0_XSD)); } return m_orm1_0Project; }
private boolean buildSessionConfigs(SessionManager sessionManager, ClassLoader loader,Document document, Project project){ // No errors occurred, unmasrshal the document which will return a // SessionConfigs containing 0 or more SessionConfigs and send // them through the factory to create actual Sessions XMLContext context = new XMLContext(project); XMLUnmarshaller unmarshaller = context.createUnmarshaller(); SessionConfigs configs = (SessionConfigs)unmarshaller.unmarshal(document); SessionsFactory factory = new SessionsFactory(); Map sessions = factory.buildSessionConfigs(configs, loader); for (Iterator iterator = sessions.entrySet().iterator(); iterator.hasNext(); ) { Map.Entry entry = (Map.Entry)iterator.next(); // Only add the session if missing. if (!sessionManager.getSessions().containsKey(entry.getKey())) { sessionManager.addSession((String)entry.getKey(), (Session)entry.getValue()); } } return true; }
private boolean buildSessionConfigs(SessionManager sessionManager, ClassLoader loader,Document document, Project project){ // No errors occurred, unmasrshal the document which will return a // SessionConfigs containing 0 or more SessionConfigs and send // them through the factory to create actual Sessions XMLContext context = new XMLContext(project); XMLUnmarshaller unmarshaller = context.createUnmarshaller(); SessionConfigs configs = (SessionConfigs)unmarshaller.unmarshal(document); SessionsFactory factory = new SessionsFactory(); Map<String, Session> sessions = factory.buildSessionConfigs(configs, loader); for (Map.Entry<String, Session> entry: sessions.entrySet()) { // Only add the session if missing. if (!sessionManager.getSessions().containsKey(entry.getKey())) { sessionManager.addSession(entry.getKey(), entry.getValue()); } } return true; }
private boolean buildSessionConfigs(SessionManager sessionManager, ClassLoader loader,Document document, Project project){ // No errors occurred, unmasrshal the document which will return a // SessionConfigs containing 0 or more SessionConfigs and send // them through the factory to create actual Sessions XMLContext context = new XMLContext(project); XMLUnmarshaller unmarshaller = context.createUnmarshaller(); SessionConfigs configs = (SessionConfigs)unmarshaller.unmarshal(document); SessionsFactory factory = new SessionsFactory(); Map<String, Session> sessions = factory.buildSessionConfigs(configs, loader); for (Map.Entry<String, Session> entry: sessions.entrySet()) { // Only add the session if missing. if (!sessionManager.getSessions().containsKey(entry.getKey())) { sessionManager.addSession(entry.getKey(), entry.getValue()); } } return true; }
public synchronized XMLContext getXmlContext() { if (xmlContext == null) { xmlContext = new XMLContext(getTopLinkProject()); XMLConversionManager xmlConversionManager = getXmlConversionManager(); xmlConversionManager.setLoader(this.loader); xmlConversionManager.setTimeZone(TimeZone.getTimeZone("GMT")); xmlConversionManager.setTimeZoneQualified(true); } return xmlContext; }
public synchronized XMLContext getXmlContext() { if (xmlContext == null) { xmlContext = new XMLContext(getTopLinkProject()); XMLConversionManager xmlConversionManager = getXmlConversionManager(); xmlConversionManager.setLoader(this.loader); xmlConversionManager.setTimeZone(TimeZone.getTimeZone("GMT")); xmlConversionManager.setTimeZoneQualified(true); } return xmlContext; }
public XMLBinder(XMLContext context) { this.context = new XMLContext(context.getXMLContextState()); marshaller = this.context.createMarshaller(); unmarshaller = this.context.createUnmarshaller(); initialize(); }
public XMLBinder(XMLContext context) { this.context = new XMLContext(context.getXMLContextState()); marshaller = this.context.createMarshaller(); unmarshaller = this.context.createUnmarshaller(); initialize(); }
/** * Given the writer, and a SessionConfigs, * this writes out the session XML file. * * @param writer writer to writer to * @param eclipseLinkSessions the SessionConfigs instance to write */ public static void write(SessionConfigs toplinkSessions, Writer writer) { XMLContext context = new XMLContext(new XMLSessionConfigProject_11_1_1()); XMLMarshaller marshaller = context.createMarshaller(); // this is throwing a null pointer exception right now, bug entered //marshaller.setNoNamespaceSchemaLocation("eclipse_persistence_sessions_1_0.xsd"); marshaller.marshal(toplinkSessions, writer); try { writer.flush(); } catch (IOException exception) { throw ValidationException.fileError(exception); } } }
/** * <p>INTERNAL: * */ public void loadXMLSchema(InputStream xrSchemaStream) { SchemaModelProject schemaProject = new SchemaModelProject(); XMLContext xmlContext = new XMLContext(schemaProject); XMLUnmarshaller unmarshaller = xmlContext.createUnmarshaller(); Schema schema = (Schema)unmarshaller.unmarshal(xrSchemaStream); NamespaceResolver nr = schema.getNamespaceResolver(); String targetNamespace = schema.getTargetNamespace(); nr.put(TARGET_NAMESPACE_PREFIX, targetNamespace); xrService.schema = schema; xrService.schemaNamespace = targetNamespace; }
/** * PUBLIC: * Given the writer, and a project, * this writes out the deployment XML file storing the project's descriptor and mapping information. * * @param writer writer to writer to * @param project the project instance to write */ public static void write(Project project, Writer writer) { XMLContext context = new XMLContext(new ObjectPersistenceWorkbenchXMLProject()); context.getSession(project).getEventManager().addListener(new MissingDescriptorListener()); XMLMarshaller marshaller = context.createMarshaller(); marshaller.marshal(project, writer); try { writer.flush(); } catch (IOException exception) { throw ValidationException.fileError(exception); } }
/** * INTERNAL: */ protected static XMLContext createXMLContext(String namespaceURI) { Project project = new Project(); NamespaceResolver resolver = new NamespaceResolver(); resolver.setDefaultNamespaceURI(namespaceURI); project.addDescriptor(buildPersistenceXMLDescriptor(resolver)); project.addDescriptor(buildPUInfoDescriptor(resolver)); project.addDescriptor(buildPUPropertyDescriptor(resolver)); return new XMLContext(project); } }
/** * INTERNAL: */ public static XMLContext createXMLContext() { Project project = new Project(); NamespaceResolver resolver = new NamespaceResolver(); resolver.setDefaultNamespaceURI("http://java.sun.com/xml/ns/persistence"); project.addDescriptor(buildPersistenceXMLDescriptor(resolver)); project.addDescriptor(buildPUInfoDescriptor(resolver)); project.addDescriptor(buildPUPropertyDescriptor(resolver)); return new XMLContext(project); } }
public Map<String, SchemaTypeInfo> generateSchemaFiles(String schemaPath, Map<QName, Type> additionalGlobalElements) throws FileNotFoundException { // process any additional global elements processAdditionalElements(additionalGlobalElements, annotationsProcessor); schemaGenerator.generateSchema(annotationsProcessor.getTypeInfoClasses(), annotationsProcessor.getTypeInfos(), annotationsProcessor.getUserDefinedSchemaTypes(), annotationsProcessor.getPackageToPackageInfoMappings(), annotationsProcessor.getGlobalElements(), annotationsProcessor.getArrayClassesToGeneratedClasses()); CoreProject proj = new SchemaModelProject(); XMLContext context = new XMLContext((Project)proj); XMLMarshaller marshaller = context.createMarshaller(); Descriptor schemaDescriptor = (Descriptor)proj.getDescriptor(Schema.class); java.util.Collection<Schema> schemas = schemaGenerator.getAllSchemas(); for(Schema schema : schemas) { File file = new File(schemaPath + "/" + schema.getName()); NamespaceResolver schemaNamespaces = schema.getNamespaceResolver(); schemaNamespaces.put(Constants.SCHEMA_PREFIX, XMLConstants.W3C_XML_SCHEMA_NS_URI); schemaDescriptor.setNamespaceResolver(schemaNamespaces); marshaller.marshal(schema, new FileOutputStream(file)); } return schemaGenerator.getSchemaTypeInfo(); }
public Map<String, SchemaTypeInfo> generateSchemaFiles(String schemaPath, Map<QName, Type> additionalGlobalElements) throws FileNotFoundException { // process any additional global elements processAdditionalElements(additionalGlobalElements, annotationsProcessor); schemaGenerator.generateSchema(annotationsProcessor.getTypeInfoClasses(), annotationsProcessor.getTypeInfos(), annotationsProcessor.getUserDefinedSchemaTypes(), annotationsProcessor.getPackageToPackageInfoMappings(), annotationsProcessor.getGlobalElements(), annotationsProcessor.getArrayClassesToGeneratedClasses()); CoreProject proj = new SchemaModelProject(); XMLContext context = new XMLContext((Project)proj); XMLMarshaller marshaller = context.createMarshaller(); Descriptor schemaDescriptor = (Descriptor)proj.getDescriptor(Schema.class); java.util.Collection<Schema> schemas = schemaGenerator.getAllSchemas(); for(Schema schema : schemas) { File file = new File(schemaPath + "/" + schema.getName()); NamespaceResolver schemaNamespaces = schema.getNamespaceResolver(); schemaNamespaces.put(Constants.SCHEMA_PREFIX, XMLConstants.W3C_XML_SCHEMA_NS_URI); schemaDescriptor.setNamespaceResolver(schemaNamespaces); marshaller.marshal(schema, new FileOutputStream(file)); } return schemaGenerator.getSchemaTypeInfo(); }