You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2007/04/10 14:53:41 UTC

svn commit: r527112 - in /directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context: AddServiceContext.java CompareServiceContext.java DeleteServiceContext.java ModifyServiceContext.java

Author: elecharny
Date: Tue Apr 10 05:53:40 2007
New Revision: 527112

URL: http://svn.apache.org/viewvc?view=rev&rev=527112
Log:
Created contexts for add, compare, delete and modify operations

Added:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/AddServiceContext.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/CompareServiceContext.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteServiceContext.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyServiceContext.java

Added: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/AddServiceContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/AddServiceContext.java?view=auto&rev=527112
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/AddServiceContext.java (added)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/AddServiceContext.java Tue Apr 10 05:53:40 2007
@@ -0,0 +1,95 @@
+/*
+ *  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.server.core.interceptor.context;
+
+import javax.naming.directory.Attributes;
+
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.util.AttributeUtils;
+
+/**
+ * A Add context used for Interceptors. It contains all the informations
+ * needed for the add operation, and used by all the interceptors
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class AddServiceContext extends AbstractServiceContext
+{
+    /** The added Attribute  */
+    private Attributes entry;
+    
+    /**
+     * 
+     * Creates a new instance of AddServiceContext.
+     *
+     */
+    public AddServiceContext()
+    {
+    	super();
+    }
+
+    /**
+     * 
+     * Creates a new instance of AddServiceContext.
+     *
+     */
+    public AddServiceContext( LdapDN dn )
+    {
+        super( dn );
+    }
+
+    /**
+     * 
+     * Creates a new instance of ModifyServiceContext.
+     *
+     */
+    public AddServiceContext( LdapDN dn, Attributes entry )
+    {
+    	super( dn );
+        this.entry = entry;
+    }
+
+	/**
+	 * @return The added attributes
+	 */
+	public Attributes getEntry() 
+	{
+		return entry;
+	}
+
+	/**
+	 * Set the added attributes
+	 * @param entry The added attributes
+	 */
+	public void setEntry( Attributes entry ) 
+	{
+		this.entry = entry;
+	}
+
+	/**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        return "AddContext for DN '" + getDn().getUpName() + "'" +
+        ", added entry: " + AttributeUtils.toString( entry ); 
+    }
+}

Added: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/CompareServiceContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/CompareServiceContext.java?view=auto&rev=527112
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/CompareServiceContext.java (added)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/CompareServiceContext.java Tue Apr 10 05:53:40 2007
@@ -0,0 +1,144 @@
+/*
+ *  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.server.core.interceptor.context;
+
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.util.StringTools;
+
+/**
+ * A Compare context used for Interceptors. It contains all the informations
+ * needed for the compare operation, and used by all the interceptors
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class CompareServiceContext  extends AbstractServiceContext
+{
+    /** The entry OID */
+    private String oid;
+
+    /** The value to be compared */
+    private Object value;
+    
+    /**
+     * 
+     * Creates a new instance of CompareServiceContext.
+     *
+     */
+    public CompareServiceContext()
+    {
+    	super();
+    }
+
+    /**
+     * 
+     * Creates a new instance of CompareServiceContext.
+     *
+     */
+    public CompareServiceContext( LdapDN dn )
+    {
+        super( dn );
+    }
+
+    /**
+     * 
+     * Creates a new instance of LookupServiceContext.
+     *
+     */
+    public CompareServiceContext( String oid )
+    {
+    	super();
+        this.oid = oid;
+    }
+
+    /**
+     * 
+     * Creates a new instance of LookupServiceContext.
+     *
+     */
+    public CompareServiceContext( LdapDN dn, String oid )
+    {
+    	super( dn );
+        this.oid = oid;
+    }
+
+    /**
+     * 
+     * Creates a new instance of LookupServiceContext.
+     *
+     */
+    public CompareServiceContext( LdapDN dn, String oid, Object value )
+    {
+    	super( dn );
+        this.oid = oid;
+        this.value = value;
+    }
+
+    /**
+     * @return The compared OID
+     */
+	public String getOid() 
+	{
+		return oid;
+	}
+
+	/**
+	 * Set the compared OID
+	 * @param oid The compared OID
+	 */
+	public void setOid( String  oid ) 
+	{
+		this.oid = oid;
+	}
+
+	/**
+	 * @return The value to compare
+	 */
+	public Object getValue() 
+	{
+		return value;
+	}
+
+	/**
+	 * Set the value to compare
+	 * @param value The value to compare
+	 */
+	public void setValue( Object value ) 
+	{
+		this.value = value;
+	}
+
+	/**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        return "CompareContext for DN '" + getDn().getUpName() + "'" + 
+        	( ( oid != null ) ? ", oid : <" + oid + ">" : "" ) +
+        	( ( value != null ) ? ", value :'" +
+        			( ( value instanceof String ) ?
+        					value :
+        					( ( value instanceof byte[] ) ?
+        							StringTools.dumpBytes( (byte[])value ) : 
+        								"unknown value type" ) )
+        				+ "'"
+        			: "" );
+    }
+}

Added: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteServiceContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteServiceContext.java?view=auto&rev=527112
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteServiceContext.java (added)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/DeleteServiceContext.java Tue Apr 10 05:53:40 2007
@@ -0,0 +1,58 @@
+/*
+ *  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.server.core.interceptor.context;
+
+import org.apache.directory.shared.ldap.name.LdapDN;
+
+/**
+ * A Delete context used for Interceptors. It contains all the informations
+ * needed for the delete operation, and used by all the interceptors
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DeleteServiceContext  extends AbstractServiceContext
+{
+    /**
+     * Creates a new instance of DeleteServiceContext.
+     */
+    public DeleteServiceContext()
+    {
+        super();
+    }
+    
+    /**
+     * Creates a new instance of DeleteServiceContext.
+     *
+     * @param deleteDn The entry DN to delete
+     */
+    public DeleteServiceContext( LdapDN deleteDn )
+    {
+        super( deleteDn );
+    }
+    
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        return "DeleteContext for DN '" + getDn().getUpName() + "'";
+    }
+}

