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 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 JavaAssociationMetadata getJavaAssociationMetadata( ModelAssociation modelAssociation ) throws ModelloException { JavaAssociationMetadata javaAssociationMetadata = (JavaAssociationMetadata) modelAssociation.getAssociationMetadata( JavaAssociationMetadata.ID ); if ( !JavaAssociationMetadata.INIT_TYPES.contains( javaAssociationMetadata.getInitializationMode() ) ) { throw new ModelloException( "The Java Modello Generator cannot use '" + javaAssociationMetadata.getInitializationMode() + "' as a <association java.init=\"" + javaAssociationMetadata.getInitializationMode() + "\"> " + "value, the only the following are acceptable " + JavaAssociationMetadata.INIT_TYPES ); } return javaAssociationMetadata; }
public void generate( Model model, Properties parameters ) throws ModelloException { initialize( model, parameters ); requiresDomSupport = false; try { generateStaxWriter(); } catch ( IOException ex ) { throw new ModelloException( "Exception while generating StAX Writer.", ex ); } serializerGenerator.generate( model, parameters ); }
private void writeTemplate( String template, File file, Context context ) throws ModelloException { try { Writer writer = getEncoding() == null ? WriterFactory.newPlatformWriter( file ) : WriterFactory.newWriter( file, getEncoding() ); velocity.getEngine().mergeTemplate( template, context, writer ); writer.flush(); writer.close(); } catch ( Exception e ) { throw new ModelloException( "Error while generating code.", e ); } } }
private void writeTemplate( String template, File file, Context context ) throws ModelloException { try { Writer writer = getEncoding() == null ? WriterFactory.newPlatformWriter( file ) : WriterFactory.newWriter( file, getEncoding() ); velocity.getEngine().mergeTemplate( template, context, writer ); writer.flush(); writer.close(); } catch ( Exception e ) { throw new ModelloException( "Error while generating code.", e ); } } }