Package org.apache.cocoon.components.repository

Examples of org.apache.cocoon.components.repository.PrincipalProvider


     * Generate XML data.
     */
    public void generate() throws IOException, SAXException, ProcessingException {

        ComponentSelector principalproviders = null;
        PrincipalProvider principalprovider = null;
        try {
            principalproviders = (ComponentSelector)this.manager.lookup(PrincipalProvider.ROLE+"Selector");

            principalprovider = (PrincipalProvider)principalproviders.select(this.principalprovidername);

            Principal[] principals = principalprovider.getPrincipals(this.principalcaller);
            PrincipalGroup[] principalgroups = principalprovider.getPrincipalGroups(this.principalcaller);

            this.contentHandler.startDocument();
            this.contentHandler.startPrefixMapping("",PL_NS);

            this.contentHandler.startElement(PL_NS, LIST_ELEMENT_NAME,
                                                    LIST_ELEMENT_NAME, new AttributesImpl());

            AttributesImpl attributes;
            for(int i=0; i<principals.length; i++) {
                attributes = new AttributesImpl();
                attributes.addAttribute("", NAME_ATTR_NAME, NAME_ATTR_NAME, "CDATA", principals[i].getName());
                if (principals[i].getRole()!=null)
                    attributes.addAttribute("", ROLE_ATTR_NAME, ROLE_ATTR_NAME, "CDATA", principals[i].getRole());
                if (principals[i].getPassword()!=null)
                    attributes.addAttribute("", PASSWORD_ATTR_NAME, PASSWORD_ATTR_NAME, "CDATA", principals[i].getPassword());

                this.contentHandler.startElement(PL_NS, PRINCIPAL_ELEMENT_NAME,
                                                        PRINCIPAL_ELEMENT_NAME, attributes);
                this.contentHandler.endElement(PL_NS, PRINCIPAL_ELEMENT_NAME, PRINCIPAL_ELEMENT_NAME);
            }

            for(int i=0; i<principalgroups.length; i++) {
                attributes = new AttributesImpl();
                attributes.addAttribute("", NAME_ATTR_NAME, NAME_ATTR_NAME, "CDATA", principalgroups[i].getName());

                this.contentHandler.startElement(PL_NS, PRINCIPALGROUP_ELEMENT_NAME,
                                                        PRINCIPALGROUP_ELEMENT_NAME, attributes);

                Principal[] members = principalprovider.members(this.principalcaller, principalgroups[i]);
                for(int j=0; j<members.length; j++) {
                    attributes = new AttributesImpl();
                    attributes.addAttribute("", NAME_ATTR_NAME, NAME_ATTR_NAME, "CDATA", members[j].getName());
                    if (members[j].getRole()!=null)
                        attributes.addAttribute("", ROLE_ATTR_NAME, ROLE_ATTR_NAME, "CDATA", members[j].getRole());
View Full Code Here


     * Generate XML data.
     */
    public void generate() throws IOException, SAXException, ProcessingException {

        ComponentSelector principalproviders = null;
        PrincipalProvider principalprovider = null;
        try {
            principalproviders = (ComponentSelector)this.manager.lookup(PrincipalProvider.ROLE+"Selector");

            principalprovider = (PrincipalProvider)principalproviders.select(this.principalprovidername);

            Principal[] principals = principalprovider.getPrincipals(this.principalcaller);
            PrincipalGroup[] principalgroups = principalprovider.getPrincipalGroups(this.principalcaller);

            this.contentHandler.startDocument();
            this.contentHandler.startPrefixMapping("",PL_NS);

            this.contentHandler.startElement(PL_NS, LIST_ELEMENT_NAME,
                                                    LIST_ELEMENT_NAME, new AttributesImpl());

            AttributesImpl attributes;
            for(int i=0; i<principals.length; i++) {
                attributes = new AttributesImpl();
                attributes.addAttribute("", NAME_ATTR_NAME, NAME_ATTR_NAME, "CDATA", principals[i].getName());
                if (principals[i].getRole()!=null)
                    attributes.addAttribute("", ROLE_ATTR_NAME, ROLE_ATTR_NAME, "CDATA", principals[i].getRole());
                if (principals[i].getPassword()!=null)
                    attributes.addAttribute("", PASSWORD_ATTR_NAME, PASSWORD_ATTR_NAME, "CDATA", principals[i].getPassword());

                this.contentHandler.startElement(PL_NS, PRINCIPAL_ELEMENT_NAME,
                                                        PRINCIPAL_ELEMENT_NAME, attributes);
                this.contentHandler.endElement(PL_NS, PRINCIPAL_ELEMENT_NAME, PRINCIPAL_ELEMENT_NAME);
            }

            for(int i=0; i<principalgroups.length; i++) {
                attributes = new AttributesImpl();
                attributes.addAttribute("", NAME_ATTR_NAME, NAME_ATTR_NAME, "CDATA", principalgroups[i].getName());

                this.contentHandler.startElement(PL_NS, PRINCIPALGROUP_ELEMENT_NAME,
                                                        PRINCIPALGROUP_ELEMENT_NAME, attributes);

                Principal[] members = principalprovider.members(this.principalcaller, principalgroups[i]);
                for(int j=0; j<members.length; j++) {
                    attributes = new AttributesImpl();
                    attributes.addAttribute("", NAME_ATTR_NAME, NAME_ATTR_NAME, "CDATA", members[j].getName());
                    if (members[j].getRole()!=null)
                        attributes.addAttribute("", ROLE_ATTR_NAME, ROLE_ATTR_NAME, "CDATA", members[j].getRole());
View Full Code Here

     * Generate XML data.
     */
    public void generate() throws IOException, SAXException, ProcessingException {

        ServiceSelector principalproviders = null;
        PrincipalProvider principalprovider = null;
        try {
            principalproviders = (ServiceSelector)this.manager.lookup(PrincipalProvider.ROLE+"Selector");

            principalprovider = (PrincipalProvider)principalproviders.select(this.principalprovidername);

            Principal[] principals = principalprovider.getPrincipals(this.principalcaller);
            PrincipalGroup[] principalgroups = principalprovider.getPrincipalGroups(this.principalcaller);

            this.contentHandler.startDocument();
            this.contentHandler.startPrefixMapping("",PL_NS);

            this.contentHandler.startElement(PL_NS, LIST_ELEMENT_NAME,
                                                    LIST_ELEMENT_NAME, new AttributesImpl());

            AttributesImpl attributes;
            for(int i=0; i<principals.length; i++) {
                attributes = new AttributesImpl();
                attributes.addAttribute("", NAME_ATTR_NAME, NAME_ATTR_NAME, "CDATA", principals[i].getName());
                if (principals[i].getRole()!=null)
                    attributes.addAttribute("", ROLE_ATTR_NAME, ROLE_ATTR_NAME, "CDATA", principals[i].getRole());
                if (principals[i].getPassword()!=null)
                    attributes.addAttribute("", PASSWORD_ATTR_NAME, PASSWORD_ATTR_NAME, "CDATA", principals[i].getPassword());

                this.contentHandler.startElement(PL_NS, PRINCIPAL_ELEMENT_NAME,
                                                        PRINCIPAL_ELEMENT_NAME, attributes);
                this.contentHandler.endElement(PL_NS, PRINCIPAL_ELEMENT_NAME, PRINCIPAL_ELEMENT_NAME);
            }

            for(int i=0; i<principalgroups.length; i++) {
                attributes = new AttributesImpl();
                attributes.addAttribute("", NAME_ATTR_NAME, NAME_ATTR_NAME, "CDATA", principalgroups[i].getName());

                this.contentHandler.startElement(PL_NS, PRINCIPALGROUP_ELEMENT_NAME,
                                                        PRINCIPALGROUP_ELEMENT_NAME, attributes);

                Principal[] members = principalprovider.members(this.principalcaller, principalgroups[i]);
                for(int j=0; j<members.length; j++) {
                    attributes = new AttributesImpl();
                    attributes.addAttribute("", NAME_ATTR_NAME, NAME_ATTR_NAME, "CDATA", members[j].getName());
                    if (members[j].getRole()!=null)
                        attributes.addAttribute("", ROLE_ATTR_NAME, ROLE_ATTR_NAME, "CDATA", members[j].getRole());
View Full Code Here

        String principal_password = parameters.getParameter(PRINCIPAL_PASSWORD,
            request.getParameter(PRINCIPAL_PASSWORD));

        ComponentSelector principalproviders = null;
        PrincipalProvider principalprovider = null;
        try {
            principalproviders = (ComponentSelector)this.manager.lookup(PrincipalProvider.ROLE+"Selector");

            principalprovider = (PrincipalProvider)principalproviders.select(principal_provider);

            Principal caller = new Principal(caller_principal_name, caller_principal_password);
            Principal principal = new Principal(principal_name, principal_role, principal_password);

            principalprovider.addPrincipal(caller, principal);
        } catch (ComponentException ce) {
            if (getLogger().isDebugEnabled())
                getLogger().debug("Could not lookup for component.", ce);
            throw new ProcessingException("Could not lookup for component.", ce);
View Full Code Here

        String principal_name = parameters.getParameter(PRINCIPAL_NAME,
            request.getParameter(PRINCIPAL_NAME));

        ComponentSelector principalproviders = null;
        PrincipalProvider principalprovider = null;
        try {
            principalproviders = (ComponentSelector)this.manager.lookup(PrincipalProvider.ROLE+"Selector");

            principalprovider = (PrincipalProvider)principalproviders.select(principal_provider);

            Principal caller = new Principal(caller_principal_name, caller_principal_password);
            Principal principal = new Principal(principal_name);

            principalprovider.removePrincipal(caller, principal);

        } catch (ComponentException ce) {
            if (getLogger().isDebugEnabled())
                getLogger().debug("Could not lookup for component.", ce);
            throw new ProcessingException("Could not lookup for component.", ce);
View Full Code Here

        String principal_group_name = parameters.getParameter(PRINCIPAL_GROUP_NAME,
            request.getParameter(PRINCIPAL_GROUP_NAME));

        ComponentSelector principalproviders = null;
        PrincipalProvider principalprovider = null;
        try {
            principalproviders = (ComponentSelector)this.manager.lookup(PrincipalProvider.ROLE+"Selector");

            principalprovider = (PrincipalProvider)principalproviders.select(principal_provider);

            Principal caller = new Principal(caller_principal_name, caller_principal_password);
            PrincipalGroup principalgroup = new PrincipalGroup(principal_group_name);

            principalprovider.addPrincipalGroup(caller, principalgroup);

        } catch (ComponentException ce) {
            if (getLogger().isDebugEnabled())
                getLogger().debug("Could not lookup for component.", ce);
            throw new ProcessingException("Could not lookup for component.", ce);
View Full Code Here

        String principal_group_name = parameters.getParameter(PRINCIPAL_GROUP_NAME,
            request.getParameter(PRINCIPAL_GROUP_NAME));

        ComponentSelector principalproviders = null;
        PrincipalProvider principalprovider = null;
        try {
            principalproviders = (ComponentSelector)this.manager.lookup(PrincipalProvider.ROLE+"Selector");

            principalprovider = (PrincipalProvider)principalproviders.select(principal_provider);

            Principal caller = new Principal(caller_principal_name, caller_principal_password);
            PrincipalGroup principalgroup = new PrincipalGroup(principal_group_name);

            principalprovider.removePrincipalGroup(caller, principalgroup);

        } catch (ComponentException ce) {
            if (getLogger().isDebugEnabled())
                getLogger().debug("Could not lookup for component.", ce);
            throw new ProcessingException("Could not lookup for component.", ce);
View Full Code Here

        String principal_name = parameters.getParameter(PRINCIPAL_NAME,
            request.getParameter(PRINCIPAL_NAME));

        ComponentSelector principalproviders = null;
        PrincipalProvider principalprovider = null;
        try {
            principalproviders = (ComponentSelector)this.manager.lookup(PrincipalProvider.ROLE+"Selector");

            principalprovider = (PrincipalProvider)principalproviders.select(principal_provider);

            Principal caller = new Principal(caller_principal_name, caller_principal_password);
            PrincipalGroup principalgroup = new PrincipalGroup(principal_group_name);
            Principal principal = new Principal(principal_name);

            principalprovider.addMember(caller, principalgroup, principal);

        } catch (ComponentException ce) {
            if (getLogger().isDebugEnabled())
                getLogger().debug("Could not lookup for component.", ce);
            throw new ProcessingException("Could not lookup for component.", ce);
View Full Code Here

        String principal_name = parameters.getParameter(PRINCIPAL_NAME,
            request.getParameter(PRINCIPAL_NAME));

        ComponentSelector principalproviders = null;
        PrincipalProvider principalprovider = null;
        try {
            principalproviders = (ComponentSelector)this.manager.lookup(PrincipalProvider.ROLE+"Selector");

            principalprovider = (PrincipalProvider)principalproviders.select(principal_provider);

            Principal caller = new Principal(caller_principal_name, caller_principal_password);
            PrincipalGroup principalgroup = new PrincipalGroup(principal_group_name);
            Principal principal = new Principal(principal_name);

            principalprovider.removeMember(caller, principalgroup, principal);

        } catch (ComponentException ce) {
            if (getLogger().isDebugEnabled())
                getLogger().debug("Could not lookup for component.", ce);
            throw new ProcessingException("Could not lookup for component.", ce);
View Full Code Here

     * Generate XML data.
     */
    public void generate() throws IOException, SAXException, ProcessingException {

        ComponentSelector principalproviders = null;
        PrincipalProvider principalprovider = null;
        try {
            principalproviders = (ComponentSelector)this.manager.lookup(PrincipalProvider.ROLE+"Selector");

            principalprovider = (PrincipalProvider)principalproviders.select(this.principalprovidername);

            Principal[] principals = principalprovider.getPrincipals(this.principalcaller);
            PrincipalGroup[] principalgroups = principalprovider.getPrincipalGroups(this.principalcaller);

            this.contentHandler.startDocument();
            this.contentHandler.startPrefixMapping("",PL_NS);

            this.contentHandler.startElement(PL_NS, LIST_ELEMENT_NAME,
                                                    LIST_ELEMENT_NAME, new AttributesImpl());

            AttributesImpl attributes;
            for(int i=0; i<principals.length; i++) {
                attributes = new AttributesImpl();
                attributes.addAttribute("", NAME_ATTR_NAME, NAME_ATTR_NAME, "CDATA", principals[i].getName());
                if (principals[i].getRole()!=null)
                    attributes.addAttribute("", ROLE_ATTR_NAME, ROLE_ATTR_NAME, "CDATA", principals[i].getRole());
                if (principals[i].getPassword()!=null)
                    attributes.addAttribute("", PASSWORD_ATTR_NAME, PASSWORD_ATTR_NAME, "CDATA", principals[i].getPassword());

                this.contentHandler.startElement(PL_NS, PRINCIPAL_ELEMENT_NAME,
                                                        PRINCIPAL_ELEMENT_NAME, attributes);
                this.contentHandler.endElement(PL_NS, PRINCIPAL_ELEMENT_NAME, PRINCIPAL_ELEMENT_NAME);
            }

            for(int i=0; i<principalgroups.length; i++) {
                attributes = new AttributesImpl();
                attributes.addAttribute("", NAME_ATTR_NAME, NAME_ATTR_NAME, "CDATA", principalgroups[i].getName());

                this.contentHandler.startElement(PL_NS, PRINCIPALGROUP_ELEMENT_NAME,
                                                        PRINCIPALGROUP_ELEMENT_NAME, attributes);

                Principal[] members = principalprovider.members(this.principalcaller, principalgroups[i]);
                for(int j=0; j<members.length; j++) {
                    attributes = new AttributesImpl();
                    attributes.addAttribute("", NAME_ATTR_NAME, NAME_ATTR_NAME, "CDATA", members[j].getName());
                    if (members[j].getRole()!=null)
                        attributes.addAttribute("", ROLE_ATTR_NAME, ROLE_ATTR_NAME, "CDATA", members[j].getRole());
View Full Code Here

TOP

Related Classes of org.apache.cocoon.components.repository.PrincipalProvider

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.