mil.dod.th.ose.sdk/src/mil/dod/th/ose/sdk/those/ProjectGenerator.java
public void create(final ProjectProperties projectProps, final File projectDir)
            throws IOException, TemplateException
    {
        preProcess(projectProps);

        // Create project directory if needed
        if (!projectDir.exists())
        {
            final boolean created = projectDir.mkdir();
            if (created)
            {
                m_OutStream.println("Created project directory: " + projectDir.getPath());
            }
            else
            {
                m_OutStream.println("Failed to create project directory: " + projectDir.getPath());
            }
        }

        // Create project directory layout
        File newDir = m_FileService.getFile(projectDir, "bin");
        newDir.mkdir();

        newDir = m_FileService.getFile(projectDir, "lib");
        newDir.mkdir();

        newDir = m_FileService.getFile(projectDir, "reports");
        newDir.mkdir();

        newDir = m_FileService.getFile(projectDir, "src");
        newDir.mkdir();

        newDir = m_FileService.getFile(projectDir, "test");
        newDir.mkdir();

        newDir = m_FileService.getFile(projectDir, "test-bin");
        newDir.mkdir();

        newDir = m_FileService.getFile(projectDir, SETTINGS_DIR);
        newDir.mkdir();

        // Generate files at the root of the project
        generateFileFromTemplate("build.properties.ftl", projectProps, projectDir);
        generateFileFromTemplate("build.xml.ftl", projectProps, projectDir);
        generateFileFromTemplate("local.properties.ftl", projectProps, projectDir);
        generateFileFromTemplate(".project.ftl", projectProps, projectDir);
        generateFileFromTemplate(".classpath.ftl", projectProps, projectDir);
        generateFileFromTemplate("bnd.bnd.ftl", projectProps, projectDir);

        // Create directories needed under src/ and test/
        final String packagePath = projectProps.getPackageName().replace('.', File.separatorChar);

        final File sourceDir = m_FileService.getFile(projectDir, "src/" + packagePath);
        sourceDir.mkdirs();

        final File testDir = m_FileService.getFile(projectDir, "test/" + packagePath);
        testDir.mkdirs();

        final File settingsDir = m_FileService.getFile(projectDir, SETTINGS_DIR);
        settingsDir.mkdirs();
        generateFileFromTemplate("org.eclipse.jdt.core.prefs.ftl", projectProps, settingsDir);

        generateFileFromTemplate("ExampleAttributes.java.ftl", projectProps, sourceDir);

        // Create files based on the project type
        switch (projectProps.getProjectType())
        {
            case PROJECT_ASSET:
                generateFileFromTemplate("ExampleAsset.java.ftl", projectProps, sourceDir);
                generateFileFromTemplate("ExampleAssetScanner.java.ftl", projectProps, sourceDir);
                generateCapabilitiesXml(projectProps, projectDir, ProjectType.PROJECT_ASSET);
                break;

            case PROJECT_LINKLAYER:
                generateFileFromTemplate("ExampleLinkLayer.java.ftl", projectProps, sourceDir);
                generateCapabilitiesXml(projectProps, projectDir, ProjectType.PROJECT_LINKLAYER);
                break;

            case PROJECT_PHYLINK:
                generateFileFromTemplate("ExamplePhysicalLink.java.ftl", projectProps, sourceDir);
                generateCapabilitiesXml(projectProps, projectDir, ProjectType.PROJECT_PHYLINK);
                break;

            case PROJECT_TRANSPORTLAYER:
                generateFileFromTemplate("ExampleTransportLayer.java.ftl", projectProps, sourceDir);
                generateCapabilitiesXml(projectProps, projectDir, ProjectType.PROJECT_TRANSPORTLAYER);
                break;

            default:
                throw new IllegalArgumentException("Invalid project type is set for create()");
        }
    }
/**
     * Creates a project using the given properties in the desired directory.
     * 
     * @param projectProps
     *            Project properties used for the file templates
     * @param projectDir
     *            Directory to create the project in
     * @throws IOException
     *             if there is a file I/O error
     * @throws TemplateException
     *             if there is an error processing the template
     */
