It's all about the answers!

Ask a question

Auto backup of process configuration XML source


Madhan Babu (356) | asked Feb 19 '14, 5:41 a.m.
edited Feb 19 '14, 5:44 a.m.
Hi,

We're working with process inheritance model, where the process configuration is maintained in a "Master Project Area" and the actual projects work on consuming project areas, which use the process from the Master PA.
To have a "recovery plan" from any unintentional changes to the process configuration on the consuming project areas (one must remember that any minor changes in the consuming PA results in broken inheritance), we need a method to backup the XML process configuration source of the consuming projects automatically (best preferred solution).

To develop this, we need a method to retrive this XML process configuration source fo a patricular Project Area.


regards
Madhan

Accepted answer


permanent link
sam detweiler (12.4k6179201) | answered Feb 19 '14, 5:55 a.m.
my code  (I can get it for all project areas at once, or just one by name)

    static String keyname = "com.ibm.team.internal.process.compiled.xml";

                    // get the project area
                    IProjectArea ip = projectList.get(i);

                    System.out.println("\nproject name = " + ip.getName());

                    // get the process data
                    @SuppressWarnings("unchecked")
                    Map<Object, Object> pd = ip.getProcessData();

                    // get the content Manager
                    IContentManager icm = repo.contentManager();
                    // get the process config content object
                    IContent processSource = (IContent) pd.get(keyname);
                    if (processSource != null)
                    {
                        System.out.println("have xml source");
                        saveXMLSource(ip, processSource, icm, sPm);
                    }
.
.
    // save the process source for the project
    private static void saveXMLSource(IProjectArea ip, IContent ic,
            IContentManager icm, SysoutProgressMonitor sPm)
    {
        // make an output stream for the content manager
        OutputStream os = new ByteArrayOutputStream();
        // get the content of the content object.
        try
        {
            icm.retrieveContent(ic, os, sPm);

            // write xml content to file
            // project name + data name
            FileOutputStream fo = new FileOutputStream(ip.getName() + "."
                    + keyname);
            // write
            fo.write(os.toString().getBytes(), 0, os.toString().length());
            // close
            fo.close();
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }
Madhan Babu selected this answer as the correct answer

Comments
Madhan Babu commented Feb 19 '14, 9:20 a.m. | edited Mar 31 '14, 1:57 p.m.

Perfect!
It works..
Thanks a lot... :)


Madhan Babu commented Feb 19 '14, 9:44 a.m.

Is it also possible to fetch via code (plain Java API) the History entries of a Project Area? Reason: I want to run a scheduled executable which checks into the History of the Project Area and notify (via Email) when there is an entry for "Process Configuration" change.


sam detweiler commented Feb 19 '14, 10:09 a.m.

 I have not looked into how to do this.. 


my 'assumption' is that the versioned xml is stored in the same 
 Map<object, Object=""> pd = ip.getProcessData();  map..
 I would dump out the map keys and see what is there..


KB 20 commented Mar 21 '14, 5:42 p.m. | edited Mar 31 '14, 2:15 p.m.

 Hi Madhan/Sam,


I am a beginner in java programming; could you please help me with the following:

I also need to access the 'process config source' file for automation purposes and using your suggestions in this post, I am trying to setup a project. I also referred to this link as well: https://jazz.net/forum/questions/111579/get-process-configuration-source-via-api

I am writing my questions first for the code I have so far; I will post the code below the questions:
In the IProjectArea ip = (IProjectArea)(repo.itemManager().fetchCompleteItem(iparenthandle, IItemManager.DEFAULT, myProgressMonitor)); I don't understand the purpose of iparenthandle variable. I'm not sure how to initialize it. 

Next, in the 'get the process data' part, I have Map<string, Object = "Project Name I want to access"> pd = ip.getProcessData(); First, what do I need to put with 'string' since I am getting an error? Second, does the 'Object' get the name of the project I want to get the information for? Third, what does 'pd' stand for?

Next, is the 'keyname' specific to the project? How do I get the keyname?

