Package org.gudy.azureus2.pluginsimpl.local

Examples of org.gudy.azureus2.pluginsimpl.local.PluginInterfaceImpl$propertyWrapper


  public MessageStreamEncoderAdapter( MessageStreamEncoder plug_encoder ) {
    this.plug_encoder = plug_encoder;
  }
 
  public com.aelitis.azureus.core.networkmanager.RawMessage[] encodeMessage( com.aelitis.azureus.core.peermanager.messaging.Message message ) {
    Message plug_msg;
   
    if( message instanceof MessageAdapter ) {  //original message created by plugin, unwrap
      plug_msg = ((MessageAdapter)message).getPluginMessage();
    }
    else {
View Full Code Here


 
    throws MessageException
  {
    if ( incoming ){
     
      throw( new MessageException( "Already connected" ));
    }
   
    if ( connecting ){
     
      throw( new MessageException( "Connect already performed" ));
    }
   
    connecting  = true;
   
    if ( closed ){
     
      throw( new MessageException( "Connection has been closed" ));
    }
   
    InetSocketAddress  tcp_ep = endpoint.getTCP();
       
    if ( tcp_ep != null ){
     
      connectTCP( initial_data, tcp_ep );
     
    }else{
     
      InetSocketAddress  udp_ep = endpoint.getUDP();

      if ( udp_ep != null ){
       
        connectUDP( initial_data, udp_ep, false );
       
      }else{
       
        throw( new MessageException( "No protocols availabld" ));
      }
    }
  }
View Full Code Here

                delegate.close();
               
              }catch( Throwable e ){
              }
             
              reportFailed( new MessageException( "Connection has been closed" ));

            }else{
             
              reportConnected();
            }
View Full Code Here

              final InetSocketAddress  target,
              Map            reply )
            {
              if ( closed ){
                             
                reportFailed( new MessageException( "Connection has been closed" ));

              }else{
               
                connect_method_count++;

                if ( TEST_TUNNEL ){
                 
                  initial_data.rewind();
                 
                  connectTunnel( initial_data, gen_udp, rendezvous, target );
                 
                }else{
               
                  udp_delegate.connect(
                      initial_data,
                      new GenericMessageConnectionAdapter.ConnectionListener()
                      {
                        private boolean  connected;
                       
                        public void
                        connectSuccess()
                        {
                          connected  = true;
                         
                          setDelegate( udp_delegate );
                         
                          if ( closed ){
                           
                            try{
                              delegate.close();
                             
                            }catch( Throwable e ){                         
                            }
                           
                            reportFailed( new MessageException( "Connection has been closed" ));
                           
                          }else{
                           
                            reportConnected();
                          }                       
                        }
                       
                        public void
                        connectFailure(
                          Throwable failure_msg )
                        {
                          if ( connected ){
                           
                            reportFailed( failure_msg );
                           
                          }else{
                           
                            initial_data.rewind();
 
                            connectTunnel( initial_data, gen_udp, rendezvous, target );
                          }
                        }
                      });
                }
              }
            }
           
            public void
            failed(
              int      failure_type )
            {
              reportFailed( new MessageException( "UDP connection attempt failed - NAT traversal failed (" + NATTraversalObserver.FT_STRINGS[ failure_type ] + ")"));
            }
           
            public void
            failed(
              Throwable   cause )
            {
              reportFailed( cause );
            }
           
            public void
            disabled()
            {
              reportFailed( new MessageException( "UDP connection attempt failed as DDB is disabled" ));
            }
          });
    }else{
 
      udp_delegate.connect(
          initial_data,
          new GenericMessageConnectionAdapter.ConnectionListener()
          {
            private boolean  connected;
           
            public void
            connectSuccess()
            {
              connected  = true;
             
              setDelegate( udp_delegate );
             
              if ( closed ){
               
                try{
                  delegate.close();
                 
                }catch( Throwable e ){ 
                }
               
                reportFailed( new MessageException( "Connection has been closed" ));

              }else{
               
                reportConnected();
              }
View Full Code Here

               
              }catch( Throwable e ){
               
              }
             
              reportFailed( new MessageException( "Connection has been closed" ));

            }else{
             
              reportConnected();
            }
View Full Code Here

  {
    int  size = ((PooledByteBufferImpl)message).getBuffer().remaining( DirectByteBuffer.SS_EXTERNAL );
   
    if ( size > getMaximumMessageSize()){
     
      throw( new MessageException( "Message is too large: supplied is " + size + ", maximum is " + getMaximumMessageSize()));
    }
   
    delegate.send( message );
  }
View Full Code Here

          public MessageStreamEncoder createEncoder() {  return new GenericMessageEncoder();}
          public MessageStreamDecoder createDecoder() {  return new GenericMessageDecoder(type, description);}
        });
   
  return(
    new GenericMessageRegistration()
    {
      public GenericMessageEndpoint
      createEndpoint(
        InetSocketAddress  notional_target )
      {
View Full Code Here

    }
    else {
      plug_msg = new MessageAdapter( message )//core created
    }
   
    RawMessage raw_plug = plug_encoder.encodeMessage( plug_msg );
    return new com.aelitis.azureus.core.networkmanager.RawMessage[]{ new RawMessageAdapter( raw_plug )};
  }
View Full Code Here

       
        return( null );
       
      }
     
      Torrent  torrent = download.getTorrent();
     
      if ( torrent.isPrivate()){
       
        Debug.out( "Attempt to download private torrent" );
       
        ddb.log( "TorrentDownload: request from " + originator + "  for '" + download.getName() + "' denied as it is private" );
       
          // should never happen as private torrents are not tracked so they can't be found for
          // download
       
        return( null );
      }
     
      String  msg = "TorrentDownload: request from " + originator + "  for '" + download.getName() + "' OK";   

      if ( TRACE ){
       
        System.out.println( msg );
      }
     
      ddb.log( msg );
     
      HashWrapper  hw = new HashWrapper( torrent.getHash());
     
      synchronized( data_cache ){
       
        Object[]  data = (Object[])data_cache.get( hw );
       
        if ( data != null ){
                   
          data[1] = new Long( SystemTime.getCurrentTime());
         
          return( ddb.createValue((byte[])data[0]));
        }
      }
     
     
      torrent = torrent.removeAdditionalProperties();
     
        // when clients get a torrent from the DHT they take on
        // responsibility for tracking it too
     
      torrent.setDecentralisedBackupRequested( true );
     
      byte[] data = torrent.writeToBEncodedData();
             
      data = encrypt( torrent.getHash(), data );
       
      if ( data == null ){
         
        return( null );
      }
View Full Code Here

      for (int i=0; i < items.size(); i++){       
      
      ShareItem  item = (ShareItem)items.get(i);
       
        try{
        Torrent  t = item.getTorrent();
                  
        Download  download = dm.getDownload( t );
       
        if ( download == null ){
                   
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.pluginsimpl.local.PluginInterfaceImpl$propertyWrapper

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.