protected XMLDescriptor getEmployeeDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(Employee.class);
    // descriptor.setDefaultRootElement("employee");
    XMLDirectMapping idMapping = new XMLDirectMapping();
    idMapping.setXPath("id/text()");
    idMapping.setAttributeName("id");
    descriptor.addMapping(idMapping);

    XMLCompositeObjectMapping emailMapping = new XMLCompositeObjectMapping();
    emailMapping.setAttributeName("emailAddress");
    emailMapping.setXPath("info/email-address");
    emailMapping.setGetMethodName("getEmailAddress");
    emailMapping.setSetMethodName("setEmailAddress");
    emailMapping.setReferenceClass(EmailAddress.class);
    descriptor.addMapping(emailMapping);

    URL schemaURL =
        ClassLoader.getSystemResource("org/eclipse/persistence/testing/oxm/jaxb/Employee.xsd");
    XMLSchemaURLReference schemaRef = new XMLSchemaURLReference(schemaURL);
    schemaRef.setType(XMLSchemaURLReference.COMPLEX_TYPE);
    schemaRef.setSchemaContext("employee-root");
    descriptor.setSchemaReference(schemaRef);

    /*
    NamespaceResolver try_test = new NamespaceResolver();
    try_test.put("xsi", XMLConstants.SCHEMA_INSTANCE_URL);
    descriptor.setNamespaceResolver(try_test);*/
    return descriptor;
  }
  protected ClassDescriptor buildDocumentPreservationPolicyConfigDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(DocumentPreservationPolicyConfig.class);
    descriptor.setDefaultRootElement("document-preservation-policy");

    XMLCompositeObjectMapping nodeOrderingPolicyMapping = new XMLCompositeObjectMapping();
    nodeOrderingPolicyMapping.setReferenceClass(NodeOrderingPolicyConfig.class);
    nodeOrderingPolicyMapping.setAttributeName("m_nodeOrderingPolicy");
    nodeOrderingPolicyMapping.setGetMethodName("getNodeOrderingPolicy");
    nodeOrderingPolicyMapping.setSetMethodName("setNodeOrderingPolicy");
    nodeOrderingPolicyMapping.setXPath("node-ordering-policy");
    descriptor.addMapping(nodeOrderingPolicyMapping);

    descriptor.getInheritancePolicy().setClassIndicatorField(new XMLField("@xsi:type"));
    descriptor
        .getInheritancePolicy()
        .addClassIndicator(
            DescriptorLevelDocumentPreservationPolicyConfig.class,
            "descriptor-level-document-preservation-policy");
    descriptor
        .getInheritancePolicy()
        .addClassIndicator(
            NoDocumentPreservationPolicyConfig.class, "no-document-preservation-policy");
    descriptor
        .getInheritancePolicy()
        .addClassIndicator(XMLBinderPolicyConfig.class, "xml-binder-policy");

    return descriptor;
  }
  // **************** TopLink Methods *****************
  @SuppressWarnings("deprecation")
  public static XMLDescriptor buildDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(MWAbstractXmlDirectCollectionMapping.class);
    descriptor.getInheritancePolicy().setParentClass(MWDirectContainerMapping.class);

    XMLCompositeObjectMapping xmlFieldMapping = new XMLCompositeObjectMapping();
    xmlFieldMapping.setReferenceClass(MWXmlField.class);
    xmlFieldMapping.setAttributeName("xmlField");
    xmlFieldMapping.setGetMethodName("getXmlFieldForTopLink");
    xmlFieldMapping.setSetMethodName("setXmlFieldForTopLink");
    xmlFieldMapping.setXPath("xpath");
    descriptor.addMapping(xmlFieldMapping);

    XMLCompositeObjectMapping containerPolicyMapping = new XMLCompositeObjectMapping();
    containerPolicyMapping.setAttributeName("containerPolicy");
    containerPolicyMapping.setReferenceClass(MWContainerPolicy.MWContainerPolicyRoot.class);
    containerPolicyMapping.setGetMethodName("getContainerPolicyForToplink");
    containerPolicyMapping.setSetMethodName("setContainerPolicyForToplink");
    containerPolicyMapping.setXPath("container-policy");
    descriptor.addMapping(containerPolicyMapping);

    return descriptor;
  }
  public static XMLDescriptor buildDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();

    descriptor.setJavaClass(MWDirectContainerMapping.class);
    descriptor.getInheritancePolicy().setParentClass(MWMapping.class);

    XMLCompositeObjectMapping converterMapping = new XMLCompositeObjectMapping();
    converterMapping.setReferenceClass(MWConverter.class);
    converterMapping.setAttributeName("directValueConverter");
    converterMapping.setGetMethodName("getConverterForTopLink");
    converterMapping.setSetMethodName("setConverterForTopLink");
    converterMapping.setXPath("direct-value-converter");
    descriptor.addMapping(converterMapping);

    return descriptor;
  }
  public static XMLDescriptor legacy60BuildDescriptor() {
    XMLDescriptor descriptor = MWModel.legacy60BuildStandardDescriptor();

    descriptor.setJavaClass(MWTypeDeclaration.class);

    // 'type' will never be null
    XMLCompositeObjectMapping typeHandleMapping = new XMLCompositeObjectMapping();
    typeHandleMapping.setAttributeName("typeHandle");
    typeHandleMapping.setReferenceClass(MWClassHandle.class);
    typeHandleMapping.setGetMethodName("getTypeHandleForTopLink");
    typeHandleMapping.setSetMethodName("setTypeHandleForTopLink");
    typeHandleMapping.setXPath("type-handle");
    descriptor.addMapping(typeHandleMapping);

    XMLDirectMapping dimMapping =
        (XMLDirectMapping) descriptor.addDirectMapping("dimensionality", "dimensionality/text()");
    dimMapping.setNullValue(new Integer(0));

    return descriptor;
  }
  public ClassDescriptor buildXMLLoginConfigDescriptor() {
    ClassDescriptor descriptor = super.buildXMLLoginConfigDescriptor();

    XMLDirectMapping equalNamespaceResolversMapping = new XMLDirectMapping();
    equalNamespaceResolversMapping.setAttributeName("m_equalNamespaceResolvers");
    equalNamespaceResolversMapping.setGetMethodName("getEqualNamespaceResolvers");
    equalNamespaceResolversMapping.setSetMethodName("setEqualNamespaceResolvers");
    equalNamespaceResolversMapping.setXPath("equal-namespace-resolvers/text()");
    equalNamespaceResolversMapping.setNullValue(Boolean.TRUE);
    descriptor.addMapping(equalNamespaceResolversMapping);

    XMLCompositeObjectMapping documentPreservationPolicyMapping = new XMLCompositeObjectMapping();
    documentPreservationPolicyMapping.setReferenceClass(DocumentPreservationPolicyConfig.class);
    documentPreservationPolicyMapping.setAttributeName("m_documentPreservationPolicy");
    documentPreservationPolicyMapping.setGetMethodName("getDocumentPreservationPolicy");
    documentPreservationPolicyMapping.setSetMethodName("setDocumentPreservationPolicy");
    documentPreservationPolicyMapping.setXPath("document-preservation-policy");
    descriptor.addMapping(documentPreservationPolicyMapping);

    return descriptor;
  }
  public static XMLDescriptor buildDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(MWMapContainerPolicy.class);

    descriptor.getInheritancePolicy().setParentClass(MWContainerPolicy.MWContainerPolicyRoot.class);

    XMLCompositeObjectMapping keyMethodHandleMapping = new XMLCompositeObjectMapping();
    keyMethodHandleMapping.setAttributeName("keyMethodHandle");
    keyMethodHandleMapping.setReferenceClass(MWMethodHandle.class);
    keyMethodHandleMapping.setSetMethodName("setKeyMethodHandleForTopLink");
    keyMethodHandleMapping.setGetMethodName("getKeyMethodHandleForTopLink");
    keyMethodHandleMapping.setXPath("key-method-handle");
    descriptor.addMapping(keyMethodHandleMapping);

    XMLCompositeObjectMapping containerClassMapping = new XMLCompositeObjectMapping();
    containerClassMapping.setAttributeName("containerClass");
    containerClassMapping.setReferenceClass(DefaultingContainerClass.class);
    containerClassMapping.setXPath("container-class");
    descriptor.addMapping(containerClassMapping);

    return descriptor;
  }
  public static XMLDescriptor buildDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(MWEisOneToManyMapping.class);
    descriptor.getInheritancePolicy().setParentClass(MWEisReferenceMapping.class);

    // use an object type mapping so we can preserve object identity
    ObjectTypeConverter foreignKeyLocationConverter = new ObjectTypeConverter();
    foreignKeyLocationConverter.addConversionValue(KEYS_ON_TARGET, KEYS_ON_TARGET);
    foreignKeyLocationConverter.addConversionValue(KEYS_ON_SOURCE, KEYS_ON_SOURCE);
    XMLDirectMapping foreignKeyLocationMapping = new XMLDirectMapping();
    foreignKeyLocationMapping.setAttributeName("foreignKeyLocation");
    foreignKeyLocationMapping.setXPath("foreign-key-location/text()");
    foreignKeyLocationMapping.setNullValue(KEYS_ON_SOURCE);
    foreignKeyLocationMapping.setConverter(foreignKeyLocationConverter);
    descriptor.addMapping(foreignKeyLocationMapping);

    XMLCompositeObjectMapping groupingElementMapping = new XMLCompositeObjectMapping();
    groupingElementMapping.setAttributeName("foreignKeyGroupingElement");
    groupingElementMapping.setReferenceClass(MWXmlField.class);
    groupingElementMapping.setGetMethodName("getGroupingElementForTopLink");
    groupingElementMapping.setSetMethodName("setGroupingElementForTopLink");
    groupingElementMapping.setXPath("foreign-key-grouping-element");
    descriptor.addMapping(groupingElementMapping);

    XMLCompositeObjectMapping containerPolicyMapping = new XMLCompositeObjectMapping();
    containerPolicyMapping.setAttributeName("containerPolicy");
    containerPolicyMapping.setReferenceClass(MWContainerPolicy.MWContainerPolicyRoot.class);
    containerPolicyMapping.setXPath("container-policy");
    descriptor.addMapping(containerPolicyMapping);

    XMLCompositeObjectMapping deleteAllInteractionMapping = new XMLCompositeObjectMapping();
    deleteAllInteractionMapping.setAttributeName("deleteAllInteraction");
    deleteAllInteractionMapping.setReferenceClass(MWEisInteraction.class);
    deleteAllInteractionMapping.setXPath("delete-all-interaction");
    descriptor.addMapping(deleteAllInteractionMapping);

    return descriptor;
  }
  public static XMLDescriptor buildDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();

    descriptor.setJavaClass(MWEisLoginSpec.class);

    descriptor.addDirectMapping("name", "name/text()");

    descriptor.addDirectMapping(
        "j2cAdapterName",
        "getJ2CAdapterNameForTopLink",
        "setJ2CAdapterNameForTopLink",
        "j2c-adapter-name/text()");

    descriptor.addDirectMapping("userName", "user-name/text()");
    descriptor.addDirectMapping(
        "password", "getPasswordForTopLink", "setPasswordForTopLink", "password/text()");
    descriptor.addDirectMapping("connectionFactoryUrl", "connection-factory-url/text()");
    ((XMLDirectMapping) descriptor.addDirectMapping("savePassword", "save-password/text()"))
        .setNullValue(Boolean.FALSE);

    XMLCompositeObjectMapping connectionSpecClassHandleMapping = new XMLCompositeObjectMapping();
    connectionSpecClassHandleMapping.setAttributeName("connectionSpecClassHandle");
    connectionSpecClassHandleMapping.setGetMethodName("getConnectionSpecClassHandleForTopLink");
    connectionSpecClassHandleMapping.setSetMethodName("setConnectionSpecClassHandleForTopLink");
    connectionSpecClassHandleMapping.setReferenceClass(MWClassHandle.class);
    connectionSpecClassHandleMapping.setXPath("connection-spec-class-handle");
    descriptor.addMapping(connectionSpecClassHandleMapping);

    XMLCompositeCollectionMapping propertiesMapping = new XMLCompositeCollectionMapping();
    propertiesMapping.setReferenceClass(MWProperty.class);
    propertiesMapping.setAttributeName("properties");
    propertiesMapping.setGetMethodName("getPropertiesForTopLink");
    propertiesMapping.setSetMethodName("setPropertiesForTopLink");
    propertiesMapping.setXPath("property");
    descriptor.addMapping(propertiesMapping);

    return descriptor;
  }
  public static XMLDescriptor buildDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();

    descriptor.setJavaClass(MWQueryableArgumentElement.class);

    XMLCompositeObjectMapping queryableHandleMapping = new XMLCompositeObjectMapping();
    queryableHandleMapping.setAttributeName("queryableHandle");
    queryableHandleMapping.setGetMethodName("getQueryableHandleForTopLink");
    queryableHandleMapping.setSetMethodName("setQueryableHandleForTopLink");
    queryableHandleMapping.setReferenceClass(MWQueryableHandle.class);
    queryableHandleMapping.setXPath("queryable-handle");
    descriptor.addMapping(queryableHandleMapping);

    ((XMLDirectMapping) descriptor.addDirectMapping("allowsNull", "allows-null/text()"))
        .setNullValue(Boolean.FALSE);

    XMLCompositeObjectMapping joinedQueryableElementMapping = new XMLCompositeObjectMapping();
    joinedQueryableElementMapping.setAttributeName("joinedQueryableElement");
    joinedQueryableElementMapping.setReferenceClass(MWQueryableArgumentElement.class);
    joinedQueryableElementMapping.setXPath("joined-queryable-element");
    descriptor.addMapping(joinedQueryableElementMapping);

    return descriptor;
  }