blob: 28faf8567f5aa1199b7b2e430a186eebe4a56eda [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2001, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jst.j2ee.jca.internal.impl;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.jst.j2ee.common.Description;
import org.eclipse.jst.j2ee.common.internal.impl.J2EEEObjectImpl;
import org.eclipse.jst.j2ee.jca.ConfigProperty;
import org.eclipse.jst.j2ee.jca.JcaPackage;
/**
* The config property contains a declaration of a single
* configuration property for a ManagedConnectionFactory instance.
*
* Each ManagedConnectionFactory instance creates connections to a specific EIS instance based on the properties configured on the ManagedConnectionFactory instance. The configurable properties are specified only once in the deployment descriptor, even though a resource adapter can be used to configure multiple ManagedConnnection-Factory instances (that create connections to different instances of the same EIS).
*
* The declaration consists of an optional description, name, type
* and an optional value of the configuration property. If the resource
* adapter provider does not specify a value than the deployer is
* responsible for providing a valid value for a configuration property.
*
* Any bounds or well-defined values of properties should be described in the description.
* @generated
*/
public class ConfigPropertyImpl extends J2EEEObjectImpl implements ConfigProperty {
/**
* The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDescription()
* @generated
* @ordered
*/
protected static final String DESCRIPTION_EDEFAULT = null;
/**
* @generated This field/method will be replaced during code generation.
*/
/**
* @generated This field/method will be replaced during code generation.
*/
protected String description = DESCRIPTION_EDEFAULT;
/**
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = null;
/**
* @generated This field/method will be replaced during code generation.
*/
protected String name = NAME_EDEFAULT;
/**
* The default value of the '{@link #getType() <em>Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getType()
* @generated
* @ordered
*/
protected static final String TYPE_EDEFAULT = null;
/**
* @generated This field/method will be replaced during code generation.
*/
protected String type = TYPE_EDEFAULT;
/**
* The default value of the '{@link #getValue() <em>Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getValue()
* @generated
* @ordered
*/
protected static final String VALUE_EDEFAULT = null;
/**
* @generated This field/method will be replaced during code generation.
*/
protected String value = VALUE_EDEFAULT;
/**
* The cached value of the '{@link #getDescriptions() <em>Descriptions</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDescriptions()
* @generated
* @ordered
*/
protected EList descriptions = null;
protected ConfigPropertyImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EClass eStaticClass() {
return JcaPackage.Literals.CONFIG_PROPERTY;
}
/**
* @generated This field/method will be replaced during code generation
*/
public String getDescription() {
return description;
}
/**
* @generated This field/method will be replaced during code generation.
*/
public void setDescription(String newDescription) {
String oldDescription = description;
description = newDescription;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, JcaPackage.CONFIG_PROPERTY__DESCRIPTION, oldDescription, description));
}
/**
* @generated This field/method will be replaced during code generation
* Contains the name of a configuration property.
*
* The connector architecture defines a set of well-defined properties all of type java.lang.String. These are as follows:
*
* ServerName
* PortNumber
* UserName
* Password
* ConnectionURL
*
* A resource adapter provider can extend this property set to include properties specific to the resource adapter and its underlying EIS.
*/
public String getName() {
return name;
}
/**
* @generated This field/method will be replaced during code generation.
*/
public void setName(String newName) {
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, JcaPackage.CONFIG_PROPERTY__NAME, oldName, name));
}
/**
* @generated This field/method will be replaced during code generation
* Contains the fully qualified Java type of a configuration property as required by ManagedConnection-Factory instance.
*
* The following are the legal values of config-property-type:
* java.lang.Boolean, java.lang.String, java.lang.Integer,
* java.lang.Double, java.lang.Byte, java.lang.Short,
* java.lang.Long, java.lang.Float, java.lang.Character
*/
public String getType() {
return type;
}
/**
* @generated This field/method will be replaced during code generation.
*/
public void setType(String newType) {
String oldType = type;
type = newType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, JcaPackage.CONFIG_PROPERTY__TYPE, oldType, type));
}
/**
* @generated This field/method will be replaced during code generation
* Contains the value of a configuration entry.
*/
public String getValue() {
return value;
}
/**
* @generated This field/method will be replaced during code generation.
*/
public void setValue(String newValue) {
String oldValue = value;
value = newValue;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, JcaPackage.CONFIG_PROPERTY__VALUE, oldValue, value));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList getDescriptions() {
if (descriptions == null) {
descriptions = new EObjectContainmentEList(Description.class, this, JcaPackage.CONFIG_PROPERTY__DESCRIPTIONS);
}
return descriptions;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case JcaPackage.CONFIG_PROPERTY__DESCRIPTIONS:
return ((InternalEList)getDescriptions()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case JcaPackage.CONFIG_PROPERTY__DESCRIPTION:
return getDescription();
case JcaPackage.CONFIG_PROPERTY__NAME:
return getName();
case JcaPackage.CONFIG_PROPERTY__TYPE:
return getType();
case JcaPackage.CONFIG_PROPERTY__VALUE:
return getValue();
case JcaPackage.CONFIG_PROPERTY__DESCRIPTIONS:
return getDescriptions();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case JcaPackage.CONFIG_PROPERTY__DESCRIPTION:
setDescription((String)newValue);
return;
case JcaPackage.CONFIG_PROPERTY__NAME:
setName((String)newValue);
return;
case JcaPackage.CONFIG_PROPERTY__TYPE:
setType((String)newValue);
return;
case JcaPackage.CONFIG_PROPERTY__VALUE:
setValue((String)newValue);
return;
case JcaPackage.CONFIG_PROPERTY__DESCRIPTIONS:
getDescriptions().clear();
getDescriptions().addAll((Collection)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void eUnset(int featureID) {
switch (featureID) {
case JcaPackage.CONFIG_PROPERTY__DESCRIPTION:
setDescription(DESCRIPTION_EDEFAULT);
return;
case JcaPackage.CONFIG_PROPERTY__NAME:
setName(NAME_EDEFAULT);
return;
case JcaPackage.CONFIG_PROPERTY__TYPE:
setType(TYPE_EDEFAULT);
return;
case JcaPackage.CONFIG_PROPERTY__VALUE:
setValue(VALUE_EDEFAULT);
return;
case JcaPackage.CONFIG_PROPERTY__DESCRIPTIONS:
getDescriptions().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean eIsSet(int featureID) {
switch (featureID) {
case JcaPackage.CONFIG_PROPERTY__DESCRIPTION:
return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
case JcaPackage.CONFIG_PROPERTY__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case JcaPackage.CONFIG_PROPERTY__TYPE:
return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type);
case JcaPackage.CONFIG_PROPERTY__VALUE:
return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value);
case JcaPackage.CONFIG_PROPERTY__DESCRIPTIONS:
return descriptions != null && !descriptions.isEmpty();
}
return super.eIsSet(featureID);
}
/**
* @generated This field/method will be replaced during code generation.
*/
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (description: ");
result.append(description);
result.append(", name: ");
result.append(name);
result.append(", type: ");
result.append(type);
result.append(", value: ");
result.append(value);
result.append(')');
return result.toString();
}
}