blob: c4d20971da93376d9940a17afc95ea519536d175 [file] [log] [blame]
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.openejb.jee;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlID;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.util.ArrayList;
import java.util.List;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "jms-destination-factoryType", propOrder = {
"name",
"descriptions",
"className",
"interfaceName",
"resourceAdapter",
"destinationName",
"property"
})
public class JMSDestination implements Keyable<String> {
@XmlTransient
protected TextMap description = new TextMap();
@XmlElement(required = true)
protected String name;
@XmlElement(name = "class-name")
protected String className;
@XmlElement(name = "interface-name")
protected String interfaceName;
@XmlElement(name = "interface-name")
protected String destinationName;
@XmlElement(name = "resource-adapter-name")
protected String resourceAdapter;
protected List<Property> property;
@XmlAttribute
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlID
@XmlSchemaType(name = "ID")
protected String id;
@XmlElement(name = "description")
public Text[] getDescriptions() {
return description.toArray();
}
public JMSDestination property(final String name, final String value) {
getProperty().add(new Property(name, value));
return this;
}
public String getResourceAdapter() {
return resourceAdapter;
}
public void setResourceAdapter(String resourceAdapter) {
this.resourceAdapter = resourceAdapter;
}
public String getDestinationName() {
return destinationName;
}
public void setDestinationName(String destinationName) {
this.destinationName = destinationName;
}
public String getClassName() {
return className;
}
public void setClassName(String className) {
this.className = className;
}
public String getInterfaceName() {
return interfaceName;
}
public void setInterfaceName(String interfaceName) {
this.interfaceName = interfaceName;
}
public List<Property> getProperty() {
if (property == null) {
property = new ArrayList<>();
}
return this.property;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getId() {
return id;
}
public void setId(final String value) {
this.id = value;
}
@Override
public String getKey() {
final String name = getName();
if (name == null || name.startsWith("java:")) return name;
return "java:comp/env/" + name;
}
}