Creates a project using the given properties in the desired directory.

@param projectProps
Project properties used for the file templates
@param projectDir
Directory to create the project in
@throws IOException
if there is a file I/O error
@throws TemplateException
if there is an error processing the template
Creates a project using the given properties in the desired directory . @param projectProps Project properties used for the file templates @param projectDir Directory to create the project in @throws IOException if there is a file I / O error @throws TemplateException if there is an error processing the template
public void create(final ProjectProperties projectProps, final File projectDir)
            throws IOException, TemplateException
    {
        preProcess(projectProps);
        if (!projectDir.exists())
        {
            final boolean created = projectDir.mkdir();
            if (created)
            {
                m_OutStream.println("Created project directory: " + projectDir.getPath());
            }
            else
            {
                m_OutStream.println("Failed to create project directory: " + projectDir.getPath());
            }
        }
        File newDir = m_FileService.getFile(projectDir, "bin");
        newDir.mkdir();
        newDir = m_FileService.getFile(projectDir, "lib");
        newDir.mkdir();
        newDir = m_FileService.getFile(projectDir, "reports");
        newDir.mkdir();
        newDir = m_FileService.getFile(projectDir, "src");
        newDir.mkdir();
        newDir = m_FileService.getFile(projectDir, "test");
        newDir.mkdir();
        newDir = m_FileService.getFile(projectDir, "test-bin");
        newDir.mkdir();
        newDir = m_FileService.getFile(projectDir, SETTINGS_DIR);
        newDir.mkdir();
        generateFileFromTemplate("build.properties.ftl", projectProps, projectDir);
        generateFileFromTemplate("build.xml.ftl", projectProps, projectDir);
        generateFileFromTemplate("local.properties.ftl", projectProps, projectDir);
        generateFileFromTemplate(".project.ftl", projectProps, projectDir);
        generateFileFromTemplate(".classpath.ftl", projectProps, projectDir);
        generateFileFromTemplate("bnd.bnd.ftl", projectProps, projectDir);
        final String packagePath = projectProps.getPackageName().replace('.', File.separatorChar);
        final File sourceDir = m_FileService.getFile(projectDir, "src/" + packagePath);
        sourceDir.mkdirs();
        final File testDir = m_FileService.getFile(projectDir, "test/" + packagePath);
        testDir.mkdirs();
        final File settingsDir = m_FileService.getFile(projectDir, SETTINGS_DIR);
        settingsDir.mkdirs();
        generateFileFromTemplate("org.eclipse.jdt.core.prefs.ftl", projectProps, settingsDir);
        generateFileFromTemplate("ExampleAttributes.java.ftl", projectProps, sourceDir);
        switch (projectProps.getProjectType())
        {
            case PROJECT_ASSET:
                generateFileFromTemplate("ExampleAsset.java.ftl", projectProps, sourceDir);
                generateFileFromTemplate("ExampleAssetScanner.java.ftl", projectProps, sourceDir);
                generateCapabilitiesXml(projectProps, projectDir, ProjectType.PROJECT_ASSET);
                break;
            case PROJECT_LINKLAYER:
                generateFileFromTemplate("ExampleLinkLayer.java.ftl", projectProps, sourceDir);
                generateCapabilitiesXml(projectProps, projectDir, ProjectType.PROJECT_LINKLAYER);
                break;
            case PROJECT_PHYLINK:
                generateFileFromTemplate("ExamplePhysicalLink.java.ftl", projectProps, sourceDir);
                generateCapabilitiesXml(projectProps, projectDir, ProjectType.PROJECT_PHYLINK);
                break;
            case PROJECT_TRANSPORTLAYER:
                generateFileFromTemplate("ExampleTransportLayer.java.ftl", projectProps, sourceDir);
                generateCapabilitiesXml(projectProps, projectDir, ProjectType.PROJECT_TRANSPORTLAYER);
                break;
            default:
                throw new IllegalArgumentException("Invalid project type is set for create()");
        }
    }
