Package org.apache.sling.commons.osgi

Examples of org.apache.sling.commons.osgi.ManifestHeader$Entry


  }

  @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


    }

  }

  private Entry entry(HttpServletRequest req) {
    return new Entry(key(uri(req)));
  }
View Full Code Here

        log("doGet " + uri);
    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);
View Full Code Here

    if (maxKeysStr != null)
      maxKeys = Integer.parseInt(maxKeysStr);
    Writer w = new Writer();
    SortedMap<Entry, S3Object> submap = new TreeMap<Entry, S3Object>(map);
    if (prefix != null)
      submap = submap.tailMap(new Entry(prefix));
    int keyCount = 0;
    boolean truncated = false;
    String nextMarker = null;
    for (Entry e : submap.keySet()) {
      if (++keyCount > maxKeys) {
View Full Code Here

    log("doPut " + uri);
    if ("/".equals(uri.getPath())) {
      log("create bucket");
      bucket = true;
    } else {
      Entry e = new Entry(key(uri));
      e.setLastModified(new Date());
      e.setSize(req.getContentLength());
      e.setOwner(new Owner("id", "name"));
      ByteArrayOutputStream os = new ByteArrayOutputStream();
      ServletInputStream is = req.getInputStream();
      byte b[] = new byte[128];
      while (true) {
        int len = is.read(b);
View Full Code Here

     */
    public BundleResourceProvider(Bundle bundle, String rootList) {
        this.bundle = new BundleResourceCache(bundle);
        List<MappedPath> prefixList = new ArrayList<MappedPath>();

        final ManifestHeader header = ManifestHeader.parse(rootList);
        for (final ManifestHeader.Entry entry : header.getEntries()) {
            final String resourceRoot = entry.getValue();
            final String pathDirective = entry.getDirectiveValue("path");
            if (pathDirective != null) {
                prefixList.add(new MappedPath(resourceRoot, pathDirective));
            } else {
View Full Code Here

     * @throws MojoExecutionException
     */
    protected void configure(String targetURL, File file)
    throws MojoExecutionException {
        // first, let's get the manifest and see if initial content is configured
        ManifestHeader header = null;
        try {
            final Manifest mf = this.getManifest(file);
            final String value = mf.getMainAttributes().getValue(HEADER_INITIAL_CONTENT);
            if ( value == null ) {
                getLog().debug("Bundle has no initial content - no file system provider config created.");
                return;
            }
            header = ManifestHeader.parse(value);
            if ( header == null || header.getEntries().length == 0 ) {
                getLog().warn("Unable to parse header or header is empty: " + value);
                return;
            }
        } catch (IOException ioe) {
            throw new MojoExecutionException("Unable to read manifest from file " + file, ioe);
        }
        // setup http client
        final HttpClient client = getHttpClient();

        getLog().info("Trying to configure file system provider...");
        // quick check if resources are configured
        final List resources = project.getResources();
        if ( resources == null || resources.size() == 0 ) {
            throw new MojoExecutionException("No resources configured for this project.");
        }
        // now get current configurations
        final Map oldConfigs = this.getCurrentFileProviderConfigs(targetURL, client);

        final Entry[] entries = header.getEntries();
        for(final Entry entry : entries) {
            String path = entry.getValue();
            if ( path != null && !path.endsWith("/") ) {
                path += "/";
            }
View Full Code Here

        if ( bundleLastModifiedStamp != null ) {
            bundleLastModified = Math.min(bundleLastModified, Long.parseLong(bundleLastModifiedStamp));
        }
        final String root = (String) bundle.getHeaders().get(CONTENT_HEADER);
        if (root != null) {
            final ManifestHeader header = ManifestHeader.parse(root);
            for (final ManifestHeader.Entry entry : header.getEntries()) {
               
                entries.add(new PathEntry(entry, bundleLastModified ));
            }
        }
View Full Code Here

    }

    private static Set<String> parseHeader(String header)
    {
        Set<String> values = new HashSet<String>();
        ManifestHeader mh = ManifestHeader.parse(header);
        for(ManifestHeader.Entry e : mh.getEntries())
        {
            values.add(e.getValue());
        }
        return values;
    }
View Full Code Here

    public static Iterator<PathEntry> getContentPaths(final Bundle bundle) {
        final List<PathEntry> entries = new ArrayList<PathEntry>();

        final String root = (String) bundle.getHeaders().get(CONTENT_HEADER);
        if (root != null) {
            final ManifestHeader header = ManifestHeader.parse(root);
            for (final ManifestHeader.Entry entry : header.getEntries()) {
                entries.add(new PathEntry(entry));
            }
        }

        if (entries.size() == 0) {
View Full Code Here

TOP

Related Classes of org.apache.sling.commons.osgi.ManifestHeader$Entry

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.