Package org.apache.ws.resource.properties

Examples of org.apache.ws.resource.properties.ResourceProperty


        }
        if ( nameOfPropToBeDeleted == null )
        {
            throw new DeleteResourcePropertyRequestFailedFaultException( getNamespaceSet(), MSG.getMessage( Keys.DEL_MISSING_RP_ATTRIB ) );
        }
        ResourceProperty prop = getProperties().get( nameOfPropToBeDeleted );
        if ( prop == null )
        {
            if ( getProperties().getMetaData().isOpenContent() )
            {
                return;
            }
            else
            {
                throw new InvalidResourcePropertyQNameFaultException( getNamespaceSet(), nameOfPropToBeDeleted );
            }
        }
        throwFaultIfPropertyIsReadOnly( prop );
        throwFaultIfDeletionViolatesSchema( prop );
        try
        {
            deletePropertyCallback( prop );
        }
        catch ( RuntimeException re )
        {
            throw new DeleteResourcePropertyRequestFailedFaultException( getNamespaceSet(), re.toString() );
        }
        Object[] oldValue = getValue( prop );
        prop.clear();
        Object[] newValue = null;
        if ( prop.getChangeListener() != null )
        {
            firePropChangeEvent( prop, oldValue, newValue );
        }
    }
View Full Code Here


        {
            throw new InvalidInsertResourcePropertiesRequestContentFaultException( getNamespaceSet(), MSG.getMessage( Keys.ERROR_INSERT_ELEMS_NOT_HOMOGENOUS ) );
        }

        QName propName = XmlBeanUtils.getName( propElemsToBeInserted[0] );
        ResourceProperty prop = getProperty( propName );

        if(prop == null)
        {
            prop = createAnyProperty(propName);
            getProperties().add(prop);
        }

        if(!prop.getMetaData().isAny())
        {
            throwFaultIfInsertionViolatesSchema( prop, propElemsToBeInserted );
        }

        throwFaultIfPropertyIsReadOnly( prop );

        try
        {
            insertPropertyCallback( prop, propElemsToBeInserted );
        }
        catch ( RuntimeException re )
        {
            throw new SetResourcePropertyRequestFailedFaultException( getNamespaceSet(), re.toString() );
        }

        Object[] oldValue = getValue( prop );
        for ( int i = 0; i < propElemsToBeInserted.length; i++ )
        {
            try
            {
                prop.add( propElemsToBeInserted[i] );
            }
            catch ( MetaDataViolationException mdve )
            {
                throw new InvalidSetResourcePropertiesRequestContentFaultException( getNamespaceSet(), mdve );
            }
        }
        Object[] newValue = getValue( prop );
        if ( prop.getChangeListener() != null )
        {
            firePropChangeEvent( prop, oldValue, newValue );
        }
    }
View Full Code Here

        if ( newPropElems.length == 0 )
        {
            return; // nothing to do
        }
        QName propName = XmlBeanUtils.getName( newPropElems[0] );
        ResourceProperty prop = getProperty( propName );

        throwFaultIfPropertyIsReadOnly( prop );
        if ( elementNamesNotHomogenous( newPropElems ) )
        {
            throw new InvalidUpdateResourcePropertiesRequestContentFaultException( getNamespaceSet(), MSG.getMessage( Keys.ERROR_UPDATE_ELEMS_NOT_HOMOGENOUS ) );
        }
        throwFaultIfUpdateViolatesSchema( prop, newPropElems );

        try
        {
            updatePropertyCallback( prop, newPropElems );
        }
        catch ( RuntimeException re )
        {
            throw new SetResourcePropertyRequestFailedFaultException( getNamespaceSet(), re.toString() );
        }

        Object[] oldValue = getValue( prop );
        // TODO: we might need to clone the oldValue elems, since we might be destroying them when we call clear() below
        try
        {
            prop.clear();
            for ( int i = 0; i < newPropElems.length; i++ )
            {
                prop.add( newPropElems[i] );
            }
        }
        catch ( MetaDataViolationException mdve )
        {
            throw new InvalidSetResourcePropertiesRequestContentFaultException( getNamespaceSet(), mdve );
        }
        Object[] newValue = getValue( prop );
        if ( prop.getChangeListener() != null )
        {
            firePropChangeEvent( prop, oldValue, newValue );
        }
    }
