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:10 UTC
[1/3] directory-kerby git commit: DIRKRB-421. Define transaction API
for identity backend
Repository: directory-kerby
Updated Branches:
refs/heads/master 675e792e1 -> 705775a15
DIRKRB-421. Define transaction API for identity backend
Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/0aa0802b
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/0aa0802b
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/0aa0802b
Branch: refs/heads/master
Commit: 0aa0802bd36f1359d3eef1317221201697bec821
Parents: 6e15b50
Author: Kai Zheng <ka...@intel.com>
Authored: Thu Sep 24 22:10:44 2015 +0800
Committer: Kai Zheng <ka...@intel.com>
Committed: Thu Sep 24 22:10:44 2015 +0800
----------------------------------------------------------------------
.../kerb/identity/CacheableIdentityService.java | 16 +++++
.../kerberos/kerb/identity/IdentityService.java | 12 ++++
.../kerb/identity/IdentityTransaction.java | 64 ++++++++++++++++++++
.../backend/AbstractIdentityBackend.java | 17 ++++++
4 files changed, 109 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/0aa0802b/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 f53220c..5b9ec29 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
@@ -50,6 +50,22 @@ public class CacheableIdentityService
init();
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean supportTransaction() {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public IdentityTransaction startTransaction() throws KrbException {
+ throw new KrbException("Transaction isn't supported");
+ }
+
private void init() {
Map<String, KrbIdentity> tmpMap =
new LinkedHashMap<String, KrbIdentity>(cacheSize) {
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/0aa0802b/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 3d2e7dd..73ff44b 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,6 +27,18 @@ import org.apache.kerby.kerberos.kerb.KrbException;
public interface IdentityService {
/**
+ * Query to know if transaction is supported or not.
+ * @return true if supported, false otherwise
+ */
+ boolean supportTransaction();
+
+ /**
+ * Start a transaction.
+ * @return transaction
+ */
+ IdentityTransaction startTransaction() throws KrbException;
+
+ /**
* Get all of the identity principal names.
* Note it's ordered by principal name.
* @return principal names
http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/0aa0802b/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
new file mode 100644
index 0000000..d86876b
--- /dev/null
+++ b/kerby-kerb/kerb-identity/src/main/java/org/apache/kerby/kerberos/kerb/identity/IdentityTransaction.java
@@ -0,0 +1,64 @@
+/**
+ * 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/0aa0802b/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 774ee6d..a63e054 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,6 +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.KrbIdentity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -56,6 +57,22 @@ public abstract class AbstractIdentityBackend
}
/**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean supportTransaction() {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public IdentityTransaction startTransaction() throws KrbException {
+ throw new KrbException("Transaction isn't supported");
+ }
+
+ /**
* Perform the real initialization work for the backend.
* @throws KrbException e
*/
[3/3] directory-kerby git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/directory-kerby
Posted by dr...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/directory-kerby
Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/705775a1
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/705775a1
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/705775a1
Branch: refs/heads/master
Commit: 705775a1583457fe17e405fa0730bfb419d0ac2c
Parents: 217ac5e 675e792
Author: Kai Zheng <ka...@intel.com>
Authored: Fri Sep 25 10:39:09 2015 +0800
Committer: Kai Zheng <ka...@intel.com>
Committed: Fri Sep 25 10:39:09 2015 +0800
----------------------------------------------------------------------
.../org/apache/kerby/kerberos/kdc/KerbyKdcServer.java | 9 ++++++---
.../kerb/identity/backend/MemoryIdentityBackend.java | 5 ++++-
.../kerby/kerberos/kerb/server/request/KdcRequest.java | 5 -----
.../org/apache/kerby/kerberos/tool/kinit/KinitTool.java | 4 ++--
.../org/apache/kerby/kerberos/tool/klist/KlistTool.java | 4 ++--
.../apache/kerby/kerberos/tool/kadmin/KadminTool.java | 9 ++++++---
.../apache/kerby/kerberos/tool/kdcinit/KdcInitTool.java | 12 ++++++++----
7 files changed, 28 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
[2/3] directory-kerby git commit: Refined the new transaction API
Posted by dr...@apache.org.
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");
}