You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by dr...@apache.org on 2015/09/25 04:40:11 UTC
[2/3] directory-kerby git commit: Refined the new transaction API
Refined the new transaction API
Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/217ac5e1
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/217ac5e1
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/217ac5e1
Branch: refs/heads/master
Commit: 217ac5e1b8a396be8c97c114c32d5cae8fa79839
Parents: 0aa0802
Author: Kai Zheng <ka...@intel.com>
Authored: Fri Sep 25 10:28:18 2015 +0800
Committer: Kai Zheng <ka...@intel.com>
Committed: Fri Sep 25 10:28:18 2015 +0800
----------------------------------------------------------------------
.../kerb/identity/CacheableIdentityService.java | 4 +-
.../kerberos/kerb/identity/IdentityService.java | 8 +--
.../kerb/identity/IdentityTransaction.java | 64 -------------------
.../kerby/kerberos/kerb/identity/XTrans.java | 65 ++++++++++++++++++++
.../backend/AbstractIdentityBackend.java | 6 +-
5 files changed, 74 insertions(+), 73 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/217ac5e1/kerby-kerb/kerb-identity/src/main/java/org/apache/kerby/kerberos/kerb/identity/CacheableIdentityService.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-identity/src/main/java/org/apache/kerby/kerberos/kerb/identity/CacheableIdentityService.java b/kerby-kerb/kerb-identity/src/main/java/org/apache/kerby/kerberos/kerb/identity/CacheableIdentityService.java
index 5b9ec29..ac00ebf 100644
--- a/kerby-kerb/kerb-identity/src/main/java/org/apache/kerby/kerberos/kerb/identity/CacheableIdentityService.java
+++ b/kerby-kerb/kerb-identity/src/main/java/org/apache/kerby/kerberos/kerb/identity/CacheableIdentityService.java
@@ -54,7 +54,7 @@ public class CacheableIdentityService
* {@inheritDoc}
*/
@Override
- public boolean supportTransaction() {
+ public boolean supportXtrans() {
return false;
}
@@ -62,7 +62,7 @@ public class CacheableIdentityService
* {@inheritDoc}
*/
@Override
- public IdentityTransaction startTransaction() throws KrbException {
+ public XTrans startXtrans() throws KrbException {
throw new KrbException("Transaction isn't supported");
}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/217ac5e1/kerby-kerb/kerb-identity/src/main/java/org/apache/kerby/kerberos/kerb/identity/IdentityService.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-identity/src/main/java/org/apache/kerby/kerberos/kerb/identity/IdentityService.java b/kerby-kerb/kerb-identity/src/main/java/org/apache/kerby/kerberos/kerb/identity/IdentityService.java
index 73ff44b..ee6b3f6 100644
--- a/kerby-kerb/kerb-identity/src/main/java/org/apache/kerby/kerberos/kerb/identity/IdentityService.java
+++ b/kerby-kerb/kerb-identity/src/main/java/org/apache/kerby/kerberos/kerb/identity/IdentityService.java
@@ -27,16 +27,16 @@ import org.apache.kerby.kerberos.kerb.KrbException;
public interface IdentityService {
/**
- * Query to know if transaction is supported or not.
+ * Query to know if xtrans is supported or not.
* @return true if supported, false otherwise
*/
- boolean supportTransaction();
+ boolean supportXtrans();
/**
* Start a transaction.
- * @return transaction
+ * @return xtrans
*/
- IdentityTransaction startTransaction() throws KrbException;
+ XTrans startXtrans() throws KrbException;
/**
* Get all of the identity principal names.
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/217ac5e1/kerby-kerb/kerb-identity/src/main/java/org/apache/kerby/kerberos/kerb/identity/IdentityTransaction.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-identity/src/main/java/org/apache/kerby/kerberos/kerb/identity/IdentityTransaction.java b/kerby-kerb/kerb-identity/src/main/java/org/apache/kerby/kerberos/kerb/identity/IdentityTransaction.java
deleted file mode 100644
index d86876b..0000000
--- a/kerby-kerb/kerb-identity/src/main/java/org/apache/kerby/kerberos/kerb/identity/IdentityTransaction.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * 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.kerby.kerberos.kerb.identity;
-
-import org.apache.kerby.kerberos.kerb.KrbException;
-
-/**
- * Identity transaction for KDC backend to create/update/delete principal accounts.
- */
-public interface IdentityTransaction {
-
- /**
- * Commit this transaction, releasing any associated resources.
- * @throws KrbException
- */
- void commit() throws KrbException;
-
- /**
- * Give up this transaction, releasing any associated resources.
- * @throws KrbException
- */
- void rollback() throws KrbException;
-
- /**
- * Add an identity, and return the newly created result.
- * @param identity The identity
- * @return IdentityTransaction
- * @throws KrbException e
- */
- IdentityTransaction addIdentity(KrbIdentity identity) throws KrbException;
-
- /**
- * Update an identity, and return the updated result.
- * @param identity The identity
- * @return IdentityTransaction
- * @throws KrbException e
- */
- IdentityTransaction updateIdentity(KrbIdentity identity) throws KrbException;
-
- /**
- * Delete the identity specified by principal name
- * @param principalName The principal name
- * @return IdentityTransaction
- * @throws KrbException e
- */
- IdentityTransaction deleteIdentity(String principalName) throws KrbException;
-}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/217ac5e1/kerby-kerb/kerb-identity/src/main/java/org/apache/kerby/kerberos/kerb/identity/XTrans.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-identity/src/main/java/org/apache/kerby/kerberos/kerb/identity/XTrans.java b/kerby-kerb/kerb-identity/src/main/java/org/apache/kerby/kerberos/kerb/identity/XTrans.java
new file mode 100644
index 0000000..b5dcb6b
--- /dev/null
+++ b/kerby-kerb/kerb-identity/src/main/java/org/apache/kerby/kerberos/kerb/identity/XTrans.java
@@ -0,0 +1,65 @@
+/**
+ * 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.kerby.kerberos.kerb.identity;
+
+import org.apache.kerby.kerberos.kerb.KrbException;
+
+/**
+ * Batch operations support to create/update/delete principal accounts
+ * in a transaction.
+ */
+public interface XTrans {
+
+ /**
+ * Commit this transaction, releasing any associated resources.
+ * @throws KrbException
+ */
+ void commit() throws KrbException;
+
+ /**
+ * Give up this transaction, releasing any associated resources.
+ * @throws KrbException
+ */
+ void rollback() throws KrbException;
+
+ /**
+ * Add an identity, and return the newly created result.
+ * @param identity The identity
+ * @return XTrans
+ * @throws KrbException e
+ */
+ XTrans addIdentity(KrbIdentity identity) throws KrbException;
+
+ /**
+ * Update an identity, and return the updated result.
+ * @param identity The identity
+ * @return XTrans
+ * @throws KrbException e
+ */
+ XTrans updateIdentity(KrbIdentity identity) throws KrbException;
+
+ /**
+ * Delete the identity specified by principal name
+ * @param principalName The principal name
+ * @return XTrans
+ * @throws KrbException e
+ */
+ XTrans deleteIdentity(String principalName) throws KrbException;
+}
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/217ac5e1/kerby-kerb/kerb-identity/src/main/java/org/apache/kerby/kerberos/kerb/identity/backend/AbstractIdentityBackend.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-identity/src/main/java/org/apache/kerby/kerberos/kerb/identity/backend/AbstractIdentityBackend.java b/kerby-kerb/kerb-identity/src/main/java/org/apache/kerby/kerberos/kerb/identity/backend/AbstractIdentityBackend.java
index a63e054..991fce0 100644
--- a/kerby-kerb/kerb-identity/src/main/java/org/apache/kerby/kerberos/kerb/identity/backend/AbstractIdentityBackend.java
+++ b/kerby-kerb/kerb-identity/src/main/java/org/apache/kerby/kerberos/kerb/identity/backend/AbstractIdentityBackend.java
@@ -21,7 +21,7 @@ package org.apache.kerby.kerberos.kerb.identity.backend;
import org.apache.kerby.config.Configured;
import org.apache.kerby.kerberos.kerb.KrbException;
-import org.apache.kerby.kerberos.kerb.identity.IdentityTransaction;
+import org.apache.kerby.kerberos.kerb.identity.XTrans;
import org.apache.kerby.kerberos.kerb.identity.KrbIdentity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -60,7 +60,7 @@ public abstract class AbstractIdentityBackend
* {@inheritDoc}
*/
@Override
- public boolean supportTransaction() {
+ public boolean supportXtrans() {
return false;
}
@@ -68,7 +68,7 @@ public abstract class AbstractIdentityBackend
* {@inheritDoc}
*/
@Override
- public IdentityTransaction startTransaction() throws KrbException {
+ public XTrans startXtrans() throws KrbException {
throw new KrbException("Transaction isn't supported");
}