Package org.apache.geronimo.xml.ns.security_1

Examples of org.apache.geronimo.xml.ns.security_1.ObjectFactory


                else if (element instanceof DistinguishedNameType) {
                  DistinguishedNameType object = (DistinguishedNameType) element;
                    return "DistinguishedName: name = \"" + object.getName() + "\"";
                }
                else if (element instanceof RealmPrincipalType) {
                  RealmPrincipalType object = (RealmPrincipalType) element;
                    return "RealmPrincipal: name = \"" + object.getName() +
                            "\", class = \"" + object.getClazz() +
                            "\", domain-name = \"" + object.getDomainName() +
                            "\", realm-name = \"" + object.getRealmName() +"\"";
                }
                else if (element instanceof LoginDomainPrincipalType) {
                  LoginDomainPrincipalType object = (LoginDomainPrincipalType) element;
                    return "LoginDomainPrincipal: name = \"" + object.getName() +
                            "\", class = \"" + object.getClazz() +
                            "\", domain-name = \"" + object.getDomainName() +"\"";
                }
                else if (element instanceof PrincipalType) {
                  PrincipalType object = (PrincipalType) element;
                    return "Principal: name = \"" + object.getName() +
                            "\", class = \"" + object.getClazz() + "\"";
                }

                return null;
            }
View Full Code Here


    public List getObjectContainer() {
        return getRoles(getPlan(), false);
    }

    public static List<RoleType> getRoles(JAXBElement plan, boolean create) {
      RoleMappingsType roleMappings = getRoleMappings(plan, create);
        if (roleMappings != null) {
            return roleMappings.getRole();
        }
        return null;
    }
View Full Code Here

        if (security == null && create) {
            security = new SecurityType();
            JAXBModelUtils.setSecurity(plan, security);
        }
        if (security != null) {
          RoleMappingsType roleMappings = security.getRoleMappings();
            if (roleMappings == null && create) {
                roleMappings = new RoleMappingsType();
                security.setRoleMappings(roleMappings);
            }
            return roleMappings;
        }
        return null;
View Full Code Here

                return false;
            }
            DistinguishedNameType distinguishedName = (DistinguishedNameType)eObject;
            if (distinguishedName == null) {
                distinguishedName = (DistinguishedNameType)getEFactory().create(DistinguishedNameType.class);
                RoleType role = (RoleType) section.getSelectedObject();
                role.getDistinguishedName().add(distinguishedName);
            }
            distinguishedName.setName(name.getText());
            break;

        case PRINCIPAL:
            if (isEmpty(name.getText()) || isEmpty(clazz.getText())) {
                return false;
            }
            PrincipalType principal = (PrincipalType)eObject;
            if (principal == null) {
                principal = (PrincipalType)getEFactory().create(PrincipalType.class);
                RoleType role = (RoleType) section.getSelectedObject();
                role.getPrincipal().add(principal);
            }
            principal.setName(name.getText());
            principal.setClazz(clazz.getText());
            break;

        case LOGIN_DOMAIN_PRINCIPAL:
            if (isEmpty(name.getText()) || isEmpty(clazz.getText()) || isEmpty(domainName.getText())) {
                return false;
            }
            LoginDomainPrincipalType loginDomainPrincipal = (LoginDomainPrincipalType)eObject;
            if (loginDomainPrincipal == null) {
                loginDomainPrincipal = (LoginDomainPrincipalType)getEFactory().create(LoginDomainPrincipalType.class);
                RoleType role = (RoleType) section.getSelectedObject();
                role.getLoginDomainPrincipal().add(loginDomainPrincipal);
            }
            loginDomainPrincipal.setName(name.getText());
            loginDomainPrincipal.setClazz(clazz.getText());
            loginDomainPrincipal.setDomainName(domainName.getText());
            break;

        case REALM_PRINCIPAL:
            if (isEmpty(name.getText()) || isEmpty(clazz.getText()) || isEmpty(domainName.getText())
                    || isEmpty(realmName.getText())) {
                return false;
            }
            RealmPrincipalType realmPrincipal = (RealmPrincipalType)eObject;
            if (realmPrincipal == null) {
                realmPrincipal = (RealmPrincipalType)getEFactory().create(RealmPrincipalType.class);
                RoleType role = (RoleType) section.getSelectedObject();
                role.getRealmPrincipal().add(realmPrincipal);
            }
            realmPrincipal.setName(name.getText());
            realmPrincipal.setClazz(clazz.getText());
            realmPrincipal.setDomainName(domainName.getText());
            realmPrincipal.setRealmName(realmName.getText());
