How do I convert NetBeans form and its class to something usable in IntelliJ IDEA form editor? - user-interface

I apologize for perhaps naive question but I couldn't find an answer online.
I've got some UI code that was created in NetBeans. Unfortunately I don't know what version was used. My understanding is that IntelliJ IDEA (v11 in my case) doesn't support NetBeans forms.
Can I convert the form to something usable in IDEA's form editor ? Content of form's XML file looks lie this:
<?xml version="1.1" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<NonVisualComponents>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="text" type="java.lang.String" value="jLabel3"/>
</Properties>
</Component>
<Menu class="javax.swing.JMenuBar" name="menuBar">
<SubComponents>
<Menu class="javax.swing.JMenu" name="fileMenu">
<Properties>
<Property name="mnemonic" type="int" value="102"/>
<Property name="text" type="java.lang.String" value="File"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="openMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="111"/>
<Property name="text" type="java.lang.String" value="Open"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="saveMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="115"/>
<Property name="text" type="java.lang.String" value="Save"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="saveAsMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="97"/>
<Property name="text" type="java.lang.String" value="Save As ..."/>
<Property name="displayedMnemonicIndex" type="int" value="5"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="exitMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="120"/>
<Property name="text" type="java.lang.String" value="Exit"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="exitMenuItemActionPerformed"/>
</Events>
</MenuItem>
</SubComponents>
</Menu>
<Menu class="javax.swing.JMenu" name="editMenu">
<Properties>
<Property name="mnemonic" type="int" value="101"/>
<Property name="text" type="java.lang.String" value="Edit"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="cutMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="116"/>
<Property name="text" type="java.lang.String" value="Cut"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="copyMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="121"/>
<Property name="text" type="java.lang.String" value="Copy"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="pasteMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="112"/>
<Property name="text" type="java.lang.String" value="Paste"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="deleteMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="100"/>
<Property name="text" type="java.lang.String" value="Delete"/>
</Properties>
</MenuItem>
</SubComponents>
</Menu>
<Menu class="javax.swing.JMenu" name="helpMenu">
<Properties>
<Property name="mnemonic" type="int" value="104"/>
<Property name="text" type="java.lang.String" value="Help"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="contentsMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="99"/>
<Property name="text" type="java.lang.String" value="Contents"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="aboutMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="97"/>
<Property name="text" type="java.lang.String" value="About"/>
</Properties>
</MenuItem>
</SubComponents>
</Menu>
</SubComponents>
</Menu>
</NonVisualComponents>
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
<Property name="title" type="java.lang.String" value="My Reporting"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="menuBar" type="java.lang.String" value="menuBar"/>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<Component id="dataRequestButton" min="-2" max="-2" attributes="0"/>
<EmptySpace min="99" pref="99" max="99" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="downloadButton" min="-2" max="-2" attributes="0"/>
<Component id="answersLoaded" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="answersToLoad" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="28" max="-2" attributes="0"/>
</Group>
<Component id="statusLabel" alignment="0" pref="574" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="32" max="-2" attributes="0"/>
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="493" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="534" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="answersLoaded" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="answersToLoad" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="dataRequestButton" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="downloadButton" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="316" max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="statusLabel" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Answer data loaded until"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="answersLoaded">
<Properties>
<Property name="text" type="java.lang.String" value="<nothing loaded>"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="Unloaded answers at the server"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="answersToLoad">
<Properties>
<Property name="text" type="java.lang.String" value="<nothing available>"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="downloadButton">
<Properties>
<Property name="text" type="java.lang.String" value="Download ready data"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="downloadButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="statusLabel">
<Properties>
<Property name="text" type="java.lang.String" value="Ready"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="dataRequestButton">
<Properties>
<Property name="text" type="java.lang.String" value="Request data"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="dataRequestButtonActionPerformed"/>
</Events>
</Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTable" name="engineTable">
<Properties>
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
<Table columnCount="4" rowCount="4">
<Column editable="true" title="Title 1" type="java.lang.Object"/>
<Column editable="true" title="Title 2" type="java.lang.Object"/>
<Column editable="true" title="Title 3" type="java.lang.Object"/>
<Column editable="true" title="Title 4" type="java.lang.Object"/>
</Table>
</Property>
<Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor">
<TableColumnModel selectionModel="0">
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
<Title/>
<Editor/>
<Renderer/>
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
<Title/>
<Editor/>
<Renderer/>
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
<Title/>
<Editor/>
<Renderer/>
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
<Title/>
<Editor/>
<Renderer/>
</Column>
</TableColumnModel>
</Property>
<Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
<TableHeader reorderingAllowed="true" resizingAllowed="true"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="text" type="java.lang.String" value="Engines"/>
</Properties>
</Component>
</SubComponents>
</Form>
Thanks a lot.

