protected ClassDescriptor buildXMLBinderPolicyConfigDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(XMLBinderPolicyConfig.class);
    descriptor.getInheritancePolicy().setParentClass(DocumentPreservationPolicyConfig.class);

    return descriptor;
  }
  protected ClassDescriptor buildIgnoreNewElementsOrderingPolicyConfigDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(IgnoreNewElementsOrderingPolicyConfig.class);
    descriptor.getInheritancePolicy().setParentClass(NodeOrderingPolicyConfig.class);

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

    return descriptor;
  }
  public XMLSessionConfigProject_11_1_1() {
    super();
    addDescriptor(buildOc4jJGroupsTransportManagerConfigDescriptor());
    addDescriptor(buildServerPlatformConfigDescriptorFor(Oc4jPlatformConfig.class));
    addDescriptor(buildServerPlatformConfigDescriptorFor(GlassfishPlatformConfig.class));
    addDescriptor(buildServerPlatformConfigDescriptorFor(SunAS9PlatformConfig.class));
    addDescriptor(buildServerPlatformConfigDescriptorFor(WebLogic_9_PlatformConfig.class));
    addDescriptor(buildServerPlatformConfigDescriptorFor(WebLogic_10_PlatformConfig.class));
    addDescriptor(buildServerPlatformConfigDescriptorFor(WebSphere_6_1_PlatformConfig.class));
    addDescriptor(buildServerPlatformConfigDescriptorFor(WebSphere_7_0_PlatformConfig.class));
    addDescriptor(buildServerPlatformConfigDescriptorFor(WebSphere_Liberty_Platform_Config.class));

    // 242452 -- add metadata support for XMLLogin's DocumentPreservationPolicy
    addDescriptor(buildDocumentPreservationPolicyConfigDescriptor());
    addDescriptor(buildDescriptorLevelDocumentPreservationPolicyConfigDescriptor());
    addDescriptor(buildNoDocumentPreservationPolicyConfigDescriptor());
    addDescriptor(buildXMLBinderPolicyConfigDescriptor());
    addDescriptor(buildNodeOrderingPolicyConfigDescriptor());
    addDescriptor(buildAppendNewElementsOrderingPolicyConfigDescriptor());
    addDescriptor(buildIgnoreNewElementsOrderingPolicyConfigDescriptor());
    addDescriptor(buildRelativePositionOrderingPolicyConfigDescriptor());

    // Set the namespaces on all descriptors.
    NamespaceResolver namespaceResolver = new NamespaceResolver();
    namespaceResolver.put("xsi", W3C_XML_SCHEMA_INSTANCE_NS_URI);
    namespaceResolver.put("xsd", W3C_XML_SCHEMA_NS_URI);

    for (Iterator descriptors = getDescriptors().values().iterator(); descriptors.hasNext(); ) {
      XMLDescriptor descriptor = (XMLDescriptor) descriptors.next();
      descriptor.setNamespaceResolver(namespaceResolver);
    }
  }
  protected ClassDescriptor buildRelativePositionOrderingPolicyConfigDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(RelativePositionOrderingPolicyConfig.class);
    descriptor.getInheritancePolicy().setParentClass(NodeOrderingPolicyConfig.class);

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

    return descriptor;
  }
 private XMLDescriptor getAddressDescriptor() {
   XMLDescriptor descriptor = new XMLDescriptor();
   descriptor.setJavaClass(Address.class);
   descriptor.addPrimaryKeyFieldName("city/text()");
   descriptor.addPrimaryKeyFieldName("zip/text()");
   descriptor.setDefaultRootElement("address");
   // create id mapping
   XMLDirectMapping idMapping = new XMLDirectMapping();
   idMapping.setAttributeName("id");
   idMapping.setXPath("@aid");
   descriptor.addMapping(idMapping);
   // create street mapping
   XMLDirectMapping streetMapping = new XMLDirectMapping();
   streetMapping.setAttributeName("street");
   streetMapping.setXPath("street/text()");
   descriptor.addMapping(streetMapping);
   // create city mapping
   XMLDirectMapping cityMapping = new XMLDirectMapping();
   cityMapping.setAttributeName("city");
   cityMapping.setXPath("city/text()");
   descriptor.addMapping(cityMapping);
   // create country mapping
   XMLDirectMapping countryMapping = new XMLDirectMapping();
   countryMapping.setAttributeName("country");
   countryMapping.setXPath("country/text()");
   descriptor.addMapping(countryMapping);
   // create zip mapping
   XMLDirectMapping zipMapping = new XMLDirectMapping();
   zipMapping.setAttributeName("zip");
   zipMapping.setXPath("zip/text()");
   descriptor.addMapping(zipMapping);
   return descriptor;
 }
  public static XMLDescriptor buildDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(MWEisProjectDefaultsPolicy.class);
    descriptor.getInheritancePolicy().setParentClass(MWTransactionalProjectDefaultsPolicy.class);

    return descriptor;
  }
