Search in sources :

Example 56 with CaMgmtException

use of org.xipki.ca.server.mgmt.api.CaMgmtException in project xipki by xipki.

the class CaRequestorRemoveCmd method execute0.

@Override
protected Object execute0() throws Exception {
    for (String requestorName : requestorNames) {
        String msg = "requestor " + requestorName + " from CA " + caName;
        try {
            caManager.removeRequestorFromCa(requestorName, caName);
            println("removed " + msg);
        } catch (CaMgmtException ex) {
            throw new CmdFailure("could not remove " + msg + ", error: " + ex.getMessage(), ex);
        }
    }
    return null;
}
Also used : CaMgmtException(org.xipki.ca.server.mgmt.api.CaMgmtException) CmdFailure(org.xipki.console.karaf.CmdFailure)

Example 57 with CaMgmtException

use of org.xipki.ca.server.mgmt.api.CaMgmtException in project xipki by xipki.

the class CaUnrevokeCmd method execute0.

@Override
protected Object execute0() throws Exception {
    if (!caManager.getCaNames().contains(caName)) {
        throw new IllegalCmdParamException("invalid CA name " + caName);
    }
    String msg = "CA " + caName;
    try {
        caManager.unrevokeCa(caName);
        println("unrevoked " + msg);
        return null;
    } catch (CaMgmtException ex) {
        throw new CmdFailure("could not unrevoke " + msg + ", error: " + ex.getMessage(), ex);
    }
}
Also used : CaMgmtException(org.xipki.ca.server.mgmt.api.CaMgmtException) CmdFailure(org.xipki.console.karaf.CmdFailure) IllegalCmdParamException(org.xipki.console.karaf.IllegalCmdParamException)

Example 58 with CaMgmtException

use of org.xipki.ca.server.mgmt.api.CaMgmtException in project xipki by xipki.

the class CaUserAddCmd method execute0.

@Override
protected Object execute0() throws Exception {
    CaHasUserEntry entry = new CaHasUserEntry(new NameId(null, userName));
    entry.setProfiles(profiles);
    int intPermission = ShellUtil.getPermission(permissions);
    entry.setPermission(intPermission);
    String msg = "user " + userName + " to CA " + caName;
    try {
        caManager.addUserToCa(entry, caName);
        println("added " + msg);
        return null;
    } catch (CaMgmtException ex) {
        throw new CmdFailure("could not add " + msg + ", error: " + ex.getMessage(), ex);
    }
}
Also used : CaHasUserEntry(org.xipki.ca.server.mgmt.api.CaHasUserEntry) CaMgmtException(org.xipki.ca.server.mgmt.api.CaMgmtException) NameId(org.xipki.ca.api.NameId) CmdFailure(org.xipki.console.karaf.CmdFailure)

Example 59 with CaMgmtException

use of org.xipki.ca.server.mgmt.api.CaMgmtException in project xipki by xipki.

the class ClearPublishQueueCmd method execute0.

@Override
protected Object execute0() throws Exception {
    if (publisherNames == null) {
        throw new RuntimeException("should not reach here");
    }
    boolean allPublishers = false;
    for (String publisherName : publisherNames) {
        if ("all".equalsIgnoreCase(publisherName)) {
            allPublishers = true;
            break;
        }
    }
    if (allPublishers) {
        publisherNames = null;
    }
    if ("all".equalsIgnoreCase(caName)) {
        caName = null;
    }
    String msg = "publish queue of CA " + caName + " for publishers " + toString(publisherNames);
    try {
        caManager.clearPublishQueue(caName, publisherNames);
        println("cleared " + msg);
        return null;
    } catch (CaMgmtException ex) {
        throw new CmdFailure("could not clear " + msg + ", error: " + ex.getMessage(), ex);
    }
}
Also used : CaMgmtException(org.xipki.ca.server.mgmt.api.CaMgmtException) CmdFailure(org.xipki.console.karaf.CmdFailure)

Example 60 with CaMgmtException

use of org.xipki.ca.server.mgmt.api.CaMgmtException in project xipki by xipki.

the class CmpControlUpdateCmd method execute0.

@Override
protected Object execute0() throws Exception {
    String msg = "CMP control " + name;
    try {
        caManager.changeCmpControl(name, conf);
        println("updated " + msg);
        return null;
    } catch (CaMgmtException ex) {
        throw new CmdFailure("could not update " + msg + ", error: " + ex.getMessage(), ex);
    }
}
Also used : CaMgmtException(org.xipki.ca.server.mgmt.api.CaMgmtException) CmdFailure(org.xipki.console.karaf.CmdFailure)

Aggregations

CaMgmtException (org.xipki.ca.server.mgmt.api.CaMgmtException)157 PreparedStatement (java.sql.PreparedStatement)63 SQLException (java.sql.SQLException)63 CmdFailure (org.xipki.console.karaf.CmdFailure)52 NameId (org.xipki.ca.api.NameId)31 ResultSet (java.sql.ResultSet)24 OperationException (org.xipki.ca.api.OperationException)18 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)16 InvalidConfException (org.xipki.common.InvalidConfException)11 DataAccessException (org.xipki.datasource.DataAccessException)11 CertificateEncodingException (java.security.cert.CertificateEncodingException)9 CaHasRequestorEntry (org.xipki.ca.server.mgmt.api.CaHasRequestorEntry)9 CertificateException (java.security.cert.CertificateException)8 ObjectCreationException (org.xipki.common.ObjectCreationException)8 X509Certificate (java.security.cert.X509Certificate)7 Date (java.util.Date)7 X509CaEntry (org.xipki.ca.server.mgmt.api.x509.X509CaEntry)7 IOException (java.io.IOException)6 Statement (java.sql.Statement)6 CaHasUserEntry (org.xipki.ca.server.mgmt.api.CaHasUserEntry)6