Skip to Content.
Sympa Menu

mace-opensaml-users - Implementation for StatusMessageType

Subject: OpenSAML user discussion

List archive

Implementation for StatusMessageType


Chronological Thread 
  • From: Ted Hesselroth <>
  • To:
  • Subject: Implementation for StatusMessageType
  • Date: Wed, 16 Jul 2008 16:57:58 -0500

I would like to use StatusMessageType to pass information on errors in the PDP, but the needed classes are not implemented in 2.1. Perhaps they are meant to be in 2.2. Anyway, I attach some code here, which I am now using. I had to add some lines to the StatusMessageType code. Also, these lines need to be added to xacml20-context-config.xml.

<!-- StatusMessageType -->
<ObjectProvider qualifiedName="xacml-context:StatusMessage">
<BuilderClass className="org.opensaml.xacml.ctx.impl.StatusMessageTypeImplBuilder" />
<MarshallingClass className="org.opensaml.xacml.ctx.impl.StatusMessageTypeMarshaller" />
<UnmarshallingClass className="org.opensaml.xacml.ctx.impl.StatusMessageTypeUnmarshaller" />
</ObjectProvider>
<!-- StatusMessageType -->
<ObjectProvider qualifiedName="xacml-context:StatusMessageType">
<BuilderClass className="org.opensaml.xacml.ctx.impl.StatusMessageTypeImplBuilder" />
<MarshallingClass className="org.opensaml.xacml.ctx.impl.StatusMessageTypeMarshaller" />
<UnmarshallingClass className="org.opensaml.xacml.ctx.impl.StatusMessageTypeUnmarshaller" />
</ObjectProvider>

package org.opensaml.xacml.ctx;

import javax.xml.namespace.QName;

import org.opensaml.xacml.XACMLConstants;
import org.opensaml.xacml.XACMLObject;
import org.opensaml.xml.schema.XSString;

/** XACML context StatusMessage schema type. */
public interface StatusMessageType extends XSString, XACMLObject {

    /** Local name of the StatusCode element. */
    public static final String DEFAULT_ELEMENT_LOCAL_NAME = "StatusMessage";

    /** Default element name. */
    public static final QName DEFAULT_ELEMENT_NAME = new QName(XACMLConstants.XACML20CTX_NS,
            DEFAULT_ELEMENT_LOCAL_NAME, XACMLConstants.XACMLCONTEXT_PREFIX);

    /** Local name of the XSI type. */
    public static final String TYPE_LOCAL_NAME = "StatusMessageType";

    /** QName of the XSI type XACML20. */
    public static final QName TYPE_NAME = new QName(XACMLConstants.XACML20CTX_NS, TYPE_LOCAL_NAME,
            XACMLConstants.XACMLCONTEXT_PREFIX);

    /** Name of the Value attribute. */
    public static final String VALUE_ATTTRIB_NAME = "Value";

    /**
     * Gets the value of the attribute named value of the status element.
     * 
     * @return The value of the attribute named value for the status element
     */
    public String getValue();

    /**
     * Sets the attribute named value of the status elements.
     * 
     * @param value The wanted value for the attribute value
     */
    public void setValue(String value);
}

package org.opensaml.xacml.ctx.impl;

/*
 * Copyright 2008 Members of the EGEE Collaboration.
 * Copyright 2008 University Corporation for Advanced Internet Development, Inc.
 *
 * Licensed 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.
 */


import java.util.List;

import org.opensaml.xacml.ctx.StatusMessageType;
import org.opensaml.xml.XMLObject;
import org.opensaml.xml.validation.AbstractValidatingXMLObject;

/**
 * Implementation of {@link org.opensaml.xacml.ctx.StatusMessageType}.
 */
public class StatusMessageTypeImpl extends AbstractValidatingXMLObject implements StatusMessageType {

    /**Message.*/
    private String message;
    /**
     * Constructor.
     *
     * @param namespaceURI the namespace the element is in
     * @param elementLocalName the local name of the XML element this Object represents
     * @param namespacePrefix the prefix for the given namespace
     */
    protected StatusMessageTypeImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
        super(namespaceURI, elementLocalName, namespacePrefix);
    }

    /** {@inheritDoc} */
    public String getValue() {
        return message;
    }

    /** {@inheritDoc} */
    public void setValue(String newMessage) {
        message = prepareForAssignment(message,newMessage);

    }

    /** {@inheritDoc} */
    public List<XMLObject> getOrderedChildren() {
        return null;
    }

}
package org.opensaml.xacml.ctx.impl;

