Package nexj.core.meta

Examples of nexj.core.meta.MetadataException


      if (lockingAttribute != null &&
         lockingAttribute.getDeclarator() == lockingAttribute.getMetaclass())
      {
         if (!lockingAttribute.getType().isPrimitive())
         {
            throw new MetadataException("err.meta.lockingAttributeType",
               new Object[]{lockingAttribute.getName(), m_metaclass.getName()});
         }

         if (!lockingAttribute.isRequired())
         {
            throw new MetadataException("err.meta.lockingAttributeNonRequired",
               new Object[]{lockingAttribute.getName(), m_metaclass.getName()});
         }

         if (lockingAttribute.getInitializer() == Undefined.VALUE)
         {
            throw new MetadataException("err.meta.lockingAttributeUninitialized",
               new Object[]{lockingAttribute.getName(), m_metaclass.getName()});
         }
      }
   }
View Full Code Here


      if (typeCodeAttribute != null)
      {
         if (!typeCodeAttribute.getType().isPrimitive() &&
            typeCodeAttribute.getDeclarator() == typeCodeAttribute.getMetaclass())
         {
            throw new MetadataException("err.meta.typeCodeAttrType",
               new Object[]{typeCodeAttribute.getName(), m_metaclass.getName()});
         }
        
         if (!typeCodeAttribute.isRequired())
         {
            throw new MetadataException("err.meta.typeCodeAttrNonRequired",
               new Object[]{typeCodeAttribute.getName(), m_metaclass.getName()});
         }

         if (typeCodeAttribute.getInitializer() != Undefined.VALUE &&
            typeCodeAttribute.getValue() != Undefined.VALUE)
         {
            throw new MetadataException("err.meta.typeCodeAttrInitializer",
               new Object[]{typeCodeAttribute.getName(), m_metaclass.getName()});
         }
      }
   }
View Full Code Here

      if (oldValue != null)
      {
         m_typeCodeMap.put(typeCode, oldValue);

         throw new MetadataException("err.meta.typeCodeDup",
            new Object[]{typeCode, m_metaclass.getName()});
      }

      if (!m_bTypeCodePrivileged)
      {
View Full Code Here

   {
      verifyNotReadOnly();

      if (fragmentAttribute != null && fragmentAttribute.getType() != Primitive.STRING)
      {
         throw new MetadataException("err.meta.fragmentAttributeType",
            new Object[]{fragmentAttribute.getName(), m_metaclass.getName()});
      }

      m_fragmentAttribute = fragmentAttribute;
   }
View Full Code Here

      {
         Object instance = hook.getInstance(null);

         if (!(instance instanceof PersistenceHook))
         {
            throw new MetadataException("err.meta.invalidPersistenceHook", new Object[]{hook.getName()});
         }
      }
   }
