[Yanel-commits] rev 44377 - in public/yanel/trunk/src/build:
java/org/wyona/yanel/ant targets
michi at wyona.com
michi at wyona.com
Tue Aug 25 14:03:36 CEST 2009
Author: michi
Date: 2009-08-25 14:03:36 +0200 (Tue, 25 Aug 2009)
New Revision: 44377
Modified:
public/yanel/trunk/src/build/java/org/wyona/yanel/ant/MergeResourceTypesConfigsTask.java
public/yanel/trunk/src/build/targets/resources.xml
Log:
check if binary release and if so and no package or copy-dir-name specified, then set package name automatically
Modified: public/yanel/trunk/src/build/java/org/wyona/yanel/ant/MergeResourceTypesConfigsTask.java
===================================================================
--- public/yanel/trunk/src/build/java/org/wyona/yanel/ant/MergeResourceTypesConfigsTask.java 2009-08-25 12:02:30 UTC (rev 44376)
+++ public/yanel/trunk/src/build/java/org/wyona/yanel/ant/MergeResourceTypesConfigsTask.java 2009-08-25 12:03:36 UTC (rev 44377)
@@ -9,6 +9,7 @@
import java.io.File;
+import org.wyona.yanel.core.ResourceTypeDefinition;
import org.wyona.yanel.core.map.Realm;
import org.wyona.yanel.core.map.RealmContextConfig;
import org.wyona.yanel.core.map.RealmManagerConfig;
@@ -29,6 +30,7 @@
private Path realmsConfigFile;
private Path globalResourceTypesConfigFile;
+ private boolean isBinaryRelease;
/**
*
@@ -60,20 +62,27 @@
}
/**
- *
+ * Ant file task attribute realmsconfigfile
*/
public void setRealmsConfigFile(Path realmsConfigFile) {
this.realmsConfigFile = realmsConfigFile;
}
/**
- *
+ * Ant file task attribute globalresourcetypesconfigfile
*/
public void setGlobalResourceTypesConfigFile(Path globalResourceTypesConfigFile) {
this.globalResourceTypesConfigFile = globalResourceTypesConfigFile;
}
/**
+ * Ant file task attribute isbinaryrelease
+ */
+ public void setIsBinaryRelease(boolean isBinaryRelease) {
+ this.isBinaryRelease = isBinaryRelease;
+ }
+
+ /**
*
*/
private void mergeResourceTypesOfRealm(File unresolvedRealmConfig, File globalResourceTypesConfig) {
@@ -125,7 +134,17 @@
String copyDirNameAttr = resourceTypeElements[i].getAttribute("copy-dir-name");
if (copyDirNameAttr != null && !copyDirNameAttr.equals("")) {
rtElement.setAttribute("copy-dir-name", copyDirNameAttr);
+ log("WARN: copy-dir-name attribute is deprecated (Resource '" + srcAttr + "')!");
+ log.warn("copy-dir-name attribute is deprecated!");
}
+ if (isBinaryRelease) {
+ //log("DEBUG: This is a binary release! (Resource: " + srcAttr + ")");
+ //log.warn("DEBUG: This is a binary release!");
+ if (copyDirNameAttr.equals("") && packageAttr.equals("")) {
+ log("INFO: Insert the package name of the resource '" + srcAttr + "' automatically.");
+ rtElement.setAttribute("package", getJavaPackageOfResourceType(srcAttr));
+ }
+ }
rootElement.appendChild(rtElement);
}
}
@@ -148,4 +167,13 @@
if (elements.length > 0) return true;
return false;
}
+
+ /**
+ * @param resourceHomePath Source directory of resource type
+ */
+ private String getJavaPackageOfResourceType(String resourceHomePath) throws Exception {
+ String classname = new ResourceTypeDefinition(new File(resourceHomePath, "resource.xml")).getResourceTypeClassname();
+ //return Class.forName(classname).getPackage().getName(); // NOTE: This doesn't work, because java classloader check
+ return classname.substring(0, classname.lastIndexOf(".")); // NOTE: This doesn't work in the case of ...
+ }
}
Modified: public/yanel/trunk/src/build/targets/resources.xml
===================================================================
--- public/yanel/trunk/src/build/targets/resources.xml 2009-08-25 12:02:30 UTC (rev 44376)
+++ public/yanel/trunk/src/build/targets/resources.xml 2009-08-25 12:03:36 UTC (rev 44377)
@@ -38,7 +38,7 @@
<antcall target="prepare-realms-config"/>
<antcall target="prepare-global-resource-types-config"/>
- <merge-resource-types-configs realmsconfigfile="${classes.dir}/realms.xml" globalresourcetypesconfigfile="${classes.dir}/resource-types.xml"/>
+ <merge-resource-types-configs realmsconfigfile="${classes.dir}/realms.xml" globalresourcetypesconfigfile="${classes.dir}/resource-types.xml" isbinaryrelease="${copy.resource-type-configs.to.webapp}"/>
<antcall target="generate-resources-build-file"/>
</target>
More information about the Yanel-commits
mailing list