Package org.apache.ws.resource.properties

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


      ResourcePropertySetMetaData   propSetMetaData =
         new XmlBeansResourcePropertySetMetaData( propsDoc.schemaType(  ), READ_ONLY_PROP_NAMES );
      m_propSet = new XmlBeansResourcePropertySet( propsDoc, propSetMetaData );

      // wsrlw:ScheduledResourceTermination props
      ResourceProperty    prop        =
         m_propSet.get( ScheduledResourceTerminationPortType.PROP_QNAME_CURRENT_TIME );
      CurrentTimeDocument currTimeDoc = CurrentTimeDocument.Factory.newInstance(  );
      currTimeDoc.setCurrentTime( getCurrentTime(  ) );
      prop.setCallback( new CurrentTimeCallback(  ) );
      prop.add( currTimeDoc );
      prop = m_propSet.get( ScheduledResourceTerminationPortType.PROP_QNAME_TERMINATION_TIME );
      TerminationTimeDocument termTimeDoc = TerminationTimeDocument.Factory.newInstance(  );
      termTimeDoc.setTerminationTime( getTerminationTime(  ) );
      prop.add( termTimeDoc );

      // wsntw:SubscriptionManager props
      prop = m_propSet.get( SubscriptionManagerPortType.PROP_QNAME_CONSUMER_REFERENCE );
      ConsumerReferenceDocument consumerRefDoc = ConsumerReferenceDocument.Factory.newInstance(  );
      consumerRefDoc.setConsumerReference( (EndpointReferenceType) ( (XmlObjectWrapper) m_consumerReference )
                                           .getXmlObject(  ) );
      prop.add( consumerRefDoc );
      prop = m_propSet.get( SubscriptionManagerPortType.PROP_QNAME_CREATION_TIME );
      CreationTimeDocument creationTimeDoc = CreationTimeDocument.Factory.newInstance(  );
      creationTimeDoc.setCreationTime( m_creationTime );
      prop.add( creationTimeDoc );
      prop = m_propSet.get( SubscriptionManagerPortType.PROP_QNAME_TOPIC_EXPRESSION );
      TopicExpressionDocument topicExprDoc = TopicExpressionDocument.Factory.newInstance(  );
      topicExprDoc.setTopicExpression( (TopicExpressionType) ( (XmlBeansTopicExpression) m_topicExpression )
                                       .getXmlObject(  ) );
      prop.add( topicExprDoc );
      prop = m_propSet.get( SubscriptionManagerPortType.PROP_QNAME_USE_NOTIFY );
      UseNotifyDocument useNotifyDoc = UseNotifyDocument.Factory.newInstance(  );
      useNotifyDoc.setUseNotify( m_useNotify );
      prop.add( useNotifyDoc );
      if ( m_precondition != null )
      {
         prop = m_propSet.get( SubscriptionManagerPortType.PROP_QNAME_PRECONDITION );
         PreconditionDocument preconditionDoc = PreconditionDocument.Factory.newInstance(  );
         preconditionDoc.setPrecondition( (QueryExpressionType) ( (XmlBeansQueryExpression) m_precondition )
                                          .getXmlObject(  ) );
         prop.add( preconditionDoc );
      }

      if ( m_selector != null )
      {
         prop = m_propSet.get( SubscriptionManagerPortType.PROP_QNAME_SELECTOR );
         SelectorDocument selectorDoc = SelectorDocument.Factory.newInstance(  );
         selectorDoc.setSelector( (QueryExpressionType) ( (XmlBeansQueryExpression) m_selector ).getXmlObject(  ) );
         prop.add( selectorDoc );
      }

      if ( m_policy != null )
      {
         prop = m_propSet.get( SubscriptionManagerPortType.PROP_QNAME_SUBSCRIPTION_POLICY );
         SubscriptionPolicyDocument subPolicyDoc = SubscriptionPolicyDocument.Factory.newInstance(  );
         subPolicyDoc.setSubscriptionPolicy( null );
         prop.add( subPolicyDoc );
      }
   }
