User: dsundstrom
  Date: 01/11/01 14:11:26

  Modified:    src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata
                        JDBCEntityMetaData.java JDBCQlQueryMetaData.java
                        JDBCQueryMetaData.java
  Log:
  Cleaned up code.
  
  Revision  Changes    Path
  1.8       +177 -95   
jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata/JDBCEntityMetaData.java
  
  Index: JDBCEntityMetaData.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata/JDBCEntityMetaData.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JDBCEntityMetaData.java   2001/10/09 00:29:43     1.7
  +++ JDBCEntityMetaData.java   2001/11/01 22:11:26     1.8
  @@ -22,12 +22,12 @@
   import org.w3c.dom.Element;
   
   /**
  - *   This immutable class contains information about an entity
  + * This immutable class contains information about an entity
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Dain Sundstrom</a>
  - *   @author <a href="[EMAIL PROTECTED]">Sebastien Alborini</a>
  + * @author <a href="[EMAIL PROTECTED]">Sebastien Alborini</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Dirk Zimmermann</a>
  - *   @version $Revision: 1.7 $
  + * @version $Revision: 1.8 $
    */
   public final class JDBCEntityMetaData {
      /**
  @@ -121,7 +121,8 @@
      private final Class primaryKeyClass;
   
      /**
  -    * the name of the primary key field or null if the primary key field is 
multivalued
  +    * the name of the primary key field or null if the primary key field 
  +    * is multivalued
       */
      private final String primaryKeyFieldName;
   
  @@ -131,12 +132,14 @@
      private final Map cmpFields = new HashMap();
   
      /**
  -    * The fields which should always be loaded when an entity of this type is 
loaded.
  +    * The fields which should always be loaded when an entity of this type
  +    * is loaded.
       */
      private final List eagerLoadFields = new ArrayList();
   
      /**
  -    * A list of groups (also lists) of the fields that should be lazy loaded 
together.
  +    * A list of groups (also lists) of the fields that should be lazy
  +    * loaded together.
       */
      private final List lazyLoadGroups = new ArrayList();
   
  @@ -156,15 +159,21 @@
      private final JDBCReadAheadMetaData readAhead;
   
      /**
  -    * Constructs jdbc entity meta data defined in the jdbcApplication and with the
  -    * data from the entity meta data which is loaded from the ejb-jar.xml file.
  +    * Constructs jdbc entity meta data defined in the jdbcApplication and 
  +    * with the data from the entity meta data which is loaded from the
  +    * ejb-jar.xml file.
       *
       * @param jdbcApplication the application in which this entity is defined
  -    * @param entity the entity meta data for this entity that is loaded from the 
ejb-jar.xml file
  -    * @throws DeploymentException if an problem occures while loading the classes 
or if
  -    *       data in the ejb-jar.xml is inconsistent with data from 
jbosscmp-jdbc.xml file
  -    */
  -   public JDBCEntityMetaData(JDBCApplicationMetaData jdbcApplication, 
EntityMetaData entity) throws DeploymentException {
  +    * @param entity the entity meta data for this entity that is loaded
  +    *    from the ejb-jar.xml file
  +    * @throws DeploymentException if an problem occures while loading the
  +    *    classes or if data in the ejb-jar.xml is inconsistent with data 
  +    *    from jbosscmp-jdbc.xml file
  +    */
  +   public JDBCEntityMetaData(
  +         JDBCApplicationMetaData jdbcApplication,
  +         EntityMetaData entity) throws DeploymentException {
  +
         this.jdbcApplication = jdbcApplication;
         entityName = entity.getEjbName();
         abstractSchemaName = entity.getAbstractSchemaName();
  @@ -176,9 +185,11 @@
         }
   
         try {
  -         primaryKeyClass = getClassLoader().loadClass(entity.getPrimaryKeyClass());
  +         primaryKeyClass = 
  +               getClassLoader().loadClass(entity.getPrimaryKeyClass());
         } catch (ClassNotFoundException e) {
  -         throw new DeploymentException("could not load primary key class: " + 
entity.getPrimaryKeyClass());
  +         throw new DeploymentException("could not load primary key class: " +
  +               entity.getPrimaryKeyClass());
         }
   
         isCMP1x = entity.isCMP1x();
  @@ -200,12 +211,14 @@
            try {
               localHomeClass = getClassLoader().loadClass(localHome);
            } catch (ClassNotFoundException e) {
  -            throw new DeploymentException("local home class not found: " + 
localHome);
  +            throw new DeploymentException("local home class not found: " +
  +                  localHome);
            }
         } else {
            // we must have a home or local home
            if(home == null) {
  -            throw new DeploymentException("Entity must have atleast a home or local 
home: " + entityName);
  +            throw new DeploymentException("Entity must have atleast a home " +
  +                  "or local home: " + entityName);
            }
   
            localHomeClass = null;
  @@ -215,22 +228,27 @@
         // the table name may be overridden in importXml(jbosscmp-jdbc.xml)
         tableName = entityName.replace('.', '_');
         
  -      // build the metadata for the cmp fields now in case there is no 
jbosscmp-jdbc.xml
  +      // build the metadata for the cmp fields now in case there is
  +      // no jbosscmp-jdbc.xml
         for(Iterator i = entity.getCMPFields(); i.hasNext(); ) {
            String cmpFieldName = (String)i.next();
  -          JDBCCMPFieldMetaData cmpField = new JDBCCMPFieldMetaData(this, 
cmpFieldName);         
  +          JDBCCMPFieldMetaData cmpField = 
  +               new JDBCCMPFieldMetaData(this, cmpFieldName);         
            cmpFields.put(cmpFieldName, cmpField);
         }
   
  -      // set eager load fields to all cmp fields in case there is no 
jbosscmp-jdbc.xml
  -       eagerLoadFields.addAll(cmpFields.values());
  +      // set eager load fields to all cmp fields in case there is
  +      // no jbosscmp-jdbc.xml
  +      eagerLoadFields.addAll(cmpFields.values());
   
         // Create no lazy load groups. By default every thing is eager loaded.
  -
  -      // build the metadata for the queries now in case there is no 
jbosscmp-jdbc.xml
  +      // build the metadata for the queries now in case there is no 
  +      // jbosscmp-jdbc.xml
         queryFactory = new JDBCQueryMetaDataFactory(this);
  +
  +      for(Iterator queriesIterator = entity.getQueries();
  +            queriesIterator.hasNext();) {
   
  -      for(Iterator queriesIterator = entity.getQueries(); 
queriesIterator.hasNext();) {
            QueryMetaData queryData = (QueryMetaData)queriesIterator.next();
            Method[] methods = queryFactory.getQueryMethods(queryData);
            for(int i=0; i<methods.length; i++) {
  @@ -239,7 +257,8 @@
            }
         }
   
  -      // Create no relationship roles for this entity, will be added by the 
relation meta data
  +      // Create no relationship roles for this entity, will be added 
  +      // by the relation meta data
   
   
         // other default values
  @@ -257,18 +276,23 @@
   
      /**
       * Constructs entity meta data with the data contained in the entity xml
  -    * element from a jbosscmp-jdbc xml file. Optional values of the xml element that
  -    * are not present are loaded from the defalutValues parameter.
  +    * element from a jbosscmp-jdbc xml file. Optional values of the xml element 
  +    * that are not present are loaded from the defalutValues parameter.
       *
       * @param jdbcApplication the application in which this entity is defined
  -    * @param element the xml Element which contains the metadata about this entity
  +    * @param element the xml Element which contains the metadata about 
  +    *       this entity
       * @param defaultValues the JDBCEntityMetaData which contains the values
       *       for optional elements of the element
       * @throws DeploymentException if the xml element is not semantically correct
       */
  -   public JDBCEntityMetaData(JDBCApplicationMetaData jdbcApplication, Element 
element, JDBCEntityMetaData defaultValues) throws DeploymentException {
  -      // store passed in application... application in defaultValues may be 
different
  -      // because jdbcApplication is imutable
  +   public JDBCEntityMetaData(
  +         JDBCApplicationMetaData jdbcApplication, 
  +         Element element, 
  +         JDBCEntityMetaData defaultValues) throws DeploymentException {
  +
  +      // store passed in application... application in defaultValues may 
  +      // be different because jdbcApplication is imutable
         this.jdbcApplication = jdbcApplication;
   
         // set default values
  @@ -283,20 +307,24 @@
         queryFactory = new JDBCQueryMetaDataFactory(this);
   
         // datasource name
  -      String dataSourceNameString = MetaData.getOptionalChildContent(element, 
"datasource");
  +      String dataSourceNameString = 
  +            MetaData.getOptionalChildContent(element, "datasource");
         if(dataSourceNameString != null) {
            dataSourceName = dataSourceNameString;
         } else {
            dataSourceName = defaultValues.getDataSourceName();
         }
         
  -      // get the type mapping for this datasource (optional, but always set in 
standardjbosscmp-jdbc.xml)
  -      String typeMappingString = MetaData.getOptionalChildContent(element, 
"type-mapping");      
  +      // get the type mapping for this datasource (optional, but always 
  +      // set in standardjbosscmp-jdbc.xml)
  +      String typeMappingString = 
  +            MetaData.getOptionalChildContent(element, "type-mapping");      
         if(typeMappingString != null) {
            typeMapping = jdbcApplication.getTypeMappingByName(typeMappingString);
         
            if(typeMapping == null) {
  -            throw new DeploymentException("Error in jbosscmp-jdbc.xml : 
type-mapping " + typeMappingString + " not found");
  +            throw new DeploymentException("Error in jbosscmp-jdbc.xml : " +
  +                  "type-mapping " + typeMappingString + " not found");
            }
         } else {
            typeMapping = defaultValues.getTypeMapping();
  @@ -319,7 +347,8 @@
         }
   
         // create table?  If not provided, keep default.
  -      String createStr = MetaData.getOptionalChildContent(element, "create-table");
  +      String createStr =
  +            MetaData.getOptionalChildContent(element, "create-table");
         if(createStr != null) {
            createTable = Boolean.valueOf(createStr).booleanValue();
         } else {
  @@ -327,7 +356,8 @@
         }
   
          // remove table?  If not provided, keep default.
  -      String removeStr = MetaData.getOptionalChildContent(element, "remove-table");
  +      String removeStr = 
  +            MetaData.getOptionalChildContent(element, "remove-table");
         if(removeStr != null) {
            removeTable = Boolean.valueOf(removeStr).booleanValue();
         } else {
  @@ -335,7 +365,8 @@
         }
   
         // read-only
  -      String readOnlyStr = MetaData.getOptionalChildContent(element, "read-only");
  +      String readOnlyStr =
  +            MetaData.getOptionalChildContent(element, "read-only");
         if(readOnlyStr != null) {
            readOnly = Boolean.valueOf(readOnlyStr).booleanValue();
         } else {
  @@ -343,16 +374,19 @@
         }
   
         // read-time-out
  -      String readTimeOutStr = MetaData.getOptionalChildContent(element, 
"read-time-out");
  +      String readTimeOutStr =
  +            MetaData.getOptionalChildContent(element, "read-time-out");
         if(readTimeOutStr != null) {
            readTimeOut = Integer.parseInt(readTimeOutStr);
         } else {
            readTimeOut = defaultValues.getReadTimeOut();
         }
   
  -      String sForUpStr = MetaData.getOptionalChildContent(element, 
"select-for-update");
  +      String sForUpStr = 
  +            MetaData.getOptionalChildContent(element, "select-for-update");
         if(sForUpStr != null) {
  -         selectForUpdate = !isReadOnly() && 
(Boolean.valueOf(sForUpStr).booleanValue());
  +         selectForUpdate = 
  +               !isReadOnly() && (Boolean.valueOf(sForUpStr).booleanValue());
         } else {
            selectForUpdate = defaultValues.hasSelectForUpdate();
         }
  @@ -367,15 +401,23 @@
   
         // cmp fields
         cmpFields.putAll(defaultValues.cmpFields);
  -      for(Iterator i = MetaData.getChildrenByTagName(element, "cmp-field"); 
i.hasNext(); ) {
  +      for(Iterator i = MetaData.getChildrenByTagName(element, "cmp-field"); 
  +            i.hasNext(); ) {
  +
            Element cmpFieldElement = (Element)i.next();
  -         String fieldName = MetaData.getUniqueChildContent(cmpFieldElement, 
"field-name");
  +         String fieldName =
  +               MetaData.getUniqueChildContent(cmpFieldElement, "field-name");
   
  -         JDBCCMPFieldMetaData cmpFieldMetaData = 
(JDBCCMPFieldMetaData)cmpFields.get(fieldName);
  +         JDBCCMPFieldMetaData cmpFieldMetaData =
  +               (JDBCCMPFieldMetaData)cmpFields.get(fieldName);
            if(cmpFieldMetaData == null) {
  -            throw new DeploymentException("CMP field not found : fieldName=" + 
fieldName);
  +            throw new DeploymentException("CMP field not found : fieldName=" +
  +                  fieldName);
            }
  -         cmpFieldMetaData = new JDBCCMPFieldMetaData(this, cmpFieldElement, 
cmpFieldMetaData);
  +         cmpFieldMetaData = new JDBCCMPFieldMetaData(
  +               this, 
  +               cmpFieldElement, 
  +               cmpFieldMetaData);
            cmpFields.put(fieldName, cmpFieldMetaData);
         }
   
  @@ -388,21 +430,34 @@
         loadLazyLoadGroupsXml(element);
   
         // read-ahead
  -      Element readAheadElement = MetaData.getOptionalChild(element, "read-ahead");
  +      Element readAheadElement =
  +            MetaData.getOptionalChild(element, "read-ahead");
         if (readAheadElement != null) {
            readAhead = new JDBCReadAheadMetaData(readAheadElement);
         } else {
            readAhead = defaultValues.readAhead;
         }
   
  -        // build the metadata for the queries now in case there is no 
jbosscmp-jdbc.xml
  +      // build the metadata for the queries now in case there is
  +      // no jbosscmp-jdbc.xml
         queries.putAll(defaultValues.queries);
  -      for(Iterator queriesIterator = MetaData.getChildrenByTagName(element, 
"query"); queriesIterator.hasNext(); ) {
  +      
  +      for(Iterator queriesIterator = 
  +            MetaData.getChildrenByTagName(element, "query"); 
  +            queriesIterator.hasNext(); ) {
  +
            Element queryElement = (Element)queriesIterator.next();
            Method[] methods = queryFactory.getQueryMethods(queryElement);
            for(int i=0; i<methods.length; i++) {
  -            JDBCQueryMetaData jdbcQueryData = 
(JDBCQueryMetaData)queries.get(methods[i]);
  -            jdbcQueryData = queryFactory.createJDBCQueryMetaData(jdbcQueryData, 
queryElement, methods[i], readAhead);
  +            JDBCQueryMetaData jdbcQueryData = 
  +                  (JDBCQueryMetaData)queries.get(methods[i]);
  +
  +            jdbcQueryData = queryFactory.createJDBCQueryMetaData(
  +                  jdbcQueryData, 
  +                  queryElement, 
  +                  methods[i], 
  +                  readAhead);
  +
               queries.put(methods[i], jdbcQueryData);
            }
         }
  @@ -412,7 +467,8 @@
       * Loads the list of eager loaded fields from the xml element.
       */
      private void loadEagerLoadXml(Element element) throws DeploymentException {
  -      Element eagerLoadElement = MetaData.getOptionalChild(element, "eager-load");
  +      Element eagerLoadElement = 
  +            MetaData.getOptionalChild(element, "eager-load");
   
         // If no info, we're done. Default work was already done in constructor.
         if(eagerLoadElement == null) {
  @@ -421,11 +477,13 @@
   
         // only allowed for cmp 2.x
         if(isCMP1x) {
  -         throw new DeploymentException("eager-load is only allowed for CMP 2.x");
  +         throw new DeploymentException("eager-load is only allowed " +
  +               "for CMP 2.x");
         }
   
         // get the fields
  -      Iterator fieldNames = MetaData.getChildrenByTagName(eagerLoadElement, 
"field-name");
  +      Iterator fieldNames =
  +            MetaData.getChildrenByTagName(eagerLoadElement, "field-name");
   
         // If no eager fields, clear current list and return
         if(!fieldNames.hasNext()) {
  @@ -441,7 +499,8 @@
            
            // check that there are no other fields listed
            if(fieldNames.hasNext()) {
  -            throw new DeploymentException("When * is specified in eager-load, it is 
the only field-name element allowed.");
  +            throw new DeploymentException("When * is specified in " +
  +                  "eager-load, it is the only field-name element allowed.");
            }
            return;
         } 
  @@ -471,8 +530,11 @@
      /**
       * Loads the lazy load groups of cmp fields from the xml element
       */
  -   private void loadLazyLoadGroupsXml(Element element) throws DeploymentException {
  -      Element lazyLoadGroupsElement = MetaData.getOptionalChild(element, 
"lazy-load-groups");
  +   private void loadLazyLoadGroupsXml(Element element)
  +         throws DeploymentException {
  +
  +      Element lazyLoadGroupsElement = 
  +            MetaData.getOptionalChild(element, "lazy-load-groups");
         if(lazyLoadGroupsElement == null) {
            // no info, default work already done in constructor
            return;
  @@ -480,18 +542,23 @@
         
         // only allowed for cmp 2.x
         if(isCMP1x) {
  -         throw new DeploymentException("lazy-load-groups are only allowed for CMP 
2.x");
  +         throw new DeploymentException("lazy-load-groups are only allowed " +
  +               "for CMP 2.x");
         }
         
  -      Iterator groups = MetaData.getChildrenByTagName(lazyLoadGroupsElement, 
"lazy-load-group");
  +      Iterator groups = MetaData.getChildrenByTagName(
  +            lazyLoadGroupsElement, "lazy-load-group");
  +
         while(groups.hasNext()) {
            Element groupsElement = (Element)groups.next();
            ArrayList group = new ArrayList();
   
            // add each field
  -         Iterator fields = MetaData.getChildrenByTagName(groupsElement, 
"field-name");
  +         Iterator fields =
  +               MetaData.getChildrenByTagName(groupsElement, "field-name");
            while(fields.hasNext()) {
  -            String fieldName = MetaData.getElementContent((Element)fields.next());
  +            String fieldName = 
  +                  MetaData.getElementContent((Element)fields.next());
               group.add(getExistingFieldByName(fieldName));
            }
            
  @@ -540,7 +607,8 @@
      }
   
      /**
  -    * Gets the abstract shcema name of this entity. The name come from the 
ejb-jar.xml file.
  +    * Gets the abstract shcema name of this entity. The name come from 
  +    * the ejb-jar.xml file.
       * @return the abstract schema name of this entity
       */
      public String getAbstractSchemaName() {
  @@ -548,8 +616,10 @@
      }
   
      /**
  -    * Gets the class loaded which is used to load all classes used by this entity
  -    * @return the class loader which is used to load all classes used by this entity
  +    * Gets the class loaded which is used to load all classes used by this
  +    * entity
  +    * @return the class loader which is used to load all classes used by
  +    *    this entity
       */
      public ClassLoader getClassLoader() {
         return jdbcApplication.getClassLoader();
  @@ -605,16 +675,18 @@
      
      /**
       * Gets the cmp fields of this entity which are eager loaded 
  -    * @return an unmodifiable collection of the JDBCCMPFieldMetaData objects that 
are eager loaded
  +    * @return an unmodifiable collection of the JDBCCMPFieldMetaData objects
  +    *    that are eager loaded
       */
      public Collection getEagerLoadFields() {
         return Collections.unmodifiableCollection(eagerLoadFields);
      }
      
      /**
  -    * Gets the collections cmp fields of this entity which are lazy loaded together 
  -    * @return an unmodifiable collection of unmodifiable collections of the 
JDBCCMPFieldMetaData 
  -    *       objects that are lazy loaded together
  +    * Gets the collections cmp fields of this entity which are lazy
  +    * loaded together 
  +    * @return an unmodifiable collection of unmodifiable collections of the
  +    *       JDBCCMPFieldMetaData objects that are lazy loaded together
       */
      public Collection getLazyLoadGroups() {
         return Collections.unmodifiableCollection(lazyLoadGroups);
  @@ -635,10 +707,13 @@
       * @return the cmp field with the specified name
       * @throws DeploymentException if the field is not found
       */
  -   private JDBCCMPFieldMetaData getExistingFieldByName(String name) throws 
DeploymentException {
  +   private JDBCCMPFieldMetaData getExistingFieldByName(String name) 
  +         throws DeploymentException {
  +
         JDBCCMPFieldMetaData field = getCMPFieldByName(name);
         if(field == null) {
  -         throw new DeploymentException("field-name '"+name+"' found in 
jbosscmp-jdbc.xml but not in ejb-jar.xml");
  +         throw new DeploymentException("field-name '" + name + 
  +               "' found in jbosscmp-jdbc.xml but not in ejb-jar.xml");
         }
         return field;
      }
  @@ -652,8 +727,8 @@
      }
      
      /**
  -    * Gets the flag used to determine if the store manager should attempt to create 
  -    * database table when the entity is deployed.
  +    * Gets the flag used to determine if the store manager should attempt to
  +    * create database table when the entity is deployed.
       * @return true if the store manager should attempt to create the table
       */
      public boolean getCreateTable() {
  @@ -661,8 +736,8 @@
      }
   
      /**
  -    * Gets the flag used to determine if the store manager should attempt to remove
  -    * database table when the entity is undeployed.
  +    * Gets the flag used to determine if the store manager should attempt to
  +    * remove database table when the entity is undeployed.
       * @return true if the store manager should attempt to remove the table
       */
      public boolean getRemoveTable() {
  @@ -670,18 +745,18 @@
      }
      
      /**
  -    * Gets the flag used to determine if the store manager should add a priary key 
  -    * constraint when creating the table
  -    * @return true if the store manager should add a primary key constraint to the 
  -    *       create table sql statement
  +    * Gets the flag used to determine if the store manager should add a 
  +    * priary key constraint when creating the table
  +    * @return true if the store manager should add a primary key constraint to
  +    *       the create table sql statement
       */
      public boolean hasPrimaryKeyConstraint() {
         return primaryKeyConstraint;
      }
   
      /**
  -    * Gets the flag used to determine if the store manager should add a for update  
  -    * clause when selecting data from the table
  +    * Gets the flag used to determine if the store manager should add a for
  +    * update clause when selecting data from the table
       * @return true if the store manager should add a for update  
       *       clause when selecting data from the table
       */
  @@ -700,7 +775,8 @@
      /**
       * Get the relationsip roles of this entity. 
       * Items are instance of JDBCRelationshipRoleMetaData.
  -    * @return an unmodifiable collection of the relationship roles defined for this 
entity
  +    * @return an unmodifiable collection of the relationship roles defined
  +    *    for this entity
       */
      public Collection getRelationshipRoles() {
         return jdbcApplication.getRolesForEntity(entityName);
  @@ -715,7 +791,8 @@
      }
      
      /**
  -    * Is this entity read only? A readonly entity will never be stored into the 
database.
  +    * Is this entity read only? A readonly entity will never be stored into
  +    * the database.
       * @return true if this entity is read only
       */
      public boolean isReadOnly() {
  @@ -723,11 +800,12 @@
      }
      
      /**
  -    * How long is a read of this entity valid. This property should only be used on
  -    * read only entities, and determines how long the data read from the database is
  -    * valid. When the read times out it should be reread from the database. If the 
value
  -    * is -1 and the entity is not using commit option a, the read is only valid for 
the length of the transaction in which it was
  -    * loaded.
  +    * How long is a read of this entity valid. This property should only be
  +    * used on read only entities, and determines how long the data read from
  +    * the database is valid. When the read times out it should be reread from
  +    * the database. If the value is -1 and the entity is not using commit
  +    * option a, the read is only valid for the length of the transaction in
  +    * which it was loaded.
       * @return the length of time that a read is valid or -1 if the read is only
       *       valid for the length of the transaction
       */
  @@ -736,8 +814,10 @@
      }
   
      /**
  -    * Gets the name of the primary key field of this entity or null if the primary 
key is multivalued
  -    * @return the name of the primary key field of this entity or null if the 
primary key is multivalued
  +    * Gets the name of the primary key field of this entity or null if
  +    * the primary key is multivalued
  +    * @return the name of the primary key field of this entity or null 
  +    *    if the primary key is multivalued
       */
      public String getPrimaryKeyFieldName() {
         return primaryKeyFieldName;
  @@ -757,20 +837,22 @@
       * true if the objects are the same. Two JDBCEntityMetaData are the same
       * if they both have the same name and are defined in the same application.
       * @param o the reference object with which to compare
  -    * @return true if this object is the same as the object argument; false 
otherwise
  +    * @return true if this object is the same as the object argument; 
  +    *    false otherwise
       */
      public boolean equals(Object o) {
         if(o instanceof JDBCEntityMetaData) {
            JDBCEntityMetaData entity = (JDBCEntityMetaData)o;
  -         return entityName.equals(entity.entityName) && 
jdbcApplication.equals(entity.jdbcApplication);
  +         return entityName.equals(entity.entityName) &&
  +               jdbcApplication.equals(entity.jdbcApplication);
         }
         return false;
      }
      
      /**
       * Returns a hashcode for this JDBCEntityMetaData. The hashcode is computed
  -    * based on the hashCode of the declaring application and the hashCode of the 
  -    * entityName
  +    * based on the hashCode of the declaring application and the hashCode of
  +    * the entityName
       * @return a hash code value for this object
       */
      public int hashCode() {
  @@ -781,8 +863,8 @@
      }
      /**
       * Returns a string describing this JDBCEntityMetaData. The exact details
  -    * of the representation are unspecified and subject to change, but the following
  -    * may be regarded as typical:
  +    * of the representation are unspecified and subject to change, but the
  +    * following may be regarded as typical:
       * 
       * "[JDBCEntityMetaData: entityName=UserEJB]"
       *
  
  
  
  1.6       +33 -10    
jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata/JDBCQlQueryMetaData.java
  
  Index: JDBCQlQueryMetaData.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata/JDBCQlQueryMetaData.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JDBCQlQueryMetaData.java  2001/09/01 22:03:17     1.5
  +++ JDBCQlQueryMetaData.java  2001/11/01 22:11:26     1.6
  @@ -11,14 +11,25 @@
   import org.w3c.dom.Element;
   
   /**
  - * Imutable class which contains information about an EJB QL query.
  + * Immutable class which contains information about an EJB QL query.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Dain Sundstrom</a>
  - *   @version $Revision: 1.5 $
  + * @version $Revision: 1.6 $
    */
   public final class JDBCQlQueryMetaData implements JDBCQueryMetaData {
  +   /**
  +    * The method to which this query is bound.
  +    */
      private final Method method;
  +
  +   /**
  +    * The ejb-ql fro the query.
  +    */
      private final String ejbQl;
  +
  +   /**
  +    * Should the query return Local or Remote beans.
  +    */
      private final boolean resultTypeMappingLocal;
   
      /**
  @@ -29,29 +40,38 @@
      /**
       * Constructs a JDBCQlQueryMetaData which is defined by the queryMetaData
       * and is invoked by the specified method.
  -    * @param queryMetaData the metadata about this query which was loaded from the 
ejb-jar.xml file
  +    * @param queryMetaData the metadata about this query which was loaded 
  +    *    from the ejb-jar.xml file
       * @param method the method which invokes this query
       */
      public JDBCQlQueryMetaData(QueryMetaData queryMetaData, Method method) {
         this.method = method;
         this.readAhead = JDBCReadAheadMetaData.DEFAULT;
         ejbQl = queryMetaData.getEjbQl();
  -      resultTypeMappingLocal = (queryMetaData.getResultTypeMapping() == 
QueryMetaData.LOCAL);
  +      resultTypeMappingLocal = 
  +            (queryMetaData.getResultTypeMapping() == QueryMetaData.LOCAL);
      }
   
      /**
       * Constructs a JDBCQlQueryMetaData with data from the jdbcQueryMetaData
       * and additional data from the xml element
       * @param queryMetaData the metadata about this query
  -    * @param queryElement the ejb-ql element which contains additional information 
about this query
  +    * @param queryElement the ejb-ql element which contains additional
  +    *    information about this query
       */
  -   public JDBCQlQueryMetaData(JDBCQlQueryMetaData jdbcQueryMetaData, Element 
queryElement, Method method, JDBCReadAheadMetaData readAhead) {
  +   public JDBCQlQueryMetaData(
  +         JDBCQlQueryMetaData jdbcQueryMetaData,
  +         Element queryElement,
  +         Method method,
  +         JDBCReadAheadMetaData readAhead) {
  +      
         this.method = method;
         this.readAhead = readAhead;
         ejbQl = jdbcQueryMetaData.getEjbQl();
         resultTypeMappingLocal = jdbcQueryMetaData.resultTypeMappingLocal;
      }
   
  +   // javadoc in parent class
      public Method getMethod() {
         return method;
      }
  @@ -64,6 +84,7 @@
         return ejbQl;
      }
   
  +   // javadoc in parent class
      public boolean isResultTypeMappingLocal() {
         return resultTypeMappingLocal;
      }
  @@ -81,7 +102,8 @@
       * true if the objects are the same. Two JDBCQlQueryMetaData are the same
       * if they are both invoked by the same method.
       * @param o the reference object with which to compare
  -    * @return true if this object is the same as the object argument; false 
otherwise
  +    * @return true if this object is the same as the object argument; 
  +    *    false otherwise
       */
      public boolean equals(Object o) {
         if(o instanceof JDBCQlQueryMetaData) {
  @@ -100,10 +122,11 @@
      }
      /**
       * Returns a string describing this JDBCQlQueryMetaData. The exact details
  -    * of the representation are unspecified and subject to change, but the following
  -    * may be regarded as typical:
  +    * of the representation are unspecified and subject to change, but the 
  +    * following may be regarded as typical:
       * 
  -    * "[JDBCQlQueryMetaData: method=public org.foo.User 
findByName(java.lang.String)]"
  +    * "[JDBCQlQueryMetaData: method=public org.foo.User
  +    *       findByName(java.lang.String)]"
       *
       * @return a string representation of the object
       */
  
  
  
  1.6       +7 -6      
jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata/JDBCQueryMetaData.java
  
  Index: JDBCQueryMetaData.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/metadata/JDBCQueryMetaData.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JDBCQueryMetaData.java    2001/09/01 22:03:17     1.5
  +++ JDBCQueryMetaData.java    2001/11/01 22:11:26     1.6
  @@ -9,15 +9,15 @@
   import java.lang.reflect.Method;
   
   /**
  - *   This interface is used to identify a query that will be invoked in
  + * This interface is used to identify a query that will be invoked in
    * responce to the invocation of a finder method in a home interface or
    * an ejbSelect method in a bean implementation class.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Dain Sundstrom</a>
  - *   @author <a href="[EMAIL PROTECTED]">Sebastien Alborini</a>
  - *   @author <a href="[EMAIL PROTECTED]">danch</a>
  - *   @author <a href="[EMAIL PROTECTED]">Oleg Nitz</a>
  - *   @version $Revision: 1.5 $
  + * @author <a href="[EMAIL PROTECTED]">Sebastien Alborini</a>
  + * @author <a href="[EMAIL PROTECTED]">danch</a>
  + * @author <a href="[EMAIL PROTECTED]">Oleg Nitz</a>
  + * @version $Revision: 1.6 $
    */
   public interface JDBCQueryMetaData {
      /**
  @@ -27,7 +27,8 @@
      public Method getMethod();
   
      /**
  -    * Is the result set of ejbSelect is mapped to local ejb objects or remote ejb 
objects.
  +    * Is the result set of ejbSelect is mapped to local ejb objects or 
  +    * remote ejb objects.
       * @return true, if the result set is to be local objects
       */
      public boolean isResultTypeMappingLocal();
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to