KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > asset > AssetFactory


1 // Copyright 2005 The Apache Software Foundation
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14

15 package org.apache.tapestry.asset;
16
17 import java.util.Locale JavaDoc;
18
19 import org.apache.hivemind.Location;
20 import org.apache.hivemind.Resource;
21 import org.apache.tapestry.IAsset;
22
23 /**
24  * A service which creates an asset. In some cases, the asset is selected based on the Resource
25  * (typically of the component or page specification).
26  *
27  * @author Howard M. Lewis Ship
28  * @since 4.0
29  */

30 public interface AssetFactory
31 {
32     /**
33      * Creates a new asset.
34      *
35      * @param baseResource
36      * the base resource from which an asset path may be calculated. Each type of asset
37      * is linked to a particular implemenation of {@link Resource}, and generates a
38      * corresponding implementation of {@link org.apache.tapestry.IAsset}.
39      * @param path
40      * the path relative to the resource (if no leading slash), or an absolute path
41      * within the domain of the asset type (i.e, within the classpath, or within the web
42      * application).
43      * @param locale
44      * the desired locale of the asset; the closest match will be used.
45      * @param location
46      * the location to be associated with the returned asset.
47      * @throws org.apache.hivemind.ApplicationRuntimeException
48      * if no matching asset may be found.
49      */

50     public IAsset createAsset(Resource baseResource, String JavaDoc path, Locale JavaDoc locale, Location location);
51
52     /**
53      * Creates a new asset based on a known resource.
54      */

55
56     public IAsset createAsset(Resource resource, Location location);
57 }
Popular Tags