org.apache.cayenne.wocompat
Class EOModelHelper

java.lang.Object
  extended by org.apache.cayenne.wocompat.EOModelHelper

public class EOModelHelper
extends Object

Helper class used by EOModelProcessor. EOModelHelper loads an EOModel from the specified location and gives its users access to the untyped EOModel information.


Field Summary
protected  DataMap dataMap
           
protected  Map entityClassIndex
           
protected  Map entityClientClassIndex
           
protected  Map entityIndex
           
protected  Map entityQueryIndex
           
protected  URL modelUrl
           
 
Constructor Summary
EOModelHelper(String path)
          Creates helper instance and tries to locate EOModel and load index file.
 
Method Summary
 String entityClass(String entityName, boolean getClientClass)
           
 Map entityPListMap(String entityName)
          Returns an info map for the entity called entityName.
protected  String findModelName(String path)
          Returns EOModel name based on its path.
protected  URL findModelUrl(String path)
          Returns a URL of the EOModel directory.
 DataMap getDataMap()
          Returns a DataMap associated with this helper.
 URL getModelUrl()
          Returns EOModel location as URL.
 Map getPrototypeAttributeMapFor(String aPrototypeAttributeName)
           
 String javaTypeForEOModelerType(String valueClassName, String valueType)
          Performs Objective C data types conversion to Java types.
protected  Map loadEntityIndex(String entityName)
          Loads EOEntity information and returns it as a map.
protected  Map loadModelIndex()
          Loads EOModel index and returns it as a map.
protected  Map loadQueryIndex(String entityName)
          Loads EOFetchSpecification information and returns it as a map.
 Iterator modelNames()
          Returns an iterator of model names.
 List modelNamesAsList()
          Returns a list of model entity names.
protected  Class numericAttributeClass(String valueType)
           
protected  InputStream openEntityStream(String entityName)
          Returns InputStream to read an EOEntity plist file.
protected  InputStream openIndexStream()
          Returns InputStream to read an EOModel index file.
protected  InputStream openQueryStream(String entityName)
          Returns InputStream to read an EOFetchSpecification plist file.
 Iterator queryNames(String entityName)
          Returns the iterator over EOFetchSpecification names for a given entity.
 Map queryPListMap(String entityName, String queryName)
          Returns a map containing EOFetchSpecification information for entity name and query name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

modelUrl

protected URL modelUrl

entityIndex

protected Map entityIndex

entityClassIndex

protected Map entityClassIndex

entityQueryIndex

protected Map entityQueryIndex

entityClientClassIndex

protected Map entityClientClassIndex

dataMap

protected DataMap dataMap
Constructor Detail

EOModelHelper

public EOModelHelper(String path)
              throws Exception
Creates helper instance and tries to locate EOModel and load index file.

Throws:
Exception
Method Detail

javaTypeForEOModelerType

public String javaTypeForEOModelerType(String valueClassName,
                                       String valueType)
Performs Objective C data types conversion to Java types.

Returns:
String representation for Java type corresponding to String representation of Objective C type.
Since:
1.1

numericAttributeClass

protected Class numericAttributeClass(String valueType)
Since:
1.1

getDataMap

public DataMap getDataMap()
Returns a DataMap associated with this helper.


getModelUrl

public URL getModelUrl()
Returns EOModel location as URL.


modelNames

public Iterator modelNames()
Returns an iterator of model names.


modelNamesAsList

public List modelNamesAsList()
Returns a list of model entity names.

Since:
1.1

getPrototypeAttributeMapFor

public Map getPrototypeAttributeMapFor(String aPrototypeAttributeName)

entityPListMap

public Map entityPListMap(String entityName)
Returns an info map for the entity called entityName.


queryNames

public Iterator queryNames(String entityName)
Returns the iterator over EOFetchSpecification names for a given entity.

Since:
1.1

queryPListMap

public Map queryPListMap(String entityName,
                         String queryName)
Returns a map containing EOFetchSpecification information for entity name and query name. Returns null if no such query is found.

Since:
1.1

entityClass

public String entityClass(String entityName,
                          boolean getClientClass)

loadModelIndex

protected Map loadModelIndex()
                      throws Exception
Loads EOModel index and returns it as a map.

Throws:
Exception

loadEntityIndex

protected Map loadEntityIndex(String entityName)
                       throws Exception
Loads EOEntity information and returns it as a map.

Throws:
Exception

loadQueryIndex

protected Map loadQueryIndex(String entityName)
                      throws Exception
Loads EOFetchSpecification information and returns it as a map.

Throws:
Exception

findModelName

protected String findModelName(String path)
Returns EOModel name based on its path.


findModelUrl

protected URL findModelUrl(String path)
Returns a URL of the EOModel directory. Throws exception if it can't be found.


openIndexStream

protected InputStream openIndexStream()
                               throws Exception
Returns InputStream to read an EOModel index file.

Throws:
Exception

openEntityStream

protected InputStream openEntityStream(String entityName)
                                throws Exception
Returns InputStream to read an EOEntity plist file.

Parameters:
entityName - name of EOEntity to be loaded.
Returns:
InputStream to read an EOEntity plist file or null if entityname.plist file can not be located.
Throws:
Exception

openQueryStream

protected InputStream openQueryStream(String entityName)
                               throws Exception
Returns InputStream to read an EOFetchSpecification plist file.

Parameters:
entityName - name of EOEntity to be loaded.
Returns:
InputStream to read an EOEntity plist file or null if entityname.plist file can not be located.
Throws:
Exception


Copyright © 2001-2011 Apache Cayenne. All Rights Reserved.