Added: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyServiceContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyServiceContext.java?view=auto&rev=527112
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyServiceContext.java (added)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyServiceContext.java Tue Apr 10 05:53:40 2007
@@ -0,0 +1,114 @@
+/*
+ *  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.server.core.interceptor.context;
+
+import javax.naming.directory.Attributes;
+
+import org.apache.directory.shared.ldap.name.LdapDN;
+
+/**
+ * A Modify context used for Interceptors. It contains all the informations
+ * needed for the modify operation, and used by all the interceptors
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ModifyServiceContext extends AbstractServiceContext
+{
+    /** The modification type */
+    private int modOp;
+
+    /** The modified Attribute  */
+    private Attributes mods;
+    
+    /**
+     * 
+     * Creates a new instance of ModifyServiceContext.
+     *
+     */
+    public ModifyServiceContext()
+    {
+    	super();
+    }
+
+    /**
+     * 
+     * Creates a new instance of ModifyServiceContext.
+     *
+     */
+    public ModifyServiceContext( LdapDN dn )
+    {
+        super( dn );
+    }
+
+    /**
+     * 
+     * Creates a new instance of ModifyServiceContext.
+     *
+     */
+    public ModifyServiceContext( LdapDN dn, int modOp, Attributes mods )
+    {
+    	super( dn );
+        this.modOp = modOp;
+        this.mods = mods;
+    }
+
+    /**
+     * @return The modify type
+     */
+	public int getModOp() 
+	{
+		return modOp;
+	}
+
+	/**
+	 * Set modification operation type
+	 * @param modOp the Modification operation type
+	 */
+	public void setModOp( int modOp ) 
+	{
+		this.modOp = modOp;
+	}
+
+	/**
+	 * @return The modified attributes
+	 */
+	public Attributes getMods() 
+	{
+		return mods;
+	}
+
+	/**
+	 * Set the modified attributes
+	 * @param value The modified attributes
+	 */
+	public void setMods( Attributes mods ) 
+	{
+		this.mods = mods;
+	}
+
+	/**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        return "ModifyContext for DN '" + getDn().getUpName() + "'"; 
+    }
+}