private Template getTemplate( String name ) throws ModelloException { try { return velocity.getEngine().getTemplate( name ); } catch ( ResourceNotFoundException e ) { 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 ); } } }
new MojoExecutionException( "Error generating: " + e.getMessage(), e );
private static void writeValueStrategy( String valueStrategy, XMLWriter writer ) throws ModelloException { if ( !"off".equals( valueStrategy ) ) { if ( !VALUE_STRATEGY_LIST.contains( valueStrategy ) ) { throw new ModelloException( "The JDO mapping generator does not support the specified " + "value-strategy '" + valueStrategy + "'. " + "Supported types: " + VALUE_STRATEGY_LIST ); } writer.addAttribute( "value-strategy", valueStrategy ); } }
public Modello() throws ModelloException { try { container = new DefaultPlexusContainer(); core = (ModelloCore) container.lookup( ModelloCore.ROLE ); } catch ( Exception ex ) { throw new ModelloException( "Error while starting plexus.", ex ); } }
private Template getTemplate( String name ) throws ModelloException { try { return velocity.getEngine().getTemplate( name ); } catch ( ResourceNotFoundException e ) { 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 ); } } }
private static void writeValueStrategy( String valueStrategy, XMLWriter writer ) throws ModelloException { if ( !"off".equals( valueStrategy ) ) { if ( !VALUE_STRATEGY_LIST.contains( valueStrategy ) ) { throw new ModelloException( "The JDO mapping generator does not support the specified " + "value-strategy '" + valueStrategy + "'. " + "Supported types: " + VALUE_STRATEGY_LIST ); } writer.addAttribute( "value-strategy", valueStrategy ); } }
private void assertSupportedIdentityPrimitive( ModelField modelField ) throws ModelloException { if ( !PRIMITIVE_IDENTITY_MAP.containsKey( modelField.getType() ) ) { throw new ModelloException( "The JDO mapping generator does not support the specified " + "field type '" + modelField.getType() + "'. " + "Supported types: " + PRIMITIVE_IDENTITY_MAP.keySet() ); } }
protected String getEnumString( Map data, String key, String[] legalValues, String defaultValue ) throws ModelloException { String value = (String) data.get( key ); if ( StringUtils.isEmpty( value ) ) { return defaultValue; } for ( int i = 0; i < legalValues.length; i++ ) { String enumString = legalValues[i]; if ( StringUtils.equals( enumString, value ) ) { return value; } } String emsg = "Unknown " + key + " value: '" + value + "'. " + "(Allowed values: " + legalValues + ")"; throw new ModelloException( emsg ); }
protected String getEnumString( Map data, String key, String[] legalValues, String defaultValue ) throws ModelloException { String value = (String) data.get( key ); if ( StringUtils.isEmpty( value ) ) { return defaultValue; } for ( int i = 0; i < legalValues.length; i++ ) { String enumString = legalValues[i]; if ( StringUtils.equals( enumString, value ) ) { return value; } } String emsg = "Unknown " + key + " value: '" + value + "'. " + "(Allowed values: " + legalValues + ")"; throw new ModelloException( emsg ); }
private void assertSupportedIdentityPrimitive( ModelField modelField ) throws ModelloException { if ( !PRIMITIVE_IDENTITY_MAP.containsKey( modelField.getType() ) ) { throw new ModelloException( "The JDO mapping generator does not support the specified " + "field type '" + modelField.getType() + "'. " + "Supported types: " + PRIMITIVE_IDENTITY_MAP.keySet() ); } }
public void generate( Model model, Properties parameters ) throws ModelloException { initialize( model, parameters ); try { generateXsd( parameters ); } catch ( IOException ex ) { throw new ModelloException( "Exception while generating xsd.", ex ); } }
public void generate( Model model, Properties parameters ) throws ModelloException { initialize( model, parameters ); requiresDomSupport = false; try { generateDom4jWriter(); } catch ( IOException ex ) { throw new ModelloException( "Exception while generating Dom4j Writer.", ex ); } }
public void generate( Model model, Properties parameters ) throws ModelloException { initialize( model, parameters ); requiresDomSupport = false; try { generateXpp3Writer(); } catch ( IOException ex ) { throw new ModelloException( "Exception while generating XPP3 Writer.", ex ); } }
public void generate( Model model, Properties parameters ) throws ModelloException { initialize( model, parameters ); requiresDomSupport = false; try { generateDom4jReader(); } catch ( IOException ex ) { throw new ModelloException( "Exception while generating Dom4j Reader.", ex ); } }
public void generate( Model model, Properties parameters ) throws ModelloException { initialize( model, parameters ); requiresDomSupport = false; try { generateJDOMWriter(); } catch ( IOException ex ) { throw new ModelloException( "Exception while generating JDOM Writer.", ex ); } }
public void generate( Model model, Properties parameters ) throws ModelloException { initialize( model, parameters ); requiresDomSupport = false; try { generateSaxWriter(); } catch ( IOException ex ) { throw new ModelloException( "Exception while generating SAX Writer.", ex ); } }
public void generate( Model model, Properties parameters ) throws ModelloException { initialize( model, parameters ); requiresDomSupport = true; try { generateJacksonWriter(); } catch ( IOException ex ) { throw new ModelloException( "Exception while generating JSON Jackson Writer.", ex ); } }
public void generate( Model model, Properties parameters ) throws ModelloException { initialize( model, parameters ); try { generateJava(); } catch ( IOException ex ) { throw new ModelloException( "Exception while generating Java.", ex ); } }
public void generate( Model model, Properties parameters ) throws ModelloException { initialize( model, parameters ); try { generateStaxSerializer(); } catch ( IOException ex ) { throw new ModelloException( "Exception while generating StAX serializer.", ex ); } }
private String getCloneMode( ModelAssociation modelAssociation, String cloneModeClass ) throws ModelloException { JavaAssociationMetadata javaAssociationMetadata = (JavaAssociationMetadata) modelAssociation.getAssociationMetadata( JavaAssociationMetadata.ID ); String cloneModeAssoc = javaAssociationMetadata.getCloneMode(); if ( cloneModeAssoc == null ) { cloneModeAssoc = cloneModeClass; } else if ( !JavaAssociationMetadata.CLONE_MODES.contains( cloneModeAssoc ) ) { throw new ModelloException( "The Java Modello Generator cannot use '" + cloneModeAssoc + "' as a value for <association java.clone=\"...\">, " + "only the following values are acceptable " + JavaAssociationMetadata.CLONE_MODES ); } return cloneModeAssoc; }