Preparing to replace the exceptions.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the AttributeInUseException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.directory.AttributeInUseException
|
||||
*/
|
||||
public class AttributeInUseException extends NamingException {
|
||||
|
||||
public AttributeInUseException(
|
||||
javax.naming.directory.AttributeInUseException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the AttributeModificationException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.directory.AttributeModificationException
|
||||
*/
|
||||
public class AttributeModificationException extends NamingException {
|
||||
|
||||
public AttributeModificationException(
|
||||
javax.naming.directory.AttributeModificationException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2005 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
|
||||
/**
|
||||
* Exception that indicates that an invalid or missing Attribute has been
|
||||
* supplied to an LDAP operation.
|
||||
*
|
||||
* @author Mattias Arthursson
|
||||
*
|
||||
*/
|
||||
public class AttributesIntegrityViolationException extends
|
||||
DataIntegrityViolationException {
|
||||
|
||||
private static final long serialVersionUID = -6368616096960202571L;
|
||||
|
||||
public AttributesIntegrityViolationException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
public AttributesIntegrityViolationException(String msg, Throwable t) {
|
||||
super(msg, t);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the AuthenticationException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.AuthenticationException
|
||||
*/
|
||||
public class AuthenticationException extends NamingSecurityException {
|
||||
|
||||
public AuthenticationException(javax.naming.AuthenticationException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the AuthenticationNotSupportedException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.AuthenticationNotSupportedException
|
||||
*/
|
||||
public class AuthenticationNotSupportedException extends
|
||||
NamingSecurityException {
|
||||
|
||||
public AuthenticationNotSupportedException(
|
||||
javax.naming.AuthenticationNotSupportedException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2005 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
import org.springframework.dao.InvalidDataAccessResourceUsageException;
|
||||
|
||||
/**
|
||||
* Thrown to indicate that an invalid value has been supplied to an LDAP
|
||||
* operation. This could be an invalid filter or dn.
|
||||
*
|
||||
* @author Mattias Arthursson
|
||||
*/
|
||||
public class BadLdapGrammarException extends
|
||||
InvalidDataAccessResourceUsageException {
|
||||
|
||||
private static final long serialVersionUID = 961612585331409470L;
|
||||
|
||||
public BadLdapGrammarException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public BadLdapGrammarException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the CannotProceedException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.CannotProceedException
|
||||
*/
|
||||
public class CannotProceedException extends NamingException {
|
||||
|
||||
public CannotProceedException(javax.naming.CannotProceedException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the CommunicationException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.CommunicationException
|
||||
*/
|
||||
public class CommunicationException extends NamingException {
|
||||
|
||||
public CommunicationException(javax.naming.CommunicationException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the ConfigurationException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.ConfigurationException
|
||||
*/
|
||||
public class ConfigurationException extends NamingException {
|
||||
|
||||
public ConfigurationException(javax.naming.ConfigurationException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the ContextNotEmptyException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.ContextNotEmptyException
|
||||
*/
|
||||
public class ContextNotEmptyException extends NamingException {
|
||||
|
||||
public ContextNotEmptyException(javax.naming.ContextNotEmptyException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2005 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
import javax.naming.CommunicationException;
|
||||
import javax.naming.ContextNotEmptyException;
|
||||
import javax.naming.LimitExceededException;
|
||||
import javax.naming.NameAlreadyBoundException;
|
||||
import javax.naming.NameNotFoundException;
|
||||
import javax.naming.NamingException;
|
||||
import javax.naming.directory.InvalidAttributesException;
|
||||
import javax.naming.directory.InvalidSearchControlsException;
|
||||
import javax.naming.directory.InvalidSearchFilterException;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.dao.DataRetrievalFailureException;
|
||||
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||
|
||||
/**
|
||||
* The default implementation of NamingExceptionTranslator.
|
||||
*
|
||||
* @author Mattias Arthursson
|
||||
*/
|
||||
public class DefaultNamingExceptionTranslator implements
|
||||
NamingExceptionTranslator {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.springframework.ldap.NamingExceptionTranslator#translate(java.lang.String,
|
||||
* java.lang.String, java.lang.String, javax.naming.NamingException)
|
||||
*/
|
||||
public DataAccessException translate(NamingException namingException) {
|
||||
|
||||
if (namingException instanceof NameNotFoundException) {
|
||||
return new EntryNotFoundException("Entry not found",
|
||||
namingException);
|
||||
}
|
||||
|
||||
if (namingException instanceof InvalidSearchFilterException) {
|
||||
return new BadLdapGrammarException("Invalid search filter",
|
||||
namingException);
|
||||
}
|
||||
|
||||
if (namingException instanceof InvalidSearchControlsException) {
|
||||
return new InvalidDataAccessApiUsageException(
|
||||
"Invalid search controls supplied by internal API",
|
||||
namingException);
|
||||
}
|
||||
|
||||
if (namingException instanceof NameAlreadyBoundException) {
|
||||
return new DataIntegrityViolationException("Name already bound",
|
||||
namingException);
|
||||
}
|
||||
|
||||
if (namingException instanceof ContextNotEmptyException) {
|
||||
return new DataIntegrityViolationException(
|
||||
"The context needs to be empty in order to be removed",
|
||||
namingException);
|
||||
}
|
||||
|
||||
if (namingException instanceof InvalidAttributesException) {
|
||||
return new AttributesIntegrityViolationException(
|
||||
"Invalid attributes", namingException);
|
||||
}
|
||||
|
||||
if (namingException instanceof LimitExceededException) {
|
||||
return new SearchLimitExceededException("Too many objects found",
|
||||
namingException);
|
||||
}
|
||||
|
||||
if (namingException instanceof CommunicationException) {
|
||||
throw new DataRetrievalFailureException(
|
||||
"Unable to communicate with LDAP server", namingException);
|
||||
}
|
||||
|
||||
// Fallback - other type of NamingException encountered.
|
||||
return new UncategorizedLdapException("Operation failed",
|
||||
namingException);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2005 the original author or authors.
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,22 +16,17 @@
|
||||
|
||||
package org.springframework.ldap;
|
||||
|
||||
import org.springframework.dao.DataRetrievalFailureException;
|
||||
|
||||
/**
|
||||
* Represents that an entry could not be found.
|
||||
* Runtime exception mirroring the InsufficientResourcesException.
|
||||
*
|
||||
* @author Mattias Arthursson
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.InsufficientResourcesException
|
||||
*/
|
||||
public class EntryNotFoundException extends DataRetrievalFailureException {
|
||||
public class InsufficientResourcesException extends NamingException {
|
||||
|
||||
private static final long serialVersionUID = -1268390922996332424L;
|
||||
|
||||
public EntryNotFoundException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
public EntryNotFoundException(String msg, Throwable cause) {
|
||||
super(msg, cause);
|
||||
public InsufficientResourcesException(
|
||||
javax.naming.InsufficientResourcesException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the InterruptedNamingException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.InterruptedNamingException
|
||||
*/
|
||||
public class InterruptedNamingException extends NamingException {
|
||||
|
||||
public InterruptedNamingException(
|
||||
javax.naming.InterruptedNamingException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the InvalidAttributeIdentifierException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.directory.InvalidAttributeIdentifierException
|
||||
*/
|
||||
public class InvalidAttributeIdentifierException extends NamingException {
|
||||
|
||||
public InvalidAttributeIdentifierException(
|
||||
javax.naming.directory.InvalidAttributeIdentifierException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the InvalidAttributeValueException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.directory.InvalidAttributeValueException
|
||||
*/
|
||||
public class InvalidAttributeValueException extends NamingException {
|
||||
|
||||
public InvalidAttributeValueException(
|
||||
javax.naming.directory.InvalidAttributeValueException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2005 the original author or authors.
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,22 +16,17 @@
|
||||
|
||||
package org.springframework.ldap;
|
||||
|
||||
import org.springframework.dao.DataRetrievalFailureException;
|
||||
|
||||
/**
|
||||
* Indicates that the search limit was exceeded in a search.
|
||||
*
|
||||
* @author Mattias Arthursson
|
||||
* Runtime exception mirroring the InvalidAttributesException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.directory.InvalidAttributesException
|
||||
*/
|
||||
public class SearchLimitExceededException extends DataRetrievalFailureException {
|
||||
private static final long serialVersionUID = 6899885947075235580L;
|
||||
public class InvalidAttributesException extends NamingException {
|
||||
|
||||
public SearchLimitExceededException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
public SearchLimitExceededException(String msg, Throwable cause) {
|
||||
super(msg, cause);
|
||||
public InvalidAttributesException(
|
||||
javax.naming.directory.InvalidAttributesException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the InvalidNameException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.InvalidNameException
|
||||
*/
|
||||
public class InvalidNameException extends NamingException {
|
||||
|
||||
public InvalidNameException(javax.naming.InvalidNameException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the InvalidSearchControlsException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.directory.InvalidSearchControlsException
|
||||
*/
|
||||
public class InvalidSearchControlsException extends NamingException {
|
||||
|
||||
public InvalidSearchControlsException(
|
||||
javax.naming.directory.InvalidSearchControlsException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the InvalidSearchFilterException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.directory.InvalidSearchFilterException
|
||||
*/
|
||||
public class InvalidSearchFilterException extends NamingException {
|
||||
|
||||
public InvalidSearchFilterException(
|
||||
javax.naming.directory.InvalidSearchFilterException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the LdapReferralException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.ldap.LdapReferralException
|
||||
*/
|
||||
public class LdapReferralException extends ReferralException {
|
||||
|
||||
public LdapReferralException(javax.naming.ldap.LdapReferralException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the LimitExceededException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.LimitExceededException
|
||||
*/
|
||||
public class LimitExceededException extends NamingException {
|
||||
|
||||
public LimitExceededException(javax.naming.LimitExceededException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the LinkException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.LinkException
|
||||
*/
|
||||
public class LinkException extends NamingException {
|
||||
|
||||
public LinkException(javax.naming.LinkException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the LinkLoopException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.LinkLoopException
|
||||
*/
|
||||
public class LinkLoopException extends LinkException {
|
||||
|
||||
public LinkLoopException(javax.naming.LinkLoopException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the MalformedLinkException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.MalformedLinkException
|
||||
*/
|
||||
public class MalformedLinkException extends LinkException {
|
||||
|
||||
public MalformedLinkException(javax.naming.MalformedLinkException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the NameAlreadyBoundException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.NameAlreadyBoundException
|
||||
*/
|
||||
public class NameAlreadyBoundException extends NamingException {
|
||||
|
||||
public NameAlreadyBoundException(
|
||||
javax.naming.NameAlreadyBoundException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the NameNotFoundException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.NameNotFoundException
|
||||
*/
|
||||
public class NameNotFoundException extends NamingException {
|
||||
|
||||
public NameNotFoundException(javax.naming.NameNotFoundException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
import javax.naming.Name;
|
||||
|
||||
import org.springframework.core.NestedRuntimeException;
|
||||
|
||||
/**
|
||||
* Base class for exception thrown by the framework whenever it encounters a
|
||||
* problem related to LDAP.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
*/
|
||||
public abstract class NamingException extends NestedRuntimeException {
|
||||
|
||||
/**
|
||||
* Constructor that takes a message.
|
||||
*
|
||||
* @param msg
|
||||
* the detail message
|
||||
*/
|
||||
public NamingException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor that allows a message and a root cause.
|
||||
*
|
||||
* @param msg
|
||||
* the detail message
|
||||
* @param cause
|
||||
* the cause of the exception. This argument is generally
|
||||
* expected to be a proper subclass of
|
||||
* {@link javax.naming.NamingException}.
|
||||
*/
|
||||
public NamingException(String msg, Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor that allows a plain root cause, intended for subclasses
|
||||
* mirroring corresponding <code>javax.naming</code> exceptions.
|
||||
*
|
||||
* @param cause
|
||||
* the cause of the exception. This argument is generally
|
||||
* expected to be a proper subclass of
|
||||
* {@link javax.naming.NamingException}.
|
||||
*/
|
||||
public NamingException(Throwable cause) {
|
||||
super(cause != null ? cause.getMessage() : null, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to get the explanation associated with this exception,
|
||||
* if the root cause was an instance of {@link javax.naming.NamingException}.
|
||||
*
|
||||
* @return a detail string explaining more about this exception if the root
|
||||
* cause is an instance of javax.naming.NamingException, or
|
||||
* <code>null</code> if there is no detail message for this
|
||||
* exception
|
||||
*/
|
||||
public String getExplanation() {
|
||||
if (getCause() instanceof javax.naming.NamingException) {
|
||||
return ((javax.naming.NamingException) getCause()).getExplanation();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to get the unresolved part of the name associated with
|
||||
* this exception, if the root cause was an instance of
|
||||
* {@link javax.naming.NamingException}.
|
||||
*
|
||||
* @return a composite name describing the part of the name that has not
|
||||
* been resolved if the root cause is an instance of
|
||||
* javax.naming.NamingException, or <code>null</code> if the
|
||||
* remaining name field has not been set
|
||||
*/
|
||||
public Name getRemainingName() {
|
||||
if (getCause() instanceof javax.naming.NamingException) {
|
||||
return ((javax.naming.NamingException) getCause())
|
||||
.getRemainingName();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to get the leading portion of the resolved name
|
||||
* associated with this exception, if the root cause was an instance of
|
||||
* {@link javax.naming.NamingException}.
|
||||
*
|
||||
* @return a composite name describing the the leading portion of the name
|
||||
* that was resolved successfully if the root cause is an instance
|
||||
* of javax.naming.NamingException, or <code>null</code> if the
|
||||
* resolved name field has not been set
|
||||
*/
|
||||
public Name getResolvedName() {
|
||||
if (getCause() instanceof javax.naming.NamingException) {
|
||||
return ((javax.naming.NamingException) getCause())
|
||||
.getResolvedName();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to get the resolved object associated with this
|
||||
* exception, if the root cause was an instance of
|
||||
* {@link javax.naming.NamingException}.
|
||||
*
|
||||
* @return the object that was resolved so far if the root cause is an
|
||||
* instance of javax.naming.NamingException, or <code>null</code>
|
||||
* if the resolved object field has not been set
|
||||
*/
|
||||
public Object getResolvedObj() {
|
||||
if (getCause() instanceof javax.naming.NamingException) {
|
||||
return ((javax.naming.NamingException) getCause()).getResolvedObj();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2005 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
import javax.naming.NamingException;
|
||||
|
||||
import org.springframework.dao.DataAccessException;
|
||||
|
||||
/**
|
||||
* Interface to be implemented by classes that can translate between
|
||||
* NamingExceptions and DataAccessExceptions.
|
||||
*
|
||||
* @author Mattias Arthursson
|
||||
*
|
||||
*/
|
||||
public interface NamingExceptionTranslator {
|
||||
/**
|
||||
* Translate the given NamingException into a generic data access exception.
|
||||
* @param namingException
|
||||
* the offending NamingException.
|
||||
*
|
||||
* @return the DataAccessException to throw.
|
||||
*/
|
||||
public DataAccessException translate(NamingException namingException);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the NamingSecurityException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.NamingSecurityException
|
||||
*/
|
||||
public abstract class NamingSecurityException extends NamingException {
|
||||
|
||||
public NamingSecurityException(javax.naming.NamingSecurityException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the NoInitialContextException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.NoInitialContextException
|
||||
*/
|
||||
public class NoInitialContextException extends NamingException {
|
||||
|
||||
public NoInitialContextException(
|
||||
javax.naming.NoInitialContextException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the NoPermissionException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.NoPermissionException
|
||||
*/
|
||||
public class NoPermissionException extends NamingSecurityException {
|
||||
|
||||
public NoPermissionException(javax.naming.NoPermissionException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the NoSuchAttributeException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.directory.NoSuchAttributeException
|
||||
*/
|
||||
public class NoSuchAttributeException extends NamingException {
|
||||
|
||||
public NoSuchAttributeException(
|
||||
javax.naming.directory.NoSuchAttributeException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the NotContextException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.NotContextException
|
||||
*/
|
||||
public class NotContextException extends NamingException {
|
||||
|
||||
public NotContextException(javax.naming.NotContextException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the OperationNotSupportedException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.OperationNotSupportedException
|
||||
*/
|
||||
public class OperationNotSupportedException extends NamingException {
|
||||
|
||||
public OperationNotSupportedException(
|
||||
javax.naming.OperationNotSupportedException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the PartialResultException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.PartialResultException
|
||||
*/
|
||||
public class PartialResultException extends NamingException {
|
||||
|
||||
public PartialResultException(javax.naming.PartialResultException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the ReferralException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.ReferralException
|
||||
*/
|
||||
public abstract class ReferralException extends NamingException {
|
||||
|
||||
public ReferralException(javax.naming.ReferralException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the SchemaViolationException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.directory.SchemaViolationException
|
||||
*/
|
||||
public class SchemaViolationException extends NamingException {
|
||||
|
||||
public SchemaViolationException(
|
||||
javax.naming.directory.SchemaViolationException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the ServiceUnavailableException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.ServiceUnavailableException
|
||||
*/
|
||||
public class ServiceUnavailableException extends NamingException {
|
||||
|
||||
public ServiceUnavailableException(
|
||||
javax.naming.ServiceUnavailableException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the SizeLimitExceededException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.SizeLimitExceededException
|
||||
*/
|
||||
public class SizeLimitExceededException extends LimitExceededException {
|
||||
|
||||
public SizeLimitExceededException(
|
||||
javax.naming.SizeLimitExceededException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap;
|
||||
|
||||
/**
|
||||
* Runtime exception mirroring the TimeLimitExceededException.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
* @see javax.naming.TimeLimitExceededException
|
||||
*/
|
||||
public class TimeLimitExceededException extends LimitExceededException {
|
||||
|
||||
public TimeLimitExceededException(
|
||||
javax.naming.TimeLimitExceededException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,8 @@
|
||||
<html>
|
||||
<body>
|
||||
The core package of the Spring-LDAP library.
|
||||
</body>
|
||||
|
||||
This package contains integration classes for JNDI/LDAP,
|
||||
allowing for Spring-style LDAP access.
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -28,8 +28,6 @@ import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.core.JdkVersion;
|
||||
import org.springframework.ldap.DefaultNamingExceptionTranslator;
|
||||
import org.springframework.ldap.NamingExceptionTranslator;
|
||||
import org.springframework.ldap.core.AuthenticationSource;
|
||||
import org.springframework.ldap.core.ContextSource;
|
||||
|
||||
|
||||
@@ -46,8 +46,6 @@ import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.ldap.DefaultNamingExceptionTranslator;
|
||||
import org.springframework.ldap.NamingExceptionTranslator;
|
||||
|
||||
/**
|
||||
* Implements the interesting methods of the DirContext interface. In particular
|
||||
|
||||
@@ -28,7 +28,6 @@ import javax.naming.InvalidNameException;
|
||||
import javax.naming.Name;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.ldap.BadLdapGrammarException;
|
||||
import org.springframework.ldap.util.ListComparator;
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,7 +21,6 @@ import java.util.regex.Pattern;
|
||||
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.ldap.BadLdapGrammarException;
|
||||
|
||||
/**
|
||||
* Helper class to encode and decode ldap names and values.
|
||||
|
||||
@@ -22,7 +22,6 @@ import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.ldap.BadLdapGrammarException;
|
||||
import org.springframework.ldap.util.ListComparator;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,210 @@
|
||||
/*
|
||||
* Copyright 2002-2006 the original author or authors.
|
||||
*
|
||||
* Licensed 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.springframework.ldap.support;
|
||||
|
||||
import javax.naming.directory.DirContext;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.ldap.NamingException;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Generic utility methods for working with LDAP. Mainly for internal use within
|
||||
* the framework, but also useful for custom code.
|
||||
*
|
||||
* @author Ulrik Sandberg
|
||||
* @since 1.2
|
||||
*/
|
||||
public abstract class LdapUtils {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(LdapUtils.class);
|
||||
|
||||
/**
|
||||
* Close the given JNDI Context and ignore any thrown exception. This is
|
||||
* useful for typical <code>finally</code> blocks in JNDI code.
|
||||
*
|
||||
* @param context
|
||||
* the JNDI Context to close (may be <code>null</code>)
|
||||
*/
|
||||
public static void closeContext(DirContext context) {
|
||||
if (context != null) {
|
||||
try {
|
||||
context.close();
|
||||
} catch (NamingException ex) {
|
||||
logger.debug("Could not close JNDI DirContext", ex);
|
||||
} catch (Throwable ex) {
|
||||
// We don't trust the JNDI provider: It might throw
|
||||
// RuntimeException or Error.
|
||||
logger.debug("Unexpected exception on closing JNDI DirContext",
|
||||
ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the specified checked
|
||||
* {@link javax.naming.NamingException NamingException} to a Spring LDAP
|
||||
* runtime {@link org.springframework.ldap.NamingException NamingException}
|
||||
* equivalent.
|
||||
*
|
||||
* @param ex
|
||||
* the original checked NamingException to convert
|
||||
* @return the Spring LDAP runtime NamingException wrapping the given
|
||||
* exception
|
||||
*/
|
||||
public static NamingException convertLdapException(
|
||||
javax.naming.NamingException ex) {
|
||||
Assert.notNull(ex, "NamingException must not be null");
|
||||
|
||||
if (ex instanceof javax.naming.directory.AttributeInUseException) {
|
||||
return new org.springframework.ldap.AttributeInUseException(
|
||||
(javax.naming.directory.AttributeInUseException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.directory.AttributeModificationException) {
|
||||
return new org.springframework.ldap.AttributeModificationException(
|
||||
(javax.naming.directory.AttributeModificationException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.AuthenticationException) {
|
||||
return new org.springframework.ldap.AuthenticationException(
|
||||
(javax.naming.AuthenticationException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.AuthenticationNotSupportedException) {
|
||||
return new org.springframework.ldap.AuthenticationNotSupportedException(
|
||||
(javax.naming.AuthenticationNotSupportedException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.CannotProceedException) {
|
||||
return new org.springframework.ldap.CannotProceedException(
|
||||
(javax.naming.CannotProceedException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.CommunicationException) {
|
||||
return new org.springframework.ldap.CommunicationException(
|
||||
(javax.naming.CommunicationException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.ConfigurationException) {
|
||||
return new org.springframework.ldap.ConfigurationException(
|
||||
(javax.naming.ConfigurationException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.ContextNotEmptyException) {
|
||||
return new org.springframework.ldap.ContextNotEmptyException(
|
||||
(javax.naming.ContextNotEmptyException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.InsufficientResourcesException) {
|
||||
return new org.springframework.ldap.InsufficientResourcesException(
|
||||
(javax.naming.InsufficientResourcesException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.InterruptedNamingException) {
|
||||
return new org.springframework.ldap.InterruptedNamingException(
|
||||
(javax.naming.InterruptedNamingException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.directory.InvalidAttributeIdentifierException) {
|
||||
return new org.springframework.ldap.InvalidAttributeIdentifierException(
|
||||
(javax.naming.directory.InvalidAttributeIdentifierException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.directory.InvalidAttributesException) {
|
||||
return new org.springframework.ldap.InvalidAttributesException(
|
||||
(javax.naming.directory.InvalidAttributesException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.directory.InvalidAttributeValueException) {
|
||||
return new org.springframework.ldap.InvalidAttributeValueException(
|
||||
(javax.naming.directory.InvalidAttributeValueException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.InvalidNameException) {
|
||||
return new org.springframework.ldap.InvalidNameException(
|
||||
(javax.naming.InvalidNameException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.directory.InvalidSearchControlsException) {
|
||||
return new org.springframework.ldap.InvalidSearchControlsException(
|
||||
(javax.naming.directory.InvalidSearchControlsException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.directory.InvalidSearchFilterException) {
|
||||
return new org.springframework.ldap.InvalidSearchFilterException(
|
||||
(javax.naming.directory.InvalidSearchFilterException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.ldap.LdapReferralException) {
|
||||
return new org.springframework.ldap.LdapReferralException(
|
||||
(javax.naming.ldap.LdapReferralException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.LimitExceededException) {
|
||||
return new org.springframework.ldap.LimitExceededException(
|
||||
(javax.naming.LimitExceededException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.LinkException) {
|
||||
return new org.springframework.ldap.LinkException(
|
||||
(javax.naming.LinkException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.LinkLoopException) {
|
||||
return new org.springframework.ldap.LinkLoopException(
|
||||
(javax.naming.LinkLoopException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.MalformedLinkException) {
|
||||
return new org.springframework.ldap.MalformedLinkException(
|
||||
(javax.naming.MalformedLinkException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.NameAlreadyBoundException) {
|
||||
return new org.springframework.ldap.NameAlreadyBoundException(
|
||||
(javax.naming.NameAlreadyBoundException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.NameNotFoundException) {
|
||||
return new org.springframework.ldap.NameNotFoundException(
|
||||
(javax.naming.NameNotFoundException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.NoInitialContextException) {
|
||||
return new org.springframework.ldap.NoInitialContextException(
|
||||
(javax.naming.NoInitialContextException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.NoPermissionException) {
|
||||
return new org.springframework.ldap.NoPermissionException(
|
||||
(javax.naming.NoPermissionException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.directory.NoSuchAttributeException) {
|
||||
return new org.springframework.ldap.NoSuchAttributeException(
|
||||
(javax.naming.directory.NoSuchAttributeException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.NotContextException) {
|
||||
return new org.springframework.ldap.NotContextException(
|
||||
(javax.naming.NotContextException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.OperationNotSupportedException) {
|
||||
return new org.springframework.ldap.OperationNotSupportedException(
|
||||
(javax.naming.OperationNotSupportedException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.PartialResultException) {
|
||||
return new org.springframework.ldap.PartialResultException(
|
||||
(javax.naming.PartialResultException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.directory.SchemaViolationException) {
|
||||
return new org.springframework.ldap.SchemaViolationException(
|
||||
(javax.naming.directory.SchemaViolationException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.ServiceUnavailableException) {
|
||||
return new org.springframework.ldap.ServiceUnavailableException(
|
||||
(javax.naming.ServiceUnavailableException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.SizeLimitExceededException) {
|
||||
return new org.springframework.ldap.SizeLimitExceededException(
|
||||
(javax.naming.SizeLimitExceededException) ex);
|
||||
}
|
||||
if (ex instanceof javax.naming.TimeLimitExceededException) {
|
||||
return new org.springframework.ldap.TimeLimitExceededException(
|
||||
(javax.naming.TimeLimitExceededException) ex);
|
||||
}
|
||||
|
||||
// fallback
|
||||
return new org.springframework.ldap.UncategorizedLdapException(ex);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,7 @@
|
||||
<html>
|
||||
<body>
|
||||
|
||||
Support classes for Spring-LDAP.
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user