com.sun.xml.internal.xsom.XSComponent Java Examples

The following examples show how to use com.sun.xml.internal.xsom.XSComponent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BIProperty.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public CValuePropertyInfo createValueProperty(String defaultName,boolean forConstant,
    XSComponent source,TypeUse tu, QName typeName) {

    markAsAcknowledged();
    constantPropertyErrorCheck();

    String name = getPropertyName(forConstant);
    if(name==null) {
        name = defaultName;
        if(tu.isCollection() && getBuilder().getGlobalBinding().isSimpleMode())
            name = JJavaName.getPluralForm(name);
    }

    CValuePropertyInfo prop = wrapUp(new CValuePropertyInfo(name, source, getCustomizations(source), source.getLocator(), tu, typeName), source);
    BIInlineBinaryData.handle(source, prop);
    return prop;
}
 
Example #2
Source File: Step.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Evaluate this step against the current node set
 * and returns matched nodes.
 */
public final Iterator<T> evaluate(Iterator<XSComponent> nodeSet) {
    // list up the whole thing
    Iterator<T> r = new Iterators.Map<T,XSComponent>(nodeSet) {
        protected Iterator<? extends T> apply(XSComponent contextNode) {
            return filter(axis.iterator(contextNode));
        }
    };

    // avoid duplicates
    r = new Iterators.Unique<T>(r);

    if(predicate>=0) {
        T item=null;
        for( int i=predicate; i>0; i-- ) {
            if(!r.hasNext())
                return Iterators.empty();
            item = r.next();
        }
        return new Iterators.Singleton<T>(item);
    }

    return r;
}
 
Example #3
Source File: BIProperty.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private CCustomizations getCustomizations( XSParticle src ) {
    // customizations for a particle  should include those defined in the term unless it's global
    // this is so that the schema like:
    //
    // <xs:sequence>
    //   <xs:element name="foo" type="xs:int">
    //     <xs:annotation><xs:appinfo>
    //       <hyperjaxb:... />
    //
    // would be picked up
    if(src.getTerm().isElementDecl()) {
        XSElementDecl xed = src.getTerm().asElementDecl();
        if(xed.isGlobal())
            return getCustomizations((XSComponent)src);
    }

    return getCustomizations(src,src.getTerm());
}
 
Example #4
Source File: SCDImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public Iterator<XSComponent> select(Iterator<? extends XSComponent> contextNode) {
    Iterator<XSComponent> nodeSet = (Iterator)contextNode;

    int len = steps.length;
    for( int i=0; i<len; i++ ) {
        if(i!=0 && i!=len-1 && !steps[i-1].axis.isModelGroup() && steps[i].axis.isModelGroup()) {
            // expand the current nodeset by adding abbreviatable complex type and model groups.
            // note that such expansion is not allowed to occure in in between model group axes.

            // TODO: this step is not needed if the next step is known not to react to
            // complex type nor model groups, such as, say Axis.FACET
            nodeSet = new Iterators.Unique<XSComponent>(
                new Iterators.Map<XSComponent,XSComponent>(nodeSet) {
                    protected Iterator<XSComponent> apply(XSComponent u) {
                        return new Iterators.Union<XSComponent>(
                            Iterators.singleton(u),
                            Axis.INTERMEDIATE_SKIP.iterator(u) );
                    }
                }
            );
        }
        nodeSet = steps[i].evaluate(nodeSet);
    }

    return nodeSet;
}
 
Example #5
Source File: UnusedCustomizationChecker.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private void check(BIDeclaration decl, XSComponent c) {
    if( !decl.isAcknowledged() ) {
        getErrorReporter().error(
            decl.getLocation(),
            Messages.ERR_UNACKNOWLEDGED_CUSTOMIZATION,
            decl.getName().getLocalPart()
            );
        getErrorReporter().error(
            c.getLocator(),
            Messages.ERR_UNACKNOWLEDGED_CUSTOMIZATION_LOCATION);
        // mark it as acknowledged to avoid
        // duplicated error messages.
        decl.markAsAcknowledged();
    }
    for (BIDeclaration d : decl.getChildren())
        check(d,c);
}
 