Example #9
0
  /**
   * INTERNAL: Convenience method that sets up class indicator and @sdoRef attribute.
   *
   * @param xdesc
   * @param pCls
   */
  private void addClassIndicator(XMLDescriptor xdesc, Class pCls, boolean isInheritanceRoot) {
    XMLField field = (XMLField) getXmlDescriptor().buildField("@xsi:type");
    xdesc.getInheritancePolicy().setClassIndicatorField(field);

    String parentIndicator = getName();
    String parentPrefix = xdesc.getNamespaceResolver().resolveNamespaceURI(getURI());
    if (parentPrefix != null) {
      parentIndicator =
          parentPrefix + SDOConstants.SDO_XPATH_NS_SEPARATOR_FRAGMENT + parentIndicator;
    }
    xdesc.getInheritancePolicy().addClassIndicator(pCls, parentIndicator);

    // only add the @sdoRef attribute if necessary
    if (xdesc.getMappingForAttributeName(SDO_REF_MAPPING_ATTRIBUTE_NAME) == null) {
      String sdoPrefix =
          ((SDOTypeHelper) aHelperContext.getTypeHelper()).getPrefix(SDOConstants.SDO_URL);
      XMLDirectMapping sdoRefMapping = new XMLDirectMapping();
      sdoRefMapping.setAttributeName(SDO_REF_MAPPING_ATTRIBUTE_NAME);

      XMLField xmlField =
          new XMLField(
              "@"
                  + sdoPrefix
                  + SDOConstants.SDO_XPATH_NS_SEPARATOR_FRAGMENT
                  + SDOConstants.CHANGESUMMARY_REF);
      xmlField.getXPathFragment().setNamespaceURI(SDOConstants.SDO_URL);
      xmlField.getLastXPathFragment().setNamespaceURI(SDOConstants.SDO_URL);

      sdoRefMapping.setField(xmlField);
      xdesc.addMapping(sdoRefMapping);
    }
  }
