Example usage for java.lang SecurityException getMessage

List of usage examples for java.lang SecurityException getMessage

Introduction

In this page you can find the example usage for java.lang SecurityException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:org.apache.directory.fortress.core.AdminMgrConsole.java

/**
 *
 *//* w  ww  .j  a  va2  s.c om*/
void addRoleAscendant() {
    try {
        Role cre = new Role();
        Role pre = new Role();
        ReaderUtil.clearScreen();
        System.out.println("Enter child role name:");
        cre.setName(ReaderUtil.readLn());
        System.out.println("Enter parent role name to add to repo:");
        pre.setName(ReaderUtil.readLn());
        System.out.println("Enter parent role description:");
        pre.setDescription(ReaderUtil.readLn());

        am.addAscendant(cre, pre);
        System.out.println("child role [" + cre.getName() + "]");
        System.out.println("parent role [" + pre.getName() + "]");
        System.out.println("parent role and inheritance relationship has been added");
        System.out.println("ENTER to continue");
    } catch (SecurityException e) {
        LOG.error("addRoleAscendant caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(),
                e);
    }
    ReaderUtil.readChar();
}

From source file:org.apache.directory.fortress.core.AdminMgrConsole.java

/**
 *
 *///  ww w  .  j a  va2s .  c  o  m
void addRoleDescendant() {
    try {
        Role cre = new Role();
        Role pre = new Role();
        ReaderUtil.clearScreen();
        System.out.println("Enter child role name to add to repo:");
        cre.setName(ReaderUtil.readLn());
        System.out.println("Enter child role description:");
        cre.setDescription(ReaderUtil.readLn());
        System.out.println("Enter parent role name:");
        pre.setName(ReaderUtil.readLn());
        am.addDescendant(pre, cre);
        System.out.println("child role [" + cre.getName() + "]");
        System.out.println("parent role [" + pre.getName() + "]");
        System.out.println("child role and inheritance relationship has been added");
        System.out.println("ENTER to continue");
    } catch (SecurityException e) {
        LOG.error("addRoleDescendant caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(),
                e);
    }
    ReaderUtil.readChar();
}

From source file:org.apache.directory.fortress.core.AdminMgrConsole.java

/**
 *
 *//*from w  ww .  j a va2s .  com*/