Example #6
Source File: CClassInfo.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public CClassInfo(Model model,JCodeModel cm, String fullName, Locator location, QName typeName, QName elementName, XSComponent source, CCustomizations customizations) {
    super(model,source,location,customizations);
    this.model = model;
    int idx = fullName.indexOf('.');
    if(idx<0) {
        this.parent = model.getPackage(cm.rootPackage());
        this.shortName = model.allocator.assignClassName(parent,fullName);
    } else {
        this.parent = model.getPackage(cm._package(fullName.substring(0,idx)));
        this.shortName = model.allocator.assignClassName(parent,fullName.substring(idx+1));
    }
    this.typeName = typeName;
    this.elementName = elementName;

    model.add(this);
}
 
Example #7
Source File: BIProperty.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private CCustomizations getCustomizations( XSParticle src ) {
    // customizations for a particle  should include those defined in the term unless it's global
    // this is so that the schema like:
    //
    // <xs:sequence>
    //   <xs:element name="foo" type="xs:int">
    //     <xs:annotation><xs:appinfo>
    //       <hyperjaxb:... />
    //
    // would be picked up
    if(src.getTerm().isElementDecl()) {
        XSElementDecl xed = src.getTerm().asElementDecl();
        if(xed.isGlobal())
            return getCustomizations((XSComponent)src);
    }

    return getCustomizations(src,src.getTerm());
}
 
Example #8
Source File: SCDImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public Iterator<XSComponent> select(Iterator<? extends XSComponent> contextNode) {
    Iterator<XSComponent> nodeSet = (Iterator)contextNode;

    int len = steps.length;
    for( int i=0; i<len; i++ ) {
        if(i!=0 && i!=len-1 && !steps[i-1].axis.isModelGroup() && steps[i].axis.isModelGroup()) {
            // expand the current nodeset by adding abbreviatable complex type and model groups.
            // note that such expansion is not allowed to occure in in between model group axes.

            // TODO: this step is not needed if the next step is known not to react to
            // complex type nor model groups, such as, say Axis.FACET
            nodeSet = new Iterators.Unique<XSComponent>(
                new Iterators.Map<XSComponent,XSComponent>(nodeSet) {
                    protected Iterator<XSComponent> apply(XSComponent u) {
                        return new Iterators.Union<XSComponent>(
                            Iterators.singleton(u),
                            Axis.INTERMEDIATE_SKIP.iterator(u) );
                    }
                }
            );
        }
        nodeSet = steps[i].evaluate(nodeSet);
    }

    return nodeSet;
}
 
Example #9
Source File: CElementPropertyInfo.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public CElementPropertyInfo(String name, CollectionMode collection, ID id, MimeType expectedMimeType, XSComponent source,
                            CCustomizations customizations, Locator locator, boolean required) {
    super(name, collection.col, source, customizations, locator);
    this.required = required;
    this.id = id;
    this.expectedMimeType = expectedMimeType;
    this.isValueList = collection.val;
}
 
Example #10
Source File: BIProperty.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private CCustomizations getCustomizations( XSAttributeUse src ) {
    // customizations for an attribute use should include those defined in the local attribute.
    // this is so that the schema like:
    //
    // <xs:attribute name="foo" type="xs:int">
    //   <xs:annotation><xs:appinfo>
    //     <hyperjaxb:... />
    //
    // would be picked up
    if(src.getDecl().isLocal())
        return getCustomizations(src,src.getDecl());
    else
        return getCustomizations((XSComponent)src);
}
 
Example #11
Source File: SchemaImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public XSComponent selectSingle(String scd, NamespaceContext nsContext) {
    try {
        return SCD.create(scd,nsContext).selectSingle(this);
    } catch (ParseException e) {
        throw new IllegalArgumentException(e);
    }
}
 
