APIs used while importing metadata for an ecore file - Forum - Corticon - Progress Community

APIs used while importing metadata for an ecore file

 Forum

APIs used while importing metadata for an ecore file

  • Hi

    Need some assistance in associating metadata to ecore files.

    I need to perform a daily activity which includes clearing and importing the metadata from and to ecore file respectively. Below are the steps

     

    1)      Open the .ecore file from the required location

    2)      Goto vocabulary and clear the metadata from the .ecore file

    3)      Import the metadata from the jar file  to required .ecore.

    Want to know which API is called when the above task are performed  in Corticon studio.I feel that there should be some way to do this by calling some methods

  • Jigesh,

    As conveyed in the previous thread community.progress.com/.../20213, there is no tool or utility or exposed API method available to perform this task .

    I'd encourage you to request this enhancement by filing an Idea.

    Request that a toll/utility  and an API method be available to accomplish this.

    For details on how to file an idea see:

    knowledgebase.progress.com/.../P11255

    Your feedback is valuable and Idea submissions are monitored by our Product Management team.  Enhancement requests are reviewed during the planning phase of each new product release.  Once you have submitted your Idea the Progress Software Community will have the opportunity to comment on and vote for your Idea.

    You can refer to your Idea at any time for updates on the status of your request.

    Thanks,

    Jan

  • I have already raised a request but I am curious to know the alternative.I strongly feel that if we are able to do it using corticon studio why cant we do it programmaticaly?

    There should be some way where we should be able to simulate the same behaviour by calling appropriate API they way we are able to do it for console

  • Hi Jigesh,

    We also need the same assistance to learing and importing the metadata from and to ecore file.

    Will help to get the relevant API.

  • If you look in the Corticon Foundation APIs Javadoc you might find what you are looking for:
    If you don’t already have the Foundation material you can find it on the ESD site:
     
     
     
  • The Foundation API is an internal API on the internal Corticon data model. (The Corticon Studio UI is built on this API). It is not formally supported for external use and is subject to change in new releases. If you need API’s not publicly available or additional functionality it needs to be addressed as an enhancement request.

    - Jan

  • Hi All,

    I tried the below code for clearing and importing metadata but the problem that I am facing is after importing the metadata the size of ecore file is reduced to 1 KB .Originally the size was around 2.7MB Unable to figure out what is the issue. Can some one please help me out with this one

    public class TestJavaMetaData {

    public static void main(String[] args) {

    TestJavaMetaData TMTD = new TestJavaMetaData();

    TMTD.ClearImportMetaData();

    }

    public void ClearImportMetaData()

    {

    try

    {

    IJavaMetadataAPI JMD= new JavaMetadataAPIImpl();

    URI modelURI=URI.createFileURI("C:\\..P.ecore");

    JMD.loadResource(modelURI);

    ResourceSet resourceSet=new ResourceSetImpl();

    Resource xmiResource=resourceSet.createResource(modelURI);

    JMD.reloadResource(xmiResource);

    JMD.clearCache();

    TestMetaData TMDA = new TestMetaData();

    List<String> classNames =TMDA.getJarsList();

    List<String> JarNames= new ArrayList<String>();

    JarNames.add("file:C:\\Jars");

    JMD.load(classNames,JarNames,null);

    JMD.saveResource(xmiResource);

    }

    catch(Exception e)

    {

    e.printStackTrace();

    }

    }

    public List<String> getJarsList() throws IOException

    {

    List<String> classNames = new ArrayList<String>();

    ZipInputStream zip = new ZipInputStream(new FileInputStream("C:\\...P.jar"));

    for (ZipEntry entry = zip.getNextEntry(); entry != null; entry = zip.getNextEntry())

    {

       if (!entry.isDirectory() && entry.getName().endsWith(".class")) {

           // This ZipEntry represents a class. Now, what class does it represent?

           String className = entry.getName().replace('/', '.'); // including ".class"

           classNames.add(className.substring(0, className.length() - ".class".length()));

       }

    }

    return classNames;

    }

    }