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 2012/01/03 18:15:57 UTC
svn commit: r1226877 -
/directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/security/CoreKeyStoreSpi.java
Author: elecharny
Date: Tue Jan 3 17:15:57 2012
New Revision: 1226877
URL: http://svn.apache.org/viewvc?rev=1226877&view=rev
Log:
No need anymore to declare a txn in getTlsEntry : it's already done in coreSession
Modified:
directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/security/CoreKeyStoreSpi.java
Modified: directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/security/CoreKeyStoreSpi.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/security/CoreKeyStoreSpi.java?rev=1226877&r1=1226876&r2=1226877&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/security/CoreKeyStoreSpi.java (original)
+++ directory/apacheds/branches/apacheds-txns/core/src/main/java/org/apache/directory/server/core/security/CoreKeyStoreSpi.java Tue Jan 3 17:15:57 2012
@@ -41,7 +41,6 @@ import org.apache.directory.server.const
import org.apache.directory.server.core.api.CoreSession;
import org.apache.directory.server.core.api.DirectoryService;
import org.apache.directory.server.core.api.LdapPrincipal;
-import org.apache.directory.server.core.api.txn.TxnManager;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.shared.ldap.model.constants.AuthenticationLevel;
import org.apache.directory.shared.ldap.model.entry.Entry;
@@ -63,9 +62,9 @@ public class CoreKeyStoreSpi extends Key
private static final String APACHEDS_ALIAS = "apacheds";
private static final Logger LOG = LoggerFactory.getLogger( CoreKeyStoreSpi.class );
-
+
private DirectoryService directoryService;
-
+
/**
* Creates a new instance of LocalKeyStore.
@@ -80,31 +79,16 @@ public class CoreKeyStoreSpi extends Key
private Entry getTlsEntry() throws Exception
{
Dn adminDn = directoryService.getDnFactory().create( ServerDNConstants.ADMIN_SYSTEM_DN );
- LdapPrincipal principal = new LdapPrincipal( directoryService.getSchemaManager(), adminDn, AuthenticationLevel.SIMPLE );
+ LdapPrincipal principal = new LdapPrincipal( directoryService.getSchemaManager(), adminDn,
+ AuthenticationLevel.SIMPLE );
CoreSession session = directoryService.getSession( principal );
-
- TxnManager txnManager = directoryService.getTxnManager();
- Entry entry;
- txnManager.beginTransaction( true );
-
- try
- {
- entry = session.lookup( adminDn );
- }
- catch ( Exception e )
- {
- txnManager.abortTransaction();
- throw ( e );
- }
- // If here then we are done.
- txnManager.commitTransaction();
+ Entry entry = session.lookup( adminDn );
return entry;
-
}
-
+
/* (non-Javadoc)
* @see java.security.KeyStoreSpi#engineAliases()
*/
@@ -123,12 +107,12 @@ public class CoreKeyStoreSpi extends Key
public boolean engineContainsAlias( String alias )
{
LOG.debug( "engineContainsAlias({}) called.", alias );
-
+
if ( alias.equalsIgnoreCase( APACHEDS_ALIAS ) )
{
return true;
}
-
+
return false;
}
@@ -163,7 +147,7 @@ public class CoreKeyStoreSpi extends Key
LOG.error( I18n.err( I18n.ERR_65 ), e );
}
}
-
+
return null;
}
@@ -175,7 +159,7 @@ public class CoreKeyStoreSpi extends Key
public String engineGetCertificateAlias( Certificate cert )
{
LOG.debug( "engineGetCertificateAlias({}) called.", cert );
-
+
if ( cert instanceof X509Certificate )
{
LOG.debug( "Certificate in alias request is X.509 based." );
@@ -185,7 +169,7 @@ public class CoreKeyStoreSpi extends Key
return APACHEDS_ALIAS;
}
}
-
+
try
{
Entry entry = getTlsEntry();
@@ -198,7 +182,7 @@ public class CoreKeyStoreSpi extends Key
{
LOG.error( I18n.err( I18n.ERR_66 ), e );
}
-
+
return null;
}
@@ -214,13 +198,14 @@ public class CoreKeyStoreSpi extends Key
{
Entry entry = getTlsEntry();
LOG.debug( "Entry:\n{}", entry );
- return new Certificate[] { TlsKeyGenerator.getCertificate( entry ) };
+ return new Certificate[]
+ { TlsKeyGenerator.getCertificate( entry ) };
}
catch ( Exception e )
{
LOG.error( I18n.err( I18n.ERR_66 ), e );
}
-
+
return new Certificate[0];
}
@@ -243,7 +228,7 @@ public class CoreKeyStoreSpi extends Key
public Key engineGetKey( String alias, char[] password ) throws NoSuchAlgorithmException, UnrecoverableKeyException
{
LOG.debug( "engineGetKey({}, {}) called.", alias, password );
-
+
try
{
Entry entry = getTlsEntry();
@@ -254,7 +239,7 @@ public class CoreKeyStoreSpi extends Key
{
LOG.error( I18n.err( I18n.ERR_68 ), e );
}
-
+
return null;
}