org.nuiton.topia.framework
Class TopiaUtil

java.lang.Object
  extended by org.nuiton.topia.framework.TopiaUtil

public class TopiaUtil
extends java.lang.Object

Author:
poussin

Constructor Summary
TopiaUtil()
           
 
Method Summary
static java.util.Properties getProperties(java.util.Properties parent, java.lang.String pathOrUrl)
          Permet de récupérer le fichier de propriété ayant le nom passé en argument.
static java.util.Properties getProperties(java.lang.String pathOrUrl)
          Permet de récupérer le fichier de propriété ayant le nom passé en argument.
static java.lang.String getTopiaIdPattern(java.lang.Class<? extends TopiaEntity> klass)
          Compute the pattern to be used to capture a topia id for a given entity class.
static java.util.regex.Pattern getTopiaPattern(java.lang.String format, java.lang.Class<? extends TopiaEntity>... classes)
          Compute a regex pattern given a format string.
static boolean isSchemaExist(org.hibernate.cfg.Configuration configuration, java.lang.String entityName)
          Test si une entite donnee correspondant a une configuration existe en base.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TopiaUtil

public TopiaUtil()
Method Detail

getProperties

public static java.util.Properties getProperties(java.lang.String pathOrUrl)
                                          throws TopiaNotFoundException
Permet de récupérer le fichier de propriété ayant le nom passé en argument.

Parameters:
pathOrUrl - le nom du fichier de propriété à charger, s'il est null ou vide retourne un objet Properties vide.
Returns:
Un nouvel objet de propriete
Throws:
TopiaNotFoundException - Si pathOrUrl n'est pas null ou vide et que le fichier devant contenir les propriétés n'est pas retrouvé.

getProperties

public static java.util.Properties getProperties(java.util.Properties parent,
                                                 java.lang.String pathOrUrl)
                                          throws TopiaNotFoundException
Permet de récupérer le fichier de propriété ayant le nom passé en argument.

Parameters:
parent - l'objet properties utilisé comme parent de l'objet retourné
pathOrUrl - le nom du fichier de propriété à charger, s'il est null ou vide retourne un objet Properties vide.
Returns:
Un nouvel objet de propriete
Throws:
TopiaNotFoundException - Si pathOrUrl n'est pas null ou vide et que le fichier devant contenir les propriétés n'est pas retrouvé.

getTopiaPattern

public static java.util.regex.Pattern getTopiaPattern(java.lang.String format,
                                                      java.lang.Class<? extends TopiaEntity>... classes)
Compute a regex pattern given a format string.

A String.format(String, Object[]) will be apply to format, with for parameters the list of klass transformed in topia pattern via method getTopiaIdPattern(Class) ready to be capture (enclosed by ()).

Parameters:
format - the format
classes - the list of class to use
Returns:
the pattern computed

getTopiaIdPattern

public static java.lang.String getTopiaIdPattern(java.lang.Class<? extends TopiaEntity> klass)
Compute the pattern to be used to capture a topia id for a given entity class.

Parameters:
klass - the entity class
Returns:
the pattern to capture a topia id for the given entity class.

isSchemaExist

public static boolean isSchemaExist(org.hibernate.cfg.Configuration configuration,
                                    java.lang.String entityName)
Test si une entite donnee correspondant a une configuration existe en base.

Parameters:
configuration - la configuration hibernate
entityName - le nom de l'entite a tester
Returns:
true si le schema de la table existe


Copyright © 2004-2010 CodeLutin. All Rights Reserved.