Skip to content
This repository has been archived by the owner on Apr 13, 2024. It is now read-only.

Commit

Permalink
Merge pull request #330 from sohaniwso2/newMaster
Browse files Browse the repository at this point in the history
Add 'preservePolicy' attribute to publish WSDL
  • Loading branch information
sohaniwso2 authored Mar 8, 2018
2 parents 129d186 + 53a573d commit 1e4d38b
Show file tree
Hide file tree
Showing 9 changed files with 198 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ public org.wso2.developerstudio.eclipse.gmf.esb.ProxyService createNode(IGraphic
hasPublishWsdl=false;
}

if("false".equals(object.getPreservePolicy())){
executeSetValueCommand(PROXY_SERVICE__PRESERVE_POLICY, false);
} else {
executeSetValueCommand(PROXY_SERVICE__PRESERVE_POLICY, true);
}

Endpoint targetInLineEndpoint = object.getTargetInLineEndpoint();
if(targetInLineEndpoint!=null){
setHasInlineEndPoint(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2400,3 +2400,4 @@ _UI_APIVersionType_URL_literal = url
_UI_InboundEndpoint_transportJMSRetriesBeforeSuspension_feature = Transport JMS Retries Before Suspension
_UI_InboundEndpoint_transportJMSResetConnectionOnPollingSuspension_feature = Transport JMS Reset Connection On Polling Suspension
_UI_InboundEndpoint_transportJMSPollingSuspensionPeriod_feature = Transport JMS Polling Suspension Period
_UI_ProxyService_preservePolicy_feature = Preserve Policy
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,13 @@ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
break;
}
}
if (proxy.getWsdlType() != ProxyWsdlType.NONE && proxy.getWsdlType() != ProxyWsdlType.ENDPOINT) {
addWsdlResourcesPropertyDescriptor(object);
if (proxy.getWsdlType() != ProxyWsdlType.NONE) {
addPreservePolicyPropertyDescriptor(object);
if (proxy.getWsdlType() != ProxyWsdlType.ENDPOINT) {
addWsdlResourcesPropertyDescriptor(object);
}
}

addInSequenceTypePropertyDescriptor(object);
switch (proxy.getInSequenceType()) {
case REGISTRY_REFERENCE: {
Expand Down Expand Up @@ -451,6 +455,28 @@ protected void addWsdlTypePropertyDescriptor(Object object) {
null));
}

/**
* This adds a property descriptor for the Preserve Policy feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
protected void addPreservePolicyPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_ProxyService_preservePolicy_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_ProxyService_preservePolicy_feature", "_UI_ProxyService_type"),
EsbPackage.Literals.PROXY_SERVICE__PRESERVE_POLICY,
true,
false,
false,
ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
"WSDL",
null));
}

/**
* This adds a property descriptor for the Wsdl XML feature.
* <!-- begin-user-doc -->
Expand Down Expand Up @@ -1037,6 +1063,7 @@ public void notifyChanged(Notification notification) {
case EsbPackage.PROXY_SERVICE__ENDPOINT_NAME:
case EsbPackage.PROXY_SERVICE__MAIN_SEQUENCE:
case EsbPackage.PROXY_SERVICE__WSDL_TYPE:
case EsbPackage.PROXY_SERVICE__PRESERVE_POLICY:
case EsbPackage.PROXY_SERVICE__WSDL_XML:
case EsbPackage.PROXY_SERVICE__WSDL_URL:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,12 +408,17 @@ private void transformAsProxy(TransformationInfo info, EsbNode subject) throws T
break;
}

if (visualService.getWsdlType()!=ProxyWsdlType.NONE && visualService.getWsdlType() != ProxyWsdlType.ENDPOINT) {
proxyService.setResourceMap(new ResourceMap());
for (ProxyWSDLResource wsdlResource : visualService.getWsdlResources()) {
proxyService.getResourceMap().addResource(wsdlResource.getLocation(),wsdlResource.getKey().getKeyValue());
if (visualService.getWsdlType() != ProxyWsdlType.NONE) {
setPreservePolicyValue(visualService, proxyService);
if (visualService.getWsdlType() != ProxyWsdlType.ENDPOINT) {
proxyService.setResourceMap(new ResourceMap());
for (ProxyWSDLResource wsdlResource : visualService.getWsdlResources()) {
proxyService.getResourceMap().addResource(wsdlResource.getLocation(),
wsdlResource.getKey().getKeyValue());
}
}
}

String pinnedServerInfo = visualService.getPinnedServers();
if (pinnedServerInfo != null && !pinnedServerInfo.equals("")) {
for (String a : pinnedServerInfo.split(",")) {
Expand Down Expand Up @@ -556,6 +561,23 @@ private void transformAsProxy(TransformationInfo info, EsbNode subject) throws T
}
}

/**
* This sets the preserve policy value
*
* @param visualService
* gmf model proxy service object
* @param proxyService
* synapse proxy service object
*/
private void setPreservePolicyValue(org.wso2.developerstudio.eclipse.gmf.esb.ProxyService visualService,
ProxyService proxyService) {
if (visualService.isPreservePolicy()) {
proxyService.setPreservePolicy("true");
} else {
proxyService.setPreservePolicy("false");
}
}

private void transformAsMainSequence(TransformationInfo info, EsbNode subject) throws TransformerException{
// Check subject.
Assert.isTrue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@
<eStructuralFeatures xsi:type="ecore:EAttribute" name="mainSequence" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="wsdlType" eType="#//ProxyWsdlType"
defaultValueLiteral="NONE"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="preservePolicy" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
defaultValueLiteral="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="wsdlXML" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
defaultValueLiteral="&lt;definitions/>"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="wsdlURL" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1113,14 +1113,23 @@ public interface EsbPackage extends EPackage {
*/
int PROXY_SERVICE__WSDL_TYPE = ESB_ELEMENT_FEATURE_COUNT + 33;

/**
* The feature id for the '<em><b>Preserve Policy</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int PROXY_SERVICE__PRESERVE_POLICY = ESB_ELEMENT_FEATURE_COUNT + 34;

/**
* The feature id for the '<em><b>Wsdl XML</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int PROXY_SERVICE__WSDL_XML = ESB_ELEMENT_FEATURE_COUNT + 34;
int PROXY_SERVICE__WSDL_XML = ESB_ELEMENT_FEATURE_COUNT + 35;

/**
* The feature id for the '<em><b>Wsdl URL</b></em>' attribute.
Expand All @@ -1129,7 +1138,7 @@ public interface EsbPackage extends EPackage {
* @generated
* @ordered
*/
int PROXY_SERVICE__WSDL_URL = ESB_ELEMENT_FEATURE_COUNT + 35;
int PROXY_SERVICE__WSDL_URL = ESB_ELEMENT_FEATURE_COUNT + 36;

/**
* The feature id for the '<em><b>Wsdl Key</b></em>' containment reference.
Expand All @@ -1138,7 +1147,7 @@ public interface EsbPackage extends EPackage {
* @generated
* @ordered
*/
int PROXY_SERVICE__WSDL_KEY = ESB_ELEMENT_FEATURE_COUNT + 36;
int PROXY_SERVICE__WSDL_KEY = ESB_ELEMENT_FEATURE_COUNT + 37;

/**
* The feature id for the '<em><b>Wsdl Endpoint</b></em>' containment reference.
Expand All @@ -1147,7 +1156,7 @@ public interface EsbPackage extends EPackage {
* @generated
* @ordered
*/
int PROXY_SERVICE__WSDL_ENDPOINT = ESB_ELEMENT_FEATURE_COUNT + 37;
int PROXY_SERVICE__WSDL_ENDPOINT = ESB_ELEMENT_FEATURE_COUNT + 38;

/**
* The feature id for the '<em><b>Wsdl Resources</b></em>' containment reference list.
Expand All @@ -1156,7 +1165,7 @@ public interface EsbPackage extends EPackage {
* @generated
* @ordered
*/
int PROXY_SERVICE__WSDL_RESOURCES = ESB_ELEMENT_FEATURE_COUNT + 38;
int PROXY_SERVICE__WSDL_RESOURCES = ESB_ELEMENT_FEATURE_COUNT + 39;

/**
* The feature id for the '<em><b>On Error</b></em>' containment reference.
Expand All @@ -1165,7 +1174,7 @@ public interface EsbPackage extends EPackage {
* @generated
* @ordered
*/
int PROXY_SERVICE__ON_ERROR = ESB_ELEMENT_FEATURE_COUNT + 39;
int PROXY_SERVICE__ON_ERROR = ESB_ELEMENT_FEATURE_COUNT + 40;

/**
* The number of structural features of the '<em>Proxy Service</em>' class.
Expand All @@ -1174,7 +1183,7 @@ public interface EsbPackage extends EPackage {
* @generated
* @ordered
*/
int PROXY_SERVICE_FEATURE_COUNT = ESB_ELEMENT_FEATURE_COUNT + 40;
int PROXY_SERVICE_FEATURE_COUNT = ESB_ELEMENT_FEATURE_COUNT + 41;

/**
* The meta object id for the '{@link org.wso2.developerstudio.eclipse.gmf.esb.impl.ProxyOutputConnectorImpl <em>Proxy Output Connector</em>}' class.
Expand Down Expand Up @@ -27491,6 +27500,17 @@ public interface EsbPackage extends EPackage {
*/
EAttribute getProxyService_WsdlType();

/**
* Returns the meta object for the attribute '{@link org.wso2.developerstudio.eclipse.gmf.esb.ProxyService#isPreservePolicy <em>Preserve Policy</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Preserve Policy</em>'.
* @see org.wso2.developerstudio.eclipse.gmf.esb.ProxyService#isPreservePolicy()
* @see #getProxyService()
* @generated
*/
EAttribute getProxyService_PreservePolicy();

/**
* Returns the meta object for the attribute '{@link org.wso2.developerstudio.eclipse.gmf.esb.ProxyService#getWsdlXML <em>Wsdl XML</em>}'.
* <!-- begin-user-doc -->
Expand Down Expand Up @@ -45079,6 +45099,14 @@ interface Literals {
*/
EAttribute PROXY_SERVICE__WSDL_TYPE = eINSTANCE.getProxyService_WsdlType();

/**
* The meta object literal for the '<em><b>Preserve Policy</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute PROXY_SERVICE__PRESERVE_POLICY = eINSTANCE.getProxyService_PreservePolicy();

/**
* The meta object literal for the '<em><b>Wsdl XML</b></em>' attribute feature.
* <!-- begin-user-doc -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.ProxyService#getEndpointName <em>Endpoint Name</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.ProxyService#isMainSequence <em>Main Sequence</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.ProxyService#getWsdlType <em>Wsdl Type</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.ProxyService#isPreservePolicy <em>Preserve Policy</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.ProxyService#getWsdlXML <em>Wsdl XML</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.ProxyService#getWsdlURL <em>Wsdl URL</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.ProxyService#getWsdlKey <em>Wsdl Key</em>}</li>
Expand Down Expand Up @@ -939,6 +940,33 @@ public interface ProxyService extends EsbElement {
*/
void setWsdlType(ProxyWsdlType value);

/**
* Returns the value of the '<em><b>Preserve Policy</b></em>' attribute.
* The default value is <code>"true"</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Preserve Policy</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Preserve Policy</em>' attribute.
* @see #setPreservePolicy(boolean)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getProxyService_PreservePolicy()
* @model default="true"
* @generated
*/
boolean isPreservePolicy();

/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.ProxyService#isPreservePolicy <em>Preserve Policy</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Preserve Policy</em>' attribute.
* @see #isPreservePolicy()
* @generated
*/
void setPreservePolicy(boolean value);

/**
* Returns the value of the '<em><b>Wsdl XML</b></em>' attribute.
* The default value is <code>"<definitions/>"</code>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4809,7 +4809,7 @@ public EAttribute getProxyService_WsdlType() {
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getProxyService_WsdlXML() {
public EAttribute getProxyService_PreservePolicy() {
return (EAttribute)proxyServiceEClass.getEStructuralFeatures().get(34);
}

Expand All @@ -4818,17 +4818,26 @@ public EAttribute getProxyService_WsdlXML() {
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getProxyService_WsdlURL() {
public EAttribute getProxyService_WsdlXML() {
return (EAttribute)proxyServiceEClass.getEStructuralFeatures().get(35);
}

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getProxyService_WsdlURL() {
return (EAttribute)proxyServiceEClass.getEStructuralFeatures().get(36);
}

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getProxyService_WsdlKey() {
return (EReference)proxyServiceEClass.getEStructuralFeatures().get(36);
return (EReference)proxyServiceEClass.getEStructuralFeatures().get(37);
}

/**
Expand All @@ -4837,7 +4846,7 @@ public EReference getProxyService_WsdlKey() {
* @generated
*/
public EReference getProxyService_WsdlEndpoint() {
return (EReference)proxyServiceEClass.getEStructuralFeatures().get(37);
return (EReference)proxyServiceEClass.getEStructuralFeatures().get(38);
}

/**
Expand All @@ -4846,7 +4855,7 @@ public EReference getProxyService_WsdlEndpoint() {
* @generated
*/
public EReference getProxyService_WsdlResources() {
return (EReference)proxyServiceEClass.getEStructuralFeatures().get(38);
return (EReference)proxyServiceEClass.getEStructuralFeatures().get(39);
}

/**
Expand All @@ -4855,7 +4864,7 @@ public EReference getProxyService_WsdlResources() {
* @generated
*/
public EReference getProxyService_OnError() {
return (EReference)proxyServiceEClass.getEStructuralFeatures().get(39);
return (EReference)proxyServiceEClass.getEStructuralFeatures().get(40);
}

/**
Expand Down Expand Up @@ -19108,6 +19117,7 @@ public void createPackageContents() {
createEAttribute(proxyServiceEClass, PROXY_SERVICE__ENDPOINT_NAME);
createEAttribute(proxyServiceEClass, PROXY_SERVICE__MAIN_SEQUENCE);
createEAttribute(proxyServiceEClass, PROXY_SERVICE__WSDL_TYPE);
createEAttribute(proxyServiceEClass, PROXY_SERVICE__PRESERVE_POLICY);
createEAttribute(proxyServiceEClass, PROXY_SERVICE__WSDL_XML);
createEAttribute(proxyServiceEClass, PROXY_SERVICE__WSDL_URL);
createEReference(proxyServiceEClass, PROXY_SERVICE__WSDL_KEY);
Expand Down Expand Up @@ -21511,6 +21521,7 @@ public void initializePackageContents() {
initEAttribute(getProxyService_EndpointName(), ecorePackage.getEString(), "endpointName", null, 0, 1, ProxyService.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getProxyService_MainSequence(), ecorePackage.getEBoolean(), "mainSequence", null, 0, 1, ProxyService.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getProxyService_WsdlType(), this.getProxyWsdlType(), "wsdlType", "NONE", 0, 1, ProxyService.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getProxyService_PreservePolicy(), ecorePackage.getEBoolean(), "preservePolicy", "true", 0, 1, ProxyService.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getProxyService_WsdlXML(), ecorePackage.getEString(), "wsdlXML", "<definitions/>", 0, 1, ProxyService.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getProxyService_WsdlURL(), ecorePackage.getEString(), "wsdlURL", "http://default/wsdl/url", 0, 1, ProxyService.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getProxyService_WsdlKey(), this.getRegistryKeyProperty(), null, "wsdlKey", null, 0, 1, ProxyService.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
Expand Down
Loading

0 comments on commit 1e4d38b

Please sign in to comment.