Example #12
Source File: CSingleTypePropertyInfo.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 *
 * @param typeName
 *      XML Schema type name of this property's single value. Optional
 *      for other schema languages. This is used to determine if we should
 *      generate {@link @XmlSchemaType} annotation to improve the roundtrip.
 */
protected CSingleTypePropertyInfo(String name, TypeUse type, QName typeName, XSComponent source, CCustomizations customizations, Locator locator) {
    super(name, type.isCollection(), source, customizations, locator);
    this.type = type;

    if(needsExplicitTypeName(type,typeName))
        schemaType = typeName;
    else
        schemaType = null;
}
 
Example #13
Source File: Axis.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public Iterator<XSSchema> iterator(Iterator<? extends XSComponent> contextNodes) {
    return new Iterators.Adapter<XSSchema,XSComponent>(contextNodes) {
        protected XSSchema filter(XSComponent u) {
            return u.getOwnerSchema();
        }
    };
}
 
Example #14
Source File: SchemaSetImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public Collection<XSComponent> select(String scd, NamespaceContext nsContext) {
    try {
        return SCD.create(scd,nsContext).select(this);
    } catch (ParseException e) {
        throw new IllegalArgumentException(e);
    }
}
 
Example #15
Source File: CReferencePropertyInfo.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public CReferencePropertyInfo(String name, boolean collection, boolean required, boolean isMixed, XSComponent source,
                              CCustomizations customizations, Locator locator, boolean dummy, boolean content, boolean isMixedExtended) {   // 'dummy' and 'content' here for NHIN fix - a hack in order to be able to handle extended mixed types better
    super(name, (collection||isMixed) && (!dummy), source, customizations, locator);
    this.isMixed = isMixed;
    this.required = required;
    this.dummy = dummy;
    this.content = content;
    this.isMixedExtendedCust = isMixedExtended;
}
 
Example #16
Source File: BGMBuilder.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If the component maps to a property, forwards to purple, otherwise to green.
 *
 * If the component is mapped to a type, this method needs to return true.
 * See the chart at the class javadoc.
 */
public void ying( XSComponent sc, @Nullable XSComponent referer ) {
    if(sc.apply(toPurple)==true || getClassSelector().bindToType(sc,referer)!=null)
        sc.visit(purple);
    else
        sc.visit(green);
}
 
Example #17
Source File: UnusedCustomizationChecker.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void checkExpectedContentTypes(XSComponent c) {
    if(c.getForeignAttribute(WellKnownNamespace.XML_MIME_URI, Const.EXPECTED_CONTENT_TYPES)==null)
        return; // no such attribute
    if(c instanceof XSParticle)
        return; // particles get the same foreign attributes as local element decls,
                // so we need to skip them

    if(!stb.isAcknowledgedXmimeContentTypes(c)) {
        // this is not used
        getErrorReporter().warning(c.getLocator(),Messages.WARN_UNUSED_EXPECTED_CONTENT_TYPES);
    }
}
 
Example #18
Source File: BIProperty.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private CCustomizations getCustomizations( XSAttributeUse src ) {
    // customizations for an attribute use should include those defined in the local attribute.
    // this is so that the schema like:
    //
    // <xs:attribute name="foo" type="xs:int">
    //   <xs:annotation><xs:appinfo>
    //     <hyperjaxb:... />
    //
    // would be picked up
    if(src.getDecl().isLocal())
        return getCustomizations(src,src.getDecl());
    else
        return getCustomizations((XSComponent)src);
}
 
Example #19
Source File: ClassSelector.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Checks if the given component is bound to a class.
 */
public final CElement isBound( XSElementDecl x, XSComponent referer ) {
    CElementInfo r = boundElements.get(x);
    if(r!=null)
        return r;
    return bindToType(x,referer);
}
 
