The Stockpile is where all your resources are stored apart from food, gold and weapons - hence why you must build it first. Clicking on the Stockpile shows you the amounts of different resources, and you can also buy/sell resources by left clicking the appropriate icon.
Unlike previous games, Stronghold Crusader 2 only allows one stockpile. However, resources are not limited here.
Wood Camps are your main source of wood. They take up much less space than the ones from Stronghold 3, take up only one worker rather than three and because of this keep more settlement space. The woodcutter will find the nearest tree and cut it down. He will then take it to the stockpile.
The quarry is responsible for the stone production. A stone quarry must be placed on the stone texture, and it collects stone, which is delivered to the stockpile using the Ox Tether system. This allows you to build castle walls and towers.
Oxen are used to transfer stone and iron to the stockpile using this building. It goes to the nearest stone wuarry or iron mine and takes the resource to the stockpile.