View Full Code Here


        m_fileSystem = new UnixFileSystem( m_id );

        /*
         * Initialize each of our properties by calling prop.add(propElem) and/or prop.setCallback(callback)...
         */
        ResourceProperty prop = m_propSet.get( FileSystemPropertyQNames.DEVICE_SPECIAL_FILE );
        DeviceSpecialFileDocument deviceDocXBean = DeviceSpecialFileDocument.Factory.newInstance();
        deviceDocXBean.setDeviceSpecialFile( m_fileSystem.getDeviceSpecialFile() );
        prop.add( deviceDocXBean );

        prop = m_propSet.get( FileSystemPropertyQNames.TYPE );
        TypeDocument typeDocXBean = TypeDocument.Factory.newInstance();
        typeDocXBean.setType( m_fileSystem.getType() );
        prop.add( typeDocXBean );

        BackupFrequencyDocument backupDocXBean = BackupFrequencyDocument.Factory.newInstance();
        backupDocXBean.setBackupFrequency( m_fileSystem.getBackupFrequency() );
        prop = m_propSet.get( FileSystemPropertyQNames.BACKUP_FREQUENCY );
        prop.add( backupDocXBean );
        prop.setCallback( new BackupFrequencyCallback( m_fileSystem ) );

        CommentDocument commentDocXBean = CommentDocument.Factory.newInstance();
        commentDocXBean.setComment( m_fileSystem.getComment() );
        prop = m_propSet.get( FileSystemPropertyQNames.COMMENT );
        prop.add( commentDocXBean );
        prop.setCallback( new CommentCallback( m_fileSystem ) );

        FsckPassNumberDocument fsckDocXBean = FsckPassNumberDocument.Factory.newInstance();
        fsckDocXBean.setFsckPassNumber( m_fileSystem.getFsckPassNumber() );
        prop = m_propSet.get( FileSystemPropertyQNames.FSCK_PASS_NUMBER );
        prop.add( fsckDocXBean );
        prop.setCallback( new FsckPassNumberCallback( m_fileSystem ) );

        MountPointDirectoryDocument mountPointDocXBean = MountPointDirectoryDocument.Factory.newInstance();
        mountPointDocXBean.setMountPointDirectory( m_fileSystem.getMountPoint() );
        prop = m_propSet.get( FileSystemPropertyQNames.MOUNT_POINT_DIR );
        prop.add( mountPointDocXBean );
        prop.setCallback( new MountPointCallback( m_fileSystem ) );

        OptionsDocument optionsDocXBean =
                OptionsDocument.Factory.newInstance();
        org.apache.ws.resource.example.filesystem.OptionsDocument.Options options =
                optionsDocXBean.addNewOptions();
        List backendOptions =
                m_fileSystem.getOptions();
        for ( int i = 0; i < backendOptions.size(); i++ )
        {
            options.addOption( (String) backendOptions.get( i ) );
        }

        prop = m_propSet.get( FileSystemPropertyQNames.OPTIONS );
        prop.add( optionsDocXBean );
        prop.setCallback( new OptionsCallback( m_fileSystem ) );

    }
