You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2007/10/22 23:20:02 UTC
svn commit: r587265 [2/2] - in /directory/studio/trunk:
studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/
studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/dialogs/
stud...
Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/IBrowserConnection.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/IBrowserConnection.java?rev=587265&r1=587264&r2=587265&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/IBrowserConnection.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/IBrowserConnection.java Mon Oct 22 14:20:01 2007
@@ -51,17 +51,145 @@
IRootDSE.ROOTDSE_ATTRIBUTE_SUPPORTEDSASLMECHANISM, ISearch.ALL_OPERATIONAL_ATTRIBUTES,
ISearch.ALL_USER_ATTRIBUTES };
- public static final int DEREFERENCE_ALIASES_NEVER = 0;
-
- public static final int DEREFERENCE_ALIASES_ALWAYS = 1;
-
- public static final int DEREFERENCE_ALIASES_FINDING = 2;
-
- public static final int DEREFERENCE_ALIASES_SEARCH = 3;
-
- public static final int HANDLE_REFERRALS_IGNORE = 0;
-
- public static final int HANDLE_REFERRALS_FOLLOW = 1;
+
+ /**
+ * Enum for the used alias dereferencing method.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+ public enum AliasDereferencingMethod
+ {
+
+ /** Never. */
+ NEVER(0),
+
+ /** Always. */
+ ALWAYS(1),
+
+ /** Finding. */
+ FINDING(2),
+
+ /** Search. */
+ SEARCH(3);
+
+ private final int ordinal;
+
+
+ private AliasDereferencingMethod( int ordinal )
+ {
+ this.ordinal = ordinal;
+ }
+
+
+ /**
+ * Gets the ordinal.
+ *
+ * @return the ordinal
+ */
+ public int getOrdinal()
+ {
+ return ordinal;
+ }
+
+
+ /**
+ * Gets the AliasDereferencingMethod by ordinal.
+ *
+ * @param ordinal the ordinal
+ *
+ * @return the AliasDereferencingMethod
+ */
+ public static AliasDereferencingMethod getByOrdinal( int ordinal )
+ {
+ switch ( ordinal )
+ {
+ case 0:
+ return NEVER;
+ case 1:
+ return ALWAYS;
+ case 2:
+ return FINDING;
+ case 3:
+ return SEARCH;
+ default:
+ return null;
+ }
+ }
+ }
+
+ /**
+ * Enum for the used referral handling method.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+ public enum ReferralHandlingMethod
+ {
+
+ /** Ignore. */
+ IGNORE(0),
+
+ /** Follow. */
+ FOLLOW(1),
+
+ /** Manual. */
+ MANUAL(2);
+
+ private final int ordinal;
+
+
+ private ReferralHandlingMethod( int ordinal )
+ {
+ this.ordinal = ordinal;
+ }
+
+
+ /**
+ * Gets the ordinal.
+ *
+ * @return the ordinal
+ */
+ public int getOrdinal()
+ {
+ return ordinal;
+ }
+
+
+ /**
+ * Gets the ReferralHandlingMethod by ordinal.
+ *
+ * @param ordinal the ordinal
+ *
+ * @return the ReferralHandlingMethod
+ */
+ public static ReferralHandlingMethod getByOrdinal( int ordinal )
+ {
+ switch ( ordinal )
+ {
+ case 0:
+ return IGNORE;
+ case 1:
+ return FOLLOW;
+ case 2:
+ return MANUAL;
+ default:
+ return null;
+ }
+ }
+ }
+
+// public static final int DEREFERENCE_ALIASES_NEVER = 0;
+//
+// public static final int DEREFERENCE_ALIASES_ALWAYS = 1;
+//
+// public static final int DEREFERENCE_ALIASES_FINDING = 2;
+//
+// public static final int DEREFERENCE_ALIASES_SEARCH = 3;
+//
+// public static final int HANDLE_REFERRALS_IGNORE = 0;
+//
+// public static final int HANDLE_REFERRALS_FOLLOW = 1;
public static final String CONTROL_MANAGEDSAIT = "2.16.840.1.113730.3.4.2"; //$NON-NLS-1$
@@ -87,16 +215,16 @@
public abstract void setCountLimit( int countLimit );
- public abstract int getAliasesDereferencingMethod();
+ public abstract AliasDereferencingMethod getAliasesDereferencingMethod();
- public abstract void setAliasesDereferencingMethod( int aliasesDereferencingMethod );
+ public abstract void setAliasesDereferencingMethod( AliasDereferencingMethod aliasesDereferencingMethod );
- public abstract int getReferralsHandlingMethod();
+ public abstract ReferralHandlingMethod getReferralsHandlingMethod();
- public abstract void setReferralsHandlingMethod( int referralsHandlingMethod );
+ public abstract void setReferralsHandlingMethod( ReferralHandlingMethod referralsHandlingMethod );
public abstract int getTimeLimit();
Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ISearch.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ISearch.java?rev=587265&r1=587264&r2=587265&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ISearch.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ISearch.java Mon Oct 22 14:20:01 2007
@@ -24,6 +24,8 @@
import java.io.Serializable;
import org.apache.directory.studio.connection.core.ConnectionPropertyPageProvider;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection.AliasDereferencingMethod;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection.ReferralHandlingMethod;
import org.apache.directory.studio.ldapbrowser.core.propertypageproviders.SearchPropertyPageProvider;
import org.eclipse.core.runtime.IAdaptable;
@@ -59,14 +61,66 @@
/** Filter for fetching subentries (|(objectClass=subentry)(objectClass=ldapSubentry)) */
public static final String FILTER_SUBENTRY = "(|(objectClass=subentry)(objectClass=ldapSubentry))"; //$NON-NLS-1$
- /** Search scope object */
- public static final int SCOPE_OBJECT = 0;
-
- /** Search scope one level */
- public static final int SCOPE_ONELEVEL = 1;
+ /**
+ * Enum for the used search scope.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+ public enum SearchScope
+ {
- /** Search scope subtree */
- public static final int SCOPE_SUBTREE = 2;
+ /** Object. */
+ OBJECT(0),
+
+ /** Onelevel. */
+ ONELEVEL(1),
+
+ /** Subtree. */
+ SUBTREE(2);
+
+ private final int ordinal;
+
+
+ private SearchScope( int ordinal )
+ {
+ this.ordinal = ordinal;
+ }
+
+
+ /**
+ * Gets the ordinal.
+ *
+ * @return the ordinal
+ */
+ public int getOrdinal()
+ {
+ return ordinal;
+ }
+
+
+ /**
+ * Gets the SearchScope by ordinal.
+ *
+ * @param ordinal the ordinal
+ *
+ * @return the SearchScope
+ */
+ public static SearchScope getByOrdinal( int ordinal )
+ {
+ switch ( ordinal )
+ {
+ case 0:
+ return OBJECT;
+ case 1:
+ return ONELEVEL;
+ case 2:
+ return SUBTREE;
+ default:
+ return null;
+ }
+ }
+ }
/**
@@ -156,66 +210,58 @@
/**
- * Gets the search scope, one of ISearch.SCOPE_OBJECT,
- * ISearch.SCOPE_ONELEVEL or ISearch.SCOPE_SUBTREE.
+ * Gets the search scope.
*
* @return the search scope
*/
- public abstract int getScope();
+ public abstract SearchScope getScope();
/**
- * Sets the search scope, one of ISearch.SCOPE_OBJECT,
- * ISearch.SCOPE_ONELEVEL or ISearch.SCOPE_SUBTREE.
+ * Sets the search scope.
*
* Calling this method causes firing a search update event.
*
* @param scope the search scope
*/
- public abstract void setScope( int scope );
+ public abstract void setScope( SearchScope scope );
/**
- * Gets the aliases dereferencing method, one of IConnection.DEREFERENCE_ALIASES_NEVER,
- * IConnection.DEREFERENCE_ALIASES_ALWAYS, IConnection.DEREFERENCE_ALIASES_FINDING
- * or IConnection.DEREFERENCE_ALIASES_SEARCH.
+ * Gets the aliases dereferencing method.
*
*
* @return the aliases dereferencing method
*/
- public abstract int getAliasesDereferencingMethod();
+ public abstract AliasDereferencingMethod getAliasesDereferencingMethod();
/**
- * Sets the aliases dereferencing method, one of IConnection.DEREFERENCE_ALIASES_NEVER,
- * IConnection.DEREFERENCE_ALIASES_ALWAYS, IConnection.DEREFERENCE_ALIASES_FINDING
- * or IConnection.DEREFERENCE_ALIASES_SEARCH.
+ * Sets the aliases dereferencing method.
*
* Calling this method causes firing a search update event.
*
* @param aliasesDereferencingMethod the aliases dereferencing method
*/
- public abstract void setAliasesDereferencingMethod( int aliasesDereferencingMethod );
+ public abstract void setAliasesDereferencingMethod( AliasDereferencingMethod aliasesDereferencingMethod );
/**
- * Gets the referrals handling method, one of IConnection.HANDLE_REFERRALS_IGNORE
- * or IConnection.HANDLE_REFERRALS_FOLLOW.
+ * Gets the referrals handling method.
*
* @return the referrals handling method
*/
- public abstract int getReferralsHandlingMethod();
+ public abstract ReferralHandlingMethod getReferralsHandlingMethod();
/**
- * Sets the referrals handling method, one of IConnection.HANDLE_REFERRALS_IGNORE or
- * IConnection.HANDLE_REFERRALS_FOLLOW.
+ * Sets the referrals handling method.
*
* Calling this method causes firing a search update event.
*
* @param referralsHandlingMethod the referrals handling method
*/
- public abstract void setReferralsHandlingMethod( int referralsHandlingMethod );
+ public abstract void setReferralsHandlingMethod( ReferralHandlingMethod referralsHandlingMethod );
/**
Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/SearchParameter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/SearchParameter.java?rev=587265&r1=587264&r2=587265&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/SearchParameter.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/SearchParameter.java Mon Oct 22 14:20:01 2007
@@ -23,6 +23,10 @@
import java.io.Serializable;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection.AliasDereferencingMethod;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection.ReferralHandlingMethod;
+import org.apache.directory.studio.ldapbrowser.core.model.ISearch.SearchScope;
+
/**
* A Bean class to hold the search parameters.
@@ -49,8 +53,8 @@
/** The returning attributes. */
private String[] returningAttributes;
- /** The search scope, one of ISearch.SCOPE_OBJECT, ISearch.SCOPE_ONELEVEL or ISearch.SCOPE_SUBTREE. */
- private int scope;
+ /** The search scope. */
+ private SearchScope scope;
/** The time limit in milliseconds, 0 means no limit. */
private int timeLimit;
@@ -58,19 +62,19 @@
/** The count limit, 0 means no limit. */
private int countLimit;
- /** The alias dereferencing method, one of IConnection.DEREFERENCE_ALIASES_NEVER, IConnection.DEREFERENCE_ALIASES_ALWAYS, IConnection.DEREFERENCE_ALIASES_FINDING or IConnection.DEREFERENCE_ALIASES_SEARCH. */
- private int aliasesDereferencingMethod;
+ /** The alias dereferencing method. */
+ private AliasDereferencingMethod aliasesDereferencingMethod;
- /** The referrals handling method, one of IConnection.HANDLE_REFERRALS_IGNORE or IConnection.HANDLE_REFERRALS_FOLLOW. */
- private int referralsHandlingMethod;
+ /** The referrals handling method. */
+ private ReferralHandlingMethod referralsHandlingMethod;
/** The controls */
private Control[] controls;
- /** Flag indicating wether the hasChildren flag of IEntry should be initialized */
+ /** Flag indicating weather the hasChildren flag of IEntry should be initialized */
private boolean initHasChildrenFlag;
- /** Flag indicating wether the isAlias and isReferral flag of IEntry should be initialized */
+ /** Flag indicating weather the isAlias and isReferral flag of IEntry should be initialized */
private boolean initAliasAndReferralFlag;
@@ -97,11 +101,11 @@
searchBase = null;
filter = ISearch.FILTER_TRUE;
returningAttributes = ISearch.NO_ATTRIBUTES;
- scope = ISearch.SCOPE_ONELEVEL;
+ scope = SearchScope.ONELEVEL;
timeLimit = 0;
countLimit = 0;
- aliasesDereferencingMethod = IBrowserConnection.DEREFERENCE_ALIASES_NEVER;
- referralsHandlingMethod = IBrowserConnection.HANDLE_REFERRALS_IGNORE;
+ aliasesDereferencingMethod = AliasDereferencingMethod.NEVER;
+ referralsHandlingMethod = ReferralHandlingMethod.IGNORE;
controls = null;
initHasChildrenFlag = false;
initAliasAndReferralFlag = false;
@@ -208,74 +212,66 @@
/**
- * Gets the scope, one of ISearch.SCOPE_OBJECT,
- * ISearch.SCOPE_ONELEVEL or ISearch.SCOPE_SUBTREE.
+ * Gets the scope.
*
* @return the scope
*/
- public int getScope()
+ public SearchScope getScope()
{
return scope;
}
/**
- * Sets the scope, one of ISearch.SCOPE_OBJECT,
- * ISearch.SCOPE_ONELEVEL or ISearch.SCOPE_SUBTREE.
+ * Sets the scope.
*
* @param scope the scope
*/
- public void setScope( int scope )
+ public void setScope( SearchScope scope )
{
this.scope = scope;
}
/**
- * Gets the aliases dereferencing method, one of IConnection.DEREFERENCE_ALIASES_NEVER,
- * IConnection.DEREFERENCE_ALIASES_ALWAYS, IConnection.DEREFERENCE_ALIASES_FINDING
- * or IConnection.DEREFERENCE_ALIASES_SEARCH.
+ * Gets the aliases dereferencing method.
*
* @return the aliases dereferencing method
*/
- public int getAliasesDereferencingMethod()
+ public AliasDereferencingMethod getAliasesDereferencingMethod()
{
return aliasesDereferencingMethod;
}
/**
- * Sets the aliases dereferencing method, one of IConnection.DEREFERENCE_ALIASES_NEVER,
- * IConnection.DEREFERENCE_ALIASES_ALWAYS, IConnection.DEREFERENCE_ALIASES_FINDING
- * or IConnection.DEREFERENCE_ALIASES_SEARCH.
+ * Sets the aliases dereferencing method.
*
* @param aliasesDereferencingMethod the aliases dereferencing method
*/
- public void setAliasesDereferencingMethod( int aliasesDereferencingMethod )
+ public void setAliasesDereferencingMethod( AliasDereferencingMethod aliasesDereferencingMethod )
{
this.aliasesDereferencingMethod = aliasesDereferencingMethod;
}
/**
- * Gets the referrals handling method, one of IConnection.HANDLE_REFERRALS_IGNORE
- * or IConnection.HANDLE_REFERRALS_FOLLOW.
+ * Gets the referrals handling method.
*
* @return the referrals handling method
*/
- public int getReferralsHandlingMethod()
+ public ReferralHandlingMethod getReferralsHandlingMethod()
{
return referralsHandlingMethod;
}
/**
- * Sets the referrals handling method, one of IConnection.HANDLE_REFERRALS_IGNORE or
- * IConnection.HANDLE_REFERRALS_FOLLOW.
+ * Sets the referrals handling method.
*
* @param referralsHandlingMethod the referrals handling method
*/
- public void setReferralsHandlingMethod( int referralsHandlingMethod )
+ public void setReferralsHandlingMethod( ReferralHandlingMethod referralsHandlingMethod )
{
this.referralsHandlingMethod = referralsHandlingMethod;
}
Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/URL.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/URL.java?rev=587265&r1=587264&r2=587265&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/URL.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/URL.java Mon Oct 22 14:20:01 2007
@@ -26,6 +26,7 @@
import org.apache.directory.studio.connection.core.ConnectionParameter.EncryptionMethod;
import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
+import org.apache.directory.studio.ldapbrowser.core.model.ISearch.SearchScope;
import org.apache.directory.studio.ldapbrowser.core.utils.Utils;
@@ -161,8 +162,8 @@
}
this.attributes = Utils.arrayToString( search.getReturningAttributes() );
- this.scope = search.getScope() == ISearch.SCOPE_SUBTREE ? "sub" : //$NON-NLS-1$
- search.getScope() == ISearch.SCOPE_ONELEVEL ? "one" : //$NON-NLS-1$
+ this.scope = search.getScope() == SearchScope.SUBTREE ? "sub" : //$NON-NLS-1$
+ search.getScope() == SearchScope.ONELEVEL ? "one" : //$NON-NLS-1$
"base"; //$NON-NLS-1$
this.filter = search.getFilter();
}
@@ -564,7 +565,7 @@
* @return the scope
* @throws NoSuchFieldException if not has scope
*/
- public int getScope() throws NoSuchFieldException
+ public SearchScope getScope() throws NoSuchFieldException
{
if ( scope == null )
{
@@ -572,13 +573,13 @@
}
if ( "base".equals( scope ) ) { //$NON-NLS-1$
- return ISearch.SCOPE_OBJECT;
+ return SearchScope.OBJECT;
}
else if ( "one".equals( scope ) ) { //$NON-NLS-1$
- return ISearch.SCOPE_ONELEVEL;
+ return SearchScope.ONELEVEL;
}
else if ( "sub".equals( scope ) ) { //$NON-NLS-1$
- return ISearch.SCOPE_SUBTREE;
+ return SearchScope.SUBTREE;
}
else
{
Modified: directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationApplyOnWizardPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationApplyOnWizardPage.java?rev=587265&r1=587264&r2=587265&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationApplyOnWizardPage.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/BatchOperationApplyOnWizardPage.java Mon Oct 22 14:20:01 2007
@@ -34,13 +34,12 @@
import org.apache.directory.studio.ldapbrowser.core.model.DN;
import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
import org.apache.directory.studio.ldapbrowser.core.model.IBookmark;
-import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
import org.apache.directory.studio.ldapbrowser.core.model.ISearchResult;
import org.apache.directory.studio.ldapbrowser.core.model.IValue;
import org.apache.directory.studio.ldapbrowser.core.model.NameException;
-
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection.ReferralHandlingMethod;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
@@ -212,7 +211,7 @@
this.initSearch.setName( null );
// never follow referrals for a batch operation!
- this.initSearch.setReferralsHandlingMethod( IBrowserConnection.HANDLE_REFERRALS_IGNORE );
+ this.initSearch.setReferralsHandlingMethod( ReferralHandlingMethod.IGNORE );
}