Package org.apache.ws.resource

Examples of org.apache.ws.resource.Resource


   /**
    * DOCUMENT_ME
    */
   public void destroy(  )
   {
      Resource producerResource = null;
      try
      {
         producerResource = getProducerResource(  );
      }
      catch ( Exception e )
      {
         ;
      }

      if ( !( producerResource instanceof NotificationProducerResource ) )
      {
         return;
      }

      Topic[] topics = null;
      topics = evaluateTopicExpression(  );

      synchronized ( producerResource )
      {
         //removes listeners from the topics
         boolean removed = removeListener( topics );

         //persists the resource
         if ( removed && producerResource instanceof PersistentResource )
         {
            try
            {
               ( (PersistentResource) producerResource ).store(  );
            }
            catch ( ResourceException e )
            {
               LOG.debug( "Unable to persist the resource: " + producerResource + " with id: "
                          + producerResource.getID(  ), e );
            }
         }
      }

      //notify listeners that this subscription expired.
View Full Code Here


            throws ResourceException
    {

        LOG.debug( MSG.getMessage( Keys.FINDING_RESOURCE_WITH_KEY, String.valueOf( key ) ) );

        Resource resource = null;
        Lock lock = getLock( key );
        try
        {
            lock.acquire();
        }
View Full Code Here

     */
    public void remove( ResourceKey key )
            throws ResourceException
    {

        Resource resource = null;
        Lock lock = getLock( key );
        try
        {
            lock.acquire();
        }
        catch ( InterruptedException ie )
        {
            throw new ResourceException( ie );
        }

        try
        {
            resource = get( key );

            try
            {
                resource.destroy();
            }
            catch ( RuntimeException re )
            {
                throw new ResourceException( MSG.getMessage( Keys.FAILED_TO_DESTROY_RESOURCE, resource, re ) );
            }

            m_resources.remove( getLookupKey( key ) );
            notifyResourceDeletedListeners( resource.getEndpointReference() );

            LOG.debug( MSG.getMessage( Keys.REMOVED_RESOURCE_WITH_KEY, resource.getClass().getName(),
                    String.valueOf( key ) ) );
            if ( m_cache != null )
            {
                m_cache.remove( resource );
            }
View Full Code Here

     */
    protected Resource createInstance( ResourceKey key )
            throws ResourceException
    {
        LOG.debug( MSG.getMessage( Keys.CREATING_INSTANCE_WITH_KEY, String.valueOf( key ) ) );
        Resource resource;
        try
        {
            resource = (Resource) getResourceClass().newInstance();
        }
        catch ( Exception e )
        {
            throw new ResourceException( e );
        }

        resource.setID( key != null ? key.getValue() : null );

        try
        {
            LOG.debug( MSG.getMessage( Keys.INIT_RESOURCE_LIFECYCLE_INSTANCE, resource.getClass().getName() ) );
            resource.init();
        }
        catch ( RuntimeException re )
        {
            throw new ResourceException( MSG.getMessage( Keys.FAILED_TO_INIT_RESOURCE, resource, re ), re );
        }
View Full Code Here

     * @throws ResourceException DOCUMENT_ME
     */
    protected Resource createNewInstanceAndLoad( ResourceKey key )
            throws ResourceException
    {
        Resource resource = createInstance( key );
        LOG.debug( MSG.getMessage( Keys.LOADING_RESOURCE_FROM_PERSISTENCE, String.valueOf( key ) ) );
        ( (PersistenceCallback) resource ).load( key );
        if ( ResourceSweeper.isExpired( resource ) )
        {
            throw new ResourceUnknownException( getLookupKey( key ), getServicePortName() );
View Full Code Here

    private Resource get( ResourceKey key )
            throws ResourceException
    {
        LOG.debug( MSG.getMessage( Keys.GET_RESOURCE_FOR_KEY, String.valueOf( key ) ) );
        Object lookupKey = getLookupKey( key );
        Resource resource = (Resource) m_resources.get( lookupKey );
        if ( resource == null )
        {
            if ( !m_resourceIsPersistent )
            {
                throw new ResourceUnknownException( lookupKey, getServicePortName() );
View Full Code Here

   {
      LOG.debug( MSG.getMessage( Keys.CLEANING_EXPIRED_RESOURCES) );

      Calendar    currentTime = Calendar.getInstance(  );
      ResourceKey key;
      Resource    resource;
      LinkedList  list = new LinkedList(  );

      synchronized ( m_resources )
      {
         Iterator keyIterator = m_resources.keySet(  ).iterator(  );
View Full Code Here

            throws ResourceException,
            ResourceContextException,
            ResourceUnknownException
    {

        Resource resource = null;
        ResourceKey key = resourceContext.getResourceKey();
        try
        {   //added because of AbstractPortType
            resource = null;
            try
View Full Code Here

            keyName = QName.valueOf( resourceKeyName );
        }

        ResourceKey key = getResourceKey( keyName, resourceKeyClass );
        LOG.debug( MSG.getMessage( Keys.LOOKUP_RESOURCE_FOR_KEY, String.valueOf( key ) ) );
        Resource resource = home.find( key );
        LOG.debug( MSG.getMessage( Keys.FOUND_RESOURCE, resource ) );
        return resource;
    }
View Full Code Here

   throws ResourceException,
          ResourceContextException,
          ResourceUnknownException
   {
      ResourceKey key      = resourceContext.getResourceKey(  );
      Resource    resource = null;
      try
      {
         resource = find( key );
      }
      catch ( ResourceException re )
View Full Code Here

TOP

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

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.