Package org.apache.ws.resource

Examples of org.apache.ws.resource.WSResource


      EndpointReferenceType returnEPR = EndpointReferenceType.Factory.newInstance(  );

      if ( subscription != null )
      {
         // Find the subscription WSResource in the registry
         WSResource resource =
            RegistrationManagerFactory.getManager(  ).find( SUBSCRIPTION_MANAGER_SERVICE,
                                                            subscription.getSubscriptionId(  ) );

         if ( resource != null )
         {
            EndpointReference subscriptionEPR = resource.getEndpointReference(  );
            AttributedURI     address = returnEPR.addNewAddress(  );
            address.setStringValue( subscriptionEPR.getAddress(  ).toString(  ) );

            // Setup the port type
            AttributedQName portType = returnEPR.addNewPortType(  );
View Full Code Here


   {
      if ( sub != null )
      {
         try
         {
            WSResource wsResource =
               SubscriptionManagerWSResourceFactory.createSubscriptionManagerWSResource( sub, this );

            RegistrationManagerFactory.getManager(  ).register( wsResource );
         }
         catch ( Exception e )
View Full Code Here

   {
      if ( doomedSub != null )
      {
         try
         {
            WSResource doomed =
               RegistrationManagerFactory.getManager(  ).find( "SubscriptionManagerPort",
                                                               doomedSub.getSubscriptionId(  ) );

            RegistrationManagerFactory.getManager(  ).unregister( doomed );
         }
View Full Code Here

          RegistrationFailureException
   {
      registerTestAsResource(  );

      // Check to see if null returns all resources
      WSResource resultList = m_manager.find( null, null );
      Assert.assertNull( resultList );

      resultList = m_manager.find( null, "doesnotmatterwhatID" );
      Assert.assertNull( resultList );

      // Check that we can find a disk resource
      WSResource diskResource = m_manager.find( "disk", "1234" );
      Assert.assertNotNull( diskResource );
      Assert.assertEquals( "1234",
                           diskResource.getId(  ) );
   }
View Full Code Here

      // 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

      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

   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

    * @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

         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

            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

TOP

Related Classes of org.apache.ws.resource.WSResource

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.