Examples of WsResource


Examples of org.apache.ws.resource.WSResource

      // Try a valid resource and see if it gets notified
      m_wasRegistered = false;
      registerTestAsResource(  );
      Assert.assertTrue( "register failed to call the registered member to notify it of registration.",
                         m_wasRegistered );
      WSResource result = m_manager.find( "UNIT_TEST_PORT", "UNIT_TEST_RESOURCE_ID_1234" );
      Assert.assertNotNull( result );
      Assert.assertEquals( result, this );
      Assert.assertEquals( result.getId(  ),
                           "UNIT_TEST_RESOURCE_ID_1234" );
      Assert.assertEquals( result.getEndpointReference(  ),
                           m_simulatedEndpointRef );
   }
View Full Code Here

Examples of org.apache.ws.resource.WSResource

      registerTestAsSingletonResource(  );
      Assert.assertTrue( "register failed to call the registered member to notify it of singleton registration.",
                         m_wasRegistered );

      // Find it as a singleton using find portname, null
      WSResource resultSingleton = m_manager.find( "UNIT_TEST_PORT", null );
      Assert.assertNotNull( resultSingleton );
      Assert.assertEquals( resultSingleton, this );
      Assert.assertEquals( resultSingleton.getEndpointReference(  ),
                           m_simulatedEndpointRef );

      // Find it without specifying a resource id
      WSResource[] result = m_manager.find( "UNIT_TEST_PORT" );
      Assert.assertNotNull( result );
View Full Code Here

Examples of org.apache.ws.resource.WSResource

   throws MalformedURIException,
          RegistrationFailureException
   {
      // Register and unregister this test
      registerTestAsResource(  );
      WSResource result = m_manager.find( "UNIT_TEST_PORT", "UNIT_TEST_RESOURCE_ID_1234" );
      m_wasUnRegistered = false;
      m_manager.unregister( result );
      Assert.assertTrue( "Resource was unregistered without being notified.", m_wasUnRegistered );
      WSResource resultPostUnreg = m_manager.find( "UNIT_TEST_PORT", "UNIT_TEST_RESOURCE_ID_1234" );
      Assert.assertNull( resultPostUnreg );

      // Register and unregister this test
      registerTestAsSingletonResource(  );
      WSResource resultSingle = m_manager.find( "UNIT_TEST_PORT", null );
      m_wasUnRegistered = false;
      m_manager.unregister( resultSingle );
      Assert.assertTrue( "Resource was unregistered without being notified.", m_wasUnRegistered );
      WSResource resultPostUnregSingle = m_manager.find( "UNIT_TEST_PORT", null );
      Assert.assertNull( resultPostUnregSingle );
   }
View Full Code Here