IntelliJ IDEA doesn't support NetBeans forms, you can try to use the create snapshot feature that can save IDEA form file from a dialog of the running application.
However, much more convenient solution would be to use JFormDesigner which has IntelliJ IDEA plug-in and can convert NetBeans form files. Note that this tool is commercial and will cost you money, but it's free to try.

I have had perfect success by simply opening up the Source tab in the NetBeans Form editor where I created the form and copying the entirety of the code into a new Class in IntelilJ, then simply adding the code for a new JFrame and its code and passing (this) to the Panel parameter at the bottom of the initComponentsGui method.
Such as:
public class ConvertedGui extends Panel { // my new class
private void initComponents()... // copied code
// >>> the copied code here >>>
JFrame frame = new JFrame("Title For JFrame");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(1440, 900);// or your preferred size
frame.add(this);
frame.setVisible(true);`
}
// >>> More copied code for all the actionListeners etc.>>>

Related

java.sql.SQLSyntaxErrorException: ORA-02289: sequence does not exist

In this method I am getting error java.sql.SQLSyntaxErrorException: ORA-02289: sequence does not exist I have gone through posts and I m not getting any Idea to fix it
public void saveOrUpdateProcessRun(ProcessRun argProcessRun) {
LOGGER.info(METHOD_START);
getHibernateTemplate().saveOrUpdate(argProcessRun);
LOGGER.info(METHOD_END);
}
This is Mapping I have XML Based Configurations Generator class is not Working(PROC_RUN_ID_SEQ)
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.uhg.esbdb.common.beans">
<class name="ProcessRun" table="PROC_RUN">
<id name="processRunID" type="integer" column="PROC_RUN_ID">
<generator class="sequence">
<param name="sequence">PROC_RUN_ID_SEQ</param>
</generator>
</id>
<property name="processID" type="integer" column="PROC_ID" />
<property name="processRunStartDatetime" type="timestamp"
column="PROC_RUN_STRT_DTTM" />
<property name="processRunEndDatetime" type="timestamp"
column="PROC_RUN_END_DTTM" />
<property name="processRunStatusCode" type="integer" column="PROC_RUN_STS_CD" />
<property name="createdByID" type="string" column="CRE_BY_ID" />
<property name="createdDatetime" type="timestamp" column="CRE_DTTM" />
<property name="modifiedByID" type="string" column="MOD_BY_ID" />
<property name="modifiedDatetime" type="timestamp" column="MOD_DTTM" />
</class>
<class name="FileLoad" table="FL_LOAD">
<id name="fileLoadID" type="integer" column="FL_LOAD_ID">
<generator class="sequence">
<param name="sequence">FL_LOAD_ID_SEQ</param>
</generator>
</id>
<property name="dataFileName" type="string" column="DATA_FL_NM" />
<property name="dataFileSizeByteNumber" type="integer"
column="DATA_FL_SZ_BYTE_NBR" />
<property name="fileLoadStatusCode" type="integer" column="FL_LOAD_STS_CD" />
<property name="loadStartDatetime" type="timestamp" column="LOAD_STRT_DTM" />
<property name="loadEndDatetime" type="timestamp" column="LOAD_END_DTM" />
<property name="createdByID" type="string" column="CRE_BY_ID" />
<property name="createdDatetime" type="timestamp" column="CRE_DTTM" />
<property name="modifiedByID" type="string" column="MOD_BY_ID" />
<property name="modifiedDatetime" type="timestamp" column="MOD_DTTM" />
<many-to-one name="processRun" class="ProcessRun" column="PROC_RUN_ID" />
</class>
<class name="ControlTotal" table="CTL_TOT">
<composite-id name="id" class="ControlTotalID">
<key-many-to-one name="fileLoad" class="FileLoad"
column="FL_LOAD_ID" />
<key-property name="controlTotalTypeCode" type="integer"
column="CTL_TOT_TYP_CD" />
</composite-id>
<property name="controlTotal" type="string" column="CTL_TOT" />
<property name="createdByID" type="string" column="CRE_BY_ID" />
<property name="createdDatetime" type="timestamp" column="CRE_DTTM" />
<property name="modifiedByID" type="string" column="MOD_BY_ID" />
<property name="modifiedDatetime" type="timestamp" column="MOD_DTTM" />
</class>
<!-- Added for loading wfg transaction ids from BE017 and BNKACH feeds to the EDB table EDBREF.WFG_ACH_PAYMENTS-->
<class name="WfgTransactionIdBean" table="EDBREF.WFG_ACH_PAYMENTS">
<id name="traceNumber" type="string" column="TRACE_NUMBER"></id>
<property name="sourceSystem" type="string" column="SOURCE_SYSTEM" />
<property name="transactionDate" type="timestamp" column="TRANSACTION_DATE" />
<property name="processed" type="string" column="PROCESSED" />
</class>
</hibernate-mapping>
Instead of PROC_RUN_ID_SEQ I am getting-> DEBUG main SQL logStatement:92 - select hibernate_sequence.nextval from dual
The causes can be different:
The name of the sequence you have mapped in your pojo is different
You have no permission to use sequence
You have no defined a sequence on your database
Solutions
Fix the sequence name on your pojo
Grant the sequence for your database user
Add the sequence on your database
EDIT AFTER UPDATED QUESTION
Try as follow:
<id name="propName" type="long" unsaved-value="null">
<column name="columnName" not-null="true" unique="true"
index="pkName" />
<generator
class="org.hibernate.id.enhanced.SequenceStyleGenerator">
<param name="optimizer">none</param>
<param name="increment_size">1</param>
<param name="sequence_name">PROC_RUN_ID_SEQ</param>
</generator>
</id>

jpos : getting error o.j.t.p.QueryHost.prepare:97 'mux.S2M-E02-MPGS-AUTORESPONDER' is not connected

No idea why am I getting this error : getting error
o.j.t.p.QueryHost.prepare:97 'mux.S2M-E02-MPGS-AUTORESPONDER' is not
connected
my jpos server xml file is as below
<server class="org.jpos.q2.iso.QServer" logger="Q2" name="mpgs-server-7276" realm="mpgs-server-7276">
<attr name="port" type="java.lang.Integer">7276</attr>
<channel class="org.jpos.iso.channel.NACChannel"
packager="org.jpos.iso.packager.GenericPackager"
type="server"
logger="Q2"
header="6000000000"
>
<property name="packager-config" value="cfg/packager/CISascii.xml" debug="True" />
<property name="timeout" value="180000"/>
</channel>
<request-listener class="org.jpos.iso.IncomingListener" logger="Q2" realm="incoming-request-listener">
<property name="queue" value="S2M_E02_MPGSTXNMGR" />
<property name="ctx.DESTINATION" value="S2M-E02-MPGS-AUTORESPONDER" />
</request-listener>
</server>
my txn manager as below
<?xml version='1.0'?>
<txnmgr class="org.jpos.transaction.TransactionManager" logger="Q2">
<property name="queue" value="S2M_E02_MPGSTXNMGR"/>
<property name="sessions" value="2"/>
<property name="max-sessions" value="128"/>
<property name="debug" value="true"/>
<participant class="org.jpos.transaction.participant.QueryHost"/>
<participant class="org.jpos.transaction.participant.SendResponse"/>
</txnmgr>
my mux as below
<?xml version="1.0" ?>
<mux class="org.jpos.q2.iso.QMUX" logger="Q2" name="S2M-E02-MPGS-AUTORESPONDER">
<in>mpgsrsc-s2me02-receive</in>
<out>mpgsrsc-s2me02-send</out>
<ready>mpgs-S2M-E02-channel</ready>
</mux>
my channel as below
<?xml version="1.0" ?>
<channel-adaptor name='mpgs-S2M-E02-channel' class="org.jpos.q2.iso.ChannelAdaptor" logger="Q2">
<channel class="org.jpos.iso.channel.NACChannel"
packager="org.jpos.iso.packager.GenericPackager"
logger="Q2"
header="6000000000"
>
<property name="packager-config" value="cfg/packager/AS280501.xml" debug="True" />
<property name="host" value="127.0.0.1" />
<property name="port" value="6269" />
<property name="timeout" value="180000"/>
</channel>
<in>mpgsrsc-s2me02-send</in>
<out>mpgsrsc-s2me02-receive</out>
<reconnect-delay>10000</reconnect-delay>
</channel-adaptor>
I send the below transaction to channel
<log realm="org.jpos.transaction.TransactionManager" at="2020-05-07T01:51:54.931" lifespan="12014ms">
<abort>
txnmgr-1:idle:1
<context>
TIMESTAMP: Thu May 07 01:51:42 AEST 2020
SOURCE: org.jpos.iso.channel.NACChannel#277ca244
REQUEST:
<isomsg direction="incoming">
<!-- org.jpos.iso.packager.GenericPackager[cfg/packager/CISascii.xml] -->
<header>6000000000</header>
<field id="0" value="0200"/>
<field id="2" value="5000100100700010"/>
<field id="3" value="000000"/>
<field id="4" value="900000005000"/>
<field id="7" value="0507015142"/>
<field id="11" value="015142"/>
<field id="12" value="015142"/>
<field id="13" value="0507"/>
<field id="14" value="2005"/>
<field id="18" value="7399"/>
<field id="22" value="812"/>
<field id="25" value="15"/>
<field id="32" value="599950"/>
<field id="33" value="004601"/>
<field id="37" value="070520015142"/>
<field id="41" value="UTIS2I25"/>
<field id="42" value="000000EUREKAAIR"/>
<field id="48" value="543432303730313033323132343332386A48796E2B3759466931455541524541414141764E5565364876383D39323033313233363130353030303031" type="binary"/>
<field id="49" value="356"/>
<field id="61" value="1025100006600356"/>
<field id="120" value="9049 9252 AirTicketNo0123OrderInf001234567890123456789012349360 940800000000"/>
</isomsg>
DESTINATION: S2M-E02-MPGS-AUTORESPONDER
RESULT:
<result>
<fail>
[HOST_UNREACHABLE] o.j.t.p.QueryHost.prepare:97 'mux.S2M-E02-MPGS-AUTORESPONDER' is not connected
</fail>
</result>
I can see 6269 port is connected on the server , but it is still complaining about HOST unreachable
<log realm="channel/127.0.0.1:6269" at="2020-05-07T02:00:33.102">
<connect>
Try 0 127.0.0.1:6269
</connect>
</log>
much appreciate if you help to solve this issue or any guidance what should i be checking
thanks in advance
note : the question is full of code , but i don't have any choice more than that to explain what's happening in this scenario.
You have your ready key wrong in your mux, the ready key exported by a channel adaptor is it's name with a .ready suffix appended.
<mux class="org.jpos.q2.iso.QMUX" logger="Q2" name="S2M-E02-MPGS-AUTORESPONDER">
<in>mpgsrsc-s2me02-receive</in>
<out>mpgsrsc-s2me02-send</out>
<ready>mpgs-S2M-E02-channel.ready</ready>
</mux>
As the ready is pointing to a key never updated by anyone, the mux always thinks the destination is not connected and its isConnected method rteturns false

Error: must have either extensions or value no both

he created a Consent resource profile through forge, with a test extension that only contains a String value.
When I try to validate the Consent resource, it gives me this error, but I do not know what it means.
Profile:
<StructureDefinition xmlns="http://hl7.org/fhir">
<id value="Consent" />
<meta>
<lastUpdated value="2017-12-21T17:22:27.087+01:00" />
</meta>
<url value="http://hl7.org/fhir/StructureDefinition/MyConsent" />
<name value="Consent" />
<status value="draft" />
<date value="2017-12-19T09:08:41.006+01:00" />
<description value="prueba
" />
<fhirVersion value="3.0.1" />
<kind value="resource" />
<abstract value="false" />
<type value="Consent" />
<baseDefinition value="http://hl7.org/fhir/StructureDefinition/Consent" />
<derivation value="constraint" />
<differential>
<element id="Consent.extension">
<path value="Consent.extension" />
<slicing>
<discriminator>
<type value="value" />
<path value="url" />
</discriminator>
<rules value="open" />
</slicing>
</element>
<element id="Consent.extension:pruebaExtension">
<path value="Consent.extension" />
<sliceName value="pruebaExtension" />
<min value="1" />
<type>
<code value="Extension" />
<profile value="http://hl7.org/fhir/StructureDefinition/PruebaExtension" />
</type>
</element>
<element id="Consent.identifier">
<path value="Consent.identifier" />
<min value="1" />
</element>
</differential>
</StructureDefinition>
Thanks

servicemix, oracle datasource, connection pooling, max connections

I'm trying to configure connection pooling in servcemix 4.4.1. I've created a oracle datasource object and set the properties like user, password,url. I deployed the following xml as osgi service in my smx.
Here's my datasource configuration:
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
<bean id="dataSource" class="oracle.jdbc.pool.OracleDataSource">
<property name="URL" value="jdbc:oracle:thin:#connection:url"/>
<property name="user" value="****"/>
<property name="password" value="*****"/>
</bean>
<service interface="javax.sql.DataSource" ref="dataSource">
<service-properties>
<entry key="osgi.jndi.service.name" value="oracleds"/>
</service-properties>
</service>
</blueprint>
The datasource object is created succesfully and I'm able to retrieve the object using jndi lookup in my bundle.
Now I want to apply connection pooling for which I need to declare "maximum connections". Please suggest me how can I declare max no. of connections in the above xml
Thanks in advance.
Here is an example of my blueprint.xml:
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
xsi:schemaLocation=
"http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"
default-activation="eager">
<cm:property-placeholder id="server.placeholder" persistent-id="test.datasource">
<cm:default-properties>
<cm:property name="driverClassName" value="oracle.jdbc.pool.OracleDataSource" />
<cm:property name="validationQuery" value="SELECT 1 FROM DUAL" />
<cm:property name="defaultReadOnly" value="false" />
<cm:property name="defaultAutoCommit" value="true" />
<cm:property name="maxActive" value="100" />
<cm:property name="whenExhaustedAction" value="2" />
<cm:property name="maxWait" value="-1" />
<cm:property name="maxIdle" value="8" />
<cm:property name="minIdle" value="1" />
<cm:property name="testOnBorrow" value="true" />
<cm:property name="testOnReturn" value="true" />
<cm:property name="timeBetweenEvictionRunsMillis" value="-1" />
<cm:property name="numTestsPerEvictionRun" value="3" />
<cm:property name="minEvictableIdleTimeMillis" value="1800000" />
<cm:property name="testWhileIdle" value="false" />
<cm:property name="softMinEvictableIdleTimeMillis" value="-1" />
<cm:property name="lifo" value="true" />
</cm:default-properties>
</cm:property-placeholder>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value= "${driverClassName}" />
<property name="url" value="jdbc:oracle:thin:#${db.host}:${db.port}:${db.instance}" />
<property name="username" value="${db.user}" />
<property name="password" value="${db.password}" />
<property name="maxIdle" value="1" />
</bean>
<bean id="connectionFactory" class="org.apache.commons.dbcp.DataSourceConnectionFactory">
<argument ref="dataSource" />
</bean>
<bean id="connectionPool" class="org.apache.commons.pool.impl.GenericObjectPool" >
<argument><null/></argument>
<argument value="${maxActive}" />
<argument value="${whenExhaustedAction}" />
<argument value="${maxWait}" />
<argument value="${maxIdle}" />
<argument value="${minIdle}" />
<argument value="${testOnBorrow}" />
<argument value="${testOnReturn}" />
<argument value="${timeBetweenEvictionRunsMillis}" />
<argument value="${numTestsPerEvictionRun}" />
<argument value="${minEvictableIdleTimeMillis}" />
<argument value="${testWhileIdle}" />
<argument value="${softMinEvictableIdleTimeMillis}" />
<argument value="${lifo}" />
</bean>
<bean id="pooledConnectionFactory" class="org.apache.commons.dbcp.PoolableConnectionFactory" >
<argument ref="connectionFactory" />
<argument ref="connectionPool" />
<argument><null/></argument>
<argument value="${validationQuery}" />
<argument value="${defaultReadOnly}" />
<argument value="${defaultAutoCommit}" />
</bean>
<bean id="poolingDataSource" class="org.apache.commons.dbcp.PoolingDataSource" depends-on="pooledConnectionFactory">
<argument ref="connectionPool" />
</bean>
<service interface="javax.sql.DataSource" ref="poolingDataSource"> <!--ref="oracleDataSource"-->
<service-properties>
<entry key="osgi.jndi.service.name" value="jdbc/testdb"/>
<entry key="datasource.name" value="jdbc/testdb" />
</service-properties>
</service>
</blueprint>
This datasource work fine.
I think the attribute "maxActive" close to what you need.
You can choose between two ways:
use oracle.jdbc.pool.OracleConnectionPoolDataSource as datasource class
use commons-dbcp https://gist.github.com/splatch/2d631ec09f9be0730b1e (this is fork of somebody else gist)

WSO2- Error Using Clone Mediator to send message to an endpoint

I am working on WSO2 proxy service that invokes a lot of other DSS services. My requirement is to send the response of one of the DSS service on to a jms queue and at the same time continue with the exsiting flow in the proxy service i.e. continue invoking and processing the other DSS services.
I need to get the response of Simple Product Service (sequence key -if4_simpleProduct) and send it back on to the queue, but after that continue with logic that is placed in the proxy service and sequence. I tried using CLONE Mediator for the same. But my prxy service flow stops after coming in to the CLONE Meditaor flow. Below is the snippet for proxy service and sequence.
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="SPE_Payload"
transports="jms" startOnLoad="true" trace="enable">
<description />
<target>
<inSequence>
<transaction action="new" />
<xslt key="StepToCommon" />
<log level="full" />
<enrich>
<source type="body" clone="true" />
<target type="property" property="MSG_PAYLOAD" />
</enrich>
<sequence key="if4_simpleProduct" />
<filter xpath="boolean (//product/simpleProduct/altPrdCodes/pn_apc_id/text())">
<enrich>
<source clone="true" xpath="//product/simpleProduct/altPrdCodes" />
<target type="property" property="ALT_PRDS" />
</enrich>
<sequence key="if4_alternateProducts" />
</filter>
....
.....
<transaction action="commit" />
</inSequence>
</target>
<parameter name="transport.jms.ContentType">application/xml</parameter>
<parameter name="transport.jms.Destination">test</parameter>
</proxy>
Given below is the code of for sequence while calling Simple Product Service
<sequence xmlns="http://ws.apache.org/ns/synapse" name="if4_simpleProduct"
onError="myErrorHandlerSeq">
<payloadFactory>
<format>
<p:O_SimpleProduct xmlns:p="http://ws.wso2.org/dataservice">
<p:PC_STEP_SKU_ID>$1</p:PC_STEP_SKU_ID>
</p:O_SimpleProduct>
</format>
<args>
<arg xmlns:m="http://wso2.org/services/product" evaluator="xml"
expression="//product/simpleProduct/step_id/text()" />
</args>
</payloadFactory>
<header name="Action" value="urn:O_SimpleProduct" />
<callout serviceURL="local://localhost/services/productEnrichment"
action="urn:O_SimpleProduct" useServerConfig="true">
<source xmlns:ns="http://org.apache.synapse/xsd" xpath="$body/child::*[fn:position()=1]" />
<target xmlns:ns="http://org.apache.synapse/xsd" xpath="$body/child::*[fn:position()=1]" />
</callout>
<clone sequential="false">
<property name="RESPONSE" value="true" />
<header name="To" action="remove" />
<target>
<endpoint>
<address
uri="jms:/step.IF04Output?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616&transport.jms.DestinationType=queue" />
</endpoint>
</target>
<target>
<filter xmlns:ns="http://org.apache.synapse/xsd" xmlns:ds="http://wso2.org/services/product"
source="//ds:result/ds:set/ds:PC_STATUS/text()" regex="0">
<then>
<log level="custom">
<property name="STATUS"
value="************DONE INSERTING SIMPLE ATTRIBUTES***************" />
</log>
</then>
<else>
<log level="full" category="ERROR">
<property name="STATUS"
value="************ERROR OCCURED WHILE INSERTING SIMPLE ATTRIBUTES. ROLLBACKING THE TRANSACTION***************" />
<property name="PC_RP_ID" expression="get-property('GEN_RP_ID')" />
</log>
<transaction action="rollback" />
<drop />
</else>
</filter>
<property xmlns:ds="http://wso2.org/services/product" name="GEN_RP_ID"
expression="//ds:result/ds:set/ds:PC_RP_ID/text()" />
<enrich>
<source type="property" clone="true" property="MSG_PAYLOAD" />
<target type="body" />
</enrich>
</target>
</clone>
</sequence>
I am struggling with the issue since last two days. tried sing Clone meditior in several places. but it does not work. Could you please provide your suggestions soon as I have a demo to go tomorrow and I need to sort it out :(
Cheers,
Aanchal
I think this is the part you are struggling;
<callout serviceURL="local://localhost/services/productEnrichment"
action="urn:O_SimpleProduct" useServerConfig="true">
<source xmlns:ns="http://org.apache.synapse/xsd" xpath="$body/child::*[fn:position()=1]" />
<target xmlns:ns="http://org.apache.synapse/xsd" xpath="$body/child::*[fn:position()=1]" />
</callout>
<clone sequential="false">
<property name="RESPONSE" value="true" />
<header name="To" action="remove" />
<target>
<endpoint>
<address
uri="jms:/step.IF04Output?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://localhost:61616&transport.jms.DestinationType=queue" />
</endpoint>
</target>
Since your requirement is get response form one of the DS service and send that to queue..I think it fails because you are removing "To" header..Use callout mediator inside clone mediator's one of the "Target" configuration after sending to JMS queue drop the message there..In the other target, define your rest of the logic..

Resources