int createSchema(String[] args) {
        ReturnCode rc = ReturnCode.OK;

        try {
            rc = generatorOptions.processArgs(args);
            // Now perform more general processing based on the current return code
            switch (rc) {
                case GENERATE_ACTION:
                    rc = ReturnCode.OK;

                    ManifestFileProcessor mfp = new ManifestFileProcessor();
                    Map<String, List<File>> bundlesByProductMap = new HashMap<String, List<File>>();
                    Map<String, Map<String, ProvisioningFeatureDefinition>> fdsByProd = mfp.getFeatureDefinitionsByProduct();
                    ContentBasedLocalBundleRepository lbr = null;

                    for (Map.Entry<String, Map<String, ProvisioningFeatureDefinition>> entry : fdsByProd.entrySet()) {
                        String productName = entry.getKey();
                        Map<String, ProvisioningFeatureDefinition> fds = entry.getValue();
                        
                        if (productName.equals(CORE_PRODUCT_NAME)) {
                            lbr = BundleRepositoryRegistry.getInstallBundleRepository();
                        } else if (productName.equals(USR_PRODUCT_EXT_NAME)) {
                            lbr = BundleRepositoryRegistry.getUsrInstallBundleRepository();
                        } else {
                            BundleRepositoryHolder brh = BundleRepositoryRegistry.getRepositoryHolder(productName);
                            lbr = (brh != null) ? brh.getBundleRepository() : null;
                        }
                        List<File> bundles = new ArrayList<File>();
                        for (ProvisioningFeatureDefinition def : fds.values()) {
                            for (FeatureResource bundle : def.getConstituents(SubsystemContentType.BUNDLE_TYPE)) {
                                if (lbr != null) {
                                    File f = lbr.selectBundle(bundle.getLocation(), bundle.getSymbolicName(), bundle.getVersionRange());
                                    if (f != null) {
                                        bundles.add(f);
                                    }
                                }                               
                            }
                        }

                        bundlesByProductMap.put(productName, bundles);
                    }

                    SchemaMetaTypeParser smtp = new SchemaMetaTypeParser(generatorOptions.getLocale(), bundlesByProductMap);
                    generate(smtp.getMetatypeInformation());
                    break;
                case HELP_ACTION:
                    // Only show command-line-style brief usage -help or --help invoked from command line
                    System.out.println(MessageFormat.format(options.getString("briefUsage"), JAR_NAME));
                    System.out.println();
                    showUsageInfo();

                    rc = ReturnCode.OK;
                    break;
                default:
                    rc = ReturnCode.BAD_ARGUMENT;
                    break;
            }
        // These exceptions relate to error flows where we just output the message
        } catch (SchemaGeneratorException e) {
          System.out.println(e.getMessage());
          rc = ReturnCode.RUNTIME_EXCEPTION;
        // These exceptions are ones we didn't expect during development so we need the stack trace for service purposes.
        } catch (RuntimeException e) {
            System.out.println(MessageFormat.format(messages.getString("error.schemaGenException"), e.getMessage()));
            e.printStackTrace();
            rc = ReturnCode.RUNTIME_EXCEPTION;
        }

        return rc.getValue();
    }
int createSchema ( String [ ] args ) { ReturnCode rc = ReturnCode . OK ; try { rc = generatorOptions . processArgs ( args ) ; switch ( rc ) { case GENERATE_ACTION : rc = ReturnCode . OK ; ManifestFileProcessor mfp = new ManifestFileProcessor ( ) ; Map < String , List < File > > bundlesByProductMap = new HashMap < String , List < File > > ( ) ; Map < String , Map < String , ProvisioningFeatureDefinition > > fdsByProd = mfp . getFeatureDefinitionsByProduct ( ) ; ContentBasedLocalBundleRepository lbr = null ; for ( Map . Entry < String , Map < String , ProvisioningFeatureDefinition > > entry : fdsByProd . entrySet ( ) ) { String productName = entry . getKey ( ) ; Map < String , ProvisioningFeatureDefinition > fds = entry . getValue ( ) ; if ( productName . equals ( CORE_PRODUCT_NAME ) ) { lbr = BundleRepositoryRegistry . getInstallBundleRepository ( ) ; } else if ( productName . equals ( USR_PRODUCT_EXT_NAME ) ) { lbr = BundleRepositoryRegistry . getUsrInstallBundleRepository ( ) ; } else { BundleRepositoryHolder brh = BundleRepositoryRegistry . getRepositoryHolder ( productName ) ; lbr = ( brh != null ) ? brh . getBundleRepository ( ) : null ; } List < File > bundles = new ArrayList < File > ( ) ; for ( ProvisioningFeatureDefinition def : fds . values ( ) ) { for ( FeatureResource bundle : def . getConstituents ( SubsystemContentType . BUNDLE_TYPE ) ) { if ( lbr != null ) { File f = lbr . selectBundle ( bundle . getLocation ( ) , bundle . getSymbolicName ( ) , bundle . getVersionRange ( ) ) ; if ( f != null ) { bundles . add ( f ) ; } } } } bundlesByProductMap . put ( productName , bundles ) ; } SchemaMetaTypeParser smtp = new SchemaMetaTypeParser ( generatorOptions . getLocale ( ) , bundlesByProductMap ) ; generate ( smtp . getMetatypeInformation ( ) ) ; break ; case HELP_ACTION : System . out . println ( MessageFormat . format ( options . getString ( "briefUsage" ) , JAR_NAME ) ) ; System . out . println ( ) ; showUsageInfo ( ) ; rc = ReturnCode . OK ; break ; default : rc = ReturnCode . BAD_ARGUMENT ; break ; } } catch ( SchemaGeneratorException e ) { System . out . println ( e . getMessage ( ) ) ; rc = ReturnCode . RUNTIME_EXCEPTION ; } catch ( RuntimeException e ) { System . out . println ( MessageFormat . format ( messages . getString ( "error.schemaGenException" ) , e . getMessage ( ) ) ) ; e . printStackTrace ( ) ; rc = ReturnCode . RUNTIME_EXCEPTION ; } return rc . getValue ( ) ; }
@param args
@return