Finally, when writing the content of the file, is the file stored on my local directory?

I have marked your suggested code with the comment: "your suggested code" Any help would be great! Thanks in advance.

Here is what I have so far:

public class SignIn {
private static String userID = "username";
private static String password = "pass";
private static String repoUri = "my repo";
static String keyname = "com.ibm.team.internal.process.compiled.xml";
public static void main(String[] args){
IProgressMonitor myProgressMonitor = new SysoutProgressMonitor(); // cannot use IProgressMonitor() because it is an interface and interface cannot be instantiated.
TeamPlatform.startup(); // Starts the RTC platform
try{
/Do all the work with RTC server here. /
// Login to the repo using the provided credentials
ITeamRepository repo = TeamPlatform.getTeamRepositoryService().getTeamRepository(repoUri);
repo.registerLoginHandler(new ILoginHandler2(){
public ILoginInfo2 challenge(ITeamRepository repo){
return new UsernameAndPasswordLoginInfo(userID, password);
}
});
myProgressMonitor.subTask("Contacting " + repo.getRepositoryURI() + "...");
repo.login(myProgressMonitor);
myProgressMonitor.subTask("connected");
/ Connecting to a specific project and getting the process config source file content /
/your suggested code for getting the data/
IItemHandle iparenthandle;
IProjectArea ip = (IProjectArea)(repo.itemManager().fetchCompleteItem(iparenthandle, IItemManager.DEFAULT, myProgressMonitor));
System.out.println("Project name = " + ip.getName());
//getting the process data
Map<String, Object = "Transmissions (RTC Scrum)"> pd = ip.getProcessData();
// get the process config content object
IContentManager icm = repo.contentManager();
IContent processSource = (IContent) pd.get(keyname);
if(processSource != null){
System.out.println("have xml source");
saveXMLSource(ip, processSource, icm, myProgressMonitor);
}
//end of: Connecting to a specific project and getting the process config source file content
//Do all of the work with myserver here.
repo.logout();
} catch (TeamRepositoryException e){
/ Handling repository exceptions such as login problems here. /
System.out.println("Unable to login: " + e.getLocalizedMessage());
}finally{
TeamPlatform.shutdown();
}
}
//your suggested code for saving the content
// saving the process config source content of the project
private static void saveXMLSource(IProjectArea ip, IContent ic, IContentManager icm, IProgressMonitor myProgressMonitor){
//making an output stream for the content manager
OutputStream os = new ByteArrayOutputStream();
// getting the content of the content object
try{
icm.retrieveContent(ic, os, myProgressMonitor);
//write the xml content to a file with project name and data name
FileOutputStream fos = new FileOutputStream(ip.getName() + "." + keyname);
//write
fos.write(os.toString().getBytes(), 0, os.toString().length());
//close
fos.close();
}catch (Exception e) {
e.printStackTrace();
}
}
}

3 other answers



permanent link
Aradhya K (1.4k44345) | answered Feb 19 '14, 11:41 p.m.
JAZZ DEVELOPER
 There is no need to backup the process spec XML manually as it is completely auditable.
In Eclipse client open the project area editor, switch to process spec XML tab.
Right click will get you you show history option.
This will list you all the changes that has happened to this XML.
Also you can select 2 versions and say compare to see what has changed.

On the web client as well there is a new tab called the History which shows what all changes had been done.

Comments
Madhan Babu commented Feb 25 '14, 11:38 a.m.

The hint regarding the history view Eclipse client was helpfull..

Regarding the History view in web client, well because of the strange/unique display of the change content, its not readable/useable when we have ~3 to 5K lines of xml..
I'd expect the history is shown in two column layout with separate display for Old and New values, to be able to use it...


Madhan Babu commented Feb 28 '14, 3:27 a.m. | edited Feb 28 '14, 3:27 a.m.