Example #20
Source File: ClassSelector.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public CClass bindToType( XSComplexType t, XSComponent referer, boolean cannotBeDelayed ) {
    // this assumption that a complex type always binds to a ClassInfo
    // does not hold for xs:anyType --- our current approach of handling
    // this idiosynchracy is to make sure that xs:anyType doesn't use
    // this codepath.
    return (CClass)_bindToClass(t,referer,cannotBeDelayed);
}
 
Example #21
Source File: BGMBuilder.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Find all types that refer to the given complex type.
 */
public Set<XSComponent> getReferer(XSType c) {
    if(refFinder==null) {
        refFinder = new RefererFinder();
        refFinder.schemaSet(Ring.get(XSSchemaSet.class));
    }
    return refFinder.getReferer(c);
}
 
Example #22
Source File: BIProperty.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static BIProperty getDefault( BGMBuilder builder, XSComponent c ) {
    while(c!=null) {
        c = c.apply(defaultCustomizationFinder);
        if(c!=null) {
            BIProperty prop = builder.getBindInfo(c).get(BIProperty.class);
            if(prop!=null)  return prop;
        }
    }

    // default to the global one
    return builder.getGlobalBinding().getDefaultProperty();
}
 
Example #23
Source File: BIProperty.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public CReferencePropertyInfo createContentExtendedMixedReferenceProperty(
        String defaultName, XSComponent source, RawTypeSet types) {
        return createReferenceProperty(
                defaultName,
                false,
                source,
                types,
                true,
                false,
                true,
                true);
}
 
Example #24
Source File: ComponentImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public XSComponent selectSingle(String scd, NamespaceContext nsContext) {
    try {
        return SCD.create(scd,nsContext).selectSingle(this);
    } catch (ParseException e) {
        throw new IllegalArgumentException(e);
    }
}
 
Example #25
Source File: CElementPropertyInfo.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public CElementPropertyInfo(String name, CollectionMode collection, ID id, MimeType expectedMimeType, XSComponent source,
                            CCustomizations customizations, Locator locator, boolean required) {
    super(name, collection.col, source, customizations, locator);
    this.required = required;
    this.id = id;
    this.expectedMimeType = expectedMimeType;
    this.isValueList = collection.val;
}
 
Example #26
Source File: BIProperty.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private CCustomizations getCustomizations( XSComponent... src ) {
    CCustomizations c = null;
    for (XSComponent s : src) {
        CCustomizations r = getCustomizations(s);
        if(c==null)     c = r;
        else            c = CCustomizations.merge(c,r);
    }
    return c;
}
 
Example #27
Source File: SchemaSetImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public XSComponent selectSingle(String scd, NamespaceContext nsContext) {
    try {
        return SCD.create(scd,nsContext).selectSingle(this);
    } catch (ParseException e) {
        throw new IllegalArgumentException(e);
    }
}
 
Example #28
Source File: CAttributePropertyInfo.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param type
 *      Represents the bound type of this attribute.
 * @param typeName
 *      XML Schema type name of this attribute. Optional for other schema languages.
 */
public CAttributePropertyInfo(String name, XSComponent source, CCustomizations customizations,
                              Locator locator, QName attName, TypeUse type, @Nullable QName typeName,
                              boolean required ) {
    super(name, type, typeName, source, customizations, locator);
    isRequired = required;
    this.attName = attName;
}
 
Example #29
Source File: CElementPropertyInfo.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public CElementPropertyInfo(String name, CollectionMode collection, ID id, MimeType expectedMimeType, XSComponent source,
                            CCustomizations customizations, Locator locator, boolean required) {
    super(name, collection.col, source, customizations, locator);
    this.required = required;
    this.id = id;
    this.expectedMimeType = expectedMimeType;
    this.isValueList = collection.val;
}
 
Example #30
Source File: Axis.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Iterate all descendant model groups of the given model group, including itself.
 */
private Iterator<XSComponent> descendants(XSModelGroup mg) {
    // TODO: write a tree iterator
    // for now, we do it eagerly because I'm lazy
    List<XSComponent> r = new ArrayList<XSComponent>();
    visit(mg,r);
    return r.iterator();
}