View Full Code Here

    public void testInsertResourcePropertiesCallback() throws XmlException, ResourceException,
            ResourceContextException
    {
        m_resourceContext = new SushiResourceContext();
        SushiResource resource = (SushiResource) m_resourceContext.getResource();
        ResourceProperty resourceProp = resource.getResourcePropertySet().get( SushiPropertyQNames.EBI );
        resourceProp.setCallback( m_callback );

        XmlObject xBean =
                XmlObject.Factory.parse( "<foo:Ebi xmlns:foo=\"http://ws.apache.org/resource/properties/test/sushi\">"
                + "0" + "</foo:Ebi>" );
        insertResourceProperty( new XmlObject[]{xBean} );
View Full Code Here

    public void testInsertResourcePropertiesFailedCallback() throws XmlException, ResourceException,
            ResourceContextException
    {
        m_resourceContext = new SushiResourceContext();
        SushiResource resource = (SushiResource) m_resourceContext.getResource();
        ResourceProperty resourceProp = resource.getResourcePropertySet().get( SushiPropertyQNames.EBI );
        resourceProp.setCallback( new ThrowsCallback() );

        XmlObject xBean =
                XmlObject.Factory.parse( "<foo:Ebi xmlns:foo=\"http://ws.apache.org/resource/properties/test/sushi\">"
                + "0" + "</foo:Ebi>" );
        try
View Full Code Here

        XmlObject xBean =
                XmlObject.Factory.parse( "<foo:Ika xmlns:foo=\"http://ws.apache.org/resource/properties/test/sushi\">"
                + "my favorite!" + "</foo:Ika>" );
        insertResourceProperty( new XmlObject[]{xBean} );
        SushiResource resource = (SushiResource) m_resourceContext.getResource();
        ResourceProperty resourceProp = resource.getResourcePropertySet().get( SushiPropertyQNames.IKA );
        resourceProp.setCallback( m_callback );
        deleteResourceProperty( SushiPropertyQNames.IKA );
        GetResourcePropertyResponseDocument.GetResourcePropertyResponse getResourcePropertyResponse = getResourceProperty(
                SushiPropertyQNames.OHTORO );
        assertNotNull( getResourcePropertyResponse );
        assertTrue( m_callback.deleteWasInvoked() );
View Full Code Here

        XmlObject xBean =
                XmlObject.Factory.parse( "<foo:Ika xmlns:foo=\"http://ws.apache.org/resource/properties/test/sushi\">"
                + "my favorite!" + "</foo:Ika>" );
        insertResourceProperty( new XmlObject[]{xBean} );
        SushiResource resource = (SushiResource) m_resourceContext.getResource();
        ResourceProperty resourceProp = resource.getResourcePropertySet().get( SushiPropertyQNames.IKA );
        resourceProp.setCallback( new ThrowsCallback() );
        try
        {
            deleteResourceProperty( SushiPropertyQNames.IKA );
        }
        catch (RuntimeException e)
View Full Code Here

        SushiPlate plate = new SushiPlate();
        SushiCallback callback = new SushiCallback( plate );

        //setup callback on resource prop
        SushiResource resource = (SushiResource) m_resourceContext.getResource();
        ResourceProperty resourceProp = resource.getResourcePropertySet().get( SushiPropertyQNames.EBI );
        resourceProp.setCallback( callback );
        XmlObject xBean =
                XmlObject.Factory.parse( "<foo:Ebi xmlns:foo=\"http://ws.apache.org/resource/properties/test/sushi\">"
                + newValue + "</foo:Ebi>" );
        updateResourceProperty( new XmlObject[]{xBean} );
        assertPropHasOneElemWithGivenValue( SushiPropertyQNames.EBI, newValue );
View Full Code Here

    {
        m_resourceContext = new SushiResourceContext();
        SushiPlate plate = new SushiPlate();
        SushiCallback callback = new SushiCallback( plate );
        SushiResource resource = (SushiResource) m_resourceContext.getResource();
        ResourceProperty resourceProp = resource.getResourcePropertySet().get( SushiPropertyQNames.EBI );
        resourceProp.setCallback( callback );
        final QName[] propNames = new QName[]{SushiPropertyQNames.EBI, SushiPropertyQNames.IKA};
        GetMultipleResourcePropertiesResponseDocument.GetMultipleResourcePropertiesResponse response = getMultipleResourceProperties( propNames );
        XmlObject[] propElems = XmlBeanUtils.getChildElements( response );
        assertNotNull( propElems );
        assertEquals( propNames[0], XmlBeanUtils.getName( propElems[0] ) );
View Full Code Here

        String value = XmlBeanUtils.getValue( ebiPropElems[0] );
        assertEquals( "9", value );

        //setup callback to modify resource prop
        SushiResource resource = (SushiResource) m_resourceContext.getResource();
        ResourceProperty resourceProp = resource.getResourcePropertySet().get( SushiPropertyQNames.EBI );
        resourceProp.setCallback( callback );

        queryResourcePropertiesResponse = queryResourceProperties( "*" );

        ebiPropElems = XmlBeanUtils.getChildElements( queryResourcePropertiesResponse, SushiPropertyQNames.EBI );
        assertNotNull( ebiPropElems );
View Full Code Here

        m_resourceContext = new SushiResourceContext();
        // create and register callback object
        SushiPlate plate = new SushiPlate();
        SushiCallback callback = new SushiCallback( plate );
        SushiResource resource = (SushiResource) m_resourceContext.getResource();
        ResourceProperty resourceProp = resource.getResourcePropertySet().get( SushiPropertyQNames.EBI );
        resourceProp.setCallback( callback );
        // send GetRP request and make sure prop got updated by callback.refreshProperty()
        GetResourcePropertyResponseDocument.GetResourcePropertyResponse response = getResourceProperty( SushiPropertyQNames.EBI );
        XmlObject[] ebiPropElems = XmlBeanUtils.getChildElements( response, SushiPropertyQNames.EBI );
        assertNotNull( ebiPropElems );
        assertEquals( 1, ebiPropElems.length );
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.