Package net.noderunner.amazon.s3

Examples of net.noderunner.amazon.s3.Connection


   }

   private S3Object wrap(Map map) throws Exception
   {
      byte[] b = getMarshaller().objectToByteBuffer(map);
      return new S3Object(b);
   }
View Full Code Here


  @Override
  protected void doDelete(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
    Entry e = entry(req);
    S3Object remove = map.remove(e);
    if (remove == null) {
      resp.sendError(404, "Not found " + e);
    } else {
      resp.sendError(HttpURLConnection.HTTP_NO_CONTENT, "Deleted");
    }
View Full Code Here

    if ("/".equals(uri.getPath())) {
      list(req, resp);
    } else {
      String key = uri.getPath().substring(1);
      Entry e = new Entry(key);
      S3Object obj = map.get(e);
        if (debug)
          log("map.get(" + key + ") = " + obj);
      if (obj == null) {
        resp.sendError(404, "Not here: " + e);
        return;
      }
      Headers h = new Headers();
      h = h.mergeMetadata(obj.getMetadata());
      for (Map.Entry<String, List<String>> me : h.getHeaders().entrySet()) {
        for (String v : me.getValue()) {
          resp.setHeader(me.getKey(), v);
        }
      }
      resp.getOutputStream().write(obj.getData());
    }

  }
View Full Code Here

        int len = is.read(b);
        if (len == -1)
          break;
        os.write(b, 0, len);
      }
      S3Object s3 = new S3Object(os.toByteArray());
      map.put(e, s3);
      Headers h = new Headers();
      @SuppressWarnings("unchecked")
      Enumeration<String> names = req.getHeaderNames();
      for (String n : Collections.list(names))
        h.put(n, req.getHeader(n));
      s3.setMetadata(h.extractMetadata());
      log("put '" + e + "' as: " + s3);
    }
  }
View Full Code Here

   @Override
   protected void configureCache(CacheSPI cache) throws Exception
   {
      if (server == null)
      {
         server = new Server();
         server.start();

      }
      String accessKey = System.getProperty("accessKey");
      String properties;
View Full Code Here

      String accessKey = System.getProperty("accessKey");
      String properties;
      if (accessKey == null)
      {
         log.info("Testing using S3CacheLoader using emulator");
         Server server = new Server();
         serverTL.set(server);
         server.start();
         properties =
               "cache.s3.accessKeyId=dummy\n"  +
               "cache.s3.secretAccessKey=dummy\n"  +
               "cache.s3.server=localhost\n"  +
               "cache.s3.port=" + server.getPort() + "\n"  +
               "cache.s3.callingFormat=VANITY" + "\n"  +
               "cache.s3.bucket=localhost" + "\n";
      }
      else
      {
View Full Code Here

      cache.getConfiguration().setCacheLoaderConfig(config);
   }
  
   @Override
   public void cleanup() {
      Server server = serverTL.get();
      if (server != null)
      {
         try
         {
             server.close();
         }
         catch (IOException e) {
         }
      }
      serverTL.set(null);
View Full Code Here

    private void connectionClosed() {
        if(! reconnect.get()) {
            return; // Nothing to do
        }
        // Wait until the connection is closed before reconnecting
        final Connection connection = this.connection;
        if(connection != null) {
            if(channel == null) {
                connection.closeAsync();
            }
        } else {
            HostControllerLogger.ROOT_LOGGER.lostRemoteDomainConnection();
            executorService.execute(new Runnable() {
                @Override
View Full Code Here

     *
     * @param connectionURI the new connection URI
     */
    protected void reconfigure(final URI connectionURI) {
        configuration.setUri(connectionURI);
        final Connection connection = this.connection;
        if(connection != null) {
            connection.closeAsync();
        }
    }
View Full Code Here

            builder.set(Options.SASL_MECHANISMS, Sequence.of("JBOSS-LOCAL-USER"));
        }

        final IoFuture<Connection> futureConnection = endpoint.connect(connectionURI, builder.getMap(), new AuthenticationCallbackHandler(username, password));
        // wait for the connection to be established
        final Connection connection = IoFutureHelper.get(futureConnection, 5000, TimeUnit.MILLISECONDS);
        // create a remoting EJB receiver for this connection
        final EJBReceiver receiver = new RemotingConnectionEJBReceiver(connection);
        // associate it with the client context
        EJBClientContext context = EJBClientContext.create();
        context.registerEJBReceiver(receiver);
View Full Code Here

TOP

Related Classes of net.noderunner.amazon.s3.Connection

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.