void addSsd() {
    SDSet se = new SDSet();

    try {
        ReaderUtil.clearScreen();
        System.out.println("Enter SSD Set name:");
        se.setName(ReaderUtil.readLn());
        System.out.println("Enter SSD's description field");
        se.setDescription(ReaderUtil.readLn());
        System.out.println("Enter role member, or null to skip:");
        String role = ReaderUtil.readLn();
        for (;;) {
            if (role != null && role.length() > 0) {
                se.addMember(role);
            } else {
                break;
            }
            System.out.println("Enter another role member, or null to skip:");
            role = ReaderUtil.readLn();
        }
        System.out.println("Enter SSD Set cardinality:");
        int cardinality = ReaderUtil.readInt();
        se.setCardinality(cardinality);
        SDSet se2 = am.createSsdSet(se);
        System.out.println("name [" + se2.getName() + "]");
        System.out.println("internalId [" + se2.getId() + "]");
        System.out.println("name description [" + se2.getDescription() + "]");
        System.out.println("has been added");
        System.out.println("ENTER to continue");
    } catch (SecurityException e) {
        LOG.error("addSsd caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
    }
    ReaderUtil.readChar();
}

From source file:org.apache.directory.fortress.core.AdminMgrConsole.java

/**
 *
 *//*from  www.  j  ava2s  . co  m*/
void addDsd() {
    SDSet se = new SDSet();

    try {
        ReaderUtil.clearScreen();
        System.out.println("Enter DSD Set name:");
        se.setName(ReaderUtil.readLn());
        System.out.println("Enter DSD's description field");
        se.setDescription(ReaderUtil.readLn());
        System.out.println("Enter role member, or null to skip:");
        String role = ReaderUtil.readLn();
        for (;;) {
            if (role != null && role.length() > 0) {
                se.addMember(role);
            } else {
                break;
            }
            System.out.println("Enter another role member, or null to skip:");
            role = ReaderUtil.readLn();
        }
        System.out.println("Enter DSD Set cardinality:");
        int cardinality = ReaderUtil.readInt();
        se.setCardinality(cardinality);
        SDSet se2 = am.createDsdSet(se);
        System.out.println("name [" + se2.getName() + "]");
        System.out.println("internalId [" + se2.getId() + "]");
        System.out.println("name description [" + se2.getDescription() + "]");
        System.out.println("has been added");
        System.out.println("ENTER to continue");
    } catch (SecurityException e) {
        LOG.error("addDsd caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
    }
    ReaderUtil.readChar();
}

From source file:org.apache.directory.fortress.core.AdminMgrConsole.java

void grantPermission(boolean isRole) {
    try {//from ww w .j a  v a2  s .  c o m
        ReaderUtil.clearScreen();
        System.out.println("Enter perm object");
        String object = ReaderUtil.readLn();
        System.out.println("Enter perm operation");
        String operation = ReaderUtil.readLn();
        Permission pOp = new Permission(object, operation);

        String name;
        if (isRole) {
            System.out.println("Enter role name");
            name = ReaderUtil.readLn();
            am.grantPermission(pOp, new Role(name));

        } else {
            System.out.println("Enter userId");
            name = ReaderUtil.readLn();
            am.grantPermission(pOp, new User(name));
        }

        System.out.println("perm object [" + object + "] operation [" + operation + "] has been granted to ["
                + name + "]");
        System.out.println("has been granted");
        System.out.println("ENTER to continue");
    } catch (SecurityException e) {
        LOG.error("grantPermission caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(),
                e);
    }
    ReaderUtil.readChar();
}

From source file:org.apache.directory.fortress.core.AdminMgrConsole.java

void revokePermission(boolean isRole) {
    try {/*from   www  .  j  ava2  s  .  c  o m*/
        ReaderUtil.clearScreen();
        System.out.println("Enter perm object");
        String object = ReaderUtil.readLn();
        System.out.println("Enter perm operation");
        String operation = ReaderUtil.readLn();
        Permission pOp = new Permission(object, operation);

        String name;
        if (isRole) {
            System.out.println("Enter role name");
            name = ReaderUtil.readLn();
            am.revokePermission(pOp, new Role(name));

        } else {
            System.out.println("Enter userId");
            name = ReaderUtil.readLn();
            am.revokePermission(pOp, new User(name));
        }

        System.out.println("perm object [" + object + "] operation [" + operation + "] has been granted to ["
                + name + "]");
        System.out.println("has been revoked.");
        System.out.println("ENTER to continue");
    } catch (SecurityException e) {
        LOG.error("revokePermission caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(),
                e);
    }
    ReaderUtil.readChar();
}

From source file:org.apache.directory.fortress.core.AdminMgrConsole.java

void addPermObject() {
    PermObj pe = new PermObj();
    try {//from  w ww.  ja v a 2s.  c o m
        ReaderUtil.clearScreen();
        System.out.println("Enter perm object name:");
        pe.setObjName(ReaderUtil.readLn());
        System.out.println("Enter Perm's description field");
        pe.setDescription(ReaderUtil.readLn());
        System.out.println("Enter organization unit, blank for default");
        pe.setOu(ReaderUtil.readLn());

        System.out.println("Enter prop key (or NULL to skip):");
        String key = ReaderUtil.readLn();
        for (int i = 0; key != null && key.length() > 0; i++) {
            System.out.println("Enter prop val:");
            String val = ReaderUtil.readLn();
            pe.addProperty(key, val);
            System.out.println("Enter next prop key (or NULL if done entering properties)");
            key = ReaderUtil.readLn();
        }

        pe = am.addPermObj(pe);
        System.out.println("perm object name [" + pe.getObjName() + "]");
        System.out.println("internalId [" + pe.getInternalId() + "]");
        System.out.println("description [" + pe.getDescription() + "]");
        System.out.println("organizational unit [" + pe.getOu() + "]");

        System.out.println("has been added");
        System.out.println("ENTER to continue");
    } catch (SecurityException e) {
        LOG.error("addPermObject caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
    }
    ReaderUtil.readChar();
}

From source file:org.apache.directory.fortress.core.AdminMgrConsole.java

/**
 * put your documentation comment here//from   w  ww.j a  v a 2s .  co m
 */
public AdminMgrConsole() {
    try {
        am = AdminMgrFactory.createInstance(TestUtils.getContext());
    } catch (org.apache.directory.fortress.core.SecurityException e) {
        LOG.error(" constructor caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage());
    }
}

From source file:org.apache.directory.fortress.core.AdminMgrConsole.java

/**
 *
 *//*from  w  w w.  j  a  va2  s  .  c  o  m*/
void addRoleInheritance() {
    try {
        Role cre = new Role();
        Role pre = new Role();
        ReaderUtil.clearScreen();
        System.out.println("Enter child role name:");
        cre.setName(ReaderUtil.readLn());
        System.out.println("Enter parent role name:");
        pre.setName(ReaderUtil.readLn());

        am.addInheritance(pre, cre);
        System.out.println("child role [" + cre.getName() + "]");
        System.out.println("parent role [" + pre.getName() + "]");
        System.out.println("inheritance relationship has been added");
        System.out.println("ENTER to continue");
    } catch (SecurityException e) {
        LOG.error(
                "addRoleInheritance caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(),
                e);
    }
    ReaderUtil.readChar();
}

From source file:org.apache.directory.fortress.core.AdminMgrConsole.java

/**
 *
 *//* w w  w  .j  av a2 s  .  c  om*/
void removeRoleInheritance() {
    try {
        Role cre = new Role();
        Role pre = new Role();
        ReaderUtil.clearScreen();
        System.out.println("Enter child role name:");
        cre.setName(ReaderUtil.readLn());
        System.out.println("Enter parent role name:");
        pre.setName(ReaderUtil.readLn());
        am.deleteInheritance(pre, cre);
        System.out.println("child role [" + cre.getName() + "]");
        System.out.println("parent role [" + pre.getName() + "]");
        System.out.println("inheritance relationship has been removed");
        System.out.println("ENTER to continue");
    } catch (SecurityException e) {
        LOG.error("removeRoleInheritance caught SecurityException rc=" + e.getErrorId() + ", msg="
                + e.getMessage(), e);
    }
    ReaderUtil.readChar();
}