You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2007/01/10 16:44:53 UTC
svn commit: r494858 [1/2] - in
/directory/trunks/ldapstudio/ldapstudio-dsml-parser: ./
src/main/java/org/apache/directory/ldapstudio/dsmlv2/
src/main/java/org/apache/directory/ldapstudio/dsmlv2/engine/
src/main/java/org/apache/directory/ldapstudio/dsml...
Author: pamarcelot
Date: Wed Jan 10 07:44:50 2007
New Revision: 494858
URL: http://svn.apache.org/viewvc?view=rev&rev=494858
Log:
Adding a new Shared LDAP => XML DSML Request Decorators that allows to transform any Shared LDAP Request into an XML DSML Request. (DIRSTUDIO-29)
Added:
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/DsmlDecorator.java
- copied, changed from r494340, directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/DsmlDecorator.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/LdapMessageDecorator.java
- copied, changed from r494340, directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/LdapMessageDecorator.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/AbandonRequestDsml.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/AbstractRequestDsml.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/AddRequestDsml.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/AuthRequestDsml.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/CompareRequestDsml.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/DelRequestDsml.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/ExtendedRequestDsml.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/LdapRequestDecorator.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/ModifyDNRequestDsml.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/ModifyRequestDsml.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/SearchRequestDsml.java
Removed:
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/DsmlDecorator.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/LdapMessageDecorator.java
Modified:
directory/trunks/ldapstudio/ldapstudio-dsml-parser/.classpath
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/Dsmlv2Grammar.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/Dsmlv2ResponseGrammar.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/engine/Dsmlv2Engine.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/AddResponseDsml.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/AuthResponseDsml.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/CompareResponseDsml.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/DelResponseDsml.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/ErrorResponse.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/ExtendedResponseDsml.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/LdapResponseDecorator.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/LdapResultDsml.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/LdapResultEnum.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/ModDNResponseDsml.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/ModifyResponseDsml.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/SearchResultDoneDsml.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/SearchResultEntryDsml.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/SearchResultReferenceDsml.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/addResponse/AddResponseTest.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/authResponse/AuthResponseTest.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/compareResponse/CompareResponseTest.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/delResponse/DelResponseTest.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/extendedResponse/ExtendedResponseTest.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/modDNResponse/ModifyDNResponseTest.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/modifyRequest/ModifyRequestTest.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/modifyResponse/ModifyResponseTest.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/searchRequest/SearchRequestTest.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/searchResponse/searchResultDone/SearchResultDoneTest.java
directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/test/java/org/apache/directory/ldapstudio/dsmlv2/searchResponse/searchResultEntry/SearchResultEntryTest.java
Modified: directory/trunks/ldapstudio/ldapstudio-dsml-parser/.classpath
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/.classpath?view=diff&rev=494858&r1=494857&r2=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/.classpath (original)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/.classpath Wed Jan 10 07:44:50 2007
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java"/>
- <classpathentry output="target/classes" kind="src" path="src/main/resources"/>
- <classpathentry output="target/test-classes" kind="src" path="src/test/java"/>
- <classpathentry output="target/test-classes" kind="src" path="src/test/resources"/>
+ <classpathentry kind="src" output="target/classes" path="src/main/resources"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3.8.1"/>
<classpathentry kind="lib" path="lib/commons-collections-3.1.jar"/>
<classpathentry kind="lib" path="lib/dom4j-1.6.1.jar"/>
<classpathentry kind="lib" path="lib/nlog4j-1.2.25.jar"/>
<classpathentry kind="lib" path="lib/xpp3-1.1.3_8.jar"/>
- <classpathentry kind="lib" path="lib/shared-asn1-0.9.6-SNAPSHOT.jar"/>
- <classpathentry kind="lib" path="lib/shared-ldap-0.9.6-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="lib/antlr-2.7.6.jar"/>
+ <classpathentry kind="lib" path="lib/shared-ldap-0.9.6-SNAPSHOT.jar"/>
+ <classpathentry kind="lib" path="lib/shared-asn1-0.9.6-SNAPSHOT.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Copied: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/DsmlDecorator.java (from r494340, directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/DsmlDecorator.java)
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/DsmlDecorator.java?view=diff&rev=494858&p1=directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/DsmlDecorator.java&r1=494340&p2=directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/DsmlDecorator.java&r2=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/DsmlDecorator.java (original)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/DsmlDecorator.java Wed Jan 10 07:44:50 2007
@@ -18,7 +18,7 @@
*
*/
-package org.apache.directory.ldapstudio.dsmlv2.reponse;
+package org.apache.directory.ldapstudio.dsmlv2;
import org.dom4j.Element;
Modified: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/Dsmlv2Grammar.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/Dsmlv2Grammar.java?view=diff&rev=494858&r1=494857&r2=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/Dsmlv2Grammar.java (original)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/Dsmlv2Grammar.java Wed Jan 10 07:44:50 2007
@@ -54,6 +54,7 @@
import org.apache.directory.shared.ldap.codec.search.PresentFilter;
import org.apache.directory.shared.ldap.codec.search.SearchRequest;
import org.apache.directory.shared.ldap.codec.search.SubstringFilter;
+import org.apache.directory.shared.ldap.message.ScopeEnum;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.name.Rdn;
import org.apache.directory.shared.ldap.util.Base64;
@@ -1799,15 +1800,15 @@
{
if ( "baseObject".equals( attributeValue ) )
{
- searchRequest.setScope( LdapConstants.SCOPE_BASE_OBJECT );
+ searchRequest.setScope( ScopeEnum.BASE_OBJECT );
}
else if ( "singleLevel".equals( attributeValue ) )
{
- searchRequest.setScope( LdapConstants.SCOPE_SINGLE_LEVEL );
+ searchRequest.setScope( ScopeEnum.SINGLE_LEVEL );
}
else if ( "wholeSubtree".equals( attributeValue ) )
{
- searchRequest.setScope( LdapConstants.SCOPE_WHOLE_SUBTREE );
+ searchRequest.setScope( ScopeEnum.WHOLE_SUBTREE );
}
else
{
@@ -2134,34 +2135,19 @@
{
SearchRequest searchRequest = ( SearchRequest ) container.getBatchRequest().getCurrentRequest();
- XmlPullParser xpp = container.getParser();
-
Asn1Object parent = searchRequest.getCurrentFilter().getParent();
if ( parent instanceof Filter )
{
Filter filter = ( Filter ) parent;
- try
- {
- searchRequest.setCurrentFilter( filter );
- }
- catch ( DecoderException e )
- {
- throw new XmlPullParserException( e.getMessage(), xpp, null );
- }
+ searchRequest.setCurrentFilter( filter );
}
else
{
- try
- {
- searchRequest.setCurrentFilter( null );
- }
- catch ( DecoderException e )
- {
- throw new XmlPullParserException( e.getMessage(), xpp, null );
- }
+ searchRequest.setCurrentFilter( null );
}
+
}
};
Modified: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/Dsmlv2ResponseGrammar.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/Dsmlv2ResponseGrammar.java?view=diff&rev=494858&r1=494857&r2=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/Dsmlv2ResponseGrammar.java (original)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/Dsmlv2ResponseGrammar.java Wed Jan 10 07:44:50 2007
@@ -50,6 +50,7 @@
import org.apache.directory.shared.ldap.codec.search.SearchResultReference;
import org.apache.directory.shared.ldap.codec.util.LdapURL;
import org.apache.directory.shared.ldap.codec.util.LdapURLEncodingException;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.util.Base64;
import org.xmlpull.v1.XmlPullParser;
@@ -1365,7 +1366,7 @@
{
try
{
- ldapResult.setResultCode( Integer.parseInt( attributeValue ) );
+ ldapResult.setResultCode( ResultCodeEnum.getResultCode( Integer.parseInt( attributeValue ) ) );
}
catch ( NumberFormatException e )
{
Copied: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/LdapMessageDecorator.java (from r494340, directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/LdapMessageDecorator.java)
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/LdapMessageDecorator.java?view=diff&rev=494858&p1=directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/LdapMessageDecorator.java&r1=494340&p2=directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/LdapMessageDecorator.java&r2=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/LdapMessageDecorator.java (original)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/LdapMessageDecorator.java Wed Jan 10 07:44:50 2007
@@ -18,12 +18,13 @@
*
*/
-package org.apache.directory.ldapstudio.dsmlv2.reponse;
+package org.apache.directory.ldapstudio.dsmlv2;
import java.nio.ByteBuffer;
-import java.util.ArrayList;
+import java.util.List;
+import org.apache.directory.shared.asn1.AbstractAsn1Object;
import org.apache.directory.shared.asn1.Asn1Object;
import org.apache.directory.shared.asn1.codec.DecoderException;
import org.apache.directory.shared.asn1.codec.EncoderException;
@@ -181,7 +182,7 @@
* @see org.apache.directory.shared.ldap.codec.LdapMessage#getControls()
*/
@Override
- public ArrayList getControls()
+ public List<Control> getControls()
{
return instance.getControls();
}
@@ -441,7 +442,7 @@
* @see org.apache.directory.shared.asn1.Asn1Object#getParent()
*/
@Override
- public Asn1Object getParent()
+ public AbstractAsn1Object getParent()
{
return instance.getParent();
}
@@ -471,9 +472,8 @@
* @see org.apache.directory.shared.asn1.Asn1Object#setParent(org.apache.directory.shared.asn1.Asn1Object)
*/
@Override
- public void setParent( Asn1Object parent )
+ public void setParent( AbstractAsn1Object parent )
{
instance.setParent( parent );
}
-
}
Modified: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/engine/Dsmlv2Engine.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/engine/Dsmlv2Engine.java?view=diff&rev=494858&r1=494857&r2=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/engine/Dsmlv2Engine.java (original)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/engine/Dsmlv2Engine.java Wed Jan 10 07:44:50 2007
@@ -70,6 +70,7 @@
import org.apache.directory.shared.ldap.codec.bind.SimpleAuthentication;
import org.apache.directory.shared.ldap.codec.extended.ExtendedResponse;
import org.apache.directory.shared.ldap.codec.util.LdapResultEnum;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.util.StringTools;
import org.dom4j.Document;
@@ -424,10 +425,10 @@
if ( !continueOnError )
{
- if ( ( realResponse.getLdapResult().getResultCode() != LdapResultEnum.SUCCESS )
- && ( realResponse.getLdapResult().getResultCode() != LdapResultEnum.COMPARE_TRUE )
- && ( realResponse.getLdapResult().getResultCode() != LdapResultEnum.COMPARE_FALSE )
- && ( realResponse.getLdapResult().getResultCode() != LdapResultEnum.REFERRAL ) )
+ if ( ( realResponse.getLdapResult().getResultCode() != ResultCodeEnum.SUCCESS )
+ && ( realResponse.getLdapResult().getResultCode() != ResultCodeEnum.COMPARE_TRUE )
+ && ( realResponse.getLdapResult().getResultCode() != ResultCodeEnum.COMPARE_FALSE )
+ && ( realResponse.getLdapResult().getResultCode() != ResultCodeEnum.REFERRAL ) )
{
// Turning on Exit flag
exit = true;
@@ -596,7 +597,7 @@
{
BindResponse resp = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage().getBindResponse();
- if ( resp.getLdapResult().getResultCode() != 0 )
+ if ( resp.getLdapResult().getResultCode() != ResultCodeEnum.SUCCESS )
{
System.err.println( "Error : " + resp.getLdapResult().getErrorMessage() );
}
@@ -606,7 +607,7 @@
ExtendedResponse resp = ( ( LdapMessageContainer ) ldapMessageContainer ).getLdapMessage()
.getExtendedResponse();
- if ( resp.getLdapResult().getResultCode() != 0 )
+ if ( resp.getLdapResult().getResultCode() != ResultCodeEnum.SUCCESS )
{
System.err.println( "Error : " + resp.getLdapResult().getErrorMessage() );
}
Modified: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/AddResponseDsml.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/AddResponseDsml.java?view=diff&rev=494858&r1=494857&r2=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/AddResponseDsml.java (original)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/AddResponseDsml.java Wed Jan 10 07:44:50 2007
@@ -21,6 +21,7 @@
package org.apache.directory.ldapstudio.dsmlv2.reponse;
+import org.apache.directory.ldapstudio.dsmlv2.DsmlDecorator;
import org.apache.directory.shared.ldap.codec.LdapMessage;
import org.dom4j.Element;
Modified: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/AuthResponseDsml.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/AuthResponseDsml.java?view=diff&rev=494858&r1=494857&r2=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/AuthResponseDsml.java (original)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/AuthResponseDsml.java Wed Jan 10 07:44:50 2007
@@ -21,6 +21,7 @@
package org.apache.directory.ldapstudio.dsmlv2.reponse;
+import org.apache.directory.ldapstudio.dsmlv2.DsmlDecorator;
import org.apache.directory.shared.ldap.codec.LdapMessage;
import org.dom4j.Element;
Modified: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/CompareResponseDsml.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/CompareResponseDsml.java?view=diff&rev=494858&r1=494857&r2=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/CompareResponseDsml.java (original)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/CompareResponseDsml.java Wed Jan 10 07:44:50 2007
@@ -21,6 +21,7 @@
package org.apache.directory.ldapstudio.dsmlv2.reponse;
+import org.apache.directory.ldapstudio.dsmlv2.DsmlDecorator;
import org.apache.directory.shared.ldap.codec.LdapMessage;
import org.dom4j.Element;
Modified: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/DelResponseDsml.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/DelResponseDsml.java?view=diff&rev=494858&r1=494857&r2=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/DelResponseDsml.java (original)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/DelResponseDsml.java Wed Jan 10 07:44:50 2007
@@ -21,6 +21,7 @@
package org.apache.directory.ldapstudio.dsmlv2.reponse;
+import org.apache.directory.ldapstudio.dsmlv2.DsmlDecorator;
import org.apache.directory.shared.ldap.codec.LdapMessage;
import org.dom4j.Element;
Modified: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/ErrorResponse.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/ErrorResponse.java?view=diff&rev=494858&r1=494857&r2=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/ErrorResponse.java (original)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/ErrorResponse.java Wed Jan 10 07:44:50 2007
@@ -21,6 +21,7 @@
package org.apache.directory.ldapstudio.dsmlv2.reponse;
+import org.apache.directory.ldapstudio.dsmlv2.DsmlDecorator;
import org.apache.directory.shared.ldap.codec.LdapResponse;
import org.dom4j.Element;
Modified: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/ExtendedResponseDsml.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/ExtendedResponseDsml.java?view=diff&rev=494858&r1=494857&r2=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/ExtendedResponseDsml.java (original)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/ExtendedResponseDsml.java Wed Jan 10 07:44:50 2007
@@ -20,6 +20,7 @@
package org.apache.directory.ldapstudio.dsmlv2.reponse;
+import org.apache.directory.ldapstudio.dsmlv2.DsmlDecorator;
import org.apache.directory.ldapstudio.dsmlv2.ParserUtils;
import org.apache.directory.shared.ldap.codec.LdapMessage;
import org.apache.directory.shared.ldap.codec.extended.ExtendedResponse;
Modified: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/LdapResponseDecorator.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/LdapResponseDecorator.java?view=diff&rev=494858&r1=494857&r2=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/LdapResponseDecorator.java (original)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/LdapResponseDecorator.java Wed Jan 10 07:44:50 2007
@@ -21,6 +21,7 @@
package org.apache.directory.ldapstudio.dsmlv2.reponse;
+import org.apache.directory.ldapstudio.dsmlv2.LdapMessageDecorator;
import org.apache.directory.shared.ldap.codec.LdapMessage;
import org.apache.directory.shared.ldap.codec.LdapResponse;
import org.apache.directory.shared.ldap.codec.LdapResult;
Modified: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/LdapResultDsml.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/LdapResultDsml.java?view=diff&rev=494858&r1=494857&r2=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/LdapResultDsml.java (original)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/LdapResultDsml.java Wed Jan 10 07:44:50 2007
@@ -21,10 +21,12 @@
package org.apache.directory.ldapstudio.dsmlv2.reponse;
-import java.util.ArrayList;
+import java.util.List;
+import org.apache.directory.ldapstudio.dsmlv2.DsmlDecorator;
import org.apache.directory.shared.ldap.codec.LdapMessage;
import org.apache.directory.shared.ldap.codec.LdapResult;
+import org.apache.directory.shared.ldap.codec.util.LdapURL;
import org.dom4j.Element;
@@ -94,7 +96,7 @@
}
// Referals
- ArrayList referals = result.getReferrals();
+ List<LdapURL> referals = result.getReferrals();
if ( referals != null )
{
for ( int i = 0; i < referals.size(); i++ )
Modified: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/LdapResultEnum.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/LdapResultEnum.java?view=diff&rev=494858&r1=494857&r2=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/LdapResultEnum.java (original)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/LdapResultEnum.java Wed Jan 10 07:44:50 2007
@@ -20,6 +20,8 @@
package org.apache.directory.ldapstudio.dsmlv2.reponse;
+import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+
/**
* This Class helps to get resultCodeDesc for a ResultCode of a LdapResult.
@@ -29,120 +31,6 @@
*/
public class LdapResultEnum
{
- /** All the possible result value as string */
- private static String[] resultStrings;
-
- static
- {
- resultStrings = new String[91];
-
- resultStrings[0] = "success";
- resultStrings[1] = "operationsError";
- resultStrings[2] = "protocolError";
- resultStrings[3] = "timeLimitExceeded";
- resultStrings[4] = "sizeLimitExceeded";
- resultStrings[5] = "compareFalse";
- resultStrings[6] = "compareTrue";
- resultStrings[7] = "authMethodNotSupported";
- resultStrings[8] = "strongAuthRequired";
- resultStrings[9] = "reserved";
- resultStrings[10] = "referral";
- resultStrings[11] = "adminLimitExceeded";
- resultStrings[12] = "unavailableCriticalExtension";
- resultStrings[13] = "confidentialityRequired";
- resultStrings[14] = "saslBindInProgress";
-
- resultStrings[15] = "unused";
-
- resultStrings[16] = "noSuchAttribute";
- resultStrings[17] = "undefinedAttributeType";
- resultStrings[18] = "inappropriateMatching";
- resultStrings[19] = "constraintViolation";
- resultStrings[20] = "attributeOrValueExists";
- resultStrings[21] = "invalidAttributeSyntax";
-
- resultStrings[22] = "unused";
- resultStrings[23] = "unused";
- resultStrings[24] = "unused";
- resultStrings[25] = "unused";
- resultStrings[26] = "unused";
- resultStrings[27] = "unused";
- resultStrings[28] = "unused";
- resultStrings[29] = "unused";
- resultStrings[30] = "unused";
- resultStrings[31] = "unused";
-
- resultStrings[32] = "noSuchObject";
- resultStrings[33] = "aliasProblem";
- resultStrings[34] = "invalidDNSyntax";
- resultStrings[35] = "reserved for undefined isLeaf";
- resultStrings[36] = "aliasDereferencingProblem";
-
- resultStrings[37] = "unused";
- resultStrings[38] = "unused";
- resultStrings[39] = "unused";
- resultStrings[40] = "unused";
- resultStrings[41] = "unused";
- resultStrings[42] = "unused";
- resultStrings[43] = "unused";
- resultStrings[44] = "unused";
- resultStrings[45] = "unused";
- resultStrings[46] = "unused";
- resultStrings[47] = "unused";
-
- resultStrings[48] = "inappropriateAuthentication";
- resultStrings[49] = "invalidCredentials";
- resultStrings[50] = "insufficientAccessRights";
- resultStrings[51] = "busy";
- resultStrings[52] = "unavailable";
- resultStrings[53] = "unwillingToPerform";
- resultStrings[54] = "loopDetect";
-
- resultStrings[55] = "unused";
- resultStrings[56] = "unused";
- resultStrings[57] = "unused";
- resultStrings[58] = "unused";
- resultStrings[59] = "unused";
- resultStrings[60] = "unused";
- resultStrings[61] = "unused";
- resultStrings[62] = "unused";
- resultStrings[63] = "unused";
-
- resultStrings[64] = "namingViolation";
- resultStrings[65] = "objectClassViolation";
- resultStrings[66] = "notAllowedOnNonLeaf";
- resultStrings[67] = "notAllowedOnRDN";
- resultStrings[68] = "entryAlreadyExists";
- resultStrings[69] = "objectClassModsProhibited";
-
- resultStrings[70] = "reserved for CLDAP";
-
- resultStrings[71] = "affectsMultipleDSAs";
-
- resultStrings[72] = "unused";
- resultStrings[73] = "unused";
- resultStrings[74] = "unused";
- resultStrings[75] = "unused";
- resultStrings[76] = "unused";
- resultStrings[77] = "unused";
- resultStrings[78] = "unused";
- resultStrings[79] = "unused";
-
- resultStrings[80] = "other";
-
- resultStrings[81] = "reserved for APIs";
- resultStrings[82] = "reserved for APIs";
- resultStrings[83] = "reserved for APIs";
- resultStrings[84] = "reserved for APIs";
- resultStrings[85] = "reserved for APIs";
- resultStrings[86] = "reserved for APIs";
- resultStrings[87] = "reserved for APIs";
- resultStrings[88] = "reserved for APIs";
- resultStrings[89] = "reserved for APIs";
- resultStrings[90] = "reserved for APIs";
- }
-
-
/**
* Gets the String description of a given result code
*
@@ -151,15 +39,95 @@
* @return
* the String description corresponding to the result code
*/
- public static String getResultCodeDescr( int resultCode )
+ public static String getResultCodeDescr( ResultCodeEnum resultCode )
{
- if ( resultCode > 90 )
- {
- return "unknown";
- }
- else
+ switch ( resultCode )
{
- return resultStrings[resultCode];
+ case SUCCESS:
+ return "success";
+ case OPERATIONS_ERROR:
+ return "operationsError";
+ case PROTOCOL_ERROR:
+ return "protocolError";
+ case TIME_LIMIT_EXCEEDED:
+ return "timeLimitExceeded";
+ case SIZE_LIMIT_EXCEEDED:
+ return "sizeLimitExceeded";
+ case COMPARE_FALSE:
+ return "compareFalse";
+ case COMPARE_TRUE:
+ return "compareTrue";
+ case AUTH_METHOD_NOT_SUPPORTED:
+ return "authMethodNotSupported";
+ case STRONG_AUTH_REQUIRED:
+ return "strongAuthRequired";
+ case PARTIAL_RESULTS:
+ return "partialResults";
+ case REFERRAL:
+ return "referral";
+ case ADMIN_LIMIT_EXCEEDED:
+ return "adminLimitExceeded";
+ case UNAVAILABLE_CRITICAL_EXTENSION:
+ return "unavailableCriticalExtension";
+ case CONFIDENTIALITY_REQUIRED:
+ return "confidentialityRequired";
+ case SASL_BIND_IN_PROGRESS:
+ return "saslBindInProgress";
+ case NO_SUCH_ATTRIBUTE:
+ return "noSuchAttribute";
+ case UNDEFINED_ATTRIBUTE_TYPE:
+ return "undefinedAttributeType";
+ case INAPPROPRIATE_MATCHING:
+ return "inappropriateMatching";
+ case CONSTRAINT_VIOLATION:
+ return "constraintViolation";
+ case ATTRIBUTE_OR_VALUE_EXISTS:
+ return "attributeOrValueExists";
+ case INVALID_ATTRIBUTE_SYNTAX:
+ return "invalidAttributeSyntax";
+ case NO_SUCH_OBJECT:
+ return "NO_SUCH_OBJECT";
+ case ALIAS_PROBLEM:
+ return "aliasProblem";
+ case INVALID_DN_SYNTAX:
+ return "invalidDNSyntax";
+ case ALIAS_DEREFERENCING_PROBLEM:
+ return "aliasDereferencingProblem";
+ case INAPPROPRIATE_AUTHENTICATION:
+ return "inappropriateAuthentication";
+ case INVALID_CREDENTIALS:
+ return "invalidCredentials";
+ case INSUFFICIENT_ACCESS_RIGHTS:
+ return "insufficientAccessRights";
+ case BUSY:
+ return "busy";
+ case UNAVAILABLE:
+ return "unavailable";
+ case UNWILLING_TO_PERFORM:
+ return "unwillingToPerform";
+ case LOOP_DETECT:
+ return "loopDetect";
+ case NAMING_VIOLATION:
+ return "namingViolation";
+ case OBJECT_CLASS_VIOLATION:
+ return "objectClassViolation";
+ case NOT_ALLOWED_ON_NON_LEAF:
+ return "notAllowedOnNonLeaf";
+ case NOT_ALLOWED_ON_RDN:
+ return "notAllowedOnRDN";
+ case ENTRY_ALREADY_EXISTS:
+ return "entryAlreadyExists";
+ case OBJECT_CLASS_MODS_PROHIBITED:
+ return "objectClassModsProhibited";
+ case AFFECTS_MULTIPLE_DSAS:
+ return "affectsMultipleDSAs";
+ case OTHER:
+ return "other";
+ case UNKNOWN:
+ return "unknown";
+
+ default:
+ return "unknoxn";
}
}
}
Modified: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/ModDNResponseDsml.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/ModDNResponseDsml.java?view=diff&rev=494858&r1=494857&r2=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/ModDNResponseDsml.java (original)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/ModDNResponseDsml.java Wed Jan 10 07:44:50 2007
@@ -21,6 +21,7 @@
package org.apache.directory.ldapstudio.dsmlv2.reponse;
+import org.apache.directory.ldapstudio.dsmlv2.DsmlDecorator;
import org.apache.directory.shared.ldap.codec.LdapMessage;
import org.dom4j.Element;
Modified: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/ModifyResponseDsml.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/ModifyResponseDsml.java?view=diff&rev=494858&r1=494857&r2=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/ModifyResponseDsml.java (original)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/ModifyResponseDsml.java Wed Jan 10 07:44:50 2007
@@ -21,6 +21,7 @@
package org.apache.directory.ldapstudio.dsmlv2.reponse;
+import org.apache.directory.ldapstudio.dsmlv2.DsmlDecorator;
import org.apache.directory.shared.ldap.codec.LdapMessage;
import org.dom4j.Element;
Modified: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/SearchResultDoneDsml.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/SearchResultDoneDsml.java?view=diff&rev=494858&r1=494857&r2=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/SearchResultDoneDsml.java (original)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/SearchResultDoneDsml.java Wed Jan 10 07:44:50 2007
@@ -21,6 +21,7 @@
package org.apache.directory.ldapstudio.dsmlv2.reponse;
+import org.apache.directory.ldapstudio.dsmlv2.DsmlDecorator;
import org.apache.directory.shared.ldap.codec.LdapMessage;
import org.dom4j.Element;
Modified: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/SearchResultEntryDsml.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/SearchResultEntryDsml.java?view=diff&rev=494858&r1=494857&r2=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/SearchResultEntryDsml.java (original)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/SearchResultEntryDsml.java Wed Jan 10 07:44:50 2007
@@ -26,6 +26,7 @@
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
+import org.apache.directory.ldapstudio.dsmlv2.DsmlDecorator;
import org.apache.directory.ldapstudio.dsmlv2.ParserUtils;
import org.apache.directory.shared.ldap.codec.LdapMessage;
import org.apache.directory.shared.ldap.codec.search.SearchResultEntry;
Modified: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/SearchResultReferenceDsml.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/SearchResultReferenceDsml.java?view=diff&rev=494858&r1=494857&r2=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/SearchResultReferenceDsml.java (original)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/reponse/SearchResultReferenceDsml.java Wed Jan 10 07:44:50 2007
@@ -21,10 +21,12 @@
package org.apache.directory.ldapstudio.dsmlv2.reponse;
-import java.util.ArrayList;
+import java.util.List;
+import org.apache.directory.ldapstudio.dsmlv2.DsmlDecorator;
import org.apache.directory.shared.ldap.codec.LdapMessage;
import org.apache.directory.shared.ldap.codec.search.SearchResultReference;
+import org.apache.directory.shared.ldap.codec.util.LdapURL;
import org.dom4j.Element;
@@ -66,7 +68,7 @@
SearchResultReference searchResultReference = instance.getSearchResultReference();
// Adding References
- ArrayList refsList = searchResultReference.getSearchResultReferences();
+ List<LdapURL> refsList = searchResultReference.getSearchResultReferences();
for ( int i = 0; i < refsList.size(); i++ )
{
element.addElement( "ref" ).addText( refsList.get( i ).toString() );
Added: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/AbandonRequestDsml.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/AbandonRequestDsml.java?view=auto&rev=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/AbandonRequestDsml.java (added)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/AbandonRequestDsml.java Wed Jan 10 07:44:50 2007
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.ldapstudio.dsmlv2.request;
+
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.abandon.AbandonRequest;
+import org.dom4j.Element;
+
+/**
+ * DSML Decorator for AbandonRequest
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class AbandonRequestDsml extends AbstractRequestDsml
+{
+ /**
+ * Creates a new instance of AddRequestDsml.
+ *
+ * @param ldapMessage
+ * the message to decorate
+ */
+ public AbandonRequestDsml( LdapMessage ldapMessage )
+ {
+ super( ldapMessage );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getMessageType()
+ {
+ return instance.getAbandonRequest().getMessageType();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public Element toDsml( Element root )
+ {
+ Element element = super.toDsml( root );
+
+ AbandonRequest request = instance.getAbandonRequest();
+
+ // AbandonID
+ if ( request.getAbandonedMessageId() != 0 )
+ {
+ element.addAttribute( "abandonID", "" + request.getAbandonedMessageId() );
+ }
+
+ return element;
+ }
+}
Added: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/AbstractRequestDsml.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/AbstractRequestDsml.java?view=auto&rev=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/AbstractRequestDsml.java (added)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/AbstractRequestDsml.java Wed Jan 10 07:44:50 2007
@@ -0,0 +1,82 @@
+package org.apache.directory.ldapstudio.dsmlv2.request;
+
+
+import org.apache.directory.ldapstudio.dsmlv2.DsmlDecorator;
+import org.apache.directory.shared.ldap.codec.LdapConstants;
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.dom4j.Element;
+
+
+public abstract class AbstractRequestDsml extends LdapRequestDecorator implements DsmlDecorator
+{
+ /**
+ * Creates a new instance of AbstractRequestDsml.
+ *
+ * @param ldapMessage
+ * the message to decorate
+ */
+ public AbstractRequestDsml( LdapMessage ldapMessage )
+ {
+ super( ldapMessage );
+ // TODO Auto-generated constructor stub
+ }
+
+
+ /**
+ * Creates the Request Element and adds RequestID and Controls.
+ *
+ * @param root
+ * the root element
+ * @return
+ * the Request Element of the given name containing
+ */
+ public Element toDsml( Element root )
+ {
+ Element element = root.addElement( getRequestName() );
+
+ // Request ID
+ int requestID = instance.getMessageId();
+ if ( requestID != 0 )
+ {
+ element.addAttribute( "requestID", "" + requestID );
+ }
+
+ // Control(s)
+ // TODO Handle Control(s)
+
+ return element;
+ }
+
+ /**
+ * Gets the name of the request according to the type of the decorated element.
+ *
+ * @return
+ * the name of the request according to the type of the decorated element.
+ */
+ private String getRequestName()
+ {
+ switch ( instance.getMessageType() )
+ {
+ case LdapConstants.ABANDON_REQUEST:
+ return "abandonRequest";
+ case LdapConstants.ADD_REQUEST:
+ return "addRequest";
+ case LdapConstants.BIND_REQUEST:
+ return "authRequest";
+ case LdapConstants.COMPARE_REQUEST:
+ return "compareRequest";
+ case LdapConstants.DEL_REQUEST:
+ return "delRequest";
+ case LdapConstants.EXTENDED_REQUEST:
+ return "extendedRequest";
+ case LdapConstants.MODIFYDN_REQUEST:
+ return "modDNRequest";
+ case LdapConstants.MODIFY_REQUEST:
+ return "modifyRequest";
+ case LdapConstants.SEARCH_REQUEST:
+ return "searchRequest";
+ default:
+ return "error";
+ }
+ }
+}
Added: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/AddRequestDsml.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/AddRequestDsml.java?view=auto&rev=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/AddRequestDsml.java (added)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/AddRequestDsml.java Wed Jan 10 07:44:50 2007
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.ldapstudio.dsmlv2.request;
+
+
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+
+import org.apache.directory.ldapstudio.dsmlv2.ParserUtils;
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.add.AddRequest;
+import org.dom4j.Element;
+import org.dom4j.Namespace;
+import org.dom4j.QName;
+
+
+/**
+ * DSML Decorator for AddRequest
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class AddRequestDsml extends AbstractRequestDsml
+{
+ /**
+ * Creates a new instance of AddRequestDsml.
+ *
+ * @param ldapMessage
+ * the message to decorate
+ */
+ public AddRequestDsml( LdapMessage ldapMessage )
+ {
+ super( ldapMessage );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getMessageType()
+ {
+ return instance.getAddRequest().getMessageType();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public Element toDsml( Element root )
+ {
+ Element element = super.toDsml( root );
+
+ AddRequest request = instance.getAddRequest();
+
+ // DN
+ if ( request.getEntry() != null )
+ {
+ element.addAttribute( "dn", request.getEntry().toString() );
+ }
+
+ // Attributes
+ Attributes attributes = request.getAttributes();
+ if ( attributes != null )
+ {
+ NamingEnumeration ne = attributes.getAll();
+ while ( ne.hasMoreElements() )
+ {
+ Attribute attribute = ( Attribute ) ne.nextElement();
+ Element attributeElement = element.addElement( "attr" );
+ attributeElement.addAttribute( "name", attribute.getID() );
+
+ // Looping on Values Enumeration
+ try
+ {
+ NamingEnumeration ne2 = attribute.getAll();
+
+ while ( ne2.hasMoreElements() )
+ {
+ Object value = ne2.nextElement();
+
+ if ( ParserUtils.needsBase64Encoding( value ) )
+ {
+ Namespace xsdNamespace = new Namespace( "xsd", ParserUtils.XML_SCHEMA_URI );
+ Namespace xsiNamespace = new Namespace( "xsi", ParserUtils.XML_SCHEMA_INSTANCE_URI );
+ attributeElement.getDocument().getRootElement().add( xsdNamespace );
+ attributeElement.getDocument().getRootElement().add( xsiNamespace );
+
+ Element valueElement = attributeElement.addElement( "value" ).addText(
+ ParserUtils.base64Encode( value ) );
+ valueElement
+ .addAttribute( new QName( "type", xsiNamespace ), "xsd:" + ParserUtils.BASE64BINARY );
+ }
+ else
+ {
+ attributeElement.addElement( "value" ).addText( value.toString() );
+ }
+ }
+ }
+ catch ( NamingException e )
+ {
+ }
+ }
+ }
+
+ return element;
+ }
+}
Added: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/AuthRequestDsml.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/AuthRequestDsml.java?view=auto&rev=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/AuthRequestDsml.java (added)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/AuthRequestDsml.java Wed Jan 10 07:44:50 2007
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.ldapstudio.dsmlv2.request;
+
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.abandon.AbandonRequest;
+import org.apache.directory.shared.ldap.codec.bind.BindRequest;
+import org.dom4j.Element;
+
+/**
+ * DSML Decorator for AbandonRequest
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class AuthRequestDsml extends AbstractRequestDsml
+{
+ /**
+ * Creates a new instance of AddRequestDsml.
+ *
+ * @param ldapMessage
+ * the message to decorate
+ */
+ public AuthRequestDsml( LdapMessage ldapMessage )
+ {
+ super( ldapMessage );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getMessageType()
+ {
+ return instance.getBindRequest().getMessageType();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public Element toDsml( Element root )
+ {
+ Element element = super.toDsml( root );
+
+ BindRequest request = instance.getBindRequest();
+
+ // AbandonID
+ String name = request.getName().toString();
+ if ( ( name != null ) && ( !"".equals( name ) ) )
+ {
+ element.addAttribute( "principal", name );
+ }
+
+ return element;
+ }
+}
Added: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/CompareRequestDsml.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/CompareRequestDsml.java?view=auto&rev=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/CompareRequestDsml.java (added)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/CompareRequestDsml.java Wed Jan 10 07:44:50 2007
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.ldapstudio.dsmlv2.request;
+
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.compare.CompareRequest;
+import org.dom4j.Element;
+
+/**
+ * DSML Decorator for CompareRequest
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class CompareRequestDsml extends AbstractRequestDsml
+{
+ /**
+ * Creates a new instance of CompareRequestDsml.
+ *
+ * @param ldapMessage
+ * the message to decorate
+ */
+ public CompareRequestDsml( LdapMessage ldapMessage )
+ {
+ super( ldapMessage );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getMessageType()
+ {
+ return instance.getCompareRequest().getMessageType();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public Element toDsml( Element root )
+ {
+ Element element = super.toDsml( root );
+
+ CompareRequest request = instance.getCompareRequest();
+
+ // DN
+ if ( request.getEntry() != null )
+ {
+ element.addAttribute( "dn", request.getEntry().toString() );
+ }
+
+ // Assertion
+ Element assertionElement = element.addElement( "assertion");
+ if ( request.getAttributeDesc() != null )
+ {
+ assertionElement.addAttribute( "name", request.getAttributeDesc() );
+ }
+ if ( request.getAssertionValue() != null )
+ {
+ assertionElement.addElement( "value").setText( (String) request.getAssertionValue() );
+ }
+
+ return element;
+ }
+}
Added: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/DelRequestDsml.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/DelRequestDsml.java?view=auto&rev=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/DelRequestDsml.java (added)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/DelRequestDsml.java Wed Jan 10 07:44:50 2007
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.ldapstudio.dsmlv2.request;
+
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.del.DelRequest;
+import org.dom4j.Element;
+
+/**
+ * DSML Decorator for DelRequest
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DelRequestDsml extends AbstractRequestDsml
+{
+ /**
+ * Creates a new instance of DelRequestDsml.
+ *
+ * @param ldapMessage
+ * the message to decorate
+ */
+ public DelRequestDsml( LdapMessage ldapMessage )
+ {
+ super( ldapMessage );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getMessageType()
+ {
+ return instance.getDelRequest().getMessageType();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public Element toDsml( Element root )
+ {
+ Element element = super.toDsml( root );
+
+ DelRequest request = instance.getDelRequest();
+
+ // DN
+ if ( request.getEntry() != null )
+ {
+ element.addAttribute( "dn", request.getEntry().toString() );
+ }
+
+ return element;
+ }
+}
Added: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/ExtendedRequestDsml.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/ExtendedRequestDsml.java?view=auto&rev=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/ExtendedRequestDsml.java (added)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/ExtendedRequestDsml.java Wed Jan 10 07:44:50 2007
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.ldapstudio.dsmlv2.request;
+
+import org.apache.directory.ldapstudio.dsmlv2.ParserUtils;
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.extended.ExtendedRequest;
+import org.dom4j.Element;
+import org.dom4j.Namespace;
+import org.dom4j.QName;
+
+/**
+ * DSML Decorator for ExtendedRequest
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ExtendedRequestDsml extends AbstractRequestDsml
+{
+ /**
+ * Creates a new instance of ExtendedRequestDsml.
+ *
+ * @param ldapMessage
+ * the message to decorate
+ */
+ public ExtendedRequestDsml( LdapMessage ldapMessage )
+ {
+ super( ldapMessage );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getMessageType()
+ {
+ return instance.getExtendedRequest().getMessageType();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public Element toDsml( Element root )
+ {
+ Element element = super.toDsml( root );
+
+ ExtendedRequest request = instance.getExtendedRequest();
+
+ // Request Name
+ if ( request.getRequestName() != null )
+ {
+ element.addElement( "requestName" ).setText( request.getRequestName() );
+ }
+
+ // Request Value
+ Namespace xsdNamespace = new Namespace( "xsd", ParserUtils.XML_SCHEMA_URI );
+ Namespace xsiNamespace = new Namespace( "xsi", ParserUtils.XML_SCHEMA_INSTANCE_URI );
+ element.getDocument().getRootElement().add( xsdNamespace );
+ element.getDocument().getRootElement().add( xsiNamespace );
+
+ Element valueElement = element.addElement( "requestValue" ).addText(
+ ParserUtils.base64Encode( request.getRequestValue() ) );
+ valueElement
+ .addAttribute( new QName( "type", xsiNamespace ), "xsd:" + ParserUtils.BASE64BINARY );
+
+ return element;
+ }
+}
Added: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/LdapRequestDecorator.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/LdapRequestDecorator.java?view=auto&rev=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/LdapRequestDecorator.java (added)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/LdapRequestDecorator.java Wed Jan 10 07:44:50 2007
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.ldapstudio.dsmlv2.request;
+
+import org.apache.directory.ldapstudio.dsmlv2.LdapMessageDecorator;
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+
+/**
+ * Decorator abstract class for LdapRequest
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class LdapRequestDecorator extends LdapMessageDecorator
+{
+ /**
+ * Creates a new instance of LdapRequestDecorator.
+ *
+ * @param ldapMessage
+ * the message to decorate
+ */
+ public LdapRequestDecorator( LdapMessage ldapMessage )
+ {
+ super( ldapMessage );
+ }
+}
Added: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/ModifyDNRequestDsml.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/ModifyDNRequestDsml.java?view=auto&rev=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/ModifyDNRequestDsml.java (added)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/ModifyDNRequestDsml.java Wed Jan 10 07:44:50 2007
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.ldapstudio.dsmlv2.request;
+
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.modifyDn.ModifyDNRequest;
+import org.dom4j.Element;
+
+/**
+ * DSML Decorator for ModifyDNRequest
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ModifyDNRequestDsml extends AbstractRequestDsml
+{
+ /**
+ * Creates a new instance of ModifyDNRequestDsml.
+ *
+ * @param ldapMessage
+ * the message to decorate
+ */
+ public ModifyDNRequestDsml( LdapMessage ldapMessage )
+ {
+ super( ldapMessage );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getMessageType()
+ {
+ return instance.getModifyDNRequest().getMessageType();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public Element toDsml( Element root )
+ {
+ Element element = super.toDsml( root );
+
+ ModifyDNRequest request = instance.getModifyDNRequest();
+
+ // DN
+ if ( request.getEntry() != null )
+ {
+ element.addAttribute( "dn", request.getEntry().toString() );
+ }
+
+ // NewRDN
+ if ( request.getNewRDN() != null )
+ {
+ element.addAttribute( "newrdn", request.getNewRDN().toString() );
+ }
+
+ // DeleteOldRDN
+ element.addAttribute( "deleteoldrdn", ( request.isDeleteOldRDN() ? "true" : "false" ) );
+
+ // NewSuperior
+ if ( request.getNewRDN() != null )
+ {
+ element.addAttribute( "newSuperior", request.getNewSuperior().toString() );
+ }
+
+ return element;
+ }
+}
Added: directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/ModifyRequestDsml.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/ModifyRequestDsml.java?view=auto&rev=494858
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/ModifyRequestDsml.java (added)
+++ directory/trunks/ldapstudio/ldapstudio-dsml-parser/src/main/java/org/apache/directory/ldapstudio/dsmlv2/request/ModifyRequestDsml.java Wed Jan 10 07:44:50 2007
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.ldapstudio.dsmlv2.request;
+
+import java.util.List;
+
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+import org.apache.directory.ldapstudio.dsmlv2.ParserUtils;
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.modify.ModifyRequest;
+import org.apache.directory.shared.ldap.message.ModificationItemImpl;
+import org.dom4j.Element;
+import org.dom4j.Namespace;
+import org.dom4j.QName;
+
+/**
+ * DSML Decorator for ModifyRequest
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ModifyRequestDsml extends AbstractRequestDsml
+{
+ /**
+ * Creates a new instance of ModifyRequestDsml.
+ *
+ * @param ldapMessage
+ * the message to decorate
+ */
+ public ModifyRequestDsml( LdapMessage ldapMessage )
+ {
+ super( ldapMessage );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getMessageType()
+ {
+ return instance.getModifyRequest().getMessageType();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public Element toDsml( Element root )
+ {
+ Element element = super.toDsml( root );
+
+ ModifyRequest request = instance.getModifyRequest();
+
+ // DN
+ if ( request.getObject() != null )
+ {
+ element.addAttribute( "dn", request.getObject().toString() );
+ }
+
+ // Modifications
+ List<ModificationItemImpl> modifications = request.getModifications();
+
+ for ( int i = 0; i < modifications.size(); i++ )
+ {
+ ModificationItemImpl modificationItem = modifications.get( i );
+
+ Element modElement = element.addElement( "modification" );
+ if ( modificationItem.getAttribute() != null )
+ {
+ modElement.addAttribute( "name", modificationItem.getAttribute().getID() );
+
+ try
+ {
+ NamingEnumeration ne = modificationItem.getAttribute().getAll();
+ while ( ne.hasMoreElements() )
+ {
+ Object value = ( Object ) ne.nextElement();
+
+ if ( value != null )
+ {
+ if ( ParserUtils.needsBase64Encoding( value ) )
+ {
+ Namespace xsdNamespace = new Namespace( "xsd", ParserUtils.XML_SCHEMA_URI );
+ Namespace xsiNamespace = new Namespace( "xsi", ParserUtils.XML_SCHEMA_INSTANCE_URI );
+ element.getDocument().getRootElement().add( xsdNamespace );
+ element.getDocument().getRootElement().add( xsiNamespace );
+
+ Element valueElement = modElement.addElement( "value" ).addText( ParserUtils.base64Encode( value ) );
+ valueElement
+ .addAttribute( new QName( "type", xsiNamespace ), "xsd:" + ParserUtils.BASE64BINARY );
+ }
+ else
+ {
+ modElement.addElement( "value" ).setText( (String) value );
+ }
+ }
+ }
+ }
+ catch ( NamingException e )
+ {
+ }
+ }
+
+ int operation = modificationItem.getModificationOp();
+ if ( operation == DirContext.ADD_ATTRIBUTE )
+ {
+ modElement.addAttribute( "operation", "add" );
+ }
+ else if ( operation == DirContext.REPLACE_ATTRIBUTE )
+ {
+ modElement.addAttribute( "operation", "replace" );
+ }
+ else if ( operation == DirContext.REMOVE_ATTRIBUTE )
+ {
+ modElement.addAttribute( "operation", "delete" );
+ }
+ }
+
+ return element;
+ }
+}