Update of /cvsroot/xdoclet/xdoclet2/src/java/xdoclet
In directory sc8-pr-cvs1:/tmp/cvs-serv11958/src/java/xdoclet
Modified Files:
Plugin.java
Log Message:
Added a little demo project to get people started
Index: Plugin.java
===================================================================
RCS file: /cvsroot/xdoclet/xdoclet2/src/java/xdoclet/Plugin.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** Plugin.java 16 Mar 2003 23:24:15 -0000 1.11
--- Plugin.java 17 Mar 2003 13:38:56 -0000 1.12
***************
*** 47,52 ****
*/
public abstract class Plugin extends BeanContextSupportEx {
- private final List _dynamicProperties = new ArrayList();
-
/** Extra objects that are not available via the CollectionFactory (xjavadoc). */
private final Map _contextObjects = new HashMap();
--- 47,50 ----
***************
*** 55,59 ****
private String _encoding = "ISO-8859-1";
private String _packageName;
- private List _packageSubstitutions = new ArrayList();
private String _fileName = "";
--- 53,56 ----
***************
*** 145,164 ****
public final Property createProperty() {
Property property = new Property();
!
! _dynamicProperties.add(property);
!
return property;
}
public final PackageSubstitution createPackageSubstitution() {
LogFactory.getLog(Plugin.class).info(this + ".createPackageSubstitution");
-
PackageSubstitution packageSubstitution = new PackageSubstitution();
!
! _packageSubstitutions.add(packageSubstitution);
!
return packageSubstitution;
}
/**
* Generates the content.
--- 142,178 ----
public final Property createProperty() {
Property property = new Property();
! add(property);
return property;
}
+ private Collection getProperties() {
+ return CollectionUtils.select( this, new Predicate() {
+ public boolean evaluate( Object o ) {
+ return o instanceof Property;
+ }
+ });
+ }
+
+ /**
+ * Creates a new PackageSubstitution
+ *
+ * @bean.method shortDescription="Add a new Package Substitution"
+ * displayName="New Package Substitution"
+ */
public final PackageSubstitution createPackageSubstitution() {
LogFactory.getLog(Plugin.class).info(this + ".createPackageSubstitution");
PackageSubstitution packageSubstitution = new PackageSubstitution();
! add(packageSubstitution);
return packageSubstitution;
}
+ private Collection getPackageSubstitutions() {
+ return CollectionUtils.select( this, new Predicate() {
+ public boolean evaluate( Object o ) {
+ return o instanceof PackageSubstitution;
+ }
+ });
+ }
+
/**
* Generates the content.
***************
*** 219,223 ****
throws XDocletException {
if (_packageName != null) {
! if (!_packageSubstitutions.isEmpty()) {
throw new XDocletException("Can't specify both packageSubstitution
and packageName.");
}
--- 233,237 ----
throws XDocletException {
if (_packageName != null) {
! if (!getPackageSubstitutions().isEmpty()) {
throw new XDocletException("Can't specify both packageSubstitution
and packageName.");
}
***************
*** 276,280 ****
private final void setDynamicProperties() {
! for (Iterator i = _dynamicProperties.iterator(); i.hasNext();) {
Property property = (Property) i.next();
--- 290,294 ----
private final void setDynamicProperties() {
! for (Iterator i = getProperties().iterator(); i.hasNext();) {
Property property = (Property) i.next();
***************
*** 288,292 ****
String originalPackageName =
getXDoclet().getMetadataProvider().getPackageName(object);
! for (Iterator i = _packageSubstitutions.iterator(); i.hasNext();) {
PackageSubstitution packageSubstitution = (PackageSubstitution) i.next();
--- 302,306 ----
String originalPackageName =
getXDoclet().getMetadataProvider().getPackageName(object);
! for (Iterator i = getPackageSubstitutions().iterator(); i.hasNext();) {
PackageSubstitution packageSubstitution = (PackageSubstitution) i.next();
***************
*** 402,409 ****
throws XDocletException {
String fileNameSubstitutionValue =
getXDoclet().getMetadataProvider().getFilenameSubstitutionValue(object);
- String fileName = MessageFormat.format(getFileName(), new String[] {
fileNameSubstitutionValue });
String packageName = getSubstitutedPackageName(object);
! return new File(getAndCreateRealDestDir(packageName), fileName);
}
--- 416,434 ----
throws XDocletException {
String fileNameSubstitutionValue =
getXDoclet().getMetadataProvider().getFilenameSubstitutionValue(object);
String packageName = getSubstitutedPackageName(object);
! File destinationDir = null;
! String[] formatArguments = null;
! if( getFileName().indexOf("{1}") != -1 ) {
! formatArguments = new String[] { fileNameSubstitutionValue, packageName
};
! // Don't use package name when finding the destDir. It's in the fileName
! packageName = "";
! } else {
! formatArguments = new String[] { fileNameSubstitutionValue };
! }
! destinationDir = getAndCreateRealDestDir(packageName);
! String fileName = MessageFormat.format(getFileName(), formatArguments);
!
! return new File(destinationDir, fileName);
}
-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open!
Get cracking and register here for some mind boggling fun and
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
_______________________________________________
xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel