01: /*
02: * Copyright 2006-2007 Luca Garulli (luca.garulli@assetdata.it)
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.romaframework.aspect.persistence.jdo;
17:
18: import java.io.File;
19: import java.util.ArrayList;
20: import java.util.List;
21:
22: import org.romaframework.core.resource.ResourceResolverListener;
23:
24: /**
25: * JDO Metadata listener to collect all .jdo files to be enhanced later by JDOBasePersistenceAspect.
26: *
27: * @author Luca Garulli (luca.garulli@assetdata.it)
28: */
29: public class JDOMetadataResourceResolver implements
30: ResourceResolverListener {
31:
32: private static final String METADATA_EXT = ".jdo";
33:
34: private List<String> metadatas = new ArrayList<String>();
35:
36: public void addResource(File file, String name,
37: String packagePrefix, String startingPackage) {
38: if (!name.endsWith(METADATA_EXT))
39: return;
40:
41: metadatas.add(packagePrefix + "/" + name);
42: }
43:
44: public String[] getMetadatas() {
45: return metadatas.toArray(new String[metadatas.size()]);
46: }
47: }
|