Author: ersiner Date: Mon Sep 4 04:50:46 2006 New Revision: 440035 URL: http://svn.apache.org/viewvc?view=rev&rev=440035 Log: Added support for special SP parameter: $ldapContext. Added: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/sp/LdapContextParameter.java Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/sp/JavaStoredProcedureUtils.java Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/sp/JavaStoredProcedureUtils.java URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/sp/JavaStoredProcedureUtils.java?view=diff&rev=440035&r1=440034&r2=440035 ============================================================================== --- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/sp/JavaStoredProcedureUtils.java (original) +++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/sp/JavaStoredProcedureUtils.java Mon Sep 4 04:50:46 2006 @@ -138,8 +138,20 @@ */ for ( int i = 0; i < arguments.length; i++ ) { - byte[] type = arguments[i].getClass().getName().getBytes( "UTF-8" ); - byte[] value = SerializationUtils.serialize( ( Serializable ) arguments[i] ); + byte[] type; + byte[] value; + if ( arguments[i] instanceof LdapContextParameter ) + { + LdapContextParameter lcp = ( LdapContextParameter ) arguments[i]; + type = lcp.getType().getBytes( "UTF-8" ); + value = SerializationUtils.serialize( ( Serializable ) lcp.getValue() ); + } + else + { + type = arguments[i].getClass().getName().getBytes( "UTF-8" ); + value = SerializationUtils.serialize( ( Serializable ) arguments[i] ); + } + req.addParameter( type, value ); } Added: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/sp/LdapContextParameter.java URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/sp/LdapContextParameter.java?view=auto&rev=440035 ============================================================================== --- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/sp/LdapContextParameter.java (added) +++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/sp/LdapContextParameter.java Mon Sep 4 04:50:46 2006 @@ -0,0 +1,49 @@ +/* + * 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.shared.ldap.sp; + + + +/** + * A class for representing the special SP parameter: $ldapContext. + * + * @author Apache Directory Project + * @version $Rev:$ + */ +public class LdapContextParameter +{ + private String name; + + public LdapContextParameter( String name ) + { + this.name = name; + } + + public String getType() + { + return "$ldapContext"; + } + + public Object getValue() + { + return name; + } +}