Package org.apache.ws.resource.properties

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


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


            return; // nothing to do
        }
        throwFaultIfElementNamesHeterogenous( propElemsToBeInserted );

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

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

        if(!prop.getMetaData().isAny())
        {
            //todo probably need to check this for xsd:any to check for possible violations
            //refreshProperty( prop );
            throwFaultIfInsertionViolatesSchema( prop, propElemsToBeInserted );
        }

        throwFaultIfPropertyIsReadOnly( prop );

        try
        {
            insertPropertyCallback( prop, propElemsToBeInserted );
        }
        catch ( RuntimeException re )
        {
            throw new SetResourcePropertyRequestFailedFaultException( 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( mdve );
            }
        }
        Object[] newValue = getValue( prop );
        if ( prop.getChangeListener() != null )
        {
            firePropChangeEvent( prop, oldValue, newValue );
        }
    }
View Full Code Here

        {
            return; // nothing to do
        }

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

        throwFaultIfPropertyIsReadOnly( prop );
        throwFaultIfElementNamesHeterogenous( newPropElems );
        throwFaultIfUpdateViolatesSchema( prop, newPropElems );

        try
        {
            updatePropertyCallback( prop, newPropElems );
        }
        catch ( RuntimeException re )
        {
            throw new SetResourcePropertyRequestFailedFaultException( 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( 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( propName );
View Full Code Here

    * Test for XmlBeansResourceProperty#add.
    */
   public void testAdd()
         throws Exception
   {
      ResourceProperty prop = m_resourcePropSet.get( SushiPropertyQNames.IKA );
      final String stringValue = "somethang";
      prop.add( XmlObject.Factory.parse( "<" + SushiPropertyQNames.IKA.getLocalPart() + " xmlns=\"" + SushiPropertyQNames.IKA.getNamespaceURI() + "\">" + stringValue + "</" + SushiPropertyQNames.IKA.getLocalPart() + ">" ) );
      assertEquals( 2,
            prop.size() );
      XmlString xString = (XmlString) prop.get( 1 );
      assertEquals( stringValue,
            xString.getStringValue() );
   }
View Full Code Here

    * Test for XmlBeansResourceProperty#clear.
    */
   public void testClear()
         throws Exception
   {
      ResourceProperty manufacturerProp = m_resourcePropSet.get( SushiPropertyQNames.IKA );
      manufacturerProp.clear();
      assertTrue( manufacturerProp.isEmpty() );
   }
View Full Code Here

    * Test for XmlBeansResourceProperty#get.
    */
   public void testGet()
         throws Exception
   {
      ResourceProperty manufacturerProp = m_resourcePropSet.get( SushiPropertyQNames.AKAGI );
      Object propObj = manufacturerProp.get( 0 );
      assertTrue( propObj instanceof XmlInt );
      XmlInt xInt = (XmlInt) propObj;
      assertEquals( "24",
            xInt.getStringValue() );
   }
View Full Code Here

    * Test for XmlBeansResourceProperty#getMetaData.
    */
   public void testGetMetaData()
         throws Exception
   {
      ResourceProperty blockSize = m_resourcePropSet.get( SushiPropertyQNames.EBI );
      ResourcePropertyMetaData metaData = blockSize.getMetaData();
      assertNotNull( metaData );
      assertEquals( SushiPropertyQNames.EBI,
            metaData.getName() );
      assertEquals( 1,
            metaData.getMinOccurs() );
View Full Code Here

    * Test for XmlBeansResourceProperty#isEmpty.
    */
   public void testIsEmpty()
         throws Exception
   {
      ResourceProperty prop = m_resourcePropSet.get( SushiPropertyQNames.IKA );
      assertFalse( prop.isEmpty() );
      prop.clear();
      assertTrue( prop.isEmpty() );
      assertEquals( 0,
            prop.size() );
   }
View Full Code Here

    * Test for XmlBeansResourceProperty#remove.
    */
   public void testRemove()
         throws Exception
   {
      ResourceProperty prop = m_resourcePropSet.get( SushiPropertyQNames.IKA );
      prop.remove( prop.get( 0 ) );
      assertTrue( prop.isEmpty() );
   }
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.