Examples of org.apache.ws.resource.WSResource

    * @see org.apache.ws.resource.discovery.RegistrationManager#find(String, String)
    */
   public WSResource find( String serviceName,
                           String id )
   {
      WSResource retResource = null;

      if ( serviceName != null )
      {
         synchronized ( m_resourceMap )
         {
            Map svcMap = (Map) m_resourceMap.get( serviceName );

            if ( svcMap != null )
            {
               if ( id != null )
               { // id was not null, look for any instance of this service with the given ID
                  retResource = (WSResource) svcMap.get( id );
               }
               else
               { // id was null which indicates we should look for the singleton

                  // if map is not of size 1 then we know there is no singleton since only 1 may exist, no more no less.
                  if ( svcMap.size(  ) == 1 )
                  {
                     WSResource resource = (WSResource) svcMap.values(  ).iterator(  ).next(  );

                     if ( resource.isSingleton(  ) )
                     {
                        retResource = resource;
                     }
                  }
               }
View Full Code Here

Examples of org.apache.ws.resource.WSResource

         String serviceName = getServiceName( resource );
         String id = getIdKey( resource );

         synchronized ( m_resourceMap )
         {
            WSResource doomedResource = find( serviceName, id );

            if ( doomedResource != null )
            {
               Map svcMap = (Map) m_resourceMap.get( serviceName ); // doomedResource is not null so svcMap will never be null
               svcMap.remove( id );

               // let the resource know we just unregistered it
               doomedResource.unregistered( this );
            }
            else
            {
               throw new RegistrationFailureException( MSG.getMessage( Keys.RESOURCE_EX_UNREGISTER_FAILURE,
                                                                       serviceName, id ) );
View Full Code Here

Examples of org.apache.ws.resource.WSResource

            throw new RegistrationFailureException( MSG.getMessage( Keys.RESOURCE_EX_ALREADY_REGISTERED,
                                                                    serviceName, "Singleton" ) );
         }

         // Do not permit the registration of identical ResourceId's
         WSResource registeredResource = find( serviceName,
                                               getIdKey( resource ) );

         if ( registeredResource == null )
         {
            // add it to our map of registered resources
View Full Code Here

Examples of org.apache.ws.resource.WSResource

    *
    */
   public void testGetResourceId(  )
   throws Exception
   {
      WSResource resource =
         new ClientProxyWSResource( ClientProxyWSResource.createEndpointReference( getAxisWebServiceUrl( ExampleConstants.SERVICE_NAME ),
                                                                                   RESOURCE_ID ) );
      SOAPElement[] responseElems =
         resource.getResourceProperty( Muws05Constants.RESOURCE_PROP_QNAME_RESOURCE_ID );
      assertNotNull( responseElems );
      assertTrue( responseElems.length == 1 );
      SOAPElement responseElem = responseElems[0];
      assertEquals( ResourceProperties11Constants.NSURI_WSRP,
                    responseElem.getNamespaceURI(  ) );
View Full Code Here

Examples of org.apache.ws.resource.WSResource

            WSResource[] resources = m_registrationManager.find( null );

            // loop through all resources found in the manager, stop if our thread has been told to shutdown
            for ( int i = 0; ( i < resources.length ) && m_started; i++ )
            {
               final WSResource resource = resources[i];

               // only examine termination time if we have not seen this resource before or we have and it supports WS-RL TerminationTime
               if ( !m_noTerminationTimeSupport.containsKey( resource.getId(  ) ) )
               {
                  // tell the thread pool to run code that examines the current resource and destroys it if it is expired
                  m_reaperThreadPool.execute( new Runnable(  )
                     {
                        public void run(  )
                        {
                           TerminationTimeDocument termTimeXmlBean = null;

                           try
                           {
                              SOAPElement[] soapEle =
                                              resource.getResourceProperty( ResourceLifetime11Constants.RESOURCE_PROP_QNAME_TERMINATION_TIME );

                              termTimeXmlBean = (TerminationTimeDocument) XmlBeansUtils.toXmlObject( soapEle[0] );
                           }
                           catch ( Throwable t )
                           {
                              m_noTerminationTimeSupport.put( resource.getId(  ),
                                                              resource.getId(  ) );
                           }

                           if ( ( termTimeXmlBean != null )
                                && !termTimeXmlBean.isNilTerminationTime(  )
                                && termTimeXmlBean.getTerminationTime(  ).before( Calendar.getInstance(  ) ) )
                           {
                              try
                              {
                                 resource.destroy(  );
                              }
                              catch ( Exception destroyException )
                              {
                                 // TODO: what should we do if we failed to destroy an expired resource?
                                 //destroyException.printStackTrace(  );
View Full Code Here

Examples of org.apache.ws.resource.WSResource

   public boolean handleRequest( MessageContext msgContext )
   {
      // Do this first so we get the full MessageContext
      boolean    returnValue = super.handleRequest( msgContext );

      WSResource target = null;

      try
      {
         target =
            RegistrationManagerFactory.getManager(  ).find( AxisUtils.getServiceName( msgContext ),
View Full Code Here

Examples of org.apache.ws.resource.WSResource

         results = new WSResource[0];
      }
      EndpointReferenceType[] eprList = new EndpointReferenceType[results.length];
      for ( int i = 0; i < results.length; i++ )
      {
         WSResource resource = results[i];
         eprList[i] = resource.getEndpointReference( );
      }
      return new axis.org.apache.ws.generated.registry.FindResponse( eprList );
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.