/*
 * Copyright 2008 Members of the EGEE Collaboration.
 * Copyright 2008 University Corporation for Advanced Internet Development, Inc.
 *
 * Licensed 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.
 */


import org.opensaml.xacml.XACMLConstants;
import org.opensaml.xacml.XACMLObjectBuilder;
import org.opensaml.xacml.ctx.StatusMessageType;
import org.opensaml.xacml.policy.DescriptionType;
import org.opensaml.xml.AbstractXMLObjectBuilder;


/**
 * Builder for {@link org.opensaml.xacml.ctx.StatusMessageType}.
 */
public class StatusMessageTypeImplBuilder extends AbstractXMLObjectBuilder <StatusMessageType> implements
  XACMLObjectBuilder<StatusMessageType> {

    /**
     * Constructor.
     */
    public StatusMessageTypeImplBuilder(){

    }

    /** {@inheritDoc} */
    public StatusMessageType buildObject() {
        return buildObject(StatusMessageType.DEFAULT_ELEMENT_NAME);
    }

    /** {@inheritDoc} */
    public StatusMessageType buildObject(String namespaceURI, String localName, String namespacePrefix) {
        return new StatusMessageTypeImpl(namespaceURI,localName,namespacePrefix);
    }

}
/*
 *Copyright 2008 Members of the EGEE Collaboration.
 * Copyright 2008 University Corporation for Advanced Internet Development, Inc.
 *
 * Licensed 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.opensaml.xacml.ctx.impl;

import org.opensaml.xacml.ctx.StatusMessageType;
import org.opensaml.xml.XMLObject;
import org.opensaml.xml.io.AbstractXMLObjectMarshaller;
import org.opensaml.xml.io.MarshallingException;
import org.opensaml.xml.util.XMLHelper;
import org.w3c.dom.Element;

/**
 *Masrhaller for {@link org.opensaml.xacml.ctx.StatusMessageType}.
 */
public class StatusMessageTypeMarshaller extends AbstractXMLObjectMarshaller {

    /** {@inheritDoc} */
    protected void marshallAttributes(XMLObject arg0, Element arg1) throws MarshallingException {
        // TODO Auto-generated method stub

    }

    /** {@inheritDoc} */
    protected void marshallElementContent(XMLObject xmlObject, Element domElement) throws MarshallingException {
        StatusMessageType message = (StatusMessageType)xmlObject;

        if(message.getValue() != null){
            XMLHelper.appendTextContent(domElement, message.getValue());
        }
    }

}
/*
 * Copyright 2008 Members of the EGEE Collaboration.
 * Copyright 2008 University Corporation for Advanced Internet Development, Inc.
 *
 * Licensed 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.opensaml.xacml.ctx.impl;

import org.opensaml.xacml.ctx.StatusMessageType;
import org.opensaml.xml.XMLObject;
import org.opensaml.xml.io.AbstractXMLObjectUnmarshaller;
import org.opensaml.xml.io.UnmarshallingException;
import org.w3c.dom.Attr;

/**
 *Unmarshaller for {@link org.opensaml.xacml.ctx.StatusMessageType}.
 */
public class StatusMessageTypeUnmarshaller extends AbstractXMLObjectUnmarshaller {

    /** {@inheritDoc} */
    protected void processAttribute(XMLObject arg0, Attr arg1) throws UnmarshallingException {
        // TODO Auto-generated method stub

    }

    /** {@inheritDoc} */
    protected void processChildElement(XMLObject arg0, XMLObject arg1) throws UnmarshallingException {
        // TODO Auto-generated method stub

    }

    /** {@inheritDoc} */
    protected void processElementContent(XMLObject xmlObject, String content) {
        StatusMessageType message = (StatusMessageType)xmlObject;
        message.setValue(content);
    }
}



Archive powered by MHonArc 2.6.16.

Top of Page