You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2007/08/18 02:48:49 UTC
svn commit: r567194 - in /geronimo/server/trunk:
applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/databasemanager/wizard/
configs/webconsole-jetty6/src/plan/ configs/webconsole-tomcat/src/plan/
modules/geronimo-k...
Author: djencks
Date: Fri Aug 17 17:48:48 2007
New Revision: 567194
URL: http://svn.apache.org/viewvc?view=rev&rev=567194
Log:
GERONIMO-3422 provide per-db filtering of artifacts in db pool wizard.
Modified:
geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/databasemanager/wizard/DatabaseDriver.java
geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/databasemanager/wizard/DatabaseDriverGBean.java
geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java
geronimo/server/trunk/configs/webconsole-jetty6/src/plan/plan.xml
geronimo/server/trunk/configs/webconsole-tomcat/src/plan/plan.xml
geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/Artifact.java
geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/resolver/ExplicitDefaultArtifactResolver.java
Modified: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/databasemanager/wizard/DatabaseDriver.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/databasemanager/wizard/DatabaseDriver.java?view=diff&rev=567194&r1=567193&r2=567194
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/databasemanager/wizard/DatabaseDriver.java (original)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/databasemanager/wizard/DatabaseDriver.java Fri Aug 17 17:48:48 2007
@@ -17,6 +17,9 @@
*/
package org.apache.geronimo.console.databasemanager.wizard;
+import java.util.Set;
+import java.util.List;
+
import org.apache.geronimo.kernel.repository.Artifact;
/**
@@ -28,9 +31,10 @@
public interface DatabaseDriver {
String getName();
String getURLPrototype();
- String[] getURLParameters();
+ List<String> getURLParameters();
String getDriverClassName();
int getDefaultPort();
boolean isSpecific();
Artifact getRAR();
+ Set<Artifact> getDependencyFilters();
}
Modified: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/databasemanager/wizard/DatabaseDriverGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/databasemanager/wizard/DatabaseDriverGBean.java?view=diff&rev=567194&r1=567193&r2=567194
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/databasemanager/wizard/DatabaseDriverGBean.java (original)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/databasemanager/wizard/DatabaseDriverGBean.java Fri Aug 17 17:48:48 2007
@@ -25,6 +25,8 @@
import java.util.regex.Matcher;
import java.util.List;
import java.util.ArrayList;
+import java.util.Set;
+import java.util.HashSet;
/**
* Implementation of DatabaseDriver that contains database driver information
@@ -40,6 +42,7 @@
private int defaultPort;
private boolean specific;
private Artifact RAR;
+ private Set<Artifact> dependencyFilters;
public String getName() {
return name;
@@ -85,17 +88,29 @@
return RAR;
}
+ public void setDependencyFilterStrings(List<String> filterStrings) {
+ dependencyFilters = new HashSet<Artifact>();
+ for (String filterString: filterStrings) {
+ Artifact filter = Artifact.createPartial(filterString);
+ dependencyFilters.add(filter);
+ }
+ }
+
+ public Set<Artifact> getDependencyFilters() {
+ return dependencyFilters != null && !dependencyFilters.isEmpty()? dependencyFilters : null;
+ }
+
public void setRARName(String name) {
RAR = Artifact.create(name);
}
- public String[] getURLParameters() {
+ public List<String> getURLParameters() {
Matcher m = PARAM_PATTERN.matcher(URLPrototype);
- List list = new ArrayList();
+ List<String> list = new ArrayList<String>();
while(m.find()) {
list.add(URLPrototype.substring(m.start()+1, m.end()-1));
}
- return (String[]) list.toArray(new String[list.size()]);
+ return list;
}
public static final GBeanInfo GBEAN_INFO;
@@ -108,9 +123,9 @@
infoFactory.addAttribute("defaultPort", int.class, true, true);
infoFactory.addAttribute("specific", boolean.class, true, true);
infoFactory.addAttribute("RARName", String.class, true, true);
+ infoFactory.addAttribute("dependencyFilterStrings", List.class, true, true);
+ infoFactory.addAttribute("dependencyFilters", Set.class, false, false);
infoFactory.addInterface(DatabaseDriver.class);
-
- infoFactory.setConstructor(new String[0]);
GBEAN_INFO = infoFactory.getBeanInfo();
}
Modified: geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java?view=diff&rev=567194&r1=567193&r2=567194
==============================================================================
--- geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java (original)
+++ geronimo/server/trunk/applications/console/geronimo-console-standard/src/main/java/org/apache/geronimo/console/databasemanager/wizard/DatabasePoolPortlet.java Fri Aug 17 17:48:48 2007
@@ -763,7 +763,8 @@
private void renderEdit(RenderRequest renderRequest, RenderResponse renderResponse, PoolData data) throws IOException, PortletException {
if (data.abstractName == null || data.abstractName.equals("")) {
- loadDriverJARList(renderRequest);
+ DatabaseDriver info = getDatabaseInfo(renderRequest, data);
+ loadDriverJARList(renderRequest, info);
}
if (!data.isGeneric()) {
ResourceAdapterParams params = getRARConfiguration(renderRequest, data.getRarPath(),
@@ -803,12 +804,11 @@
}
private void renderBasicParams(RenderRequest renderRequest, RenderResponse renderResponse, PoolData data) throws IOException, PortletException {
- loadDriverJARList(renderRequest);
- // Make sure all properties available for the DB are listed
DatabaseDriver info = getDatabaseInfo(renderRequest, data);
+ loadDriverJARList(renderRequest, info);
+ // Make sure all properties available for the DB are listed
if (info != null) {
- String[] params = info.getURLParameters();
- for (String param : params) {
+ for (String param : info.getURLParameters()) {
final String key = "urlproperty-" + param;
if (!data.getUrlProperties().containsKey(key)) {
data.getUrlProperties().put(key,
@@ -822,14 +822,22 @@
basicParamsView.include(renderRequest, renderResponse);
}
- private void loadDriverJARList(RenderRequest renderRequest) {
+ private void loadDriverJARList(RenderRequest renderRequest, DatabaseDriver info) {
// List the available JARs
List<String> list = new ArrayList<String>();
ListableRepository[] repos = PortletManager.getCurrentServer(renderRequest).getRepositories();
+ Set<Artifact> dependencyFilters = info == null? null : info.getDependencyFilters();
for (ListableRepository repo : repos) {
SortedSet<Artifact> artifacts = repo.list();
for (Artifact artifact : artifacts) {
- if (INCLUDE_ARTIFACTIDS.contains(artifact.getArtifactId())
+ if (dependencyFilters != null) {
+ for (Artifact filter: dependencyFilters) {
+ if (filter.matches(artifact)) {
+ list.add(artifact.toString());
+ }
+ }
+
+ } else if (INCLUDE_ARTIFACTIDS.contains(artifact.getArtifactId())
|| !EXCLUDE_GROUPIDS.contains(artifact.getGroupId())) {
list.add(artifact.toString());
}
@@ -1003,7 +1011,7 @@
}
} else { // it's an XA driver or non-TranQL RA
for (ConfigPropertySetting setting : settings) {
- String value = (String) data.properties.get("property-" + setting.getName());
+ String value = data.properties.get("property-" + setting.getName());
setting.setValue(value == null ? "" : value);
}
}
@@ -1184,7 +1192,7 @@
}
}
- private static String populateURL(String url, String[] keys, Map properties) {
+ private static String populateURL(String url, List<String> keys, Map properties) {
for (String key : keys) {
String value = (String) properties.get("urlproperty-" + key);
if (value == null || value.equals("")) {
@@ -1208,11 +1216,11 @@
// value contains backslash or dollar sign and needs preprocessing for replaceAll to work properly
StringBuffer temp = new StringBuffer();
char[] valueChars = value.toCharArray();
- for (int j = 0; j < valueChars.length; ++j) {
- if (valueChars[j] == '\\' || valueChars[j] == '$') {
+ for (char valueChar : valueChars) {
+ if (valueChar == '\\' || valueChar == '$') {
temp.append('\\');
}
- temp.append(valueChars[j]);
+ temp.append(valueChar);
}
value = temp.toString();
}
@@ -1403,12 +1411,12 @@
if (rarPath != null) response.setRenderParameter("rarPath", rarPath);
for (Map.Entry<String, Object> entry : urlProperties.entrySet()) {
if (entry.getValue() != null) {
- response.setRenderParameter((String) entry.getKey(), (String) entry.getValue());
+ response.setRenderParameter(entry.getKey(), entry.getValue().toString());
}
}
for (Map.Entry<String, String> entry : properties.entrySet()) {
if (entry.getValue() != null) {
- response.setRenderParameter((String) entry.getKey(), (String) entry.getValue());
+ response.setRenderParameter(entry.getKey(), entry.getValue());
}
}
if (deployError != null) response.setRenderParameter("deployError", deployError);
Modified: geronimo/server/trunk/configs/webconsole-jetty6/src/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/configs/webconsole-jetty6/src/plan/plan.xml?view=diff&rev=567194&r1=567193&r2=567194
==============================================================================
--- geronimo/server/trunk/configs/webconsole-jetty6/src/plan/plan.xml (original)
+++ geronimo/server/trunk/configs/webconsole-jetty6/src/plan/plan.xml Fri Aug 17 17:48:48 2007
@@ -149,6 +149,7 @@
<attribute name="defaultPort">0</attribute>
<attribute name="specific">true</attribute>
<attribute name="RARName">org.tranql/tranql-connector-derby-embed-local//rar</attribute>
+ <attribute name="dependencyFilterStrings">org.apache.geronimo.configs/system-database//car</attribute>
</gbean>
<gbean name="Database5" class="org.apache.geronimo.console.databasemanager.wizard.DatabaseDriverGBean">
<attribute name="name">Derby network</attribute>
@@ -157,6 +158,7 @@
<attribute name="defaultPort">0</attribute>
<attribute name="specific">true</attribute>
<attribute name="RARName">org.tranql/tranql-connector-derby-client-local//rar</attribute>
+ <attribute name="dependencyFilterStrings">org.apache.geronimo.configs/system-database//car</attribute>
</gbean>
<gbean name="Database6" class="org.apache.geronimo.console.databasemanager.wizard.DatabaseDriverGBean">
<attribute name="name">Derby embedded XA</attribute>
@@ -165,6 +167,7 @@
<attribute name="defaultPort">0</attribute>
<attribute name="specific">true</attribute>
<attribute name="RARName">org.tranql/tranql-connector-derby-embed-xa//rar</attribute>
+ <attribute name="dependencyFilterStrings">org.apache.geronimo.configs/system-database//car</attribute>
</gbean>
<gbean name="Database7" class="org.apache.geronimo.console.databasemanager.wizard.DatabaseDriverGBean">
<attribute name="name">Derby network XA</attribute>
@@ -173,6 +176,7 @@
<attribute name="defaultPort">0</attribute>
<attribute name="specific">true</attribute>
<attribute name="RARName">org.tranql/tranql-connector-derby-client-xa//rar</attribute>
+ <attribute name="dependencyFilterStrings">org.apache.geronimo.configs/system-database//car</attribute>
</gbean>
<gbean name="Database8" class="org.apache.geronimo.console.databasemanager.wizard.DatabaseDriverGBean">
<attribute name="name">FrontBase</attribute>
@@ -189,6 +193,7 @@
<attribute name="defaultPort">0</attribute>
<attribute name="specific">false</attribute>
<attribute name="RARName">org.tranql/tranql-connector-ra//rar</attribute>
+ <attribute name="dependencyFilterStrings">hsqldb///jar</attribute>
</gbean>
<gbean name="Database10" class="org.apache.geronimo.console.databasemanager.wizard.DatabaseDriverGBean">
<attribute name="name">HSQLDB server</attribute>
@@ -197,6 +202,7 @@
<attribute name="defaultPort">0</attribute>
<attribute name="specific">false</attribute>
<attribute name="RARName">org.tranql/tranql-connector-ra//rar</attribute>
+ <attribute name="dependencyFilterStrings">hsqldb/hsqldb//jar</attribute>
</gbean>
<gbean name="Database11" class="org.apache.geronimo.console.databasemanager.wizard.DatabaseDriverGBean">
<attribute name="name">Informix</attribute>
@@ -245,6 +251,7 @@
<attribute name="defaultPort">0</attribute>
<attribute name="specific">false</attribute>
<attribute name="RARName">org.tranql/tranql-connector-ra//rar</attribute>
+ <attribute name="dependencyFilterStrings">mckoi/mkjdbc//jar</attribute>
</gbean>
<gbean name="Database17" class="org.apache.geronimo.console.databasemanager.wizard.DatabaseDriverGBean">
<attribute name="name">McKoi server</attribute>
@@ -253,6 +260,7 @@
<attribute name="defaultPort">0</attribute>
<attribute name="specific">false</attribute>
<attribute name="RARName">org.tranql/tranql-connector-ra//rar</attribute>
+ <attribute name="dependencyFilterStrings">mckoi/mkjdbc//jar</attribute>
</gbean>
<gbean name="Database18" class="org.apache.geronimo.console.databasemanager.wizard.DatabaseDriverGBean">
<attribute name="name">Mimer</attribute>
@@ -269,6 +277,7 @@
<attribute name="defaultPort">3306</attribute>
<attribute name="specific">false</attribute>
<attribute name="RARName">org.tranql/tranql-connector-ra//rar</attribute>
+ <attribute name="dependencyFilterStrings">mysql/mysql-connector-java//jar</attribute>
</gbean>
<gbean name="Database20" class="org.apache.geronimo.console.databasemanager.wizard.DatabaseDriverGBean">
<attribute name="name">Oracle Thin</attribute>
@@ -317,6 +326,7 @@
<attribute name="defaultPort">5432</attribute>
<attribute name="specific">false</attribute>
<attribute name="RARName">org.tranql/tranql-connector-ra//rar</attribute>
+ <attribute name="dependencyFilterStrings">postgresql/postgresql-7.3//jar,postgresql/postgresql-7.4//jar,postgresql/postgresql-8.0//jar,postgresql/postgresql-8.1//jar</attribute>
</gbean>
<gbean name="Database26" class="org.apache.geronimo.console.databasemanager.wizard.DatabaseDriverGBean">
<attribute name="name">Progress</attribute>
@@ -333,6 +343,7 @@
<attribute name="defaultPort">0</attribute>
<attribute name="specific">false</attribute>
<attribute name="RARName">org.tranql/tranql-connector-ra//rar</attribute>
+ <attribute name="dependencyFilterStrings">maxdb/sapdbc//jar</attribute>
</gbean>
<gbean name="Database28" class="org.apache.geronimo.console.databasemanager.wizard.DatabaseDriverGBean">
<attribute name="name">SQL Server</attribute>
@@ -349,6 +360,7 @@
<attribute name="defaultPort">1433</attribute>
<attribute name="specific">false</attribute>
<attribute name="RARName">org.tranql/tranql-connector-ra//rar</attribute>
+ <attribute name="dependencyFilterStrings">jtds/jtds//jar</attribute>
</gbean>
<gbean name="Database30" class="org.apache.geronimo.console.databasemanager.wizard.DatabaseDriverGBean">
<attribute name="name">SQL Server (DataDirect)</attribute>
Modified: geronimo/server/trunk/configs/webconsole-tomcat/src/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/configs/webconsole-tomcat/src/plan/plan.xml?view=diff&rev=567194&r1=567193&r2=567194
==============================================================================
--- geronimo/server/trunk/configs/webconsole-tomcat/src/plan/plan.xml (original)
+++ geronimo/server/trunk/configs/webconsole-tomcat/src/plan/plan.xml Fri Aug 17 17:48:48 2007
@@ -150,6 +150,7 @@
<attribute name="defaultPort">0</attribute>
<attribute name="specific">true</attribute>
<attribute name="RARName">org.tranql/tranql-connector-derby-embed-local//rar</attribute>
+ <attribute name="dependencyFilterStrings">org.apache.geronimo.configs/system-database//car</attribute>
</gbean>
<gbean name="Database5" class="org.apache.geronimo.console.databasemanager.wizard.DatabaseDriverGBean" xmlns="http://geronimo.apache.org/xml/ns/deployment-${geronimoSchemaVersion}">
<attribute name="name">Derby network</attribute>
@@ -158,6 +159,7 @@
<attribute name="defaultPort">0</attribute>
<attribute name="specific">true</attribute>
<attribute name="RARName">org.tranql/tranql-connector-derby-client-local//rar</attribute>
+ <attribute name="dependencyFilterStrings">org.apache.geronimo.configs/system-database//car</attribute>
</gbean>
<gbean name="Database6" class="org.apache.geronimo.console.databasemanager.wizard.DatabaseDriverGBean" xmlns="http://geronimo.apache.org/xml/ns/deployment-${geronimoSchemaVersion}">
<attribute name="name">Derby embedded XA</attribute>
@@ -166,6 +168,7 @@
<attribute name="defaultPort">0</attribute>
<attribute name="specific">true</attribute>
<attribute name="RARName">org.tranql/tranql-connector-derby-embed-xa//rar</attribute>
+ <attribute name="dependencyFilterStrings">org.apache.geronimo.configs/system-database//car</attribute>
</gbean>
<gbean name="Database7" class="org.apache.geronimo.console.databasemanager.wizard.DatabaseDriverGBean" xmlns="http://geronimo.apache.org/xml/ns/deployment-${geronimoSchemaVersion}">
<attribute name="name">Derby network XA</attribute>
@@ -174,6 +177,7 @@
<attribute name="defaultPort">0</attribute>
<attribute name="specific">true</attribute>
<attribute name="RARName">org.tranql/tranql-connector-derby-client-xa//rar</attribute>
+ <attribute name="dependencyFilterStrings">org.apache.geronimo.configs/system-database//car</attribute>
</gbean>
<gbean name="Database8" class="org.apache.geronimo.console.databasemanager.wizard.DatabaseDriverGBean" xmlns="http://geronimo.apache.org/xml/ns/deployment-${geronimoSchemaVersion}">
<attribute name="name">FrontBase</attribute>
@@ -190,6 +194,7 @@
<attribute name="defaultPort">0</attribute>
<attribute name="specific">false</attribute>
<attribute name="RARName">org.tranql/tranql-connector-ra//rar</attribute>
+ <attribute name="dependencyFilterStrings">hsqldb///jar</attribute>
</gbean>
<gbean name="Database10" class="org.apache.geronimo.console.databasemanager.wizard.DatabaseDriverGBean" xmlns="http://geronimo.apache.org/xml/ns/deployment-${geronimoSchemaVersion}">
<attribute name="name">HSQLDB server</attribute>
@@ -198,6 +203,7 @@
<attribute name="defaultPort">0</attribute>
<attribute name="specific">false</attribute>
<attribute name="RARName">org.tranql/tranql-connector-ra//rar</attribute>
+ <attribute name="dependencyFilterStrings">hsqldb/hsqldb//jar</attribute>
</gbean>
<gbean name="Database11" class="org.apache.geronimo.console.databasemanager.wizard.DatabaseDriverGBean" xmlns="http://geronimo.apache.org/xml/ns/deployment-${geronimoSchemaVersion}">
<attribute name="name">Informix</attribute>
@@ -246,6 +252,7 @@
<attribute name="defaultPort">0</attribute>
<attribute name="specific">false</attribute>
<attribute name="RARName">org.tranql/tranql-connector-ra//rar</attribute>
+ <attribute name="dependencyFilterStrings">mckoi/mkjdbc//jar</attribute>
</gbean>
<gbean name="Database17" class="org.apache.geronimo.console.databasemanager.wizard.DatabaseDriverGBean" xmlns="http://geronimo.apache.org/xml/ns/deployment-${geronimoSchemaVersion}">
<attribute name="name">McKoi server</attribute>
@@ -254,6 +261,7 @@
<attribute name="defaultPort">0</attribute>
<attribute name="specific">false</attribute>
<attribute name="RARName">org.tranql/tranql-connector-ra//rar</attribute>
+ <attribute name="dependencyFilterStrings">mckoi/mkjdbc//jar</attribute>
</gbean>
<gbean name="Database18" class="org.apache.geronimo.console.databasemanager.wizard.DatabaseDriverGBean" xmlns="http://geronimo.apache.org/xml/ns/deployment-${geronimoSchemaVersion}">
<attribute name="name">Mimer</attribute>
@@ -270,6 +278,7 @@
<attribute name="defaultPort">3306</attribute>
<attribute name="specific">false</attribute>
<attribute name="RARName">org.tranql/tranql-connector-ra//rar</attribute>
+ <attribute name="dependencyFilterStrings">mysql/mysql-connector-java//jar</attribute>
</gbean>
<gbean name="Database20" class="org.apache.geronimo.console.databasemanager.wizard.DatabaseDriverGBean" xmlns="http://geronimo.apache.org/xml/ns/deployment-${geronimoSchemaVersion}">
<attribute name="name">Oracle Thin</attribute>
@@ -318,6 +327,7 @@
<attribute name="defaultPort">5432</attribute>
<attribute name="specific">false</attribute>
<attribute name="RARName">org.tranql/tranql-connector-ra//rar</attribute>
+ <attribute name="dependencyFilterStrings">postgresql/postgresql-7.3//jar,postgresql/postgresql-7.4//jar,postgresql/postgresql-8.0//jar,postgresql/postgresql-8.1//jar</attribute>
</gbean>
<gbean name="Database26" class="org.apache.geronimo.console.databasemanager.wizard.DatabaseDriverGBean" xmlns="http://geronimo.apache.org/xml/ns/deployment-${geronimoSchemaVersion}">
<attribute name="name">Progress</attribute>
@@ -334,6 +344,7 @@
<attribute name="defaultPort">0</attribute>
<attribute name="specific">false</attribute>
<attribute name="RARName">org.tranql/tranql-connector-ra//rar</attribute>
+ <attribute name="dependencyFilterStrings">maxdb/sapdbc//jar</attribute>
</gbean>
<gbean name="Database28" class="org.apache.geronimo.console.databasemanager.wizard.DatabaseDriverGBean" xmlns="http://geronimo.apache.org/xml/ns/deployment-${geronimoSchemaVersion}">
<attribute name="name">SQL Server</attribute>
@@ -350,6 +361,7 @@
<attribute name="defaultPort">1433</attribute>
<attribute name="specific">false</attribute>
<attribute name="RARName">org.tranql/tranql-connector-ra//rar</attribute>
+ <attribute name="dependencyFilterStrings">jtds/jtds//jar</attribute>
</gbean>
<gbean name="Database30" class="org.apache.geronimo.console.databasemanager.wizard.DatabaseDriverGBean" xmlns="http://geronimo.apache.org/xml/ns/deployment-${geronimoSchemaVersion}">
<attribute name="name">SQL Server (DataDirect)</attribute>
Modified: geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/Artifact.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/Artifact.java?view=diff&rev=567194&r1=567193&r2=567194
==============================================================================
--- geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/Artifact.java (original)
+++ geronimo/server/trunk/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/repository/Artifact.java Fri Aug 17 17:48:48 2007
@@ -32,11 +32,15 @@
private final String type;
public Artifact(String groupId, String artifactId, String version, String type) {
- this(groupId, artifactId, version == null ? null : new Version(version), type);
+ this(groupId, artifactId, version == null ? null : new Version(version), type, true);
}
public Artifact(String groupId, String artifactId, Version version, String type) {
- if (artifactId == null) throw new NullPointerException("artifactId is null: groupId: " + groupId + ", version: " + version + ", type: " + type);
+ this(groupId, artifactId, version, type, true);
+ }
+
+ private Artifact(String groupId, String artifactId, Version version, String type, boolean requireArtifactId) {
+ if (requireArtifactId && artifactId == null) throw new NullPointerException("artifactId is null: groupId: " + groupId + ", version: " + version + ", type: " + type);
this.groupId = groupId;
this.artifactId = artifactId;
this.version = version;
@@ -44,6 +48,14 @@
}
public static Artifact create(String id) {
+ return create(id, true);
+ }
+
+ public static Artifact createPartial(String id) {
+ return create(id, false);
+ }
+
+ private static Artifact create(String id, boolean requireArtifactId) {
String[] parts = id.split("/", -1);
if (parts.length != 4) {
throw new IllegalArgumentException("Invalid id: " + id);
@@ -53,7 +65,7 @@
parts[i] = null;
}
}
- return new Artifact(parts[0], parts[1], parts[2], parts[3]);
+ return new Artifact(parts[0], parts[1], parts[2] == null ? null : new Version(parts[2]), parts[3], requireArtifactId);
}
public String getGroupId() {
@@ -95,7 +107,7 @@
private static int GREATER = 1;
private static int LESS = -1;
- private static int safeCompare(Comparable left, Comparable right) {
+ private static <T extends Comparable<T>> int safeCompare(T left, T right) {
if (left == null) {
if (right != null) return LESS;
return 0;
@@ -110,7 +122,7 @@
final Artifact artifact = (Artifact) o;
- if (!artifactId.equals(artifact.artifactId)) {
+ if (artifactId != null? !artifactId.equals(artifact.artifactId) : artifact.artifactId != null) {
return false;
}
@@ -129,7 +141,7 @@
public int hashCode() {
int result;
result = (groupId != null ? groupId.hashCode() : 0);
- result = 29 * result + artifactId.hashCode();
+ result = 29 * result + (artifactId != null? artifactId.hashCode() : 0);
result = 29 * result + (version != null ? version.hashCode() : 0);
result = 29 * result + (type != null ? type.hashCode() : 0);
return result;
@@ -143,7 +155,9 @@
}
buffer.append("/");
- buffer.append(artifactId);
+ if (artifactId != null) {
+ buffer.append(artifactId);
+ }
buffer.append("/");
if (version != null) {
Modified: geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/resolver/ExplicitDefaultArtifactResolver.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/resolver/ExplicitDefaultArtifactResolver.java?view=diff&rev=567194&r1=567193&r2=567194
==============================================================================
--- geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/resolver/ExplicitDefaultArtifactResolver.java (original)
+++ geronimo/server/trunk/modules/geronimo-system/src/main/java/org/apache/geronimo/system/resolver/ExplicitDefaultArtifactResolver.java Fri Aug 17 17:48:48 2007
@@ -22,7 +22,6 @@
import java.io.IOException;
import java.util.Collection;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
@@ -42,12 +41,12 @@
public ExplicitDefaultArtifactResolver(String versionMapLocation,
ArtifactManager artifactManager,
- Collection repositories,
+ Collection<? extends ListableRepository> repositories,
ServerInfo serverInfo ) throws IOException {
super(artifactManager, repositories, buildExplicitResolution(versionMapLocation, serverInfo));
}
- private static Map buildExplicitResolution(String versionMapLocation, ServerInfo serverInfo) throws IOException {
+ private static Map<Artifact, Artifact> buildExplicitResolution(String versionMapLocation, ServerInfo serverInfo) throws IOException {
if (versionMapLocation == null) {
return null;
}
@@ -62,20 +61,12 @@
return propertiesToArtifactMap(properties);
}
- private static Map propertiesToArtifactMap(Properties properties) {
+ private static Map<Artifact, Artifact> propertiesToArtifactMap(Properties properties) {
Map<Artifact, Artifact> explicitResolution = new HashMap<Artifact, Artifact>();
for (Map.Entry<Object, Object> entry : properties.entrySet()) {
String key = (String) entry.getKey();
String resolvedString = (String) entry.getValue();
- //split the string ourselves since we wish to allow blank artifactIds.
- String[] parts = key.split("/", -1);
- if (parts.length != 4) {
- throw new IllegalArgumentException("Invalid id: " + key);
- }
- if ("".equals(parts[2])) {
- parts[2] = null;
- }
- Artifact source = new Artifact(parts[0], parts[1], parts[2], parts[3]);
+ Artifact source = Artifact.createPartial(key);
Artifact resolved = Artifact.create(resolvedString);
explicitResolution.put(source, resolved);
}