Hello,

While testing migration of various projects to Ivy 6.0, I encountered a problem with a method that does not exist anymore.

  /** 
   * Find the current process name. 
   * 
   * @return fully qualified process name 
   * @throws Exception 
   */ 
    public static String getName() throws Exception {
        return SecurityManagerFactory.getSecurityManager().executeAsSystem(new Callable<String>() {
            public String call() {
                IProcess process = ProcessNavigationUtil.getProcess(MetaData.getProcessElement());

                if (process != null) 
                    return process.getPath();

                return null;
            }
        });
    }

In the previous code, the method MetaData.getProcessElement() is not found. By looking in Ivy 5.1.7, it was implemented as:

  public static ZObject getProcessElement()
  {
    return (ZObject)IvyThreadContext.getIvyThreadLocalValue("processElement");
  }

Now the method has been removed, and a new method getProcessElementId() was added, but with a new signature:

  public static PID getProcessElementId()
  {
    return (PID)IvyThreadContext.getIvyThreadLocalValue("processElement");
  }

I didn't found this change in the migration documentation. Can I know the reason for removing the previous method and what are the alternative in order to get the current process name? Thanks.

asked 14.12.2015 at 15:03

A1234's gravatar image

A1234
(suspended)
accept rate: 33%


This is internal API which was never meant to be used by project implementors, thats why nothing is mentioned in the migration notes.

If you really need the name of the process resource you can use this API.

String pid = MetaData.getProcessElementId()
DiCore.getGlobalInjector().getInstance(IProcessManager.class).findProcess(pid ).getName();

of course this new API is internal as well. the API can change in the future!

link

answered 14.12.2015 at 15:40

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
9.4k31958
accept rate: 70%

edited 15.12.2015 at 12:44

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×3

Asked: 14.12.2015 at 15:03

Seen: 1,597 times

Last updated: 15.12.2015 at 12:44