Example #10
0
  /** INTERNAL: Get the XMLDescriptor associated with this Type or generate a new one. */
  public void initializeNamespaces(List namespaceResolvers) {
    if (!isDataType()) {
      NamespaceResolver nr = new NamespaceResolver();

      // copy namespaces between resolvers for well known and SDO namespaces
      if (namespaceResolvers != null) {
        for (int i = 0; i < namespaceResolvers.size(); i++) {
          NamespaceResolver nextNR = (NamespaceResolver) namespaceResolvers.get(i);
          if (nextNR != null) {
            for (int j = 0, size = nextNR.getNamespaces().size(); j < size; j++) {
              Namespace nextNamespace = (Namespace) nextNR.getNamespaces().get(j);
              if ((!nextNamespace.getPrefix().equals(XMLConstants.XMLNS))
                  && (!nextNamespace.getNamespaceURI().equals(XMLConstants.SCHEMA_URL))
                  && (!nextNamespace.getNamespaceURI().equals(SDOConstants.SDOJAVA_URL))
                  && (!nextNamespace.getNamespaceURI().equals(SDOConstants.SDOXML_URL))
                  && (!nextNamespace.getNamespaceURI().equals(SDOConstants.SDO_URL))) {
                String newPrefix =
                    ((SDOTypeHelper) aHelperContext.getTypeHelper())
                        .addNamespace(nextNamespace.getPrefix(), nextNamespace.getNamespaceURI());
                nr.put(newPrefix, nextNamespace.getNamespaceURI());
              }
            }
          }
        }
      }
      xmlDescriptor.setNamespaceResolver(nr);
      if (getURI() != null) {
        String prefix = ((SDOTypeHelper) aHelperContext.getTypeHelper()).getPrefix(getURI());
        xmlDescriptor.getNamespaceResolver().put(prefix, getURI());
      }
      xmlDescriptor
          .getNamespaceResolver()
          .put(XMLConstants.SCHEMA_INSTANCE_PREFIX, XMLConstants.SCHEMA_INSTANCE_URL);
    }
  }
  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;
  }
  public static XMLDescriptor buildDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(MWBatchReadItem.class);

    descriptor.getInheritancePolicy().setParentClass(MWAttributeItem.class);

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

    descriptor.setJavaClass(MWDeleteQuery.class);
    descriptor.getDescriptorInheritancePolicy().setParentClass(MWAbstractCustomQuery.class);

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

    descriptor.setJavaClass(MWDirectToFieldMapping.class);
    descriptor.getInheritancePolicy().setParentClass(MWRelationalDirectMapping.class);

    return descriptor;
  }
  public ClassDescriptor buildTransportManagerConfigDescriptor() {
    XMLDescriptor descriptor = (XMLDescriptor) super.buildTransportManagerConfigDescriptor();
    descriptor
        .getInheritancePolicy()
        .addClassIndicator(Oc4jJGroupsTransportManagerConfig.class, "oc4j-jgroups-transport");

    return descriptor;
  }
 public void initializeDescriptor(XMLDescriptor descriptor) {
   AbstractSession theSession = (AbstractSession) getXmlContext().getSession(0);
   // do initialization for new descriptor;
   descriptor.preInitialize(theSession);
   descriptor.initialize(theSession);
   descriptor.postInitialize(theSession);
   descriptor.getObjectBuilder().initializePrimaryKey(theSession);
   getXmlContext().storeXMLDescriptorByQName(descriptor);
 }
  public static XMLDescriptor buildDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();

    descriptor.setJavaClass(MWEJBQLQueryFormat.class);

    descriptor.getInheritancePolicy().setParentClass(MWStringQueryFormat.class);

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

    descriptor.addDirectMapping("key", "key/text()");
    descriptor.addDirectMapping("value", "value/text()");

    return descriptor;
  }
  protected XMLDescriptor getEmployeeDescriptor() {
    XMLDescriptor descriptor = super.getEmployeeDescriptor();
    descriptor.setDefaultRootElement("thens:employee");

    NamespaceResolver resolver = new NamespaceResolver();
    resolver.put("thensdiff", "www.example.com/some-dir/employee.xsd");
    descriptor.setNamespaceResolver(resolver);

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

    descriptor.addDirectMapping("queriesCacheAllStatements", "cache-all-statements/text()");
    descriptor.addDirectMapping("queriesBindAllParameters", "bind-all-parameters/text()");

    return descriptor;
  }
 public ClassDescriptor buildServerPlatformConfigDescriptor() {
   XMLDescriptor descriptor = (XMLDescriptor) super.buildServerPlatformConfigDescriptor();
   descriptor.getInheritancePolicy().addClassIndicator(Oc4jPlatformConfig.class, "oc4j-platform");
   descriptor
       .getInheritancePolicy()
       .addClassIndicator(SunAS9PlatformConfig.class, "sunas-9-platform");
   descriptor
       .getInheritancePolicy()
       .addClassIndicator(GlassfishPlatformConfig.class, "glassfish-platform");
   descriptor
       .getInheritancePolicy()
       .addClassIndicator(WebLogic_9_PlatformConfig.class, "weblogic-9-platform");
   descriptor
       .getInheritancePolicy()
       .addClassIndicator(WebLogic_10_PlatformConfig.class, "weblogic-10-platform");
   descriptor
       .getInheritancePolicy()
       .addClassIndicator(WebSphere_6_1_PlatformConfig.class, "websphere-61-platform");
   descriptor
       .getInheritancePolicy()
       .addClassIndicator(WebSphere_7_0_PlatformConfig.class, "websphere-7-platform");
   descriptor
       .getInheritancePolicy()
       .addClassIndicator(WebSphere_Liberty_Platform_Config.class, "websphere-liberty-platform");
   return descriptor;
 }
  public void addPhoneNumberDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(PhoneNumber.class);

    XMLDirectMapping numberMapping = new XMLDirectMapping();
    numberMapping.setAttributeName("number");
    numberMapping.setXPath("text()");
    descriptor.addMapping(numberMapping);

    this.addDescriptor(descriptor);
  }
  public void addAddressDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(Address.class);

    XMLDirectMapping street = new XMLDirectMapping();
    street.setAttributeName("street");
    street.setXPath("street/text()");
    descriptor.addMapping(street);

    this.addDescriptor(descriptor);
  }
  public XMLDescriptor getAddressDescriptor() {
    XMLDescriptor xmlDescriptor = new XMLDescriptor();
    xmlDescriptor.setJavaClass(Address.class);

    XMLDirectMapping idMapping = new XMLDirectMapping();
    idMapping.setAttributeName("street");
    idMapping.setXPath("@street");
    xmlDescriptor.addMapping(idMapping);

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

    InheritancePolicy ip = (InheritancePolicy) descriptor.getInheritancePolicy();
    ip.setClassIndicatorFieldName("@type");
    ip.addClassIndicator(MWAttributeContainerAccessor.class, "attribute-based");
    ip.addClassIndicator(MWMethodContainerAccessor.class, "method-based");

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

    ((XMLDirectMapping) descriptor.addDirectMapping("minOccurs", "min-occurs/text()"))
        .setNullValue(new Integer(1));
    ((XMLDirectMapping) descriptor.addDirectMapping("maxOccurs", "max-occurs/text()"))
        .setNullValue(new Integer(1));

    return descriptor;
  }
 protected ClassDescriptor buildAddressDescriptor() {
   XMLDescriptor descriptor = new XMLDescriptor();
   descriptor.setJavaClass(Address.class);
   descriptor.setDefaultRootElement("address");
   XMLDirectMapping mapping = new XMLDirectMapping();
   mapping.setAttributeName("address_content");
   mapping.setGetMethodName("getContent");
   mapping.setSetMethodName("setContent");
   mapping.setXPath("text()");
   descriptor.addMapping(mapping);
   return descriptor;
 }
  public void addPhoneNumberDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(PhoneNumber.class);
    descriptor.setDefaultRootElement("phone-number");

    XMLDirectMapping num = new XMLDirectMapping();
    num.setAttributeName("number");
    num.setXPath("text()");
    descriptor.addMapping(num);

    this.addDescriptor(descriptor);
  }
  public ClassDescriptor buildRootDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(AnyCollectionRoot.class);
    descriptor.setDefaultRootElement("root");

    XMLAnyCollectionMapping mapping = new XMLAnyCollectionMapping();
    mapping.setAttributeName("any");
    mapping.setGetMethodName("getAny");
    mapping.setSetMethodName("setAny");
    descriptor.addMapping(mapping);

    return descriptor;
  }
  public XMLDescriptor addAddressDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(Address.class);
    descriptor.setDefaultRootElement("address");

    XMLDirectMapping street = new XMLDirectMapping();
    street.setAttributeName("street");
    street.setXPath("street/text()");
    descriptor.addMapping(street);

    this.addDescriptor(descriptor);
    return descriptor;
  }