사용자 자신의 중개 기본요소를 개발하고 해당 기본요소를 중개 플로우 편집기 팔레트에 제공할 수 있습니다. 그런 다음 통합 개발자는 제공된 중개 기본요소(예: 메시지 필터)를 사용하는 것과 같은 방식으로 이 중개 기본요소를 사용할 수 있습니다.
다음 주제에서는 사용자의 중개 기본요소 개발, 중개 플로우 편집기 팔레트에 기본요소 제공 및 기본요소 배치를 위해 실행해야 하는 조치에 대해 설명합니다. 그런 다음 예제를 사용하여 필요한 단계를 표시하고 참조 문서에 링크를 제공합니다.
참고: 다음 단계는 앞으로의 릴리스에서 변경될 수 있으며 앞으로의 릴리스에 대한 제공을 재사용하는 데 노력이 필요할 수도 있습니다.
중개 메타데이터 생성 보기를 사용하여 중개 기본요소용 중개 메타데이터(.mednode 파일)를 생성하십시오. .mednode 파일에는 mediationPrimitiveHandlers의 런타임 표시가 있으며, 이 파일은 3단계에서 작성하는 Java™ 프로젝트의 루트에 위치해야 합니다.
Java 프로젝트를 작성하고 코드를 기록하여 사용자 중개 기본요소를 구현하십시오.
참고: Getter 및 Setter 메소드 이름은 특성 이름과 일치해야 합니다. 예를 들어, 특성 이름이 값이면 Getter 및 Setter 메소드는 getValue() 및 setValue()로 명명되어야 합니다.
중개 기본요소가 중개 플로우 편집기 팔레트에 표시되도록 플러그인을 배치하십시오.
중개 기본요소를 WebSphere Enterprise Service Bus 또는 WebSphere Process Server 런타임에 배치하려면 다음을 실행하십시오.
참고: .mednode 파일은 서브디렉토리가 아닌, 배치된 JAR의 루트에 있어야 합니다.
플러그인 프로젝트 작성
plugin.xml 편집
플러그인 Manifest 편집기에서 plugin.xml을 열어 확장 페이지로 전환하십시오.
플러그인 프로젝트에 필수 폴더 작성
XML 파일에 특성 추가
CurrencyConverterPropertyGroup.xml에서 해당 새 기본요소의 특성을 설명하여 중개 플로우 편집기에서 특성 보기 상세 페이지의 UI를 유도할 수 있습니다. Java 클래스에는 각 특성에 해당하는 Getter 및 Setter 메소드가 있어야 합니다. 자세한 정보는 특성 XML 파일 및 특성 그룹 스키마 정의 파일을(를) 참조하십시오.
<pg:BasePropertyGroups name="CacheReaderPropertyGroups" resourceBundle="ESBMediationExamples" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pg="http://www.ibm.com/propertygroup/6.0.1"> <propertyGroup name="CurrencyConverterPropertyGroup" xsi:type="pg:BasePropertyGroup" > <!-- currency path using XPathProperty --> <property name="currencyPath" displayName="Currency Path" defaultValue="/body" required="true" propertyType="String" id="com.ibm.propertygroup.ext.ui.XPathProperty" xsi:type="pg:ConstraintSingleValuedProperty"> <description> 입력 통화 값의 XPath 식. </description> </property> <!-- currency rate using Combo box --> <property name="currencyRate" displayName="Currency" required="true" defaultValue="1.0" propertyType="float" xsi:type="pg:ConstraintSingleValuedProperty"> <description> 입력 통화 값을 변환하는 데 사용하는 비율. </description> <validValue value="1.0" displayValue="USD"/> <validValue value="1.15091" displayValue="CAD"/> <validValue value="0.836371" displayValue="EUR"/> <validValue value="119.895" displayValue="JPY"/> <validValue value="8.07560" displayValue="CNY"/> </property> </propertyGroup> </pg:BasePropertyGroups>
메타데이터 생성
작성자 Java 코드
package com.ibm.websphere.esb.mediation.example.logic; import com.ibm.wsspi.sibx.mediation.InputTerminal; import com.ibm.wsspi.sibx.mediation.MediationBusinessException; import com.ibm.wsspi.sibx.mediation.MediationConfigurationException; import com.ibm.wsspi.sibx.mediation.OutputTerminal; import com.ibm.wsspi.sibx.mediation.esb.ESBMediationPrimitive; import commonj.sdo.DataObject; /** * This mediation converts from one currency value to another currency value. */ public class CurrencyConverterMediation extends ESBMediationPrimitive { private static final String OUTPUT_TERMINAL_NAME = "out"; private String currencyPath; private float currencyRate; /** * Default constructor. */ public CurrencyConverterMediation() { super(); } /** * @return Returns the currencyPath. */ public String getCurrencyPath() { return currencyPath; } /** * @param currencyPath * The currencyPath to set. */ public void setCurrencyPath(String currencyPath) { this.currencyPath = currencyPath; } /** * @return Returns the currencyRate. */ public float getCurrencyRate() { return currencyRate; } /** * @param currencyRate * The currencyRate to set. */ public void setCurrencyRate(float currencyRate) { this.currencyRate = currencyRate; } /* * (non-Javadoc) * * @see com.ibm.wsspi.sibx.mediation.Mediation#mediate(com.ibm.wsspi.sibx.mediation.InputTerminal, * commonj.sdo.DataObject) */ public void mediate(InputTerminal inputTerminal, DataObject message) throws MediationConfigurationException, MediationBusinessException { // retrieves the input currency value float inputCurrencyValue = message.getFloat(getCurrencyPath()); // converts to the new currency value float newCurrencyValue = inputCurrencyValue * getCurrencyRate(); // update the new currency value to the message message.setFloat(getCurrencyPath(), newCurrencyValue); // gets the out terminal from the mediation services OutputTerminal outTerminal = getMediationServices().getOutputTerminal( OUTPUT_TERMINAL_NAME); if (outTerminal != null) { // fires the message to the out terminal outTerminal.fire(message); } } }
런타임에 배치
JAR(예: myPrimitives.jar)로 Java 프로젝트를 내보내십시오. 루트 폴더에서 .mednode만을 선택하되, 선택한 Java 클래스는 변경하지 마십시오. JAR를 WAS_HOME/lib/ext에 내보내십시오.
서비스 데이터 오브젝트 API에 대한 정보는 http://download.eclipse.org/tools/emf/sdo/javadoc/을(를) 참조하십시오.
<pg:BasePropertyGroups name="myGroups" resourceBundle="mypacakage.myProperties">
속성 | 설명 |
---|---|
이름 | 특성 그룹 이름. 이 이름은 중개 플로우 편집기에서 표시되지 않습니다. |
resourceBundle | 자원 번들은 문자열 값을 해석하는 데 로드됩니다. 이는 글로벌화를 위해 사용됩니다. |
<propertyGroup name="myGroup" xsi:type="pg:BasePropertyGroup">
속성 | 설명 |
---|---|
이름 | 특성 그룹 이름. 둘 이상의 propertyGroup이 있는 경우, 각 propertyGroup 요소는 세부사항 페이지에서 탭 페이지로 렌더링됩니다. 이름 속성은 탭 페이지의 이름이 됩니다. |
특성 | 속성 | 설명 |
---|---|---|
|
name / displayName | 이름은 특성의 ID입니다. DisplayName은 특성 입력 제어에 우선하는 레이블로 사용됩니다. |
설명 | 도구 팁 텍스트로 표시 | |
propertyType | 값 유형(문자열 / 부울 / float / 정수) 정의 | |
defaultValue | 특성의 기본값 | |
숨겨짐 | 특성이 숨겨져 있는지 또는 표시되는지의 여부를 정의 | |
readOnly | 특성이 읽기 전용인지의 여부를 정의 | |
필수 | 특성에 값이 필요함을 표시 | |
구분 | 값 유형이 문자열이면 이 속성은 해당 문자열이 대소문자 구분인지의 여부를 결정 | |
validValuesEditable | 사용자가 validValues로 정의된 값과 다른 값을 입력할 수 있는지의 여부를 정의 | |
validValues | 올바른 값 목록 | |
패턴 | 값 유형이 문자열이면 편집기는 패턴을 일치시켜 사용자 입력의 유효성을 검증 | |
maxLength | 값 유형이 문자열이면 편집기는 입력할 수 있는 크기를 제한 | |
minValue / maxValue | 값 유형이 정수 또는 float면 편집기는 입력 범위 확인을 실행합니다. | |
validValueGeneratorClass | 올바른 값을 동적으로 생성하는 데 책임이 있는 클래스 위치.. 클래스는 interface com.ibm.propertygroup.ext.api .IValidValuesGenerator를 구현해야 함 |
<property name="filters" displayName="% displayname" xsi:type="pg:TableProperty"> <column name="pattern" required="true" .../> <column name="terminalName" required="true" .../> </property>
<property name="myCustomProperty" class=â€MyCustomImpl†xsi:type="pg:CustomProperty">
<property name="filters" xsi:type="pg:TableProperty"> <qualifier preferredHeight="100" xsi:type="pg:TableLayoutQualifier"> <column name="pattern" preferredWidth="100" xsi:type="pg:TableColumnQualifier"/> <column name="terminalName" preferredWidth="200" xsi:type="pg:TableColumnQualifier"/> </qualifier> ... </property>
<?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:propertygroup="http://www.ibm.com/propertygroup/6.0.1" targetNamespace="http://www.ibm.com/propertygroup/6.0.1"> <element name="propertyGroups" type="propertygroup:BasePropertyGroups"/> <element name="description" type="string"/> <complexType name="PersistentFormatter"> </complexType> <complexType name="StringFormatter"> <complexContent> <extension base="propertygroup:PersistentFormatter"> <attribute name="escapeCharacter" type="token" use="optional"/> </extension> </complexContent> </complexType> <complexType name="StringListFormatter"> <complexContent> <extension base="propertygroup:StringFormatter"> <attribute name="separator" type="token" use="optional"/> </extension> </complexContent> </complexType> <complexType name="StringTableFormatter"> <complexContent> <extension base="propertygroup:StringFormatter"> <attribute name="rowSeparator" type="token" use="optional"/> <attribute name="columnSeparator" type="token" use="optional"/> </extension> </complexContent> </complexType> <complexType name="Qualifier"> </complexType> <complexType name="TableColumnQualifier"> <complexContent> <extension base="propertygroup:Qualifier"> <attribute name="name" type="token" use="required"/> <attribute name="preferredWidth" type="token" use="required"/> </extension> </complexContent> </complexType> <complexType name="TableLayoutQualifier"> <complexContent> <extension base="propertygroup:Qualifier"> <choice> <element maxOccurs="unbounded" minOccurs="0" name="column" type="propertygroup:TableColumnQualifier"/> </choice> <attribute name="preferredHeight" type="token" use="required"/> </extension> </complexContent> </complexType> <complexType name="PropertyClassificationQualifier"> <complexContent> <extension base="propertygroup:Qualifier"> <attribute name="name" type="token" use="required"/> </extension> </complexContent> </complexType> <complexType name="PropertyDescriptor"> <choice> <element ref="propertygroup:description" minOccurs="0"/> <element name="persistentFormatter" type="propertygroup:PersistentFormatter" minOccurs="0"/> <element maxOccurs="unbounded" minOccurs="0" name="qualifier" type="propertygroup:Qualifier"/> </choice> <attribute name="id" type="token" use="optional"/> <attribute name="name" type="token" use="required"/> <attribute name="displayName" type="token" use="optional"/> </complexType> <complexType name="BasePropertyDescriptor"> <complexContent> <extension base="propertygroup:PropertyDescriptor"> </extension> </complexContent> </complexType> <complexType name="BaseProperty"> <complexContent> <extension base="propertygroup:BasePropertyDescriptor"> <attribute name="validationMessage" type="token" use="optional"/> </extension> </complexContent> </complexType> <complexType name="BaseNodeProperty"> <complexContent> <extension base="propertygroup:BaseProperty"> <sequence> <element maxOccurs="0" minOccurs="0" name="children" type="propertygroup:BaseNodeProperty"/> </sequence> </extension> </complexContent> </complexType> <complexType name="ValidValue"> <sequence> <element ref="propertygroup:description" minOccurs="0"/> </sequence> <attribute name="displayValue" type="token" use="optional"/> <attribute name="value" type="token" use="required"/> </complexType> <complexType name="BaseSingleTypedProperty"> <complexContent> <extension base="propertygroup:BaseProperty"> <sequence> <element maxOccurs="unbounded" minOccurs="0" name="validValue" type="propertygroup:ValidValue"/> </sequence> <attribute name="defaultValue" type="token" use="optional"/> <attribute name="propertyType" type="token" use="required"/> <attribute name="expert" type="boolean" use="optional"/> <attribute name="hidden" type="boolean" use="optional"/> <attribute name="readOnly" type="boolean" use="optional"/> <attribute name="required" type="boolean" use="optional"/> <attribute name="sensitive" type="boolean" use="optional"/> <attribute name="validValuesEditable" type="boolean" use="optional"/> </extension> </complexContent> </complexType> <complexType name="BaseMultiValuedProperty"> <complexContent> <extension base="propertygroup:BaseSingleTypedProperty"> </extension> </complexContent> </complexType> <complexType name="BaseBoundedMultiValuedProperty"> <complexContent> <extension base="propertygroup:BaseMultiValuedProperty"> <attribute name="boundedSize" type="token" use="optional"/> </extension> </complexContent> </complexType> <complexType name="File"> <attribute name="extension" type="token" use="optional"/> <attribute name="pattern" type="token" use="optional"/> </complexType> <complexType name="MultiFileProperty"> <complexContent> <extension base="propertygroup:BaseMultiValuedProperty"> <sequence> <element maxOccurs="unbounded" minOccurs="0" name="fileExtension" type="propertygroup:File"/> </sequence> </extension> </complexContent> </complexType> <complexType name="MultiFolderProperty"> <complexContent> <extension base="propertygroup:BaseMultiValuedProperty"> </extension> </complexContent> </complexType> <complexType name="ConstraintMultiValuedProperty"> <complexContent> <extension base="propertygroup:BaseBoundedMultiValuedProperty"> <attribute name="pattern" type="token" use="optional"/> <attribute name="minValue" type="integer" use="optional"/> <attribute name="maxValue" type="integer" use="optional"/> <attribute name="maxLength" type="integer" use="optional"/> </extension> </complexContent> </complexType> <complexType name="BaseSingleValuedProperty"> <complexContent> <extension base="propertygroup:BaseSingleTypedProperty"> </extension> </complexContent> </complexType> <complexType name="FileProperty"> <complexContent> <extension base="propertygroup:BaseSingleValuedProperty"> <sequence> <element maxOccurs="unbounded" minOccurs="0" name="fileExtension" type="propertygroup:File"/> </sequence> </extension> </complexContent> </complexType> <complexType name="FolderProperty"> <complexContent> <extension base="propertygroup:BaseSingleValuedProperty"> </extension> </complexContent> </complexType> <complexType name="ConstraintSingleValuedProperty"> <complexContent> <extension base="propertygroup:BaseSingleValuedProperty"> <attribute name="pattern" type="token" use="optional"/> <attribute name="minValue" type="integer" use="optional"/> <attribute name="maxValue" type="integer" use="optional"/> <attribute name="maxLength" type="integer" use="optional"/> <attribute name="validValuesGeneratorClass" type="token" use="optional"/> </extension> </complexContent> </complexType> <complexType name="PropertyGroup"> <complexContent> <extension base="propertygroup:BaseProperty"> </extension> </complexContent> </complexType> <complexType name="BasePropertyGroup"> <complexContent> <extension base="propertygroup:PropertyGroup"> <sequence> <element maxOccurs="unbounded" minOccurs="0" name="property" type="propertygroup:PropertyDescriptor"/> <element maxOccurs="unbounded" minOccurs="0" name="customProperty" type="propertygroup:CustomProperty"/> </sequence> </extension> </complexContent> </complexType> <complexType name="CustomPropertyGroup"> <complexContent> <extension base="propertygroup:PropertyGroup"> <attribute name="class" type="token" use="optional"/> </extension> </complexContent> </complexType> <complexType name="BasePropertyGroups"> <complexContent> <extension base="propertygroup:BaseProperty"> <sequence> <element maxOccurs="unbounded" minOccurs="0" name="propertyGroup" type="propertygroup:PropertyGroup"/> </sequence> <attribute name="resourceBundle" type="token" use="optional"/> </extension> </complexContent> </complexType> <complexType name="BaseTreeProperty"> <complexContent> <extension base="propertygroup:BaseProperty"> </extension> </complexContent> </complexType> <complexType name="TableProperty"> <complexContent> <extension base="propertygroup:PropertyDescriptor"> <sequence> <element maxOccurs="unbounded" minOccurs="0" name="column" type="propertygroup:BaseSingleTypedProperty"/> </sequence> </extension> </complexContent> </complexType> <complexType name="TreeProperty"> <complexContent> <extension base="propertygroup:PropertyDescriptor"> <sequence> <element maxOccurs="1" minOccurs="0" name="root" type="propertygroup:BaseNodeProperty"/> </sequence> </extension> </complexContent> </complexType> <complexType name="CustomProperty"> <attribute name="class" type="token" use="required"/> </complexType> </schema>