Package com.sun.tools.xjc.model

Examples of com.sun.tools.xjc.model.CPluginCustomization


        throws JAXBException
    {
        if ( !this.mappedClasses.contains( c.implClass.binaryName() )
             && c.target.getCustomizations().find( ORM_NS, "mapped-superclass" ) != null )
        {
            final CPluginCustomization pc = c.target.getCustomizations().find( ORM_NS, "mapped-superclass" );
            final MappedSuperclass mappedSuperclass =
                JAXB.unmarshal( new DOMSource( pc.element ), MappedSuperclass.class );

            orm.getMappedSuperclass().add( mappedSuperclass );
            this.toMappedSuperclass( outline, c, orm, mappedSuperclass );

            if ( !pc.isAcknowledged() )
            {
                pc.markAsAcknowledged();
            }

            this.mappedClasses.add( mappedSuperclass.getClazz() );
        }
    }
View Full Code Here


        throws JAXBException
    {
        if ( !this.mappedClasses.contains( c.implClass.binaryName() )
             && c.target.getCustomizations().find( ORM_NS, "embeddable" ) != null )
        {
            final CPluginCustomization pc = c.target.getCustomizations().find( ORM_NS, "embeddable" );
            final Embeddable embeddable = JAXB.unmarshal( new DOMSource( pc.element ), Embeddable.class );

            orm.getEmbeddable().add( embeddable );
            this.toEmbeddable( c, embeddable );

            if ( !pc.isAcknowledged() )
            {
                pc.markAsAcknowledged();
            }

            this.mappedClasses.add( embeddable.getClazz() );
        }
    }
