Creating a CVS Module and JDeveloper Workspace

by Jeff Hunter, Sr. Database Administrator


Contents

  1. Overview
  2. Create a CVS Connection
  3. Creating Initial JDeveloper Workarea
  4. Create New CVS Module / Import Initial Code
  5. Checkout the New Module
Overview
The following example demonstrates the steps necessary to use JDeveloper and CVS in a multiple developer environment. In this example, we will create an initial filesystem setup with a JDeveloper Workspace.

The example will assume the following setup:

Create a CVS Connection
In this section, you will be creating a CVS connection to the TEST repository. Keep in mind that the CVS repository is located on the same machine as JDeveloper, so this will be a :local: connection.

Right-click on the CVS Server node and select New Connection. (This is located in: System Navigator - Connections - CVS Server.)

The following is a set of screen shots along with detailed information on how to create a connection to the "TEST" CVS repository:

Welcome Screen


Connection Name

For this example, I want to create a CVS Repository name of "TEST_REPOSITORY".


Connection Details

Since the CVS Repository is located on the same machine as JDeveloper, I will choose the "Local" option. Also, since this is a local connection, I will need to provide the full path to the repository.


CVS Root

This screen is simply the CVS Root that will be set for this connection. The value the the CVSROOT was produced by the information you entered in the previous screen. You should not have to change anything here.


Test Connection

You should test the connection to the repository to ensure you have the correct CVSROOT value.


Summary Screen

This is simply a summary screen. Click on "Finish" to create the new connection.


New CVS Connection

If all goes well, then you should have a new connection to the TEST repository as shown in the above screen shot.


Creating Initial JDeveloper Workarea
Now, let's create a new JDeveloper Workspace. This will be a very simple example Workspace that contains only one Project and one Java Class. Just enough to get us familiar with how to work with CVS within the JDevelopment environment.

Here are the details about the example JDeveloper Workarea I created:

  1. Create a "Work Area" (sometimes called your sandbox area). For this example, I will create the directory: C:\jhunter\programming\jdev\TestCvsWA:
    C:\> mkdir C:\jhunter\programming\jdev\TestCvsWA

  2. Create a new JDeveloper Workspace. Within the JDeveloper environment, I will create a new JDeveloper Workspace named: TestCvsWS within the above Workarea directory you just created.

  3. Create a new Empty JDeveloper Project. Within the JDeveloper environment, I will create a new JDeveloper Empty Project named: TestCvsPRJ within the above Workspace you just created.

  4. Create a new Java Class. Within the JDeveloper environment, I will create a new Java Class named: PrintName.java within the above Project you just created. For this example, I will put the class within the package info.idevelopment:

    Here is a listing the sample program (info.idevelopment.PrintName) that I created:

    info.idevelopment.PrintName
    // ---------------------------------
    // PrintName.java
    // ---------------------------------
    
    package info.idevelopment;
    
    public class PrintName  {
    
        private String firstName = null;
        private String lastName  = null;
    
        public PrintName() {
            firstName  = "Alex";
            lastName   = "Hunter";
        }
    
        public String toString() {
            String tempName = "First Name: " + firstName + "\n" +
                              "Last Name : " + lastName;
            return tempName;
        }
    
        public static void main(String[] args) {
            PrintName printName = new PrintName();
            System.out.println(printName);
        }
    }

Create New CVS Module / Import Initial Code
At this point, it is assumed that you have a JDeveloper Workspace that you are ready to import into a new CVS Module. This can all be done within the JDeveloper GUI environment.

In this example, I will be creating a new CVS Module named "PrintNameModule" and will import the entire Workspace we just created. To do this, single click on your JDeveloper Workspace (in our example TestCvsWS.jws) in the System - Navigator. Then go to the pull down menu option File | Source Control | Import Module. The following screen shots are those used to create our new CVS Module.

Welcome Screen


Create New CVS Module

In this screen, we will create a new CVS Module named "PrintNameModule".


Name Symbolic Tag

Select Source Path

I am not sure why this screen always selects just the Project. I generally want the entire Workspace to be imported, including the Workspace directory. To do this, I just removed the Project and Workspace portion of the directory to include the just my workarea.


Set Filters

You can accept the default settings.


General Options

You can accept the default settings.


Import Options

I normally de-select the option "Perform a checkout after the import". I generally perform this as a manual step later.


Summary Screen

After clicking the "Finish" button, you should see the following in the CVS Client tab of your Log:

$ cd C:\jhunter\programming\jdev\TestCvsWA
$ cvs -d :local:c:\cvsrepo\test import -m "Sources imported into CVS repository." -I *.class PrintNameModule INITIAL start
cvs import: Importing c:/cvsrepo/test/PrintNameModule/TestCvsWS
N PrintNameModule/TestCvsWS/TestCvsWS.jws
cvs import: Importing c:/cvsrepo/test/PrintNameModule/TestCvsWS/TestCvsPRJ
N PrintNameModule/TestCvsWS/TestCvsPRJ/TestCvsPRJ.jpr
cvs import: Importing c:/cvsrepo/test/PrintNameModule/TestCvsWS/TestCvsPRJ/classes
N PrintNameModule/TestCvsWS/TestCvsPRJ/classes/connections.xml
N PrintNameModule/TestCvsWS/TestCvsPRJ/classes/TestCvsPRJ.cdi
cvs import: Importing c:/cvsrepo/test/PrintNameModule/TestCvsWS/TestCvsPRJ/classes/info
cvs import: Importing c:/cvsrepo/test/PrintNameModule/TestCvsWS/TestCvsPRJ/classes/info/idevelopment
I PrintNameModule/TestCvsWS/TestCvsPRJ/classes/info/idevelopment/PrintName.class
cvs import: Importing c:/cvsrepo/test/PrintNameModule/TestCvsWS/TestCvsPRJ/src
cvs import: Importing c:/cvsrepo/test/PrintNameModule/TestCvsWS/TestCvsPRJ/src/info
cvs import: Importing c:/cvsrepo/test/PrintNameModule/TestCvsWS/TestCvsPRJ/src/info/idevelopment
N PrintNameModule/TestCvsWS/TestCvsPRJ/src/info/idevelopment/PrintName.java

No conflicts created by this import

Checkout the New Module
When we imported the Workspace into CVS using the JDeveloper GUI, we de-selected the option to perform a check-out of the code. In this section, we will perform the step of checking out our newly imported module.

The first thing we need to do is remove the Workspace (TestCvsWS) that we just imported into JDeveloper. To do this, select (single-click) the TestCvsWS.jws in the System - Navigator and from the pull down menu, select File | Erase from Disk:

This will remove the Workspace from the System - Navigator within JDeveloper but will not remove all of the files. You will need to remove all files related to this Workspace. This can be done from the command-line:

C:\> rmdir /s C:\jhunter\programming\jdev\TestCvsWA\TestCvsWS
C:\jhunter\programming\jdev\TestCvsWA\TestCvsWS, Are you sure (Y/N)? y
At this point, you should still have your original "Workarea" (or Sandbox) directory, (C:\jhunter\programming\jdev\TestCvsWA), with no files or directories in it.

Now, let's return to our JDevelopment environment to checkout our testing Workspace (TestCvsWS). Go to the pull down menu "File | Source Control | Check Out Module". The following is list of the screen shots for checking out our Workspace CVS Module:

Welcome Screen


Select Module

Select Target Workarea

This is the most important step. You should put this module (Workspace) in your created Workarea. In this example, our Workarea is "C:\jhunter\programming\jdev\TestCvsWA".


General Options

Checkout Options

Summary Screen

After clicking the "Finish" button, you should see the following in the CVS Client tab of your Log:

$ cd C:\jhunter\programming\jdev\TestCvsWA
$ cvs -d :local:c:\cvsrepo\test checkout PrintNameModule
cvs checkout: Updating PrintNameModule
cvs checkout: Updating PrintNameModule/TestCvsWS
U PrintNameModule/TestCvsWS/TestCvsWS.jws
cvs checkout: Updating PrintNameModule/TestCvsWS/TestCvsPRJ
U PrintNameModule/TestCvsWS/TestCvsPRJ/TestCvsPRJ.jpr
cvs checkout: Updating PrintNameModule/TestCvsWS/TestCvsPRJ/classes
U PrintNameModule/TestCvsWS/TestCvsPRJ/classes/TestCvsPRJ.cdi
U PrintNameModule/TestCvsWS/TestCvsPRJ/classes/connections.xml
cvs checkout: Updating PrintNameModule/TestCvsWS/TestCvsPRJ/classes/info
cvs checkout: Updating PrintNameModule/TestCvsWS/TestCvsPRJ/classes/info/idevelopment
cvs checkout: Updating PrintNameModule/TestCvsWS/TestCvsPRJ/src
cvs checkout: Updating PrintNameModule/TestCvsWS/TestCvsPRJ/src/info
cvs checkout: Updating PrintNameModule/TestCvsWS/TestCvsPRJ/src/info/idevelopment
U PrintNameModule/TestCvsWS/TestCvsPRJ/src/info/idevelopment/PrintName.java

Newly Checkout Module

If the Checkout was successfull, you should now have the newly checkout Workspace available in the JDeveloper System - Navigator.

Note that when CVS checks out the module to your workarea, it puts the name of the module (in our example "PrintNameModule") first in the path. (i.e. C:\jhunter\programming\jdev\TestCvsWA\PrintNameModule\TestCvsWS)




Last modified on: Saturday, 18-Sep-2010 18:16:06 EDT
Page Count: 21938