001// Copyright 2004, 2005 The Apache Software Foundation
002//
003// Licensed under the Apache License, Version 2.0 (the "License");
004// you may not use this file except in compliance with the License.
005// You may obtain a copy of the License at
006//
007//     http://www.apache.org/licenses/LICENSE-2.0
008//
009// Unless required by applicable law or agreed to in writing, software
010// distributed under the License is distributed on an "AS IS" BASIS,
011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012// See the License for the specific language governing permissions and
013// limitations under the License.
014
015package org.apache.tapestry.asset;
016
017import org.apache.hivemind.Location;
018import org.apache.hivemind.Resource;
019import org.apache.hivemind.util.ToStringBuilder;
020import org.apache.tapestry.IAsset;
021
022/**
023 *  Base class for {@link org.apache.tapestry.IAsset} implementations.  Provides
024 *  the location property.
025 *
026 *  @author Howard Lewis Ship
027 *  @since 3.0
028 *
029 **/
030
031public abstract class AbstractAsset implements IAsset
032{
033        private Resource _resourceLocation;
034    private Location _location;
035
036    protected AbstractAsset(Resource resourceLocation, Location location)
037    {
038        _resourceLocation = resourceLocation;
039        _location = location;
040    }
041
042    public Location getLocation()
043    {
044        return _location;
045    }
046    
047    public Resource getResourceLocation()
048    {
049        return _resourceLocation;
050    }
051    
052    public String toString()
053    {
054        ToStringBuilder builder = new ToStringBuilder(this);
055        
056        builder.append("resourceLocation", _resourceLocation);
057        builder.append("location", _location);
058        
059        return builder.toString();
060    }
061}