directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ha...@apache.org
Subject directory-kerby git commit: DIRKRB-240 Add KadminOption for kadmin tool. Contributed by Jiajia
Date Fri, 24 Apr 2015 14:58:12 GMT
Repository: directory-kerby
Updated Branches:
  refs/heads/master 8b74b5210 -> 854f924db


DIRKRB-240 Add KadminOption for kadmin tool. Contributed by Jiajia


Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/854f924d
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/854f924d
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/854f924d

Branch: refs/heads/master
Commit: 854f924db70b376ce9cf746bb39ac8b1579ee047
Parents: 8b74b52
Author: Lin <linchen7@foxmail.com>
Authored: Fri Apr 24 22:57:47 2015 +0800
Committer: Lin <linchen7@foxmail.com>
Committed: Fri Apr 24 22:57:47 2015 +0800

----------------------------------------------------------------------
 .../kerberos/tool/kadmin/tool/KadminOption.java | 114 +++++++++++++++++++
 .../main/java/org/apache/kerby/KOptionType.java |   3 +-
 .../main/java/org/apache/kerby/KOptions.java    |   4 +
 3 files changed, 120 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/854f924d/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/tool/KadminOption.java
----------------------------------------------------------------------
diff --git a/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/tool/KadminOption.java
b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/tool/KadminOption.java
new file mode 100644
index 0000000..d3ba441
--- /dev/null
+++ b/kerby-tool/kdc-tool/src/main/java/org/apache/kerby/kerberos/tool/kadmin/tool/KadminOption.java
@@ -0,0 +1,114 @@
+/**
+ *  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.tool.kadmin.tool;
+
+import org.apache.kerby.KOption;
+import org.apache.kerby.KOptionType;
+
+public enum KadminOption implements KOption {
+    NONE("NONE"),
+    EXPIRE("-expire", "expire time", KOptionType.DATE),
+    DISABLED("-disabled", "disabled", KOptionType.BOOL),
+    LOCKED("-locked", "locked", KOptionType.BOOL),
+    ;
+
+    private String name;
+    private KOptionType type = KOptionType.NONE;
+    private String description;
+    private Object value;
+
+    KadminOption(String description) {
+        this(description, KOptionType.NOV);
+    }
+
+    KadminOption(String description, KOptionType type) {
+        this.description = description;
+        this.type = type;
+    }
+
+    KadminOption(String name, String description) {
+        this(name, description, KOptionType.NOV);
+    }
+
+    KadminOption(String name, String description, KOptionType type) {
+        this.name = name;
+        this.description = description;
+        this.type = type;
+    }
+
+    public static KadminOption fromName(String name) {
+        if (name != null ) {
+            for (KadminOption kopt : values()) {
+                if (kopt.getName().equals(name)) {
+                    return (KadminOption) kopt;
+                }
+            }
+        }
+        return NONE;
+    }
+
+    @Override
+    public String getOptionName() {
+        return name();
+    }
+
+    @Override
+    public KOptionType getType() {
+        return this.type;
+    }
+
+    @Override
+    public void setType(KOptionType type) {
+        this.type = type;
+    }
+
+    @Override
+    public String getName() {
+        if (name != null) {
+            return name;
+        }
+        return name();
+    }
+
+    @Override
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public String getDescription() {
+        return this.description;
+    }
+
+    @Override
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    @Override
+    public Object getValue() {
+        return value;
+    }
+
+    @Override
+    public void setValue(Object value) {
+        this.value = value;
+    }
+}

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/854f924d/lib/kerby-util/src/main/java/org/apache/kerby/KOptionType.java
----------------------------------------------------------------------
diff --git a/lib/kerby-util/src/main/java/org/apache/kerby/KOptionType.java b/lib/kerby-util/src/main/java/org/apache/kerby/KOptionType.java
index e985131..d7e53b3 100644
--- a/lib/kerby-util/src/main/java/org/apache/kerby/KOptionType.java
+++ b/lib/kerby-util/src/main/java/org/apache/kerby/KOptionType.java
@@ -30,5 +30,6 @@ public enum KOptionType {
     BOOL, // boolean value
     FILE, // file path value
     DIR, // dir path value
-    OBJ  // arbitrary object
+    OBJ,  // arbitrary object
+    DATE // date value
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/854f924d/lib/kerby-util/src/main/java/org/apache/kerby/KOptions.java
----------------------------------------------------------------------
diff --git a/lib/kerby-util/src/main/java/org/apache/kerby/KOptions.java b/lib/kerby-util/src/main/java/org/apache/kerby/KOptions.java
index d124582..5e2780d 100644
--- a/lib/kerby-util/src/main/java/org/apache/kerby/KOptions.java
+++ b/lib/kerby-util/src/main/java/org/apache/kerby/KOptions.java
@@ -85,6 +85,10 @@ public class KOptions {
                 strVal.equalsIgnoreCase("yes") ||
                 strVal.equals("1")) {
                 return true;
+            } else if (strVal.equalsIgnoreCase("false") ||
+                strVal.equalsIgnoreCase("no") ||
+                strVal.equals("0")) {
+                return false;
             }
         } else if (value instanceof Boolean) {
             return (Boolean) value;


Mime
View raw message