I am happy with the availability of all versions of the process configuration in the Eclipse client..
but some doubts in this regard..
1. Would it be possible to open the project area and recover this content from the Eclipse client in case the project area is messed up due to any mis-configurations?
2. Is there some possibility to add comments about the changes done to the process configuration? Would you recommend adding a comment in the header section of the xm itself? Or any other method possible?


permanent link
sam detweiler (12.4k6179201) | answered Mar 21 '14, 6:08 p.m.
you just don't have all the pieces..

here is the whole thing

package com.sd.tools;

import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.eclipse.core.runtime.IProgressMonitor;

import com.ibm.team.repository.client.IContentManager;
import com.ibm.team.repository.client.IItemManager;
import com.ibm.team.repository.client.ITeamRepository;
import com.ibm.team.repository.client.TeamPlatform;
import com.ibm.team.repository.common.IContent;
import com.ibm.team.repository.common.IItem;
import com.ibm.team.repository.common.TeamRepositoryException;
import com.ibm.team.process.client.*;
import com.ibm.team.process.common.IDevelopmentLine;
import com.ibm.team.process.common.IDevelopmentLineHandle;
import com.ibm.team.process.common.IIteration;
import com.ibm.team.process.common.IIterationHandle;
import com.ibm.team.process.common.IIterationType;
import com.ibm.team.process.common.IIterationTypeHandle;
import com.ibm.team.process.common.IProjectArea;
import com.ibm.team.process.common.IProjectAreaHandle;
import com.ibm.team.process.internal.common.IterationType;
import com.ibm.team.process.internal.common.ProjectArea;
//import com.ibm.team.process.internal.common.impl.ProjectAreaImpl;

public class GetProjectSource
{

    /**
     * key used to store project process configuration source
     */
    static String keyname = "com.ibm.team.internal.process.compiled.xml";

