Examples of ModelloException


Examples of org.codehaus.modello.ModelloException

            }
        }

        if ( template == null )
        {
            throw new ModelloException( "Could not find the template '" + templateName + "'." );
        }

        if ( !file.getParentFile().exists() )
        {
            if ( !file.getParentFile().mkdirs() )
            {
                throw new ModelloException(
                    "Error while creating parent directories for '" + file.getAbsolutePath() + "'." );
            }
        }

        try
        {
            Writer writer = getEncoding() == null ? WriterFactory.newPlatformWriter( file )
                            : WriterFactory.newWriter( file, getEncoding() );

            template.merge( context, writer );

            writer.close();
        }
        catch ( Exception e )
        {
            throw new ModelloException( "Error while generating code.", e );
        }
    }
View Full Code Here

Examples of org.codehaus.modello.ModelloException

        {
            return null;
        }
        catch ( ParseErrorException e )
        {
            throw new ModelloException( "Could not parse the template '" + name + "'.", e );
        }
        catch ( Exception e )
        {
            throw new ModelloException( "Error while loading template '" + name + "'.", e );
        }
    }
View Full Code Here

Examples of org.codehaus.modello.ModelloException

        if ( !interfaceFile.getParentFile().exists() )
        {
            if ( !interfaceFile.getParentFile().mkdirs() )
            {
                throw new ModelloException( "Error while creating parent directories for '" + interfaceFile.getAbsolutePath() + "'." );
            }
        }

        String interfaceTemplate = "org/apache/archiva/redback/components/modello/plugin/store/templates/Store.vm";
View Full Code Here

Examples of org.codehaus.modello.ModelloException

            writer.close();
        }
        catch ( Exception e )
        {
            throw new ModelloException( "Error while generating code.", e );
        }
    }
View Full Code Here

Examples of org.codehaus.modello.ModelloException

        if ( !StringUtils.isEmpty( maxSize ) )
        {
            if ( !field.getType().equals( "String" ) )
            {
                throw new ModelloException( "When specifying max size on a field the type must be String. " +
                                            "Class: '" + field.getModelClass().getName() + "', " +
                                            "field : '" + field.getName() + "'." );
            }

            try
            {
                metadata.setMaxSize( Integer.parseInt( maxSize ) );
            }
            catch ( NumberFormatException e )
            {
                throw new ModelloException( "Max size on a field the type must be String. " +
                                            "Class: '" + field.getModelClass().getName() + "', " +
                                            "field : '" + field.getName() + "'." );
            }
        }
View Full Code Here

Examples of org.codehaus.modello.ModelloException

            System.out.println( stdout.getOutput() );
        }

        if ( exitCode != 0 )
        {
            throw new ModelloException( "The JPox enhancer tool exited with a non-null exit code." );
        }
    }
View Full Code Here

Examples of org.codehaus.modello.ModelloException

            if ( !parent.exists() )
            {
                if ( !parent.mkdirs() )
                {
                    throw new ModelloException( "Error while creating parent directories for the file " + "'"
                                    + packageJdo.getAbsolutePath() + "'." );
                }
            }

            generatePackageJdo( packageJdo, model );
        }
        catch ( IOException e )
        {
            throw new ModelloException( "Error while writing package.jdo.", e );
        }
    }
View Full Code Here

Examples of org.codehaus.modello.ModelloException

            if ( StringUtils.isNotEmpty( jpoxMetadata.getIdentityType() ) )
            {
                String identityType = jpoxMetadata.getIdentityType();
                if ( !IDENTITY_TYPES.contains( identityType ) )
                {
                    throw new ModelloException( "The JDO mapping generator does not support the specified "
                                    + "class identity type '" + identityType + "'. " + "Supported types: "
                                    + IDENTITY_TYPES );
                }
                writer.addAttribute( "identity-type", identityType );
            }
            else if ( isInstantionApplicationType( modelClass ) )
            {
                writer.addAttribute( "identity-type", "application" );
            }
        }
        else
        {
            needInheritance = true;
        }

        if ( objectIdClassOverride != null )
        {
            if ( StringUtils.isNotEmpty( objectIdClassOverride ) )
            {
                writer.addAttribute( "objectid-class", jpoxMetadata.getIdentityClass() );
            }
        }
        else if ( StringUtils.isNotEmpty( jpoxMetadata.getIdentityClass() ) )
        {
            // Use user provided objectId class.
            writer.addAttribute( "objectid-class", jpoxMetadata.getIdentityClass() );
        }
        else
        {
            // Calculate the objectId class.

            List primaryKeys = getPrimaryKeyFields( modelClass );

            // TODO: write generation support for multi-primary-key support.
            //       would likely need to write a java class that can supply an ObjectIdentity
            //       to the jpox/jdo implementation.
            if ( primaryKeys.size() > 1 )
            {
                throw new ModelloException(
                                            "The JDO mapping generator does not yet support Object Identifier generation "
                                                            + "for the " + primaryKeys.size()
                                                            + " fields specified as <identifier> or "
                                                            + "with jpox.primary-key=\"true\"" );
            }
View Full Code Here

Examples of org.codehaus.modello.ModelloException

            emsg.append( ERROR_LINE );

            // Determine possible exception.
            if ( hasError || modelMetadata.getReservedWordStrictness().equals( JPoxModelMetadata.WARNING ) )
            {
                throw new ModelloException( emsg.toString() );
            }

            // No exception. use it. But log it.
            getLogger().warn( emsg.toString() );
        }
View Full Code Here

Examples of org.codehaus.modello.ModelloException

            emsg.append( ERROR_LINE );

            // Determine possible exception.
            if ( hasError || modelMetadata.getReservedWordStrictness().equals( JPoxModelMetadata.WARNING ) )
            {
                throw new ModelloException( emsg.toString() );
            }

            // No exception. use it. But log it.
            getLogger().warn( emsg.toString() );
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.