View Full Code Here

    private ResourceProperty getProperty( QName propName )
    {
        LOG.debug( MSG.getMessage( Keys.GET_RP_WITH_NAME,
                propName.toString() ) );
        ResourceProperty prop = getProperties().get( propName );
        if ( prop == null )
        {
            if ( !getProperties().getMetaData().isOpenContent() )
            {
                throw new InvalidResourcePropertyQNameFaultException( getNamespaceSet(), propName );
View Full Code Here

        {
            LOG.debug( MSG.getMessage( Keys.GET_RP_REQ, requestDoc.toString() ) );
        }
        GetResourcePropertyResponseDocument responseDoc = createResponseDocument();
        QName propName = requestDoc.getGetResourceProperty();
        ResourceProperty prop = getProperty( propName );
        addPropertyToResponse( prop, responseDoc.getGetResourcePropertyResponse() );
        return responseDoc;
    }
View Full Code Here

     * @param resource
     * @return Muws Identity ResourceProperty or null if prop doesn't exist
     */
    private ResourceProperty getIdentityProperty(Resource resource)
    {
        ResourceProperty identityProp = null;

        if (resource instanceof PropertiesResource)
        {
            ResourceProperty resourceProperty = ((PropertiesResource) resource).getResourcePropertySet().get(IdentityCapability.PROP_NAME_RESOURCE_ID);
            if (resourceProperty != null)
            {
                identityProp = resourceProperty;
            }
        }
View Full Code Here

    public void creationOccurred(ResourceCreationEvent event)
    {
        Resource resource = event.getResource();

        //determine if resource is a muws resource
        ResourceProperty identityProperty = getIdentityProperty(resource);
        if (identityProperty != null)
        {
            CreationNotificationDocument creationNotifDoc = CreationNotificationDocument.Factory.newInstance();
            CreationNotificationDocument.CreationNotification creationNotif = creationNotifDoc.addNewCreationNotification();
            EndpointReference epr = resource.getEndpointReference();
View Full Code Here

     * @param event
     */
    public void destructionOccurred(ResourceDestructionEvent event)
    {
        Resource resource = event.getResource();
        ResourceProperty identityProperty = getIdentityProperty(resource);
        if (identityProperty != null)
        {
            XmlAnyURI id = (XmlAnyURI) identityProperty.get(0);
            String resourceID = null;
            if (id == null)
            {
                resourceID = "ResourceID Unknown.  May be singleton.";
            }
View Full Code Here

        if (propElems.length == 1)
        {
            //get the request epr
            EndpointReferenceType weatherStationEpr = (EndpointReferenceType) propElems[0];
            ResourcePropertySet resourcePropertySet = ((PropertiesResource) this).getResourcePropertySet();
            ResourceProperty resourceProperty = resourcePropertySet.get(WeatherClientConfigPropertyQNames.RELATIONSHIP);

            //define a relationship
            RelationshipDocument relationshipDocument = RelationshipDocument.Factory.newInstance();
            RelationshipType relationshipType = InteropRequestUtils.createRelationshipType(relationshipDocument.addNewRelationship());

            //add self as a participant
            RelationshipParticipantType parentRelationshipParticipantType = relationshipType.addNewParticipant();
            XmlBeansEndpointReference xmlEpr = (XmlBeansEndpointReference) this.getEndpointReference();
            EndpointReferenceType configEndpointReferenceType = (EndpointReferenceType) xmlEpr.getXmlObject(AddressingConstants.NSURI_ADDRESSING_SCHEMA);
            parentRelationshipParticipantType.setResourceId("urn:" + getID());
            parentRelationshipParticipantType.setRole(InteropConstants.PARENT_RELATION);//uri
            parentRelationshipParticipantType.setManageabilityEndpointReferenceArray(new EndpointReferenceType[]{configEndpointReferenceType});


            //add the new ws as the other participant
            RelationshipParticipantType childRelationshipParticipantType = relationshipType.addNewParticipant();
            childRelationshipParticipantType.setResourceId(InteropRequestUtils.getResourceId(weatherStationEpr));
            childRelationshipParticipantType.setResourceId(InteropConstants.WS1_KEY);
            childRelationshipParticipantType.setRole(InteropConstants.CHILD_RELATION);//uri
            childRelationshipParticipantType.setManageabilityEndpointReferenceArray(new EndpointReferenceType[]{weatherStationEpr});

            resourceProperty.clear();           
            resourceProperty.add(relationshipDocument);

        }
        else
        {
            throw new CallbackFailedException("There was more than one reference passed!");
View Full Code Here

     *
     * @param name
     */
    public void setName(String name)
    {
         ResourceProperty resourceProperty = getResourcePropertySet().get(WeatherStationPropertyQNames.NAME);
         org.wsdmdemo.service.weatherStation.NameDocument prop_name = org.wsdmdemo.service.weatherStation.NameDocument.Factory.newInstance();
         prop_name.setName(name);
         resourceProperty.add(prop_name);
    }
View Full Code Here

TOP

Related Classes of org.apache.ws.resource.properties.ResourceProperty

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.