View Full Code Here

    @Override
    public void handleDelete() {
        TreeItem selectedItem = tree.getSelection()[0];
        Object selectedObject = selectedItem.getData();
        RoleType role = (RoleType) selectedItem.getParentItem().getData();
        try {
      ((ArrayList) JAXBUtils.getValue(role, selectedObject.getClass().getSimpleName())).remove(selectedObject);
    } catch (Exception e) {
      MessageDialog.openError(Display.getCurrent().getActiveShell(),"Error", e.getMessage());
    }
View Full Code Here

                    roleExists = true;
                    break;
                }
            }
            if (!roleExists) {
              RoleType newRole = new RoleType();
                newRole.setRoleName(roleName);
                newRoles.add(newRole);
            }
        }
        definedRoles.addAll(newRoles);
        return newRoles.size() > 0;
View Full Code Here

            public Object[] getChildren(Object parentElement) {
                if (RoleMappingsType.class.isInstance(parentElement)) {
                    return ((RoleMappingsType) parentElement).getRole().toArray();
                }
                if (parentElement instanceof RoleType) {
                  RoleType role = (RoleType) parentElement;
                    return concat(role.getDistinguishedName().toArray(), role.getPrincipal().toArray(),
                            role.getLoginDomainPrincipal().toArray(), role.getRealmPrincipal().toArray());
                }
                return new String[] {};
            }

            private Object[] concat(Object[] arr1, Object[] arr2, Object[] arr3, Object[] arr4) {
View Full Code Here

    public ILabelProvider getLabelProvider() {
        return new LabelProvider() {
            @Override
            public String getText(Object element) {
                if (RoleType.class.isInstance(element)) {
                  RoleType role = (RoleType) element;
                    return "Role: role-name = \"" + role.getRoleName() + "\"";
                }
                else if (element instanceof DistinguishedNameType) {
                  DistinguishedNameType object = (DistinguishedNameType) element;
                    return "DistinguishedName: name = \"" + object.getName() + "\"";
                }
View Full Code Here

public class MarshallerListener extends Marshaller.Listener{

    @Override
    public void beforeMarshal(Object source) {
        if (source instanceof SecurityType) {
            SecurityType security = (SecurityType)source;
            if (security.getRoleMappings() != null && security.getRoleMappings().getRole().size() == 0) {
                security.setRoleMappings(null);
            }
        } else if (source instanceof WebAppType) {
            WebAppType webapp = (WebAppType)source;
            GbeanLocatorType gbeanlocator = webapp.getWebContainer();
            if (gbeanlocator != null && isEmpty(gbeanlocator.getGbeanLink()) && isEmpty(gbeanlocator.getPattern())) {
View Full Code Here

        Object plan = element;
        if (WebAppType.class.isInstance (plan)) {
            if (((WebAppType)plan).getSecurity() == null) {
                setSecurity (element, new org.apache.geronimo.xml.ns.security_1.ObjectFactory().createSecurityType());
            }
            SecurityType security = (SecurityType)((WebAppType)plan).getSecurity();
            if (security.getRoleMappings() == null) {
                security.setRoleMappings (new org.apache.geronimo.xml.ns.security_1.ObjectFactory().createRoleMappingsType());
            }
            return security;
        } else if (ApplicationType.class.isInstance (plan)) {
            if (((ApplicationType)plan).getSecurity() == null) {
                setSecurity (element, new org.apache.geronimo.xml.ns.security_1.ObjectFactory().createSecurityType());
            }
            SecurityType security = (SecurityType)((ApplicationType)plan).getSecurity();
            if (security.getRoleMappings() == null) {
                security.setRoleMappings (new org.apache.geronimo.xml.ns.security_1.ObjectFactory().createRoleMappingsType());
            }
            return security;
        } else if (OpenejbJarType.class.isInstance (plan)) {
            if (((OpenejbJarType)plan).getSecurity() == null) {
                setSecurity (element, new org.apache.geronimo.xml.ns.security_1.ObjectFactory().createSecurityType());
            }
            SecurityType security = (SecurityType)((OpenejbJarType)plan).getSecurity();
            if (security.getRoleMappings() == null) {
                security.setRoleMappings (new org.apache.geronimo.xml.ns.security_1.ObjectFactory().createRoleMappingsType());
            }
            return security;
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.xml.ns.security_1.ObjectFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.