Author: dain
Date: Mon Mar 20 14:43:36 2006
New Revision: 387329
URL: http://svn.apache.org/viewcvs?rev=387329&view=rev
Log:
Added constructor that autogerates the object name
Modified:
geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractName.java
Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractName.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractName.java?rev=387329&r1=387328&r2=387329&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractName.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractName.java
Mon Mar 20 14:43:36 2006
@@ -43,6 +43,25 @@
private final ObjectName objectName;
private final URI uri;
+ public AbstractName(Artifact artifact, Map name) {
+ if (artifact == null) throw new NullPointerException("artifact is null");
+ if (name == null) throw new NullPointerException("name is null");
+ if (name.isEmpty()) throw new IllegalArgumentException("name is empty");
+
+ this.artifact = artifact;
+ this.name = name;
+
+ try {
+ objectName = new ObjectName("geronimo", new Hashtable(name));
+ } catch (MalformedObjectNameException e) {
+ IllegalArgumentException illegalArgumentException = new IllegalArgumentException();
+ illegalArgumentException.initCause(e);
+ throw illegalArgumentException;
+ }
+
+ this.uri = createURI(artifact, name);
+ }
+
public AbstractName(Artifact artifact, Map name, ObjectName objectName) {
if (artifact == null) throw new NullPointerException("artifact is null");
if (name == null) throw new NullPointerException("name is null");
|