edu.internet2.middleware.grouper.misc
Class GrouperCheckConfig

java.lang.Object
  extended by edu.internet2.middleware.grouper.misc.GrouperCheckConfig

public class GrouperCheckConfig
extends Object

check the configuration of grouper to make sure things are configured right, and to give descriptive errors of the problems


Nested Class Summary
static class GrouperCheckConfig.CheckGroupResult
          result from check group
 
Field Summary
static String GROUPER_PROPERTIES_NAME
           
static Pattern grouperLoaderConsumerPattern
          match something like this: changeLog.consumer.ldappc.class, changeLog.consumer.ldappc.quartzCron
static Pattern grouperLoaderOtherJobPattern
          match something like this: otherJob.duo.class, otherJob.duo.quartzCron, otherJob.duo.priority
static boolean inCheckConfig
          if in check config
static Pattern memberSortSearchSecurityPattern
           match security for search and sort strings match: security.member.sort.string[0-4].allowOnlyGroup match: security.member.sort.string[0-4].wheelOnly match: security.member.search.string[0-4].allowOnlyGroup match: security.member.search.string[0-4].wheelOnly
static Pattern messagingListenerConsumerPattern
          match something like this: changeLog.consumer.ldappc.class, changeLog.consumer.ldappc.quartzCron
static Pattern typeSecurityPattern
           match type security match: security.typeName.wheelOnly match: security.typeName.allowOnlyGroup
 
Constructor Summary
GrouperCheckConfig()
           
 
Method Summary
static boolean assertAndRemove(String resourceName, Map<String,String> set, String[] propertiesNames)
          if one there, then they all must be there, and remove, return true if found one
static String attributeLoaderStemName()
          return the stem name where the attribute loader attributes go, without colon on end
static String attributeRootStemName()
          root stem where attributes live
static AttributeDefName checkAttribute(Stem stem, AttributeDef attributeDef, String extension, String displayExtension, String description, boolean logAutocreate)
          make sure an attribute is there or add it if not
static void checkAttributes()
          make sure configured attributes are there
static void checkConfig()
          check the grouper config safely, log errors
static void checkConfigProperties(String resourceName, String resourceExampleName)
          compare a properties file with an example file, compare all the properties
static boolean checkDatabase(String driverClassName, String connectionUrl, String dbUser, String dbPassword, String databaseDescription)
          test a database connection
static GrouperCheckConfig.CheckGroupResult checkGroup(GrouperSession grouperSession, String groupName, boolean logError, Boolean autoCreate, boolean logAutocreate, String displayExtension, String groupDescription, String propertyDescription, Group[] groupResult)
          verify that a group exists by name (dont throw exceptions)
static void checkGrouperDb()
          make sure the grouper.hibernate.properties db settings are correct
static void checkGrouperLoaderConfigDbs()
          check the grouper loader db configs
static void checkGrouperLoaderConsumers()
          check the grouper loader consumer configs
static void checkGrouperLoaderOtherJobs()
          check the grouper loader other jobs configs
static void checkGroups()
          make sure configured groups are there
static void checkJar(String name, long size, String sampleClassName, String manifestVersion)
          check a jar
static void checkJar(String name, Set<Long> sizes, String sampleClassName, String manifestVersion)
          check a jar
static boolean checkResource(String resourcePath)
          make sure a resource is on the resource path
static boolean checkResource(String resourcePath, boolean required)
          make sure a resource is on the resource path
static boolean configCheckDisabled()
          if the config check is disabled
static String jarVersion(Class sampleClass)
          get the version from the manifest of a jar
static Stem legacyAttributeBaseStem(GrouperSession grouperSession)
          get or create the legacy attribute base stem
static void main(String[] args)
          generate the jars to find
static String manifestProperty(Class sampleClass, String[] propertyNames)
          get the version from the manifest of a jar
static Map<String,String> memberSortSearchSecuritySettings()
           
static boolean nonStandardProperty(String resourceName, String propertyName, boolean missingPropertyInFile)
          return true if this is an exception case, dont worry about it
static Map<String,String> typeSecuritySettings()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GROUPER_PROPERTIES_NAME

public static final String GROUPER_PROPERTIES_NAME
See Also:
Constant Field Values

inCheckConfig

public static boolean inCheckConfig
if in check config


grouperLoaderConsumerPattern

public static Pattern grouperLoaderConsumerPattern
match something like this: changeLog.consumer.ldappc.class, changeLog.consumer.ldappc.quartzCron


messagingListenerConsumerPattern

public static Pattern messagingListenerConsumerPattern
match something like this: changeLog.consumer.ldappc.class, changeLog.consumer.ldappc.quartzCron


grouperLoaderOtherJobPattern

public static Pattern grouperLoaderOtherJobPattern
match something like this: otherJob.duo.class, otherJob.duo.quartzCron, otherJob.duo.priority


typeSecurityPattern

public static final Pattern typeSecurityPattern
 match type security
 match: security.typeName.wheelOnly
 match: security.typeName.allowOnlyGroup
 


memberSortSearchSecurityPattern

public static final Pattern memberSortSearchSecurityPattern
 match security for search and sort strings
 match: security.member.sort.string[0-4].allowOnlyGroup
 match: security.member.sort.string[0-4].wheelOnly
 match: security.member.search.string[0-4].allowOnlyGroup
 match: security.member.search.string[0-4].wheelOnly
 

Constructor Detail

GrouperCheckConfig

public GrouperCheckConfig()
Method Detail

