public void generate()

in xbean-blueprint/src/main/java/org/apache/xbean/blueprint/generator/XmlMetadataGenerator.java [61:143]


    public void generate(NamespaceMapping namespaceMapping) throws IOException {
        String namespace = namespaceMapping.getNamespace();
        if (namespace == null) {
            return;
        }

        File file = new File(metaInfDir, NamespaceHelper.createDiscoveryPathName(namespace));
        file.getParentFile().mkdirs();
        log.log("Generating META-INF properties file: " + file + " for namespace: " + namespace);
        PrintWriter out = new PrintWriter(new FileWriter(file));
        try {
            generatePropertiesFile(out, namespaceMapping.getElements());
        } finally {
            out.close();
        }
        
        if( generateSpringHandlersFile ) {
        	
            // Generate spring 2.0 mapping
	        file = new File(metaInfDir, "META-INF/spring.handlers");

            Properties properties = new Properties();
            if (!file.exists()) {
                log.log("Generating Spring 2.0 handler mapping: " + file + " for namespace: " + namespace);
            } else {
                log.log("Updating Spring 2.0 handler mapping: " + file + " for namespace: " + namespace);

                // read in current file
                InputStream in = new FileInputStream(file);
                try {
                    properties.load(in);
                } catch (IOException e) {
                    in.close();
                }
            }

            // add property
            properties.put(namespace,  NAMESPACE_HANDLER);

            // write properties
            OutputStream fout = new FileOutputStream(file);
            try {
                properties.store(fout, "Generated by xbean-spring");
            } finally {
                fout.close();
            }
        }

        if (schema != null && generateSpringSchemasFile ) {
            String cp = new File(metaInfDir).toURI().relativize(schema.toURI()).toString();
            file = new File(metaInfDir, "META-INF/spring.schemas");

            Properties properties = new Properties();
            if (!file.exists()) {
                log.log("Generating Spring 2.0 schema mapping: " + file + " for namespace: " + namespace);
            } else {
                log.log("Updating Spring 2.0 schema mapping: " + file + " for namespace: " + namespace);

                // read in current file
                InputStream in = new FileInputStream(file);
                try {
                    properties.load(in);
                } catch (IOException e) {
                    in.close();
                }
            }

            // add property
            String uri = namespace;
            if (!uri.endsWith("/")) {
                uri += "/";
            }
            properties.put(uri + cp,  cp);

            // write properties
            OutputStream fout = new FileOutputStream(file);
            try {
                properties.store(fout, "Generated by xbean-spring");
            } finally {
                fout.close();
            }
        }
    }