/** * Obtains the {@link Properties} for the {@link InitialDirContext}. * * @param context * {@link ManagedObjectSourceContext}. * @return {@link Properties}. * @throws Exception * If fails to obtain the {@link Properties}. */ protected Properties getProperties(ManagedObjectSourceContext<None> context) throws Exception { return context.getProperties(); }
@Override protected Properties getProperties(ManagedObjectSourceContext<None> context) throws Exception { // Obtain the properties Properties properties = context.getProperties(); // Add LDAP details properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); // Return the properties return properties; }
/** * Extracts the mapping from the {@link ManagedObjectSourceContext}. * * @param prefix * Prefix of properties with remaining being the key. * @param context * {@link ManagedObjectSourceContext}. * @param mappings * Mappings to be loaded.. * @return Mapping. */ public Map<String, String> loadMappings(String prefix, ManagedObjectSourceContext<None> context, Map<String, String> mappings) { // Load the mappings Properties properties = context.getProperties(); for (String name : properties.stringPropertyNames()) { if (name.startsWith(prefix)) { // Obtain key of property String key = name.substring(prefix.length()); // Add the mapping mappings.put(key, properties.getProperty(name)); } } // Return the mappings return mappings; }
Properties properties = mosContext.getProperties(); ClassLoader classLoader = mosContext.getClassLoader();
@Override protected void loadMetaData(MetaDataContext<None, None> context) throws Exception { ManagedObjectSourceContext<None> mosContext = context .getManagedObjectSourceContext(); // Provide meta-data context.setManagedObjectClass(JndiContextManagedObject.class); context.setObjectClass(Context.class); // Obtain the properties this.properties = mosContext.getProperties(); // Obtain the sub context name (ensuring not blank) this.subContextName = this.properties.getProperty( PROPERTY_SUB_CONTEXT_NAME, null); if ((this.subContextName == null) || (this.subContextName.trim().length() == 0)) { // No/blank sub context name this.subContextName = null; } // Determine if validate context String validate = mosContext.getProperty(PROPERTY_VALIDATE, "false"); if (Boolean.parseBoolean(validate)) { // Obtain the Managed Object to validate Context this.getManagedObject(); } }
for (String name : mosContext.getProperties().stringPropertyNames()) {
for (String name : mosContext.getProperties().stringPropertyNames()) {