checkGroup

public static GrouperCheckConfig.CheckGroupResult checkGroup(GrouperSession grouperSession,
                                                             String groupName,
                                                             boolean logError,
                                                             Boolean autoCreate,
                                                             boolean logAutocreate,
                                                             String displayExtension,
                                                             String groupDescription,
                                                             String propertyDescription,
                                                             Group[] groupResult)
verify that a group exists by name (dont throw exceptions)

Parameters:
grouperSession - (probably should be root session)
groupName -
logError -
autoCreate - if auto create, or null, for grouper.properties setting
logAutocreate -
displayExtension - optional, dislpay extension if creating
groupDescription - group description if auto create
propertyDescription - for logging explaning to the user how to fix the problem
groupResult - put in an array of size one to get the group back
Returns:
if group exists or not or was created

checkJar

public static void checkJar(String name,
                            long size,
                            String sampleClassName,
                            String manifestVersion)
check a jar

Parameters:
name - name of the jar from grouper
size - that the jar should be
sampleClassName - inside the jar
manifestVersion - in the manifest file, which version we are expecting

checkJar

public static void checkJar(String name,
                            Set<Long> sizes,
                            String sampleClassName,
                            String manifestVersion)
check a jar

Parameters:
name - name of the jar from grouper
sizes - that the jar should be
sampleClassName - inside the jar
manifestVersion - in the manifest file, which version we are expecting

checkResource

public static boolean checkResource(String resourcePath)
make sure a resource is on the resource path

Parameters:
resourcePath -
Returns:
false if problem or if not checking configs

checkResource

public static boolean checkResource(String resourcePath,
                                    boolean required)
make sure a resource is on the resource path

Parameters:
resourcePath -
required -
Returns:
false if problem or if not checking configs

configCheckDisabled

public static boolean configCheckDisabled()
if the config check is disabled

Returns:
if the config check is disabled

checkConfig

public static void checkConfig()
check the grouper config safely, log errors


checkGroups

public static void checkGroups()
make sure configured groups are there


typeSecuritySettings

public static Map<String,String> typeSecuritySettings()
Returns:
the map of settings from grouper.properties

memberSortSearchSecuritySettings

public static Map<String,String> memberSortSearchSecuritySettings()
Returns:
the map of settings from grouper.properties

checkGrouperDb

public static void checkGrouperDb()
make sure the grouper.hibernate.properties db settings are correct


checkDatabase

public static boolean checkDatabase(String driverClassName,
                                    String connectionUrl,
                                    String dbUser,
                                    String dbPassword,
                                    String databaseDescription)
test a database connection

Parameters:
driverClassName -
connectionUrl -
dbUser -
dbPassword -
databaseDescription - friendly error description when there is a problem
Returns:
true if it is ok, false if there is a problem

checkGrouperLoaderConfigDbs

public static void checkGrouperLoaderConfigDbs()
check the grouper loader db configs


checkGrouperLoaderOtherJobs

public static void checkGrouperLoaderOtherJobs()
check the grouper loader other jobs configs


checkGrouperLoaderConsumers

public static void checkGrouperLoaderConsumers()
check the grouper loader consumer configs


assertAndRemove

public static boolean assertAndRemove(String resourceName,
                                      Map<String,String> set,
                                      String[] propertiesNames)
if one there, then they all must be there, and remove, return true if found one

Parameters:
resourceName -
set - of properties that match this pattern
propertiesNames -
Returns:
true if found one

main

public static void main(String[] args)
                 throws Exception
generate the jars to find

Parameters:
args -
Throws:
Exception

jarVersion

public static String jarVersion(Class sampleClass)
                         throws Exception
get the version from the manifest of a jar

Parameters:
sampleClass -
Returns:
the version
Throws:
Exception

manifestProperty

public static String manifestProperty(Class sampleClass,
                                      String[] propertyNames)
                               throws Exception
get the version from the manifest of a jar

Parameters:
sampleClass -
propertyNames - that we are looking for (usually just one)
Returns:
the version
Throws:
Exception

nonStandardProperty

public static boolean nonStandardProperty(String resourceName,
                                          String propertyName,
                                          boolean missingPropertyInFile)
return true if this is an exception case, dont worry about it

Parameters:
resourceName -
propertyName -
missingPropertyInFile - true if missing property in file, false if extra property in file
Returns:
true if exception case

checkConfigProperties

public static void checkConfigProperties(String resourceName,
                                         String resourceExampleName)
compare a properties file with an example file, compare all the properties

Parameters:
resourceName -
resourceExampleName -

checkAttribute

public static AttributeDefName checkAttribute(Stem stem,
                                              AttributeDef attributeDef,
                                              String extension,
                                              String displayExtension,
                                              String description,
                                              boolean logAutocreate)
make sure an attribute is there or add it if not

Parameters:
stem -
attributeDef -
extension -
description -
displayExtension -
logAutocreate -
Returns:
the attribute def name

attributeLoaderStemName

public static String attributeLoaderStemName()
return the stem name where the attribute loader attributes go, without colon on end

Returns:
stem name

attributeRootStemName

public static String attributeRootStemName()
root stem where attributes live

Returns:
attribute built in stem name

checkAttributes

public static void checkAttributes()
make sure configured attributes are there


legacyAttributeBaseStem

public static Stem legacyAttributeBaseStem(GrouperSession grouperSession)
get or create the legacy attribute base stem

Parameters:
grouperSession -
Returns:
the stem