KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > apt > core > internal > VarJarFactoryContainer


1 /*******************************************************************************
2  * Copyright (c) 2005, 2007 BEA Systems, Inc.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * wharley@bea.com - initial API and implementation
10  *******************************************************************************/

11
12 package org.eclipse.jdt.apt.core.internal;
13
14 import java.io.File JavaDoc;
15
16 import org.eclipse.core.runtime.IPath;
17 import org.eclipse.core.runtime.IStatus;
18 import org.eclipse.jdt.core.JavaCore;
19
20 /**
21  * Annotation processor factory container based on a jar file
22  * outside of the workspace, referenced by a classpath variable.
23  */

24 public class VarJarFactoryContainer extends JarFactoryContainer {
25     
26     private final String JavaDoc _id;
27     private final File JavaDoc _jarFile;
28
29     /**
30      * @param jarPath
31      */

32     public VarJarFactoryContainer(IPath jarPath) {
33         _id = jarPath.toString();
34         IPath resolved = JavaCore.getResolvedVariablePath(jarPath);
35         if (null != resolved) {
36             _jarFile = resolved.toFile();
37         }
38         else {
39             _jarFile = null;
40             IStatus s = AptPlugin.createWarningStatus(
41                 null, "The factorypath entry " + _id + " could not be resolved"); //$NON-NLS-1$ //$NON-NLS-2$
42
AptPlugin.log(s);
43         }
44     }
45
46     @Override JavaDoc
47     public FactoryType getType() {
48         return FactoryType.VARJAR;
49     }
50
51     /* (non-Javadoc)
52      * @see org.eclipse.jdt.apt.core.internal.JarFactoryContainer#getJarFile()
53      */

54     @Override JavaDoc
55     public File JavaDoc getJarFile() {
56         return _jarFile;
57     }
58
59     /* (non-Javadoc)
60      * @see org.eclipse.jdt.apt.core.FactoryContainer#getId()
61      */

62     @Override JavaDoc
63     public String JavaDoc getId() {
64         return _id;
65     }
66 }
67
Popular Tags