public void create ( final ProjectProperties projectProps , final File projectDir ) throws IOException , TemplateException { preProcess ( projectProps ) ; if ( ! projectDir . exists ( ) ) { final boolean created = projectDir . mkdir ( ) ; if ( created ) { m_OutStream . println ( "Created project directory: " + projectDir . getPath ( ) ) ; } else { m_OutStream . println ( "Failed to create project directory: " + projectDir . getPath ( ) ) ; } } File newDir = m_FileService . getFile ( projectDir , "bin" ) ; newDir . mkdir ( ) ; newDir = m_FileService . getFile ( projectDir , "lib" ) ; newDir . mkdir ( ) ; newDir = m_FileService . getFile ( projectDir , "reports" ) ; newDir . mkdir ( ) ; newDir = m_FileService . getFile ( projectDir , "src" ) ; newDir . mkdir ( ) ; newDir = m_FileService . getFile ( projectDir , "test" ) ; newDir . mkdir ( ) ; newDir = m_FileService . getFile ( projectDir , "test-bin" ) ; newDir . mkdir ( ) ; newDir = m_FileService . getFile ( projectDir , SETTINGS_DIR ) ; newDir . mkdir ( ) ; generateFileFromTemplate ( "build.properties.ftl" , projectProps , projectDir ) ; generateFileFromTemplate ( "build.xml.ftl" , projectProps , projectDir ) ; generateFileFromTemplate ( "local.properties.ftl" , projectProps , projectDir ) ; generateFileFromTemplate ( ".project.ftl" , projectProps , projectDir ) ; generateFileFromTemplate ( ".classpath.ftl" , projectProps , projectDir ) ; generateFileFromTemplate ( "bnd.bnd.ftl" , projectProps , projectDir ) ; final String packagePath = projectProps . getPackageName ( ) . replace ( '.' , File . separatorChar ) ; final File sourceDir = m_FileService . getFile ( projectDir , "src/" + packagePath ) ; sourceDir . mkdirs ( ) ; final File testDir = m_FileService . getFile ( projectDir , "test/" + packagePath ) ; testDir . mkdirs ( ) ; final File settingsDir = m_FileService . getFile ( projectDir , SETTINGS_DIR ) ; settingsDir . mkdirs ( ) ; generateFileFromTemplate ( "org.eclipse.jdt.core.prefs.ftl" , projectProps , settingsDir ) ; generateFileFromTemplate ( "ExampleAttributes.java.ftl" , projectProps , sourceDir ) ; switch ( projectProps . getProjectType ( ) ) { case PROJECT_ASSET : generateFileFromTemplate ( "ExampleAsset.java.ftl" , projectProps , sourceDir ) ; generateFileFromTemplate ( "ExampleAssetScanner.java.ftl" , projectProps , sourceDir ) ; generateCapabilitiesXml ( projectProps , projectDir , ProjectType . PROJECT_ASSET ) ; break ; case PROJECT_LINKLAYER : generateFileFromTemplate ( "ExampleLinkLayer.java.ftl" , projectProps , sourceDir ) ; generateCapabilitiesXml ( projectProps , projectDir , ProjectType . PROJECT_LINKLAYER ) ; break ; case PROJECT_PHYLINK : generateFileFromTemplate ( "ExamplePhysicalLink.java.ftl" , projectProps , sourceDir ) ; generateCapabilitiesXml ( projectProps , projectDir , ProjectType . PROJECT_PHYLINK ) ; break ; case PROJECT_TRANSPORTLAYER : generateFileFromTemplate ( "ExampleTransportLayer.java.ftl" , projectProps , sourceDir ) ; generateCapabilitiesXml ( projectProps , projectDir , ProjectType . PROJECT_TRANSPORTLAYER ) ; break ; default : throw new IllegalArgumentException ( "Invalid project type is set for create()" ) ; } }
Creates a project using the given properties in the desired directory.
Creates a project using the given properties in the desired directory .
// Create project directory if needed // Create project directory layout // Generate files at the root of the project // Create directories needed under src/ and test/ // Create files based on the project type