    @SuppressWarnings("restriction")
    public static void main(String[] args)
    {
        String url = null; // repository address
        String userid = null; // userid
        String password = null; // password
        String ProjectType = null; // * or name of project

        String newProjectParent = null; // name of new process parent project,
                                        // optional

        if (args.length < 4)
        {
            System.out.println("Parameters are" +
                "URL of repository\n" +
                "Userid of Admin user\n" +
                "Password of Admin user\n"+
                "project scope\n" +
                "    * for all projects (save all project source)\n" +
                "    specific Name of project to locate\n" +
                "\n" +   
                "optional:\n" +
                "    new parent project name"
                );
            return;
        }
        url = args[0];
        userid = args[1];
        password = args[2];
        // under eclipse * parm sends in junk
        ProjectType = args[3].equalsIgnoreCase("foo") ? "*" : args[3];
        newProjectParent = args[4];

        // startup the teamplatform runtime, if not already
        if (!TeamPlatform.isStarted())
            TeamPlatform.startup();
        try
        {
            // create required Monitor
            SysoutProgressMonitor sPm = new SysoutProgressMonitor();

            // login
            if (login(url, userid, password, sPm) != null)
            {
                // get the repository object where we are connecting
                ITeamRepository repo = getRepository(url);

                // get the list of projects
                // * means all
                // specific name means only that one.. case sensitive I think
                List<IProjectArea> projectList = getProjectArea(repo, sPm,
                        ProjectType);

                System.out.println(" there are " + projectList.size()
                        + " projects");

                // loop thru the list of projects, if any
                for (int i = 0; i < projectList.size(); i++)
                {
                    // get the project area
                    IProjectArea ip = projectList.get(i);

                    System.out.println("\nproject name = " + ip.getName());
                                      
                    // get the process data
                    @SuppressWarnings("unchecked")
                    Map<Object, Object> pd = ip.getProcessData();

                    // get the content Manager
                    IContentManager icm = repo.contentManager();
                    // get the process config content object
                    IContent processSource = (IContent) pd.get(keyname);
                    if (processSource != null)
                    {
                        System.out.println("have xml source");
                        saveXMLSource(ip, processSource, icm, sPm);
                    }                   

                    IProjectArea ipi = (IProjectArea) ip.getWorkingCopy();
                    // call the internal only method to get the parent process
                    // provider.. if any
                    IProjectAreaHandle iparenthandle = ((ProjectArea) ipi)
                            .getProcessProvider();
                    // if there was a parent
                    if (iparenthandle != null)
                    {
                        // get it
                        IProjectArea parentProject = (IProjectArea) (repo
                                .itemManager().fetchCompleteItem(iparenthandle,
                                IItemManager.DEFAULT, sPm));
                        System.out.println("have parent project name = "
                                + parentProject.getName());
                        // if we are changing the parent
                        if (newProjectParent != null)
                        {
                            // find the new one
                            List<IProjectArea> plist = getProjectArea(repo,
                                    sPm, newProjectParent);
                            // if we found it
                            if (plist.size() > 0)
                            {
                                // get its handle
                                IProjectAreaHandle newParentHandle = (IProjectAreaHandle) plist
                                        .get(0);
                                // always checking
                                if (newParentHandle != null)
                                {
                                    // set the provider field
                                    ((ProjectArea) ipi)
                                            .setProcessProvider(newParentHandle);
                                    // save the project area
                                    getProcessItemService(repo).save(
                                            (IProjectArea) ipi, sPm);
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                System.out.println("unable to logon to " + url + " as "
                        + userid);
            }
        }
        catch (Exception ex)
        {
            System.out.println("exception=" + ex.toString());
        }

    }

    // save the process source for the project
    private static void saveXMLSource(IProjectArea ip, IContent ic,
            IContentManager icm, SysoutProgressMonitor sPm)
    {
        // make an output stream for the content manager
        OutputStream os = new ByteArrayOutputStream();
        // get the content of the content object.
        try
        {
            icm.retrieveContent(ic, os, sPm);

            // write xml content to file
            // project name + data name
            FileOutputStream fo = new FileOutputStream(ip.getName() + "."
                    + keyname);
            // write
            fo.write(os.toString().getBytes(), 0, os.toString().length());
            // close
            fo.close();
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }

    // login to the repository
    public static ITeamRepository login(String url, final String userid,
            final String password, IProgressMonitor monitor)
            throws TeamRepositoryException
    {

        getRepository(url).registerLoginHandler(
                new ITeamRepository.ILoginHandler()
                {
                    public ILoginInfo challenge(ITeamRepository repository)
                    {
                        return new ILoginInfo()
                        {
                            public String getUserId()
                            {
                                return userid;
                            }

                            public String getPassword()
                            {
                                return password;
                            }
                        };
                    }
                });

        monitor.subTask("Contacting " + url);
        getRepository(url).login(monitor);
        monitor.subTask("Connected");

        return getRepository(url);
    }

    // worker function repository
    private static ITeamRepository repo1 = null;

    private static ITeamRepository getRepository(String url)
    {
        if (repo1 == null)
        {
            repo1 = TeamPlatform.getTeamRepositoryService().getTeamRepository(
                    url);
        }
        return repo1;
    }

    // worker function process item service
    private static IProcessItemService processitemservice = null;

    private static IProcessItemService getProcessItemService(
            ITeamRepository repo)
    {
        if (processitemservice == null)
        {
            processitemservice = (IProcessItemService) repo
                    .getClientLibrary(IProcessItemService.class);
        }
        return processitemservice;
    }

    public static List<IProjectArea> getProjectArea(ITeamRepository repo,
            IProgressMonitor monitor, String projectAreaName)
            throws TeamRepositoryException
    {
        List<IProjectArea> projectareaonly = new ArrayList<IProjectArea>();

        @SuppressWarnings("unchecked")
        // get all the projects in this repository
        List<IProjectArea> projectAreas = getProcessItemService(repo)
                .findAllProjectAreas(null, monitor);

        // if Not ALL projects
        if (!projectAreaName.equalsIgnoreCase("*"))
        {
            for (int i = 0; i < projectAreas.size(); i++)
            {
                // get next preoject from arraypackage com.sd.tools;

import java.io.ByteArrayOutputStream;
//import com.ibm.team.process.internal.common.impl.ProjectAreaImpl;

public class GetProjectSource
{

    /**
     * key used to store project process configuration source
     */
    static String keyname = "com.ibm.team.internal.process.compiled.xml";

    @SuppressWarnings("restriction")
    public static void main(String[] args)
    {
        String url = null; // repository address
        String userid = null; // userid
        String password = null; // password
        String ProjectType = null; // * or name of project

        String newProjectParent = null; // name of new process parent project,
                                        // optional

        if (args.length < 4)
        {
            System.out.println("Parameters are" +
                "URL of repository\n" +
                "Userid of Admin user\n" +
                "Password of Admin user\n"+
                "project scope\n" +
                "    * for all projects (save all project source)\n" +
                "    specific Name of project to locate\n" +
                "\n" +   
                "optional:\n" +
                "    new parent project name"
                );
            return;
        }
        url = args[0];
        userid = args[1];
        password = args[2];
        // under eclipse * parm sends in junk
        ProjectType = args[3].equalsIgnoreCase("foo") ? "*" : args[3];
        newProjectParent = args[4];

        // startup the teamplatform runtime, if not already
        if (!TeamPlatform.isStarted())
            TeamPlatform.startup();
        try
        {
            // create required Monitor
            SysoutProgressMonitor sPm = new SysoutProgressMonitor();

            // login
            if (login(url, userid, password, sPm) != null)
            {
                // get the repository object where we are connecting
                ITeamRepository repo = getRepository(url);

                // get the list of projects
                // * means all
                // specific name means only that one.. case sensitive I think
                List<IProjectArea> projectList = getProjectArea(repo, sPm,
                        ProjectType);

                System.out.println(" there are " + projectList.size()
                        + " projects");

                // loop thru the list of projects, if any
                for (int i = 0; i < projectList.size(); i++)
                {
                    // get the project area
                    IProjectArea ip = projectList.get(i);

                    //IDevelopmentLineHandle[] idl =ip.getDevelopmentLines();
                    //IIterationTypeHandle[] iii = ip.getIterationTypes();

                    System.out.println("\nproject name = " + ip.getName());
                   
                    //IDevelopmentLine ixl =(IDevelopmentLine) idl[0].getFullState();
                    //IIterationHandle iih = ixl.getCurrentIteration();
                    //IIteration iif = (IIteration) iih.getFullState();
                    //IIterationHandle[] iip = ixl.getIterations();
                   
                    // get the process data
                    @SuppressWarnings("unchecked")
                    Map<Object, Object> pd = ip.getProcessData();

                    // get the content Manager
                    IContentManager icm = repo.contentManager();
                    // get the process config content object
                    IContent processSource = (IContent) pd.get(keyname);
                    if (processSource != null)
                    {
                        System.out.println("have xml source");
                        saveXMLSource(ip, processSource, icm, sPm);
                    }                   

                    IProjectArea ipi = (IProjectArea) ip.getWorkingCopy();
                    // call the internal only method to get the parent process
                    // provider.. if any
                    IProjectAreaHandle iparenthandle = ((ProjectArea) ipi)
                            .getProcessProvider();
                    // if there was a parent
                    if (iparenthandle != null)
                    {
                        // get it
                        IProjectArea parentProject = (IProjectArea) (repo
                                .itemManager().fetchCompleteItem(iparenthandle,
                                IItemManager.DEFAULT, sPm));
                        System.out.println("have parent project name = "
                                + parentProject.getName());
                        // if we are changing the parent
                        if (newProjectParent != null)
                        {
                            // find the new one
                            List<IProjectArea> plist = getProjectArea(repo,
                                    sPm, newProjectParent);
                            // if we found it
                            if (plist.size() > 0)
                            {
                                // get its handle
                                IProjectAreaHandle newParentHandle = (IProjectAreaHandle) plist
                                        .get(0);
                                // always checking
                                if (newParentHandle != null)
                                {
                                    // set the provider field
                                    ((ProjectArea) ipi)
                                            .setProcessProvider(newParentHandle);
                                    // save the project area
                                    getProcessItemService(repo).save(
                                            (IProjectArea) ipi, sPm);
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                System.out.println("unable to logon to " + url + " as "
                        + userid);
            }
        }
        catch (Exception ex)
        {
            System.out.println("exception=" + ex.toString());
        }

    }

    // save the process source for the project
    private static void saveXMLSource(IProjectArea ip, IContent ic,
            IContentManager icm, SysoutProgressMonitor sPm)
    {
        // make an output stream for the content manager
        OutputStream os = new ByteArrayOutputStream();
        // get the content of the content object.
        try
        {
            icm.retrieveContent(ic, os, sPm);

            // write xml content to file
            // project name + data name
            FileOutputStream fo = new FileOutputStream(ip.getName() + "."
                    + keyname);
            // write
            fo.write(os.toString().getBytes(), 0, os.toString().length());
            // close
            fo.close();
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }

    // login to the repository
    public static ITeamRepository login(String url, final String userid,
            final String password, IProgressMonitor monitor)
            throws TeamRepositoryException
    {

        getRepository(url).registerLoginHandler(
                new ITeamRepository.ILoginHandler()
                {
                    public ILoginInfo challenge(ITeamRepository repository)
                    {
                        return new ILoginInfo()
                        {
                            public String getUserId()
                            {
                                return userid;
                            }

                            public String getPassword()
                            {
                                return password;
                            }
                        };
                    }
                });

        monitor.subTask("Contacting " + url);
        getRepository(url).login(monitor);
        monitor.subTask("Connected");

        return getRepository(url);
    }

    // worker function repository
    private static ITeamRepository repo1 = null;

    private static ITeamRepository getRepository(String url)
    {
        if (repo1 == null)
        {
            repo1 = TeamPlatform.getTeamRepositoryService().getTeamRepository(
                    url);
        }
        return repo1;
    }

    // worker function process item service
    private static IProcessItemService processitemservice = null;

    private static IProcessItemService getProcessItemService(
            ITeamRepository repo)
    {
        if (processitemservice == null)
        {
            processitemservice = (IProcessItemService) repo
                    .getClientLibrary(IProcessItemService.class);
        }
        return processitemservice;
    }

    public static List<IProjectArea> getProjectArea(ITeamRepository repo,
            IProgressMonitor monitor, String projectAreaName)
            throws TeamRepositoryException
    {
        List<IProjectArea> projectareaonly = new ArrayList<IProjectArea>();

        @SuppressWarnings("unchecked")
        // get all the projects in this repository
        List<IProjectArea> projectAreas = getProcessItemService(repo)
                .findAllProjectAreas(null, monitor);

        // if Not ALL projects
        if (!projectAreaName.equalsIgnoreCase("*"))
        {
            for (int i = 0; i < projectAreas.size(); i++)
            {
                // get next preoject from array
                IProjectArea projectArea = projectAreas.get(i);

                // if the names are equal, case sensitive
                if (projectArea.getName().equals(projectAreaName))
                {
                    // return this one project to the caller
                    System.out.println("Found " + projectAreaName);
                    projectareaonly.add(projectArea);
                    break;
                }
                else if (i + 1 == projectAreas.size())
                {
                    System.out.println("Failed to find requested project '"
                            + projectAreaName + "'");
                }
            }
            return projectareaonly;
        }
        else
            projectareaonly = projectAreas;
        return projectareaonly;
    }
}

                IProjectArea projectArea = projectAreas.get(i);

                // if the names are equal, case sensitive
                if (projectArea.getName().equals(projectAreaName))
                {
                    // return this one project to the caller
                    System.out.println("Found " + projectAreaName);
                    projectareaonly.add(projectArea);
                    break;
                }
                else if (i + 1 == projectAreas.size())
                {
                    System.out.println("Failed to find requested project '"
                            + projectAreaName + "'");
                }
            }
            return projectareaonly;
        }
        else
            projectareaonly = projectAreas;
        return projectareaonly;
    }
}




Comments
KB 20 commented Mar 24 '14, 10:18 a.m. | edited Mar 31 '14, 2:10 p.m.

Sam,

Thanks a lot for your help!! What is the difference between "ProjectType" and "NewParentProject" variables? Paren project var gets the name of the project, right?


sam detweiler commented Mar 24 '14, 10:28 a.m. | edited Mar 31 '14, 2:10 p.m.

this set of code can change ONE project, or ALL projects..


the 'type' into the search routine tells it one or many. it always returns a list (1 or many) 

if the type is '*' then all are returned, else this should be the Name of the project to be modified. 

the parent is the project this project uses as its process provider (this project is called the child). 

New is the project are to SET this child to inherit from. 

we use this code to change all the children from one parent to another. 
it will not modify projects that do NOT have a parent (like your master project, we call it anchor, and there are multiple at any time)..
this code could be extended to CHECK if the parent matches some known parent, and only reparent THOSE projects. 


KB 20 commented Mar 24 '14, 1:32 p.m. | edited Mar 31 '14, 2:12 p.m.

great, thanks!

 public static List<iprojectarea> getProjectArea(ITeamRepository repo,
IProgressMonitor monitor, String projectAreaName)
throws TeamRepositoryException -- should 'iprojectarea' be changed to 'IProjectArea'? When I am using 'iprojectarea', I am getting an error saying "iprojectarea cannot be resolved to a type"

I am also getting an error for: 'Map<object, Object=""> pd = ip.getProcessData();' shows me an error at the comma after object and the '=' sign. not sure why...


sam detweiler commented Mar 24 '14, 1:37 p.m. | edited Mar 31 '14, 2:13 p.m.

yes, the forum software messes up the formatting and case..  


Object=""  is  Object
and fix the case of other things..  sorry, can't keep it from messing up the text


KB 20 commented Mar 24 '14, 4:15 p.m. | edited Mar 31 '14, 2:13 p.m.

Thanks a bunch! I misread your post, which is why I typed the one below. I was able to fix all the errors. Sorry for all the questions, but where do I type in the information about the repo, project name, userid, and pass? 

I assigned the values to the vars at the beginning (string url, string userid, string password, etc...), is this right? I keep hitting the system.out statement for if(args.length < 4) condition.


permanent link
sam detweiler (12.4k6179201) | answered Mar 24 '14, 4:19 p.m.
I design everything to be run from the commandline.. (export a runnable jar file)
java -jar  runnable_jar repo userid password project-name (or * for all) 

in eclipse this is a run configuration with parameters
repo userid password project-name (or * for all) 

Comments
KB 20 commented Mar 24 '14, 4:54 p.m. | edited Mar 31 '14, 2:16 p.m.

Thanks! I have it working, now it got to :  if (processSource != null) System.out.println("have xml source"); ....}


I don't think it executed the saveXMLSource method; how should I check if the saveXMLSource method went through or not; where would it save the XML file content? 


sam detweiler commented Mar 24 '14, 5:05 p.m. | edited Mar 31 '14, 2:17 p.m.

 in a file called


project_area_name.com.ibm.team.internal.process.compiled.xml

  FileOutputStream fo = new FileOutputStream(ip.getName() + "." 
                    + keyname); 


KB 20 commented Mar 31 '14, 1:44 p.m. | edited Mar 31 '14, 2:17 p.m.

Thanks a bunch for all your help so far!


I have couple more things to ask. First, what is the purpose of the keyname? Is that the object where the config source file is saved? 

Second, now that I have made the changes to the xml file, how can I publish it back to the project?  


sam detweiler commented Mar 31 '14, 2:48 p.m.

the keyname is the string IBM uses to store the value in the process area data map table
from above
<pre>
Map<Object, Object> pd = ip.getProcessData();
IContent processSource = (IContent) pd.get(keyname);
</pre>

Your answer


Register or to post your answer.