/** * Convenience method that sets a schema context (as QName) on a given descriptor. * * If either schemaType or desc is null, no action is performed. * * @param desc XML descriptor to which an XMLSchemaReference will be added * @param schemaType QName that will be set as the schema context QName */ private void setSchemaContext(XMLDescriptor desc, QName schemaType) { if (schemaType == null || desc == null) { return; } XMLSchemaURLReference urlRef = new XMLSchemaURLReference(); urlRef.setSchemaContextAsQName(schemaType); desc.setSchemaReference(urlRef); }
/** * Convenience method that sets a schema context (as QName) on a given descriptor. * * If either schemaType or desc is null, no action is performed. * * @param desc XML descriptor to which an XMLSchemaReference will be added * @param schemaType QName that will be set as the schema context QName */ private void setSchemaContext(XMLDescriptor desc, QName schemaType) { if (schemaType == null || desc == null) { return; } XMLSchemaURLReference urlRef = new XMLSchemaURLReference(); urlRef.setSchemaContextAsQName(schemaType); desc.setSchemaReference(urlRef); }
@Override protected ClassDescriptor buildProjectDescriptor() { XMLDescriptor descriptor = (XMLDescriptor)super.buildProjectDescriptor(); descriptor.setSchemaReference(new XMLSchemaClassPathReference(SCHEMA_DIR + TOPLINK_11_SCHEMA)); XMLDirectMapping defaultTemporalMutableMapping = new XMLDirectMapping(); defaultTemporalMutableMapping.setAttributeName("defaultTemporalMutable"); defaultTemporalMutableMapping.setSetMethodName("setDefaultTemporalMutable"); defaultTemporalMutableMapping.setGetMethodName("getDefaultTemporalMutable"); defaultTemporalMutableMapping.setXPath(getSecondaryNamespaceXPath() + "default-temporal-mutable/text()"); defaultTemporalMutableMapping.setNullValue(Boolean.FALSE); descriptor.addMapping(defaultTemporalMutableMapping); return descriptor; }
@Override protected ClassDescriptor buildProjectDescriptor() { XMLDescriptor descriptor = (XMLDescriptor)super.buildProjectDescriptor(); descriptor.setSchemaReference(new XMLSchemaClassPathReference(SCHEMA_DIR + TOPLINK_11_SCHEMA)); XMLDirectMapping defaultTemporalMutableMapping = new XMLDirectMapping(); defaultTemporalMutableMapping.setAttributeName("defaultTemporalMutable"); defaultTemporalMutableMapping.setSetMethodName("setDefaultTemporalMutable"); defaultTemporalMutableMapping.setGetMethodName("getDefaultTemporalMutable"); defaultTemporalMutableMapping.setXPath(getSecondaryNamespaceXPath() + "default-temporal-mutable/text()"); defaultTemporalMutableMapping.setNullValue(Boolean.FALSE); descriptor.addMapping(defaultTemporalMutableMapping); return descriptor; }
@Override protected ClassDescriptor buildProjectDescriptor() { XMLDescriptor descriptor = (XMLDescriptor)super.buildProjectDescriptor(); descriptor.setSchemaReference(new XMLSchemaClassPathReference(SCHEMA_DIR + TOPLINK_11_SCHEMA)); XMLDirectMapping defaultTemporalMutableMapping = new XMLDirectMapping(); defaultTemporalMutableMapping.setAttributeName("defaultTemporalMutable"); defaultTemporalMutableMapping.setSetMethodName("setDefaultTemporalMutable"); defaultTemporalMutableMapping.setGetMethodName("getDefaultTemporalMutable"); defaultTemporalMutableMapping.setXPath(getSecondaryNamespaceXPath() + "default-temporal-mutable/text()"); defaultTemporalMutableMapping.setNullValue(Boolean.FALSE); descriptor.addMapping(defaultTemporalMutableMapping); return descriptor; }
@Override protected ClassDescriptor buildProjectDescriptor() { XMLDescriptor descriptor = (XMLDescriptor)super.buildProjectDescriptor(); descriptor.setSchemaReference(new XMLSchemaClassPathReference(SCHEMA_DIR + ECLIPSELINK_SCHEMA)); XMLCompositeCollectionMapping projectQueriesMapping = new XMLCompositeCollectionMapping(); projectQueriesMapping.useCollectionClass(NonSynchronizedVector.class); projectQueriesMapping.setAttributeName("queries"); projectQueriesMapping.setSetMethodName("setQueries"); projectQueriesMapping.setGetMethodName("getQueries"); projectQueriesMapping.setReferenceClass(DatabaseQuery.class); projectQueriesMapping.setXPath(getSecondaryNamespaceXPath() + "queries/" + getSecondaryNamespaceXPath() + "query"); descriptor.addMapping(projectQueriesMapping); return descriptor; }
@Override protected ClassDescriptor buildProjectDescriptor() { XMLDescriptor descriptor = (XMLDescriptor)super.buildProjectDescriptor(); descriptor.setSchemaReference(new XMLSchemaClassPathReference(SCHEMA_DIR + ECLIPSELINK_SCHEMA)); XMLCompositeCollectionMapping projectQueriesMapping = new XMLCompositeCollectionMapping(); projectQueriesMapping.useCollectionClass(NonSynchronizedVector.class); projectQueriesMapping.setAttributeName("queries"); projectQueriesMapping.setSetMethodName("setQueries"); projectQueriesMapping.setGetMethodName("getQueries"); projectQueriesMapping.setReferenceClass(DatabaseQuery.class); projectQueriesMapping.setXPath(getSecondaryNamespaceXPath() + "queries/" + getSecondaryNamespaceXPath() + "query"); descriptor.addMapping(projectQueriesMapping); return descriptor; }
@Override protected ClassDescriptor buildProjectDescriptor() { XMLDescriptor descriptor = (XMLDescriptor)super.buildProjectDescriptor(); descriptor.setSchemaReference(new XMLSchemaClassPathReference(SCHEMA_DIR + ECLIPSELINK_SCHEMA)); XMLCompositeCollectionMapping projectQueriesMapping = new XMLCompositeCollectionMapping(); projectQueriesMapping.useCollectionClass(NonSynchronizedVector.class); projectQueriesMapping.setAttributeName("queries"); projectQueriesMapping.setSetMethodName("setQueries"); projectQueriesMapping.setGetMethodName("getQueries"); projectQueriesMapping.setReferenceClass(DatabaseQuery.class); projectQueriesMapping.setXPath(getSecondaryNamespaceXPath() + "queries/" + getSecondaryNamespaceXPath() + "query"); descriptor.addMapping(projectQueriesMapping); return descriptor; }
public ClassDescriptor buildXRRowSetModelDescriptor() { XMLDescriptor descriptor = new XMLDescriptor(); descriptor.descriptorIsAggregate(); descriptor.setJavaClass(SimpleXMLFormatModel.class); descriptor.setAlias(DEFAULT_SIMPLE_XML_FORMAT_TAG); descriptor.setNamespaceResolver(ns); descriptor.setDefaultRootElement(DEFAULT_SIMPLE_XML_FORMAT_TAG); XMLSchemaURLReference schemaReference = new XMLSchemaURLReference(""); schemaReference.setSchemaContext("/" + DEFAULT_SIMPLE_XML_FORMAT_TAG); schemaReference.setType(XMLSchemaReference.COMPLEX_TYPE); descriptor.setSchemaReference(schemaReference); XMLFragmentCollectionMapping fragMapping = new XMLFragmentCollectionMapping(); fragMapping.setAttributeName("simpleXML"); fragMapping.setXPath(DEFAULT_SIMPLE_XML_TAG); descriptor.addMapping(fragMapping); return descriptor; }
public ClassDescriptor buildXRRowSetModelDescriptor() { XMLDescriptor descriptor = new XMLDescriptor(); descriptor.descriptorIsAggregate(); descriptor.setJavaClass(SimpleXMLFormatModel.class); descriptor.setAlias(DEFAULT_SIMPLE_XML_FORMAT_TAG); descriptor.setNamespaceResolver(ns); descriptor.setDefaultRootElement(DEFAULT_SIMPLE_XML_FORMAT_TAG); XMLSchemaURLReference schemaReference = new XMLSchemaURLReference(""); schemaReference.setSchemaContext("/" + DEFAULT_SIMPLE_XML_FORMAT_TAG); schemaReference.setType(XMLSchemaReference.COMPLEX_TYPE); descriptor.setSchemaReference(schemaReference); XMLFragmentCollectionMapping fragMapping = new XMLFragmentCollectionMapping(); fragMapping.setAttributeName("simpleXML"); fragMapping.setXPath(DEFAULT_SIMPLE_XML_TAG); descriptor.addMapping(fragMapping); return descriptor; }
public ClassDescriptor buildSessionConfigsDescriptor() { XMLDescriptor descriptor = new XMLDescriptor(); descriptor.setDefaultRootElement("sessions"); descriptor.setJavaClass(SessionConfigs.class); descriptor.setSchemaReference(new XMLSchemaClassPathReference(ECLIPSELINK_SESSIONS_SCHEMA)); XMLDirectMapping versionMapping = new XMLDirectMapping(); versionMapping.setAttributeName("m_version"); versionMapping.setGetMethodName("getVersion"); versionMapping.setSetMethodName("setVersion"); versionMapping.setXPath("@version"); descriptor.addMapping(versionMapping); XMLCompositeCollectionMapping sessionConfigsMapping = new XMLCompositeCollectionMapping(); sessionConfigsMapping.setReferenceClass(SessionConfig.class); sessionConfigsMapping.setAttributeName("m_sessionConfigs"); sessionConfigsMapping.setGetMethodName("getSessionConfigs"); sessionConfigsMapping.setSetMethodName("setSessionConfigs"); sessionConfigsMapping.setXPath("session"); descriptor.addMapping(sessionConfigsMapping); return descriptor; }
public ClassDescriptor buildSessionConfigsDescriptor() { XMLDescriptor descriptor = new XMLDescriptor(); descriptor.setDefaultRootElement("sessions"); descriptor.setJavaClass(SessionConfigs.class); descriptor.setSchemaReference(new XMLSchemaClassPathReference(ECLIPSELINK_SESSIONS_SCHEMA)); XMLDirectMapping versionMapping = new XMLDirectMapping(); versionMapping.setAttributeName("m_version"); versionMapping.setGetMethodName("getVersion"); versionMapping.setSetMethodName("setVersion"); versionMapping.setXPath("@version"); descriptor.addMapping(versionMapping); XMLCompositeCollectionMapping sessionConfigsMapping = new XMLCompositeCollectionMapping(); sessionConfigsMapping.setReferenceClass(SessionConfig.class); sessionConfigsMapping.setAttributeName("m_sessionConfigs"); sessionConfigsMapping.setGetMethodName("getSessionConfigs"); sessionConfigsMapping.setSetMethodName("setSessionConfigs"); sessionConfigsMapping.setXPath("session"); descriptor.addMapping(sessionConfigsMapping); return descriptor; }
public ClassDescriptor buildSessionConfigsDescriptor() { XMLDescriptor descriptor = new XMLDescriptor(); descriptor.setDefaultRootElement("sessions"); descriptor.setJavaClass(SessionConfigs.class); descriptor.setSchemaReference(new XMLSchemaClassPathReference(ECLIPSELINK_SESSIONS_SCHEMA)); XMLDirectMapping versionMapping = new XMLDirectMapping(); versionMapping.setAttributeName("m_version"); versionMapping.setGetMethodName("getVersion"); versionMapping.setSetMethodName("setVersion"); versionMapping.setXPath("@version"); descriptor.addMapping(versionMapping); XMLCompositeCollectionMapping sessionConfigsMapping = new XMLCompositeCollectionMapping(); sessionConfigsMapping.setReferenceClass(SessionConfig.class); sessionConfigsMapping.setAttributeName("m_sessionConfigs"); sessionConfigsMapping.setGetMethodName("getSessionConfigs"); sessionConfigsMapping.setSetMethodName("setSessionConfigs"); sessionConfigsMapping.setXPath("session"); descriptor.addMapping(sessionConfigsMapping); return descriptor; }
protected void addSimpleXMLFormatModelDescriptor(XRServiceAdapter xrService) { if (isSimpleXMLFormat()) { Session oxSession = xrService.getOXSession(); XMLDescriptor simpleXMLFormatDescriptor = (XMLDescriptor)oxSession. getProject().getClassDescriptor(SimpleXMLFormatModel.class); if (simpleXMLFormatDescriptor == null) { simpleXMLFormatDescriptor = new XMLDescriptor(); simpleXMLFormatDescriptor.setJavaClass(SimpleXMLFormatModel.class); simpleXMLFormatDescriptor.setAlias(DEFAULT_SIMPLE_XML_FORMAT_TAG); simpleXMLFormatDescriptor.setDefaultRootElement(DEFAULT_SIMPLE_XML_FORMAT_TAG); XMLFragmentCollectionMapping xmlTag = new XMLFragmentCollectionMapping(); xmlTag.setAttributeName(SIMPLEXML_STR); xmlTag.setXPath(DEFAULT_SIMPLE_XML_TAG); simpleXMLFormatDescriptor.addMapping(xmlTag); NamespaceResolver nr = new NamespaceResolver(); simpleXMLFormatDescriptor.setNamespaceResolver(nr); XMLSchemaURLReference schemaReference = new XMLSchemaURLReference(EMPTY_STR); schemaReference.setSchemaContext(SIMPLEXML_FORMAT_STR); schemaReference.setType(XMLSchemaReference.COMPLEX_TYPE); simpleXMLFormatDescriptor.setSchemaReference(schemaReference); oxSession.getProject().addDescriptor(simpleXMLFormatDescriptor); ((DatabaseSessionImpl)oxSession) .initializeDescriptorIfSessionAlive(simpleXMLFormatDescriptor); xrService.getXMLContext().storeXMLDescriptorByQName(simpleXMLFormatDescriptor); } } }
protected void addSimpleXMLFormatModelDescriptor(XRServiceAdapter xrService) { if (isSimpleXMLFormat()) { Session oxSession = xrService.getOXSession(); XMLDescriptor simpleXMLFormatDescriptor = (XMLDescriptor)oxSession. getProject().getClassDescriptor(SimpleXMLFormatModel.class); if (simpleXMLFormatDescriptor == null) { simpleXMLFormatDescriptor = new XMLDescriptor(); simpleXMLFormatDescriptor.setJavaClass(SimpleXMLFormatModel.class); simpleXMLFormatDescriptor.setAlias(DEFAULT_SIMPLE_XML_FORMAT_TAG); simpleXMLFormatDescriptor.setDefaultRootElement(DEFAULT_SIMPLE_XML_FORMAT_TAG); XMLFragmentCollectionMapping xmlTag = new XMLFragmentCollectionMapping(); xmlTag.setAttributeName(SIMPLEXML_STR); xmlTag.setXPath(DEFAULT_SIMPLE_XML_TAG); simpleXMLFormatDescriptor.addMapping(xmlTag); NamespaceResolver nr = new NamespaceResolver(); simpleXMLFormatDescriptor.setNamespaceResolver(nr); XMLSchemaURLReference schemaReference = new XMLSchemaURLReference(EMPTY_STR); schemaReference.setSchemaContext(SIMPLEXML_FORMAT_STR); schemaReference.setType(XMLSchemaReference.COMPLEX_TYPE); simpleXMLFormatDescriptor.setSchemaReference(schemaReference); oxSession.getProject().addDescriptor(simpleXMLFormatDescriptor); ((DatabaseSessionImpl)oxSession) .initializeDescriptorIfSessionAlive(simpleXMLFormatDescriptor); xrService.getXMLContext().storeXMLDescriptorByQName(simpleXMLFormatDescriptor); } } }
protected ClassDescriptor buildDatabaseFieldDescriptor() { XMLDescriptor descriptor = new XMLDescriptor(); descriptor.setJavaClass(DatabaseField.class); descriptor.setDefaultRootElement("field"); descriptor.getInheritancePolicy().setClassIndicatorField(new XMLField("@xsi:type")); descriptor.getInheritancePolicy().addClassIndicator(DatabaseField.class, getSecondaryNamespaceXPath() + "column"); descriptor.getInheritancePolicy().addClassIndicator(XMLField.class, getPrimaryNamespaceXPath() + "node"); descriptor.getInheritancePolicy().addClassIndicator(XMLUnionField.class, getPrimaryNamespaceXPath() + "union-node"); XMLSchemaReference reference = new XMLSchemaClassPathReference(); reference.setSchemaContext("/"+ getSecondaryNamespaceXPath() + "column"); descriptor.setSchemaReference(reference); XMLDirectMapping tableMapping = new XMLDirectMapping(); tableMapping.setAttributeName("table"); tableMapping.setGetMethodName("getTableName"); tableMapping.setSetMethodName("setTableName"); tableMapping.setXPath("@table"); tableMapping.setNullValue(""); descriptor.addMapping(tableMapping); XMLDirectMapping nameMapping = new XMLDirectMapping(); nameMapping.setAttributeName("name"); nameMapping.setGetMethodName("getName"); nameMapping.setSetMethodName("setName"); nameMapping.setXPath("@name"); nameMapping.getNullPolicy().setNullRepresentedByEmptyNode(false); descriptor.addMapping(nameMapping); return descriptor; }
protected ClassDescriptor buildDatabaseFieldDescriptor() { XMLDescriptor descriptor = new XMLDescriptor(); descriptor.setJavaClass(DatabaseField.class); descriptor.setDefaultRootElement("field"); descriptor.getInheritancePolicy().setClassIndicatorField(new XMLField("@xsi:type")); descriptor.getInheritancePolicy().addClassIndicator(DatabaseField.class, getSecondaryNamespaceXPath() + "column"); descriptor.getInheritancePolicy().addClassIndicator(XMLField.class, getPrimaryNamespaceXPath() + "node"); descriptor.getInheritancePolicy().addClassIndicator(XMLUnionField.class, getPrimaryNamespaceXPath() + "union-node"); XMLSchemaReference reference = new XMLSchemaClassPathReference(); reference.setSchemaContext("/"+ getSecondaryNamespaceXPath() + "column"); descriptor.setSchemaReference(reference); XMLDirectMapping tableMapping = new XMLDirectMapping(); tableMapping.setAttributeName("table"); tableMapping.setGetMethodName("getTableName"); tableMapping.setSetMethodName("setTableName"); tableMapping.setXPath("@table"); tableMapping.setNullValue(""); descriptor.addMapping(tableMapping); XMLDirectMapping nameMapping = new XMLDirectMapping(); nameMapping.setAttributeName("name"); nameMapping.setGetMethodName("getName"); nameMapping.setSetMethodName("setName"); nameMapping.setXPath("@name"); nameMapping.getNullPolicy().setNullRepresentedByEmptyNode(false); descriptor.addMapping(nameMapping); return descriptor; }
descriptor.setDefaultRootElement(getPrimaryNamespaceXPath() + "object-persistence"); descriptor.setSchemaReference(new XMLSchemaClassPathReference(SCHEMA_DIR + TOPLINK_10_SCHEMA));
descriptor.setDefaultRootElement(getPrimaryNamespaceXPath() + "object-persistence"); descriptor.setSchemaReference(new XMLSchemaClassPathReference(SCHEMA_DIR + TOPLINK_10_SCHEMA));
descriptor.setDefaultRootElement(getPrimaryNamespaceXPath() + "object-persistence"); descriptor.setSchemaReference(new XMLSchemaClassPathReference(SCHEMA_DIR + TOPLINK_10_SCHEMA));