View Full Code Here

      {
         if (baseMapping.m_typeCodeAttribute != null)
         {
            if (m_typeCodeAttribute.getOrdinal() != baseMapping.m_typeCodeAttribute.getOrdinal())
            {
               throw new MetadataException("err.meta.typeCodeAttrMismatch",
                  new Object[]{m_metaclass.getName(), m_metaclass.getBase().getName()});
            }

            if (baseMapping.m_bTypeCodeForced)
            {
               m_bTypeCodeForced = true;
            }
         }

         if (baseMapping.m_lockingAttribute != null)
         {
            if (m_lockingAttribute.getOrdinal() != baseMapping.m_lockingAttribute.getOrdinal())
            {
               throw new MetadataException("err.meta.lockingAttrMismatch",
                  new Object[]{m_metaclass.getName(), m_metaclass.getBase().getName()});
            }
         }
      }

      // Validate the type code attribute

      if (m_typeCodeAttribute != null)
      {
         if (getAttributeMapping(m_typeCodeAttribute) == null)
         {
            throw new MetadataException("err.meta.unmappedTypeCodeAttr",
               new Object[]{m_typeCodeAttribute.getName(), m_metaclass.getName()});
         }

         Object typeCode = m_typeCodeAttribute.getValue();

         if (typeCode != Undefined.VALUE)
         {
            if (typeCode == null || Primitive.primitiveOf(typeCode) == Primitive.ANY)
            {
               MetadataValidationException e = new MetadataValidationException(
                  "err.meta.typeCodeValue"new Object[]{m_typeCodeAttribute.getName(), m_metaclass.getName()});

               m_typeCodeAttribute.setProperties(e);

               throw e;
            }

            typeCode = ((Primitive)m_typeCodeAttribute.getType()).convert(typeCode);
         }

         try
         {
            if (typeCode != Undefined.VALUE)
            {
               addTypeCode(typeCode, m_metaclass);
            }

            for (; baseMapping != null; baseMapping = baseMapping.getBaseMapping())
            {
               if (baseMapping.m_dataSource != m_dataSource ||
                  baseMapping.m_typeCodeAttribute == null)
               {
                  break;
               }

               if (!m_bTypeCodeFiltered)
               {
                  if (baseMapping.m_typeCodeAttribute.getValue() != Undefined.VALUE ||
                     baseMapping.getMetaclass().getDerivedCount() != 1)
                  {
                     m_bTypeCodeFiltered = true;
                  }
               }

               if (typeCode != Undefined.VALUE)
               {
                  baseMapping.addTypeCode(typeCode, m_metaclass);
                  baseMapping.m_bTypeCodeDispatched = true;
               }
            }
         }
         catch (UncheckedException x)
         {
            MetadataValidationException e = new MetadataValidationException(x);

            m_typeCodeAttribute.setProperties(e);

            throw e;
         }

         if (!m_bTypeCodeFiltered)
         {
            if (m_bTypeCodeForced || getAttributeMapping(m_typeCodeAttribute).isMultiplexed())
            {
               m_bTypeCodeFiltered = true;
            }
         }
      }

      // Validate the locking attribute

      if (m_lockingAttribute != null)
      {
         if (getAttributeMapping(m_lockingAttribute) == null)
         {
            throw new MetadataException("err.meta.unmappedLockingAttribute",
               new Object[]{m_lockingAttribute.getName(), m_metaclass.getName()});
         }
      }
   }
View Full Code Here

            int nPartCount = getObjectKey().getPartCount();
            int nValueCount = ((Number)value).intValue();

            if (nValueCount > 0 && nValueCount != nPartCount)
            {
               throw new MetadataException("err.meta.persistence.oidValueCount",
                  new Object[]{m_metaclass.getName(), keyGenerator.getName(),
                     Primitive.createInteger(nPartCount), Primitive.createInteger(nValueCount)});
            }
         }
      }
View Full Code Here

        
         oldFragment = (FileDataSourceFragment)dataDirLookup.put(fragment.getDataDirectory(), fragment);
        
         if (oldFragment != null)
         {
            throw new MetadataException("err.meta.persistence.file.duplicateDataDirectory",
               new Object[]{fragment.getName(), oldFragment.getName(), getName()});
         }
        
         oldFragment = (FileDataSourceFragment)tempDirLookup.put(fragment.getTemporaryDirectory(), fragment);
        
         if (oldFragment != null)
         {
            throw new MetadataException("err.meta.persistence.file.duplicateTemporaryDirectory",
               new Object[]{fragment.getName(), oldFragment.getName(), getName()});
         }
      }
   }
View Full Code Here

     
      if (m_nSysId == SYSID_ID)
      {
         if (attributeType != Primitive.STRING)
         {
            throw new MetadataException("err.meta.persistence.file.invalidNameType",
               new Object[]{m_attribute.getName(), m_persistenceMapping.getMetaclass().getName()});
         }
      }
      else if (m_nSysId == SYSID_DATA)
      {
         if (attributeType != Primitive.BINARY && attributeType != Primitive.STRING)
         {
            throw new MetadataException("err.meta.persistence.file.invalidDataType",
               new Object[]{m_attribute.getName(), m_persistenceMapping.getMetaclass().getName()});
         }
      }
   }
View Full Code Here

      if (!(m_metaclass instanceof Aspect))
      {
         if (m_lockingAttribute == null)
         {
            throw new MetadataException("err.meta.persistence.missingLockingAttribute",
               new Object[]{m_metaclass.getName()});
         }

         boolean bFound = false;

         for (int i = 0; i < m_mappingArray.length; i++)
         {
            FilePrimitiveMapping mapping = (FilePrimitiveMapping)m_mappingArray[i];

            if (mapping != null && mapping.getSysId() == FilePrimitiveMapping.SYSID_ID)
            {
               bFound = true;
               break;
            }
         }

         if (!bFound)
         {
            throw new MetadataException("err.meta.persistence.file.noFileNameAttribute",
               new Object[]{m_metaclass.getName()});
         }
      }
   }
View Full Code Here

TOP

Related Classes of nexj.core.meta.MetadataException

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.