/** * Creates a ServerDescriptor object based on the configuration that we read using the provided * InitialLdapContext. * * @param ctx the InitialLdapContext that will be used to read the configuration of the server. * @param filter the topology cache filter describing the information that must be retrieved. * @return a ServerDescriptor object that corresponds to the read configuration. * @throws NamingException if a problem occurred reading the server configuration. */ public static ServerDescriptor createStandalone( InitialLdapContext ctx, TopologyCacheFilter filter) throws NamingException { ServerDescriptor desc = new ServerDescriptor(); updateLdapConfiguration(desc, ctx, filter); updateAdminConnectorConfiguration(desc, ctx, filter); updateJmxConfiguration(desc, ctx, filter); updateReplicas(desc, ctx, filter); updateReplication(desc, ctx, filter); updatePublicKeyCertificate(desc, ctx, filter); updateMiscellaneous(desc, ctx, filter); desc.serverProperties.put(ServerProperty.HOST_NAME, ConnectionUtils.getHostName(ctx)); return desc; }
/** * Returns the URL to access this server using the administration connector. Returns <CODE>null * </CODE> if the server cannot get the administration connector. * * @return the URL to access this server using the administration connector. */ public String getAdminConnectorURL() { String adminConnectorUrl = null; String host = getHostName(); int port = -1; if (!serverProperties.isEmpty()) { ArrayList<?> s = (ArrayList<?>) serverProperties.get(ServerProperty.ADMIN_ENABLED); ArrayList<?> p = (ArrayList<?>) serverProperties.get(ServerProperty.ADMIN_PORT); if (s != null) { for (int i = 0; i < s.size(); i++) { if (Boolean.TRUE.equals(s.get(i))) { port = (Integer) p.get(i); break; } } } } if (port != -1) { adminConnectorUrl = ConnectionUtils.getLDAPUrl(host, port, true); } return adminConnectorUrl; }
private static Set<String> getValues(SearchResult entry, String attrName) throws NamingException { return ConnectionUtils.getValues(entry, attrName); }
/* * The following 2 methods are convenience methods to retrieve String values * from an entry. */ private static String getFirstValue(SearchResult entry, String attrName) throws NamingException { return ConnectionUtils.getFirstValue(entry, attrName); }