/*
 * Copyright 2011 Red Hat inc. and third party contributors as noted 
 * by the author tags.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.redhat.ceylon.cmr.impl;

import com.redhat.ceylon.cmr.api.Logger;
import com.redhat.ceylon.cmr.spi.ContentStore;
import com.redhat.ceylon.cmr.spi.Node;
import com.redhat.ceylon.cmr.spi.StructureBuilder;

import java.util.HashSet;
import java.util.Set;

/**
 * Abstract content store.
 *
 * @author <a href="mailto:ales.justin@jboss.org">Ales Justin</a>
 */
public abstract class AbstractContentStore implements ContentStore, StructureBuilder {

    private static final String CAR = ".car";
    private static final String JAR = ".jar";
    private static final String SHA1 = ".sha1";
    private static final String ZIP = ".zip";

    protected static final String SEPARATOR = "/";

    protected final Set<String> suffixes = new HashSet<String>();
    protected Logger log;

    protected AbstractContentStore(Logger log) {
        this.log = log;
        addSuffix(CAR);
        addSuffix(JAR);
        addSuffix(ZIP);
        addSuffix(SHA1);
    }

    public void addSuffix(String suffix) {
        suffixes.add(suffix);
    }

    protected static String getFullPath(Node parent, String child) {
        final StringBuilder sb = new StringBuilder(NodeUtils.getFullPath(parent, SEPARATOR));
        if (parent.hasBinaries() == false)
            sb.append(SEPARATOR);
        sb.append(child);
        return sb.toString();
    }

    protected boolean hasContent(String child) {
        for (String suffix : suffixes)
            if (child.endsWith(suffix))
                return true;
        return false;
    }
}

@@ -1246,16 +1246,62 @@
 .sha1%22;%0A
+    private static final String SRC = %22.src%22;%0A
     priv
@@ -1654,16 +1654,40 @@
 (SHA1);%0A
+        addSuffix(SRC);%0A
     %7D%0A%0A 

Add .src to suffixes.