| | |
| | | import java.util.HashSet; |
| | | import java.util.Set; |
| | | import java.util.EnumSet; |
| | | import java.util.Hashtable; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | |
| | | * @return name of message descriptor |
| | | */ |
| | | public String getMessageDescriptorName() { |
| | | return new StringBuffer() |
| | | return new StringBuilder() |
| | | .append(this.severity.messageDesciptorName()) |
| | | .append("_") |
| | | .append(this.description).toString(); |
| | |
| | | } |
| | | |
| | | static private String getInitialLogRecord() { |
| | | StringBuffer sb = new StringBuffer() |
| | | StringBuilder sb = new StringBuilder() |
| | | .append("Status application launched " + |
| | | DateFormat.getDateTimeInstance(DateFormat.LONG, |
| | | DateFormat.LONG). |
| | |
| | | |
| | | static private String getInitialLogRecord() { |
| | | // Note; currently the logs are not internationalized. |
| | | StringBuffer sb = new StringBuffer() |
| | | StringBuilder sb = new StringBuilder() |
| | | .append("QuickSetup application launched " + |
| | | DateFormat.getDateTimeInstance(DateFormat.LONG, |
| | | DateFormat.LONG). |
| | |
| | | |
| | | String[] args = new String[argList.size()]; |
| | | argList.toArray(args); |
| | | StringBuffer cmd = new StringBuffer(); |
| | | StringBuilder cmd = new StringBuilder(); |
| | | for (String s : argList) |
| | | { |
| | | if (cmd.length() > 0) |
| | |
| | | Build build = parseBuildLine(line); |
| | | builds.add(build); |
| | | } catch (IllegalArgumentException iae) { |
| | | StringBuffer msg = new StringBuffer() |
| | | StringBuilder msg = new StringBuilder() |
| | | .append("Error parsing line '") |
| | | .append(line) |
| | | .append("': ") |
| | |
| | | if (displayName == null || |
| | | downloadUrlString == null || |
| | | categoryString == null) { |
| | | StringBuffer msg = new StringBuffer() |
| | | StringBuilder msg = new StringBuilder() |
| | | .append("Line '") |
| | | .append(line) |
| | | .append("' is incomplete or is not correctly delimited") |
| | |
| | | try { |
| | | downloadUrl = new URL(downloadUrlString); |
| | | } catch (MalformedURLException e) { |
| | | StringBuffer msg = new StringBuffer() |
| | | StringBuilder msg = new StringBuilder() |
| | | .append("URL '") |
| | | .append(downloadUrlString) |
| | | .append("' is invalid"); |
| | |
| | | } |
| | | category = Build.Category.fromString(categoryString); |
| | | if (category == null) { |
| | | StringBuffer msg = new StringBuffer() |
| | | StringBuilder msg = new StringBuilder() |
| | | .append("Category '") |
| | | .append(categoryString) |
| | | .append("' is invalid; must be one of "); |
| | |
| | | public static String getStringFromCollection(Collection<String> col, |
| | | String separator) |
| | | { |
| | | StringBuffer msg = new StringBuffer(); |
| | | StringBuilder msg = new StringBuilder(); |
| | | for (String m : col) |
| | | { |
| | | |
| | |
| | | */ |
| | | static public String listToString(List<?> list, String separator, |
| | | String prefix, String suffix) { |
| | | StringBuffer sb = new StringBuffer(); |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | if (prefix != null) { |
| | | sb.append(prefix); |
| | |
| | | * @return String representing the list |
| | | */ |
| | | static public String stringArrayToString(String[] array, String separator) { |
| | | StringBuffer sb = new StringBuffer(); |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (int i = 0; i < array.length; i++) { |
| | | sb.append(array[i]); |
| | | if (i < array.length - 1) { |
| | |
| | | |
| | | Set<Map<ServerGroupProperty, Object>> result = adsCtx |
| | | .readServerGroupRegistry(); |
| | | StringBuffer buffer = new StringBuffer(); |
| | | StringBuilder buffer = new StringBuilder(); |
| | | |
| | | // if not verbose mode, print group name (1 per line) |
| | | if (! verboseArg.isPresent()) |
| | |
| | | { |
| | | returnCode = SUCCESSFUL; |
| | | } |
| | | StringBuffer buffer = new StringBuffer(); |
| | | StringBuilder buffer = new StringBuilder(); |
| | | for (String member : memberList) |
| | | { |
| | | // We shouldn't print out the "cn=" |
| | |
| | | .readServerGroupRegistry(); |
| | | String MemberId = listMembershipMemberNameArg.getValue(); |
| | | |
| | | StringBuffer buffer = new StringBuffer(); |
| | | StringBuilder buffer = new StringBuilder(); |
| | | for (Map<ServerGroupProperty, Object> groupProps : result) |
| | | { |
| | | // Get the group name; |
| | |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | import org.opends.messages.Message; |
| | | |
| | | |
| | | import com.sleepycat.je.*; |
| | | |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.SearchOperation; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import org.opends.server.protocols.asn1.ASN1OctetString; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.AttributeType; |
| | | import org.opends.server.types.AttributeValue; |
| | | import org.opends.server.types.ConditionResult; |
| | | import org.opends.server.types.DebugLogLevel; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.Entry; |
| | |
| | | |
| | | import static org.opends.server.util.ServerConstants.ATTR_REFERRAL_URL; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import org.opends.server.types.DebugLogLevel; |
| | | import static org.opends.messages.JebMessages. |
| | | INFO_JEB_REFERRAL_RESULT_MESSAGE; |
| | | /** |
| | |
| | | * The standard attribute type that is used to specify the set of referral |
| | | * URLs in a referral entry. |
| | | */ |
| | | public AttributeType referralType = |
| | | private final AttributeType referralType = |
| | | DirectoryServer.getAttributeType(ATTR_REFERRAL_URL); |
| | | |
| | | /** |
| | | * A flag that indicates whether there are any referrals contained in this |
| | | * database. It should only be set to {@code false} when it is known that |
| | | * there are no referrals. |
| | | */ |
| | | private volatile ConditionResult containsReferrals = |
| | | ConditionResult.UNDEFINED; |
| | | |
| | | |
| | | /** |
| | | * Create a new object representing a referral database in a given |
| | | * entryContainer. |
| | | * |
| | |
| | | { |
| | | return false; |
| | | } |
| | | containsReferrals = ConditionResult.TRUE; |
| | | return true; |
| | | } |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | containsReferrals = containsReferrals(txn); |
| | | return true; |
| | | } |
| | | |
| | |
| | | { |
| | | return false; |
| | | } |
| | | containsReferrals = containsReferrals(txn); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the underlying database contains any referrals. |
| | | * |
| | | * @param txn The transaction to use when making the determination. |
| | | * |
| | | * @return {@code true} if it is believed that the underlying database may |
| | | * contain at least one referral, or {@code false} if it is certain |
| | | * that it doesn't. |
| | | */ |
| | | private ConditionResult containsReferrals(Transaction txn) |
| | | { |
| | | try |
| | | { |
| | | Cursor cursor = openCursor(txn, null); |
| | | DatabaseEntry key = new DatabaseEntry(); |
| | | DatabaseEntry data = new DatabaseEntry(); |
| | | |
| | | OperationStatus status = cursor.getFirst(key, data, null); |
| | | cursor.close(); |
| | | |
| | | if (status == OperationStatus.SUCCESS) |
| | | { |
| | | return ConditionResult.TRUE; |
| | | } |
| | | else if (status == OperationStatus.NOTFOUND) |
| | | { |
| | | return ConditionResult.FALSE; |
| | | } |
| | | else |
| | | { |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | if (debugEnabled()) |
| | | { |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Update the referral database for an entry that has been modified. Does |
| | | * not do anything unless the entry before the modification or the entry after |
| | | * the modification is a referral entry. |
| | |
| | | public void targetEntryReferrals(DN targetDN, SearchScope searchScope) |
| | | throws DirectoryException |
| | | { |
| | | if (containsReferrals == ConditionResult.UNDEFINED) |
| | | { |
| | | containsReferrals = containsReferrals(null); |
| | | } |
| | | |
| | | if (containsReferrals == ConditionResult.FALSE) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | Transaction txn = null; |
| | | CursorConfig cursorConfig = null; |
| | | |
| | |
| | | public boolean returnSearchReferences(SearchOperation searchOp) |
| | | throws DirectoryException |
| | | { |
| | | if (containsReferrals == ConditionResult.UNDEFINED) |
| | | { |
| | | containsReferrals = containsReferrals(null); |
| | | } |
| | | |
| | | if (containsReferrals == ConditionResult.FALSE) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | Transaction txn = null; |
| | | CursorConfig cursorConfig = null; |
| | | |
| | |
| | | new HashMap<DN, ImportContext>(); |
| | | |
| | | /** |
| | | * The maximum number of parent ID values that we will remember. |
| | | */ |
| | | private static final int PARENT_ID_MAP_SIZE = 50; |
| | | |
| | | /** |
| | | * Map of likely parent entry DNs to their entry IDs. |
| | | */ |
| | | private HashMap<DN,EntryID> parentIDMap = |
| | | new HashMap<DN,EntryID>(PARENT_ID_MAP_SIZE); |
| | | |
| | | /** |
| | | * The number of entries imported. |
| | | */ |
| | | private int importedCount; |
| | |
| | | getParentWithinBase(entryDN); |
| | | if (parentDN != null) |
| | | { |
| | | parentID = dn2id.get(txn, parentDN); |
| | | parentID = getParentID(parentDN, dn2id, txn); |
| | | if (parentID == null) |
| | | { |
| | | // Reject the entry. |
| | |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the entry ID for the entry with the given DN. This will use an |
| | | * in-memory hash if possible, or will go to the database if it's not in |
| | | * cache. This should only be used for cacheable operations (like getting the |
| | | * entry ID for the parent entry) where the same parent ID is likely to be |
| | | * used multiple times. |
| | | * |
| | | * @param parentDN The DN of the parent entry for which to retrieve the |
| | | * corresponding entry ID. |
| | | * @param dn2id The handle to the dn2id database to use if the parent DN |
| | | * isn't found in the local cache. |
| | | * @param txn The transaction to use when interacting with the dn2id |
| | | * database. |
| | | * |
| | | * @return The entry ID for the entry with the given DN, or {@code null} if |
| | | * no such entry exists. |
| | | */ |
| | | private EntryID getParentID(DN parentDN, DN2ID dn2id, Transaction txn) |
| | | throws DatabaseException |
| | | { |
| | | EntryID parentID = parentIDMap.get(parentDN); |
| | | if (parentID != null) |
| | | { |
| | | return parentID; |
| | | } |
| | | |
| | | parentID = dn2id.get(txn, parentDN); |
| | | if (parentID != null) |
| | | { |
| | | if (parentIDMap.size() >= PARENT_ID_MAP_SIZE) |
| | | { |
| | | parentIDMap.keySet().iterator().remove(); |
| | | } |
| | | |
| | | parentIDMap.put(parentDN, parentID); |
| | | } |
| | | |
| | | return parentID; |
| | | } |
| | | |
| | | /** |
| | | * Get a statistic of the number of keys that reached the entry limit. |
| | | * @return The number of keys that reached the entry limit. |
| | | */ |
| | |
| | | * @param leftMargin white spaces used to indent traces |
| | | * @return a string buffer that contains trace information |
| | | */ |
| | | public StringBuffer toString(String leftMargin) |
| | | public StringBuilder toString(String leftMargin) |
| | | { |
| | | StringBuffer sb = new StringBuffer(); |
| | | StringBuilder sb = new StringBuilder(); |
| | | String newMargin = leftMargin + " "; |
| | | |
| | | sb.append (leftMargin + "Networkgroup (" + networkGroupID+ "\n"); |
| | |
| | | * @param leftMargin white spaces used to indent traces |
| | | * @return a string buffer that contains trace information |
| | | */ |
| | | public StringBuffer toString (String leftMargin) |
| | | public StringBuilder toString (String leftMargin) |
| | | { |
| | | StringBuffer sb = new StringBuffer(); |
| | | StringBuilder sb = new StringBuilder(); |
| | | String newMargin = leftMargin + " "; |
| | | |
| | | sb.append (leftMargin + "List of naming contexts:\n"); |
| | |
| | | * @param leftMargin white spaces used to indent the traces |
| | | * @return a string buffer that contains trace information |
| | | */ |
| | | public StringBuffer toString(String leftMargin) |
| | | public StringBuilder toString(String leftMargin) |
| | | { |
| | | StringBuffer sb = new StringBuffer(); |
| | | StringBuilder sb = new StringBuilder(); |
| | | |
| | | // display the baseDN |
| | | sb.append(leftMargin + "Workflow baseDN:[ \"\" ]\n"); |
| | |
| | | * @param leftMargin white spaces used to indent the traces |
| | | * @return a string buffer that contains trace information |
| | | */ |
| | | public StringBuffer toString(String leftMargin) |
| | | public StringBuilder toString(String leftMargin) |
| | | { |
| | | StringBuffer sb = new StringBuffer(); |
| | | StringBuilder sb = new StringBuilder(); |
| | | |
| | | // display the baseDN |
| | | DN baseDN = getBaseDN(); |
| | |
| | | |
| | | |
| | | import java.security.MessageDigest; |
| | | import java.security.SecureRandom; |
| | | import java.util.Arrays; |
| | | import java.util.Random; |
| | | import java.util.concurrent.locks.ReentrantLock; |
| | | |
| | | import org.opends.messages.Message; |
| | |
| | | private ReentrantLock digestLock; |
| | | |
| | | // The secure random number generator to use to generate the salt values. |
| | | private SecureRandom random; |
| | | private Random random; |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | digestLock = new ReentrantLock(); |
| | | random = new SecureRandom(); |
| | | random = new Random(); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | import java.security.MessageDigest; |
| | | import java.security.SecureRandom; |
| | | import java.util.Arrays; |
| | | import java.util.Random; |
| | | import java.util.concurrent.locks.ReentrantLock; |
| | | |
| | | import org.opends.messages.Message; |
| | |
| | | private ReentrantLock digestLock; |
| | | |
| | | // The secure random number generator to use to generate the salt values. |
| | | private SecureRandom random; |
| | | private Random random; |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | digestLock = new ReentrantLock(); |
| | | random = new SecureRandom(); |
| | | random = new Random(); |
| | | } |
| | | |
| | | |
| | |
| | | throws DirectoryException |
| | | { |
| | | byte[] saltBytes = new byte[NUM_SALT_BYTES]; |
| | | new SecureRandom().nextBytes(saltBytes); |
| | | new Random().nextBytes(saltBytes); |
| | | |
| | | byte[] passwordPlusSalt = new byte[passwordBytes.length + NUM_SALT_BYTES]; |
| | | System.arraycopy(passwordBytes, 0, passwordPlusSalt, 0, |
| | |
| | | |
| | | |
| | | import java.security.MessageDigest; |
| | | import java.security.SecureRandom; |
| | | import java.util.Arrays; |
| | | import java.util.Random; |
| | | import java.util.concurrent.locks.ReentrantLock; |
| | | |
| | | import org.opends.messages.Message; |
| | |
| | | private ReentrantLock digestLock; |
| | | |
| | | // The secure random number generator to use to generate the salt values. |
| | | private SecureRandom random; |
| | | private Random random; |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | digestLock = new ReentrantLock(); |
| | | random = new SecureRandom(); |
| | | random = new Random(); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | import java.security.MessageDigest; |
| | | import java.security.SecureRandom; |
| | | import java.util.Arrays; |
| | | import java.util.Random; |
| | | import java.util.concurrent.locks.ReentrantLock; |
| | | |
| | | import org.opends.messages.Message; |
| | |
| | | private ReentrantLock digestLock; |
| | | |
| | | // The secure random number generator to use to generate the salt values. |
| | | private SecureRandom random; |
| | | private Random random; |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | digestLock = new ReentrantLock(); |
| | | random = new SecureRandom(); |
| | | random = new Random(); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | import java.security.MessageDigest; |
| | | import java.security.SecureRandom; |
| | | import java.util.Arrays; |
| | | import java.util.Random; |
| | | import java.util.concurrent.locks.ReentrantLock; |
| | | |
| | | import org.opends.messages.Message; |
| | |
| | | private ReentrantLock digestLock; |
| | | |
| | | // The secure random number generator to use to generate the salt values. |
| | | private SecureRandom random; |
| | | private Random random; |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | digestLock = new ReentrantLock(); |
| | | random = new SecureRandom(); |
| | | random = new Random(); |
| | | } |
| | | |
| | | |
| | |
| | | throws DirectoryException |
| | | { |
| | | byte[] saltBytes = new byte[NUM_SALT_BYTES]; |
| | | new SecureRandom().nextBytes(saltBytes); |
| | | new Random().nextBytes(saltBytes); |
| | | |
| | | byte[] passwordPlusSalt = new byte[passwordBytes.length + NUM_SALT_BYTES]; |
| | | System.arraycopy(passwordBytes, 0, passwordPlusSalt, 0, |
| | |
| | | public static String formatStackTrace(Throwable t, int maxDepth, |
| | | boolean includeCause) |
| | | { |
| | | StringBuffer buffer= new StringBuffer(); |
| | | StringBuilder buffer= new StringBuilder(); |
| | | |
| | | while(t != null) |
| | | { |
| | |
| | | public static String formatStackTrace(StackTraceElement[] stackTrace, |
| | | int maxDepth) |
| | | { |
| | | StringBuffer buffer= new StringBuffer(); |
| | | StringBuilder buffer= new StringBuilder(); |
| | | |
| | | if (stackTrace != null) { |
| | | int frameLimit= Math.min(maxDepth, stackTrace.length); |
| | |
| | | |
| | | private String buildDefaultEntryMessage(Object[] args) |
| | | { |
| | | StringBuffer format = new StringBuffer(); |
| | | StringBuilder format = new StringBuilder(); |
| | | for (int i = 0; i < args.length; i++) |
| | | { |
| | | if (i != 0) format.append(", "); |
| | |
| | | |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import org.opends.server.protocols.asn1.ASN1OctetString; |
| | | |
| | | import static org.opends.messages.SchemaMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import static org.opends.messages.SchemaMessages.*; |
| | | import org.opends.messages.Message; |
| | | |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | |
| | | * @param rdnComponents The set of RDN components that make up |
| | | * this DN. |
| | | */ |
| | | public DN(ArrayList<RDN> rdnComponents) |
| | | public DN(List<RDN> rdnComponents) |
| | | { |
| | | if ((rdnComponents == null) || rdnComponents.isEmpty()) |
| | | { |
| | |
| | | // A null or empty DN is acceptable. |
| | | if (dnString == null) |
| | | { |
| | | return new DN(new ArrayList<RDN>(0)); |
| | | return NULL_DN; |
| | | } |
| | | |
| | | byte[] dnBytes = dnString.value(); |
| | | int length = dnBytes.length; |
| | | if (length == 0) |
| | | { |
| | | return new DN(new ArrayList<RDN>(0)); |
| | | return NULL_DN; |
| | | } |
| | | |
| | | |
| | |
| | | // This means that the DN was completely comprised of spaces |
| | | // and therefore should be considered the same as a null or |
| | | // empty DN. |
| | | return new DN(new ArrayList<RDN>(0)); |
| | | return NULL_DN; |
| | | } |
| | | else |
| | | { |
| | |
| | | // components. |
| | | boolean allowExceptions = |
| | | DirectoryServer.allowAttributeNameExceptions(); |
| | | ArrayList<RDN> rdnComponents = new ArrayList<RDN>(); |
| | | LinkedList<RDN> rdnComponents = new LinkedList<RDN>(); |
| | | while (true) |
| | | { |
| | | StringBuilder attributeName = new StringBuilder(); |
| | |
| | | // A null or empty DN is acceptable. |
| | | if (dnString == null) |
| | | { |
| | | return new DN(new ArrayList<RDN>(0)); |
| | | return NULL_DN; |
| | | } |
| | | |
| | | int length = dnString.length(); |
| | | if (length == 0) |
| | | { |
| | | return new DN(new ArrayList<RDN>(0)); |
| | | return NULL_DN; |
| | | } |
| | | |
| | | |
| | |
| | | // This means that the DN was completely comprised of spaces |
| | | // and therefore should be considered the same as a null or |
| | | // empty DN. |
| | | return new DN(new ArrayList<RDN>(0)); |
| | | return NULL_DN; |
| | | } |
| | | else |
| | | { |
| | |
| | | // components. |
| | | boolean allowExceptions = |
| | | DirectoryServer.allowAttributeNameExceptions(); |
| | | ArrayList<RDN> rdnComponents = new ArrayList<RDN>(); |
| | | LinkedList<RDN> rdnComponents = new LinkedList<RDN>(); |
| | | while (true) |
| | | { |
| | | StringBuilder attributeName = new StringBuilder(); |
| | |
| | | StringBuilder hexChars) |
| | | throws DirectoryException |
| | | { |
| | | if (hexChars.length() == 0) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | try |
| | | { |
| | | byte[] hexBytes = hexStringToByteArray(hexChars.toString()); |
| | |
| | | |
| | | |
| | | // Next, the set of objectclasses. |
| | | final boolean typesOnly = exportConfig.typesOnly(); |
| | | if (exportConfig.includeObjectClasses()) |
| | | { |
| | | if (exportConfig.typesOnly()) |
| | | if (typesOnly) |
| | | { |
| | | StringBuilder ocLine = new StringBuilder("objectClass:"); |
| | | writeLDIFLine(ocLine, writer, wrapLines, wrapColumn); |
| | |
| | | continue; |
| | | } |
| | | |
| | | if (exportConfig.typesOnly()) |
| | | if (typesOnly) |
| | | { |
| | | StringBuilder attrName = new StringBuilder(a.getName()); |
| | | for (String o : a.getOptions()) |
| | |
| | | continue; |
| | | } |
| | | |
| | | if (exportConfig.typesOnly()) |
| | | if (typesOnly) |
| | | { |
| | | StringBuilder attrName = new StringBuilder(a.getName()); |
| | | for (String o : a.getOptions()) |
| | |
| | | { |
| | | for (Attribute a : suppressedAttributes.get(t)) |
| | | { |
| | | if (exportConfig.typesOnly()) |
| | | if (typesOnly) |
| | | { |
| | | StringBuilder attrName = new StringBuilder(a.getName()); |
| | | for (String o : a.getOptions()) |
| | |
| | | } |
| | | |
| | | |
| | | // If we're running Java 6, then we'll use the methods that Java |
| | | // provides. Even though it's potentially less fine-grained on a |
| | | // UNIX-based system, it is more efficient and doesn't require an |
| | | // external process. |
| | | if ((setReadableMethod != null) && (setWritableMethod != null) && |
| | | (setExecutableMethod != null)) |
| | | { |
| | | return setUsingJava(f, p); |
| | | } |
| | | |
| | | |
| | | // If it's a UNIX-based system, then try using the chmod command |
| | | // to set the permissions. Otherwise (or if that fails), then try |
| | | // to use the Java 6 API. |
| | |
| | | |
| | | // FIXME -- Consider using cacls on Windows. |
| | | |
| | | if ((setReadableMethod != null) && (setWritableMethod != null) && |
| | | (setExecutableMethod != null)) |
| | | { |
| | | return setUsingJava(f, p); |
| | | } |
| | | |
| | | |
| | | // We have no way to set file permissions on this system. |
| | | return false; |
| | |
| | | */ |
| | | static public String listToString(List<?> list, String separator) |
| | | { |
| | | StringBuffer sb = new StringBuffer(); |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | sb.append(list.get(i)); |
| | | if (i < list.size() - 1) { |
| | |
| | | |
| | | /** |
| | | * Provides a single DN to search a workflow in a network group. |
| | | * |
| | | * |
| | | * Each set of DNs is composed of: |
| | | * - one baseDN |
| | | * - one subordinateDN |
| | |
| | | // |
| | | //=========================================================================== |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the network group registration. |
| | | * |
| | | * |
| | | * @param networkGroupID the ID of the network group to register |
| | | * @param workflowBaseDN1 the base DN of the first workflow node to register |
| | | * in the network group |
| | |
| | | // Create and register the network group with the server. |
| | | NetworkGroup networkGroup = new NetworkGroup(networkGroupID); |
| | | networkGroup.register(); |
| | | |
| | | |
| | | // Register again the network group with the server and catch the |
| | | // expected DirectoryServer exception. |
| | | boolean exceptionRaised = false; |
| | |
| | | WorkflowElement nullWE = null; |
| | | WorkflowImpl workflow = new WorkflowImpl( |
| | | workflowBaseDN.toString(), workflowBaseDN, nullWE); |
| | | |
| | | |
| | | // Register the workflow with the network group. |
| | | networkGroup.registerWorkflow(workflow); |
| | | |
| | | |
| | | // Register again the workflow with the network group and catch the |
| | | // expected DirectoryServer exception. |
| | | exceptionRaised = false; |
| | |
| | | ERR_REGISTER_WORKFLOW_NODE_ALREADY_EXISTS); |
| | | } |
| | | assertEquals(exceptionRaised, true); |
| | | |
| | | |
| | | // Clean the network group |
| | | networkGroup.deregisterWorkflow(workflow.getWorkflowId()); |
| | | networkGroup.deregister(); |
| | |
| | | doCheckNetworkGroup(networkGroup, dn2, subordinate2, unrelatedDN, true); |
| | | doCheckNetworkGroup(networkGroup, dn3, subordinate3, unrelatedDN, true); |
| | | } |
| | | |
| | | |
| | | if (w2 != null) |
| | | { |
| | | networkGroup.deregisterWorkflow(w2.getWorkflowId()); |
| | |
| | | doCheckNetworkGroup(networkGroup, dn2, subordinate2, unrelatedDN, false); |
| | | doCheckNetworkGroup(networkGroup, dn3, subordinate3, unrelatedDN, true); |
| | | } |
| | | |
| | | |
| | | if (w3 != null) |
| | | { |
| | | networkGroup.deregisterWorkflow(w3.getWorkflowId()); |
| | |
| | | doCheckNetworkGroup(networkGroup, dn2, subordinate2, unrelatedDN, false); |
| | | doCheckNetworkGroup(networkGroup, dn3, subordinate3, unrelatedDN, false); |
| | | } |
| | | |
| | | |
| | | // Deregister the network group |
| | | networkGroup.deregister(); |
| | | } |
| | |
| | | Workflow workflow2 = networkGroup.getWorkflowCandidate(dnSubordinate); |
| | | assertEquals(workflow2, workflow); |
| | | } |
| | | |
| | | |
| | | // Check that the unrelatedDN is not handled by any workflow |
| | | if (unrelatedDN != null) |
| | | { |
| | |
| | | |
| | | return workflow; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * Prints a text to System.out. |
| | | */ |
| | |
| | | { |
| | | System.out.print(msg); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * Prints a text to System.out. |
| | | */ |
| | |
| | | write(msg + "\n"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * Dump the network group info to the console. |
| | | */ |
| | |
| | | |
| | | if (doDump) |
| | | { |
| | | StringBuffer sb = networkGroup.toString(prompt); |
| | | writeln(sb.toString()); |
| | | StringBuilder sb = networkGroup.toString(prompt); |
| | | writeln(sb.toString()); |
| | | } |
| | | } |
| | | |
| | |
| | | assertEquals (readDN1, null); |
| | | assertEquals (readDN2, null); |
| | | assertEquals (readDN3, null); |
| | | |
| | | |
| | | // ====================================================== |
| | | // Remove a workflow in the chain and check that |
| | | // the route algorithm is still working |
| | |
| | | assertEquals (readDN1, baseDN1); |
| | | assertEquals (readDN2, baseDN1); // was baseDN2 before the removal... |
| | | assertEquals (readDN3, baseDN3); |
| | | |
| | | |
| | | // sanity check1 |
| | | // subordinate3 should be handled by w3 only |
| | | readDN1 = w3.getParentBaseDN (subordinateDN1); |
| | |
| | | assertEquals (readDN1, null); |
| | | assertEquals (readDN2, null); |
| | | assertEquals (readDN3, baseDN3); |
| | | |
| | | |
| | | // sanity check2 |
| | | // unrelatedDN should be handled by none of the workflows |
| | | readDN1 = w1.getParentBaseDN (unrelatedDN); |
| | |
| | | assertEquals (readDN1, null); |
| | | assertEquals (readDN2, null); |
| | | assertEquals (readDN3, null); |
| | | |
| | | |
| | | } // createWorkflow_simpleTopology2 |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | // dump the topology |
| | | StringBuffer sb = w1.toString (""); |
| | | StringBuilder sb = w1.toString (""); |
| | | System.out.println (sb); |
| | | |
| | | } // createWorkflow_complexTopology1 |
| | |
| | | // Create a workflow to handle the baseDN with no workflow element |
| | | WorkflowImpl workflow = new WorkflowImpl( |
| | | baseDN.toString(), baseDN, nullWE); |
| | | |
| | | |
| | | // Register the workflow with the server. Don't catch the |
| | | // DirectoryException that could be thrown by the register() method. |
| | | workflow.register(); |
| | | |
| | | |
| | | // Register the same workflow twice and catch the expected |
| | | // DirectoryException. |
| | | boolean exceptionRaised = false; |