Migrating from eobjects.org MetaModel

In it's previous incarnation, MetaModel was hosted and developed not at Apache, but at http://metamodel.eobjects.org. With the move to Apache, we're also changing the namespace of MetaModel to org.apache.metamodel instead of org.eobjects.metamodel. Obviously this causes migration issues, but on this page is a compilation of tips to overcome them.   

Quick migration: Search/replace

If you're a light user of MetaModel, then probably a quick search/replace in your .java files will do the trick. Here's the common things to search for and replace with   

Search for

Replace with

import org.eobjects.metamodel

import org.apache.metamodel

import static org.eobjects.metamodel

import static org.apache.metamodel

A broader search for org.eobjects.metamodel should also provide a good final check to see if you've missed any devils in the details.    

New schema/table name convention for CSV and Fixed Width file DataContexts

With Apache MetaModel we've introduced a new naming convention for schemas and tables from the 'csv' and 'fixedwidth' modules. This may impact your application if it is referring schema or table names of such DataContexts.   

The old convention was:  

  • Schema name: Same as the filename. Example: "data.csv"  
  • Table name: The filename without the last 4 characters (the file extension). Example "data"   

The new convention is:  

  • Schema name: The directory/folder name of the file. Example "documents".  
  • Table name: The filename. Example "data.csv"   

Deserializing legacy MetaModel objects

If you've been relying on serialization of MetaModel objects from the legacy codebase, you will encounter troubles when deserializing them. To alleviate this issue we provide a specialized ObjectInputStream class that transparently deserializes legacy objects into their new format. This class is called LegacyDeserializationObjectInputStream  

Here's a simple example of it's usage:   

 

Object obj;
FileInputStream fileIn = new FileInputStream("my_legacy_metamodel_object.ser");
try {
  ObjectInputStream ois = new LegacyDeserializationObjectInputStream(fileIn);
  obj = ois.readObject();
  ois.close();
} finally {
  FileHelper.safeClose(fileIn);
}
  • No labels