View Full Code Here

            boolean mapped = false;

            Entity entity = null;
            if ( c.target.getCustomizations().find( ORM_NS, "entity" ) != null )
            {
                final CPluginCustomization pc = c.target.getCustomizations().find( ORM_NS, "entity" );
                entity = JAXB.unmarshal( new DOMSource( pc.element ), Entity.class );

                orm.getEntity().add( entity );
                this.toEntity( outline, c, entity );

                mapped = true;

                if ( !pc.isAcknowledged() )
                {
                    pc.markAsAcknowledged();
                }
            }

            if ( !mapped )
            {
View Full Code Here

        {
            boolean mapped = false;

            if ( f.getPropertyInfo().getCustomizations().find( ORM_NS, "id" ) != null )
            {
                final CPluginCustomization pc = f.getPropertyInfo().getCustomizations().find( ORM_NS, "id" );
                final Id id = JAXB.unmarshal( new DOMSource( pc.element ), Id.class );

                if ( id.getName() == null )
                {
                    id.setName( f.getPropertyInfo().getName( false ) );
                }

                attributes.getId().add( id );
                mapped = true;

                final Column defaultColumn =
                    this.applySchemaDefaults( f.getPropertyInfo().getSchemaComponent(), id.getColumn() );

                id.setColumn( defaultColumn );

                if ( !pc.isAcknowledged() )
                {
                    pc.markAsAcknowledged();
                }
            }

            if ( f.getPropertyInfo().getCustomizations().find( ORM_NS, "basic" ) != null )
            {
                final CPluginCustomization pc = f.getPropertyInfo().getCustomizations().find( ORM_NS, "basic" );
                final Basic basic = JAXB.unmarshal( new DOMSource( pc.element ), Basic.class );

                if ( basic.getName() == null )
                {
                    basic.setName( f.getPropertyInfo().getName( false ) );
                }

                attributes.getBasic().add( basic );
                mapped = true;

                if ( !pc.isAcknowledged() )
                {
                    pc.markAsAcknowledged();
                }

                final Column defaultColumn =
                    this.applySchemaDefaults( f.getPropertyInfo().getSchemaComponent(), basic.getColumn() );

                basic.setColumn( defaultColumn );
            }

            if ( f.getPropertyInfo().getCustomizations().find( ORM_NS, "version" ) != null )
            {
                final CPluginCustomization pc = f.getPropertyInfo().getCustomizations().find( ORM_NS, "version" );
                final Version version = JAXB.unmarshal( new DOMSource( pc.element ), Version.class );

                if ( version.getName() == null )
                {
                    version.setName( f.getPropertyInfo().getName( false ) );
                }

                attributes.getVersion().add( version );
                mapped = true;

                if ( !pc.isAcknowledged() )
                {
                    pc.markAsAcknowledged();
                }

                final Column defaultColumn =
                    this.applySchemaDefaults( f.getPropertyInfo().getSchemaComponent(), version.getColumn() );

                version.setColumn( defaultColumn );
            }

            if ( f.getPropertyInfo().getCustomizations().find( ORM_NS, "many-to-one" ) != null )
            {
                final CPluginCustomization pc = f.getPropertyInfo().getCustomizations().find( ORM_NS, "many-to-one" );
                final ManyToOne m = JAXB.unmarshal( new DOMSource( pc.element ), ManyToOne.class );

                if ( m.getName() == null )
                {
                    m.setName( f.getPropertyInfo().getName( false ) );
                }

                attributes.getManyToOne().add( m );
                mapped = true;

                if ( !pc.isAcknowledged() )
                {
                    pc.markAsAcknowledged();
                }
            }

            if ( f.getPropertyInfo().getCustomizations().find( ORM_NS, "one-to-many" ) != null )
            {
                final CPluginCustomization pc = f.getPropertyInfo().getCustomizations().find( ORM_NS, "one-to-many" );
                final OneToMany o = JAXB.unmarshal( new DOMSource( pc.element ), OneToMany.class );

                if ( o.getName() == null )
                {
                    o.setName( f.getPropertyInfo().getName( false ) );
                }

                attributes.getOneToMany().add( o );

                this.generateCollectionSetter( f.parent().parent().getCodeModel(), f.parent(), f.getPropertyInfo() );
                mapped = true;

                if ( !pc.isAcknowledged() )
                {
                    pc.markAsAcknowledged();
                }
            }

            if ( f.getPropertyInfo().getCustomizations().find( ORM_NS, "one-to-one" ) != null )
            {
                final CPluginCustomization pc = f.getPropertyInfo().getCustomizations().find( ORM_NS, "one-to-one" );
                final OneToOne o = JAXB.unmarshal( new DOMSource( pc.element ), OneToOne.class );

                if ( o.getName() == null )
                {
                    o.setName( f.getPropertyInfo().getName( false ) );
                }

                attributes.getOneToOne().add( o );
                mapped = true;

                if ( !pc.isAcknowledged() )
                {
                    pc.markAsAcknowledged();
                }
            }

            if ( f.getPropertyInfo().getCustomizations().find( ORM_NS, "many-to-many" ) != null )
            {
                final CPluginCustomization pc = f.getPropertyInfo().getCustomizations().find( ORM_NS, "many-to-many" );
                final ManyToMany m = JAXB.unmarshal( new DOMSource( pc.element ), ManyToMany.class );

                if ( m.getName() == null )
                {
                    m.setName( f.getPropertyInfo().getName( false ) );
                }

                attributes.getManyToMany().add( m );

                this.generateCollectionSetter( f.parent().parent().getCodeModel(), f.parent(), f.getPropertyInfo() );
                mapped = true;

                if ( !pc.isAcknowledged() )
                {
                    pc.markAsAcknowledged();
                }
            }

            if ( f.getPropertyInfo().getCustomizations().find( ORM_NS, "embedded" ) != null )
            {
                final CPluginCustomization pc = f.getPropertyInfo().getCustomizations().find( ORM_NS, "embedded" );
                final Embedded e = JAXB.unmarshal( new DOMSource( pc.element ), Embedded.class );

                if ( e.getName() == null )
                {
                    e.setName( f.getPropertyInfo().getName( false ) );
                }

                attributes.getEmbedded().add( e );
                mapped = true;

                if ( !pc.isAcknowledged() )
                {
                    pc.markAsAcknowledged();
                }
            }

            if ( f.getPropertyInfo().getCustomizations().find( ORM_NS, "transient" ) != null )
            {
                final CPluginCustomization pc = f.getPropertyInfo().getCustomizations().find( ORM_NS, "transient" );
                final Transient t = JAXB.unmarshal( new DOMSource( pc.element ), Transient.class );

                if ( t.getName() == null )
                {
                    t.setName( f.getPropertyInfo().getName( false ) );
                }

                attributes.getTransient().add( t );
                mapped = true;

                if ( !pc.isAcknowledged() )
                {
                    pc.markAsAcknowledged();
                }
            }

            if ( !mapped )
            {
View Full Code Here

        {
            boolean mapped = false;

            if ( f.getPropertyInfo().getCustomizations().find( ORM_NS, "basic" ) != null )
            {
                final CPluginCustomization pc = f.getPropertyInfo().getCustomizations().find( ORM_NS, "basic" );
                final Basic basic = JAXB.unmarshal( new DOMSource( pc.element ), Basic.class );

                if ( basic.getName() == null )
                {
                    basic.setName( f.getPropertyInfo().getName( false ) );
                }

                attributes.getBasic().add( basic );
                mapped = true;

                if ( !pc.isAcknowledged() )
                {
                    pc.markAsAcknowledged();
                }
            }

            if ( f.getPropertyInfo().getCustomizations().find( ORM_NS, "transient" ) != null )
            {
                final CPluginCustomization pc = f.getPropertyInfo().getCustomizations().find( ORM_NS, "transient" );
                final Transient t = JAXB.unmarshal( new DOMSource( pc.element ), Transient.class );

                if ( t.getName() == null )
                {
                    t.setName( f.getPropertyInfo().getName( false ) );
                }

                attributes.getTransient().add( t );
                mapped = true;

                if ( !pc.isAcknowledged() )
                {
                    pc.markAsAcknowledged();
                }
            }

            if ( !mapped )
            {
View Full Code Here

    }

    public boolean run(Outline outline, Options opt, ErrorHandler errorHandler) {
      
        for (ClassOutline co : outline.getClasses()) {
            CPluginCustomization cust = co.target.getCustomizations().find(CFG_NAMESPACE_URI,
                                                                           CFG_CONFIGURABLE_ELEM_NAME);
            if (null == cust) {
                continue;
            }

            cust.markAsAcknowledged();

            // generated class extends AbstractConfigurableBeanBase

            JDefinedClass dc = co.implClass;
            dc._extends(AbstractConfigurableBeanBase.class);
View Full Code Here

    }

    // meat of the processing
    public boolean run(Outline model, Options opt, ErrorHandler errorHandler) {
        for( ClassOutline co : model.getClasses() ) {
            CPluginCustomization c = co.target.getCustomizations().find(Const.NS,"code");
            if(c==null)
                continue;   // no customization --- nothing to inject here

            c.markAsAcknowledged();
            // TODO: ideally you should validate this DOM element to make sure
            // that there's no typo/etc. JAXP 1.3 can do this very easily.
            String codeFragment = DOMUtils.getElementText(c.element);

            // inject the specified code fragment into the implementation class.
View Full Code Here

        for( Element e : DOMUtil.getChildElements(dom) ) {
            if(!model.options.pluginURIs.contains(e.getNamespaceURI()))
                continue;   // this isn't a plugin customization
            if(r==null)
                r = new CCustomizations();
            r.add(new CPluginCustomization(e, DOMLocator.getLocationInfo(e)));
        }

        if(r==null)     r = CCustomizations.EMPTY;
        return new CCustomizations(r);
    }
View Full Code Here

                pc.markAsAcknowledged();
                if(!Ring.get(Model.class).options.pluginURIs.contains(pc.getName().getNamespaceURI()))
                    continue;   // this isn't a plugin customization
                if(r==null)
                    r = new CCustomizations();
                r.add(new CPluginCustomization(pc.element,pc.getLocation()));
            }
        }

        if(r==null)     r = CCustomizations.EMPTY;
        return new CCustomizations(r);
View Full Code Here

  /**
   * Clone given configuration and apply settings from global/class/field JAXB customization.
   */
  private Configuration applyConfigurationFromCustomizations(Configuration configuration,
              CCustomizations customizations) throws IOException, ClassNotFoundException {
    CPluginCustomization customization = customizations.find(XEW_QNAME.getNamespaceURI(), XEW_QNAME.getLocalPart());

    if (customization != null) {
      configuration = configuration.clone();

      customization.markAsAcknowledged();

      NamedNodeMap attributes = customization.element.getAttributes();
      Map<String, String> options = new HashMap<String, String>();

      for (int i = 0; i < attributes.getLength(); i++) {
View Full Code Here

TOP

Related Classes of com.sun.tools.xjc.model.CPluginCustomization

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.