diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2005-05-20 18:20:46 +0000 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2005-05-20 18:20:46 +0000 |
commit | c521023082fc793b1236b9964f0efaffc0aec767 (patch) | |
tree | fc3c9b5ec9734e75db6d555a2624ea11b1467868 /examples | |
parent | ce52995bef1e166d56cbfe68770c19e43ce50765 (diff) | |
download | classpath-c521023082fc793b1236b9964f0efaffc0aec767.tar.gz |
2005-05-20 Andrew John Hughes <gnu_andrew@member.fsf.org>
* Merge of HEAD to generics-branch for 2005/04/28 - 2005/05/19
Changelog:
2005-05-19 Andrew John Hughes <gnu_andrew@member.fsf.org>
* java/net/URI.java:
Added more documentation.
(RFC2396_MARK): Removed.
(RFC2396_UNRESERVED): Changed to RFC3986_UNRESERVED and updated.
(RFC2396_REG_NAME): Changed to RFC3986_REG_NAME and updated.
(RFC2396_PCHAR): Changed to RFC3986_PCHAR and updated.
(RFC2396_SEGMENT): Changed to RFC3986_SEGMENT and updated.
(RFC2396_PATH_SEGMENTS): Changed to RFC3986_PATH_SEGMENTS.
(RFC3986_UNRESERVED): New field.
(RFC3986_SSP): New field.
(RFC3986_HOST): New field.
(RFC3986_USERINFO): New field.
(static): New initializer to initialize patterns with class.
(parseURI()): Moved authority parsing to parseServerAuthority().
(unquote(String)): Removed invalid exception for non-ASCII chars.
(quote(String)): Implemented.
(quoteAuthority(String)): Adapted to use new fields.
(quote(String,String)): Moved escaping of characters to another
method.
(quoteHost(String)): Implemented.
(quotePath(String)): Adapted to use new fields.
(quoteUserInfo(String)): Implemented.
(parseServerAuthority()): Implemented.
(normalize()): Implemented.
(normalizePath(String)): Implemented as part of normalize().
(removeLastSegment(StringBuffer)): Likewise.
(relativize(java.net.URI)): Implemented.
(equals(Object)): Implemented.
(hashCode()): Implemented.
(compareTo(Object)): Implemented.
(compareFragments(java.net.URI)): Implemented.
(toString()): Use fields directly.
(toASCIIString()): Implemented.
(escapeCharacters(String)): Implemented to escape non-ASCII characters.
2005-05-19 Roman Kennke <roman@kennke.org>
* javax/swing/SizeRequirements.java
(constructors): Implemented.
(getTiledSizeRequirements): Implemented.
(calculateTiledPositions): Implemented.
2005-05-19 Roman Kennke <roman@kennke.org>
* javax/swing/SizeRequirements.java:
Added API documentation for this class.
2005-05-19 Roman Kennke <roman@kennke.org>
* javax/swing/SizeRequirements.java:
Reformatted file to meet our coding standards.
2005-05-19 Roman Kennke <roman@kennke.org>
* javax/swing/SwingUtilities.java
(getUIInputMap): Return the InputMap that has been set by
the UI of the component, not the component's own InputMap.
(getUIActionMap): Return the ActionMap that has been set by
the UI of the component, not the component's own ActionMap.
2005-05-19 Roman Kennke <roman@kennke.org>
* javax/swing/FocusManager.java:
Reformatted this file to match our coding standard.
2005-05-19 Roman Kennke <roman@kennke.org>
* javax/swing/plaf/metal/BasicFileChooserUI.java:
(installComponents): Include parents ComboBox. This has been
commented out because ComboBox was broken (see previous entry).
2005-05-19 Roman Kennke <roman@kennke.org>
* javax/swing/plaf/metal/MetalComboBoxUI.java
(createUI): Do not share instances of this UI class between
different JComboBoxes.
2005-05-19 Kim Ho <kho@luxsci.net>
* javax/swing/DefaultComboBoxModel.java:
(addElement): Set index to be the element of the added item.
(removeAllElements): Clear before retrieving new size. Use
correct size.
* javax/swing/JFileChooser.java: Implemented.
* javax/swing/filechooser/FileSystemView.java: Implemented.
* javax/swing/filechooser/UnixFileSystemView.java: New file.
Implemented.
* javax/swing/plaf/basic/BasicComboBoxUI.java:
(intervalAdded): Set initial index to start.
* javax/swing/plaf/basic/BasicDirectoryModel.java: New file.
Implemented.
* javax/swing/plaf/basic/BasicFileChooserUI.java: New file.
Implemented.
* javax/swing/plaf/basic/BasicLookAndFeel.java: Add FileChooserUI.
Commented out GIF properties for FileChooser stuff.
2005-05-19 Michael Koch <konqueror@gmx.de>
* lib/Makefile.am: Remove accidentally commited -nowarn option for
jikes.
2005-05-19 Michael Koch <konqueror@gmx.de>
* java/text/DateFormatSymbols.java
(getStringArray): New method.
(getZoneStrings): Likewise.
(DateFormatSymbols): Load symbols from properties files.
* java/util/Locale.java
(getDisplayLanguage): Handle new way to load language names.
(getDisplayCountry): Handle new way to load territory names.
(getDisplayVariant): Handle new way to load variant names.
* lib/Makefile.am, lib/gen-classlist.sh.in:
No need to special case classes from gnu.java.locale anymore.
* scripts/generate-locale-list.sh:
Generate list from the new properties files.
* LICENSE: Added license of locale data properties files.
2005-05-19 Michael Koch <konqueror@gmx.de>
* resource/gnu/java/locale/LocaleInformation_aa_DJ.properties,
resource/gnu/java/locale/LocaleInformation_aa_ER.properties,
resource/gnu/java/locale/LocaleInformation_aa_ER_SAAHO.properties,
resource/gnu/java/locale/LocaleInformation_aa_ET.properties,
resource/gnu/java/locale/LocaleInformation_aa.properties,
resource/gnu/java/locale/LocaleInformation_af.properties,
resource/gnu/java/locale/LocaleInformation_af_ZA.properties,
resource/gnu/java/locale/LocaleInformation_am_ET.properties,
resource/gnu/java/locale/LocaleInformation_am.properties,
resource/gnu/java/locale/LocaleInformation_ar_DZ.properties,
resource/gnu/java/locale/LocaleInformation_ar_IN.properties,
resource/gnu/java/locale/LocaleInformation_ar_IQ.properties,
resource/gnu/java/locale/LocaleInformation_ar_JO.properties,
resource/gnu/java/locale/LocaleInformation_ar_KW.properties,
resource/gnu/java/locale/LocaleInformation_ar_LB.properties,
resource/gnu/java/locale/LocaleInformation_ar_LY.properties,
resource/gnu/java/locale/LocaleInformation_ar_MA.properties,
resource/gnu/java/locale/LocaleInformation_ar.properties,
resource/gnu/java/locale/LocaleInformation_ar_QA.properties,
resource/gnu/java/locale/LocaleInformation_ar_SA.properties,
resource/gnu/java/locale/LocaleInformation_ar_SY.properties,
resource/gnu/java/locale/LocaleInformation_ar_TN.properties,
resource/gnu/java/locale/LocaleInformation_ar_YE.properties,
resource/gnu/java/locale/LocaleInformation_as_IN.properties,
resource/gnu/java/locale/LocaleInformation_as.properties,
resource/gnu/java/locale/LocaleInformation_az_Cyrl.properties,
resource/gnu/java/locale/LocaleInformation_be_BY.properties,
resource/gnu/java/locale/LocaleInformation_be.properties,
resource/gnu/java/locale/LocaleInformation_bg_BG.properties,
resource/gnu/java/locale/LocaleInformation_bg.properties,
resource/gnu/java/locale/LocaleInformation_bn_IN.properties,
resource/gnu/java/locale/LocaleInformation_bn.properties,
resource/gnu/java/locale/LocaleInformation_ca_ES.properties,
resource/gnu/java/locale/LocaleInformation_ca.properties,
resource/gnu/java/locale/LocaleInformation_cs_CZ.properties,
resource/gnu/java/locale/LocaleInformation_cs.properties,
resource/gnu/java/locale/LocaleInformation_cy_GB.properties,
resource/gnu/java/locale/LocaleInformation_cy.properties,
resource/gnu/java/locale/LocaleInformation_da_DK.properties,
resource/gnu/java/locale/LocaleInformation_da.properties,
resource/gnu/java/locale/LocaleInformation_de_AT.properties,
resource/gnu/java/locale/LocaleInformation_de_BE.properties,
resource/gnu/java/locale/LocaleInformation_de_CH.properties,
resource/gnu/java/locale/LocaleInformation_de_DE.properties,
resource/gnu/java/locale/LocaleInformation_de_LI.properties,
resource/gnu/java/locale/LocaleInformation_de_LU.properties,
resource/gnu/java/locale/LocaleInformation_de.properties,
resource/gnu/java/locale/LocaleInformation_dv_MV.properties,
resource/gnu/java/locale/LocaleInformation_dv.properties,
resource/gnu/java/locale/LocaleInformation_dz_BT.properties,
resource/gnu/java/locale/LocaleInformation_dz.properties,
resource/gnu/java/locale/LocaleInformation_el_GR.properties,
resource/gnu/java/locale/LocaleInformation_el.properties,
resource/gnu/java/locale/LocaleInformation_en_AS.properties,
resource/gnu/java/locale/LocaleInformation_en_AU.properties,
resource/gnu/java/locale/LocaleInformation_en_BE.properties,
resource/gnu/java/locale/LocaleInformation_en_BW.properties,
resource/gnu/java/locale/LocaleInformation_en_BZ.properties,
resource/gnu/java/locale/LocaleInformation_en_CA.properties,
resource/gnu/java/locale/LocaleInformation_en_GB.properties,
resource/gnu/java/locale/LocaleInformation_en_GU.properties,
resource/gnu/java/locale/LocaleInformation_en_HK.properties,
resource/gnu/java/locale/LocaleInformation_en_IE.properties,
resource/gnu/java/locale/LocaleInformation_en_IN.properties,
resource/gnu/java/locale/LocaleInformation_en_MH.properties,
resource/gnu/java/locale/LocaleInformation_en_MP.properties,
resource/gnu/java/locale/LocaleInformation_en_MT.properties,
resource/gnu/java/locale/LocaleInformation_en_NZ.properties,
resource/gnu/java/locale/LocaleInformation_en_PH.properties,
resource/gnu/java/locale/LocaleInformation_en_PK.properties,
resource/gnu/java/locale/LocaleInformation_en.properties,
resource/gnu/java/locale/LocaleInformation_en_SG.properties,
resource/gnu/java/locale/LocaleInformation_en_UM.properties,
resource/gnu/java/locale/LocaleInformation_en_US_POSIX.properties,
resource/gnu/java/locale/LocaleInformation_en_US.properties,
resource/gnu/java/locale/LocaleInformation_en_VI.properties,
resource/gnu/java/locale/LocaleInformation_en_ZA.properties,
resource/gnu/java/locale/LocaleInformation_en_ZW.properties,
resource/gnu/java/locale/LocaleInformation_eo.properties,
resource/gnu/java/locale/LocaleInformation_es_AR.properties,
resource/gnu/java/locale/LocaleInformation_es_BO.properties,
resource/gnu/java/locale/LocaleInformation_es_CL.properties,
resource/gnu/java/locale/LocaleInformation_es_CO.properties,
resource/gnu/java/locale/LocaleInformation_es_CR.properties,
resource/gnu/java/locale/LocaleInformation_es_DO.properties,
resource/gnu/java/locale/LocaleInformation_es_EC.properties,
resource/gnu/java/locale/LocaleInformation_es_ES.properties,
resource/gnu/java/locale/LocaleInformation_es_GT.properties,
resource/gnu/java/locale/LocaleInformation_es_HN.properties,
resource/gnu/java/locale/LocaleInformation_es_MX.properties,
resource/gnu/java/locale/LocaleInformation_es_NI.properties,
resource/gnu/java/locale/LocaleInformation_es_PA.properties,
resource/gnu/java/locale/LocaleInformation_es_PE.properties,
resource/gnu/java/locale/LocaleInformation_es.properties,
resource/gnu/java/locale/LocaleInformation_es_PR.properties,
resource/gnu/java/locale/LocaleInformation_es_PY.properties,
resource/gnu/java/locale/LocaleInformation_es_SV.properties,
resource/gnu/java/locale/LocaleInformation_es_US.properties,
resource/gnu/java/locale/LocaleInformation_es_UY.properties,
resource/gnu/java/locale/LocaleInformation_es_VE.properties,
resource/gnu/java/locale/LocaleInformation_et_EE.properties,
resource/gnu/java/locale/LocaleInformation_et.properties,
resource/gnu/java/locale/LocaleInformation_eu_ES.properties,
resource/gnu/java/locale/LocaleInformation_eu.properties,
resource/gnu/java/locale/LocaleInformation_fa_AF.properties,
resource/gnu/java/locale/LocaleInformation_fa_IR.properties,
resource/gnu/java/locale/LocaleInformation_fa.properties,
resource/gnu/java/locale/LocaleInformation_fi_FI.properties,
resource/gnu/java/locale/LocaleInformation_fi.properties,
resource/gnu/java/locale/LocaleInformation_fo_FO.properties,
resource/gnu/java/locale/LocaleInformation_fo.properties,
resource/gnu/java/locale/LocaleInformation_fr_BE.properties,
resource/gnu/java/locale/LocaleInformation_fr_CA.properties,
resource/gnu/java/locale/LocaleInformation_fr_CH.properties,
resource/gnu/java/locale/LocaleInformation_fr_LU.properties,
resource/gnu/java/locale/LocaleInformation_fr.properties,
resource/gnu/java/locale/LocaleInformation_ga_IE.properties,
resource/gnu/java/locale/LocaleInformation_ga.properties,
resource/gnu/java/locale/LocaleInformation_gl_ES.properties,
resource/gnu/java/locale/LocaleInformation_gl.properties,
resource/gnu/java/locale/LocaleInformation_gu_IN.properties,
resource/gnu/java/locale/LocaleInformation_gu.properties,
resource/gnu/java/locale/LocaleInformation_gv_GB.properties,
resource/gnu/java/locale/LocaleInformation_gv.properties,
resource/gnu/java/locale/LocaleInformation_he_IL.properties,
resource/gnu/java/locale/LocaleInformation_he.properties,
resource/gnu/java/locale/LocaleInformation_hi_IN.properties,
resource/gnu/java/locale/LocaleInformation_hi.properties,
resource/gnu/java/locale/LocaleInformation_hr.properties,
resource/gnu/java/locale/LocaleInformation_hu_HU.properties,
resource/gnu/java/locale/LocaleInformation_hu.properties,
resource/gnu/java/locale/LocaleInformation_hy_AM.properties,
resource/gnu/java/locale/LocaleInformation_hy_AM_REVISED.properties,
resource/gnu/java/locale/LocaleInformation_hy.properties,
resource/gnu/java/locale/LocaleInformation_id_ID.properties,
resource/gnu/java/locale/LocaleInformation_id.properties,
resource/gnu/java/locale/LocaleInformation_is_IS.properties,
resource/gnu/java/locale/LocaleInformation_is.properties,
resource/gnu/java/locale/LocaleInformation_it_CH.properties,
resource/gnu/java/locale/LocaleInformation_it_IT.properties,
resource/gnu/java/locale/LocaleInformation_it.properties,
resource/gnu/java/locale/LocaleInformation_iu.properties,
resource/gnu/java/locale/LocaleInformation_ja_JP.properties,
resource/gnu/java/locale/LocaleInformation_ja.properties,
resource/gnu/java/locale/LocaleInformation_ka.properties,
resource/gnu/java/locale/LocaleInformation_kk_KZ.properties,
resource/gnu/java/locale/LocaleInformation_kk.properties,
resource/gnu/java/locale/LocaleInformation_kl_GL.properties,
resource/gnu/java/locale/LocaleInformation_kl.properties,
resource/gnu/java/locale/LocaleInformation_km_KH.properties,
resource/gnu/java/locale/LocaleInformation_km.properties,
resource/gnu/java/locale/LocaleInformation_kn_IN.properties,
resource/gnu/java/locale/LocaleInformation_kn.properties,
resource/gnu/java/locale/LocaleInformation_ko_KR.properties,
resource/gnu/java/locale/LocaleInformation_ko.properties,
resource/gnu/java/locale/LocaleInformation_kw_GB.properties,
resource/gnu/java/locale/LocaleInformation_kw.properties,
resource/gnu/java/locale/LocaleInformation_ky.properties,
resource/gnu/java/locale/LocaleInformation_lo_LA.properties,
resource/gnu/java/locale/LocaleInformation_lo.properties,
resource/gnu/java/locale/LocaleInformation_lt_LT.properties,
resource/gnu/java/locale/LocaleInformation_lt.properties,
resource/gnu/java/locale/LocaleInformation_lv_LV.properties,
resource/gnu/java/locale/LocaleInformation_lv.properties,
resource/gnu/java/locale/LocaleInformation_mk.properties,
resource/gnu/java/locale/LocaleInformation_ml_IN.properties,
resource/gnu/java/locale/LocaleInformation_ml.properties,
resource/gnu/java/locale/LocaleInformation_mn_MN.properties,
resource/gnu/java/locale/LocaleInformation_mn.properties,
resource/gnu/java/locale/LocaleInformation_mr_IN.properties,
resource/gnu/java/locale/LocaleInformation_mr.properties,
resource/gnu/java/locale/LocaleInformation_ms_BN.properties,
resource/gnu/java/locale/LocaleInformation_ms_MY.properties,
resource/gnu/java/locale/LocaleInformation_ms.properties,
resource/gnu/java/locale/LocaleInformation_mt_MT.properties,
resource/gnu/java/locale/LocaleInformation_mt.properties,
resource/gnu/java/locale/LocaleInformation_nb_NO.properties,
resource/gnu/java/locale/LocaleInformation_nb.properties,
resource/gnu/java/locale/LocaleInformation_nl_BE.properties,
resource/gnu/java/locale/LocaleInformation_nl_NL.properties,
resource/gnu/java/locale/LocaleInformation_nl.properties,
resource/gnu/java/locale/LocaleInformation_nn_NO.properties,
resource/gnu/java/locale/LocaleInformation_nn.properties,
resource/gnu/java/locale/LocaleInformation_om_ET.properties,
resource/gnu/java/locale/LocaleInformation_om_KE.properties,
resource/gnu/java/locale/LocaleInformation_om.properties,
resource/gnu/java/locale/LocaleInformation_or_IN.properties,
resource/gnu/java/locale/LocaleInformation_or.properties,
resource/gnu/java/locale/LocaleInformation_pa_IN.properties,
resource/gnu/java/locale/LocaleInformation_pa.properties,
resource/gnu/java/locale/LocaleInformation_pl_PL.properties,
resource/gnu/java/locale/LocaleInformation_pl.properties,
resource/gnu/java/locale/LocaleInformation.properties,
resource/gnu/java/locale/LocaleInformation_ps_AF.properties,
resource/gnu/java/locale/LocaleInformation_ps.properties,
resource/gnu/java/locale/LocaleInformation_pt_BR.properties,
resource/gnu/java/locale/LocaleInformation_pt.properties,
resource/gnu/java/locale/LocaleInformation_pt_PT.properties,
resource/gnu/java/locale/LocaleInformation_ro.properties,
resource/gnu/java/locale/LocaleInformation_ro_RO.properties,
resource/gnu/java/locale/LocaleInformation_ru.properties,
resource/gnu/java/locale/LocaleInformation_ru_RU.properties,
resource/gnu/java/locale/LocaleInformation_ru_UA.properties,
resource/gnu/java/locale/LocaleInformation_sa_IN.properties,
resource/gnu/java/locale/LocaleInformation_sa.properties,
resource/gnu/java/locale/LocaleInformation_sk.properties,
resource/gnu/java/locale/LocaleInformation_sk_SK.properties,
resource/gnu/java/locale/LocaleInformation_sl.properties,
resource/gnu/java/locale/LocaleInformation_so_DJ.properties,
resource/gnu/java/locale/LocaleInformation_so_ET.properties,
resource/gnu/java/locale/LocaleInformation_so_KE.properties,
resource/gnu/java/locale/LocaleInformation_so.properties,
resource/gnu/java/locale/LocaleInformation_so_SO.properties,
resource/gnu/java/locale/LocaleInformation_sq_AL.properties,
resource/gnu/java/locale/LocaleInformation_sq.properties,
resource/gnu/java/locale/LocaleInformation_sr_Latn.properties,
resource/gnu/java/locale/LocaleInformation_sr.properties,
resource/gnu/java/locale/LocaleInformation_sv_FI.properties,
resource/gnu/java/locale/LocaleInformation_sv.properties,
resource/gnu/java/locale/LocaleInformation_sv_SE.properties,
resource/gnu/java/locale/LocaleInformation_sw_KE.properties,
resource/gnu/java/locale/LocaleInformation_sw.properties,
resource/gnu/java/locale/LocaleInformation_sw_TZ.properties,
resource/gnu/java/locale/LocaleInformation_ta_IN.properties,
resource/gnu/java/locale/LocaleInformation_ta.properties,
resource/gnu/java/locale/LocaleInformation_te_IN.properties,
resource/gnu/java/locale/LocaleInformation_te.properties,
resource/gnu/java/locale/LocaleInformation_th.properties,
resource/gnu/java/locale/LocaleInformation_th_TH.properties,
resource/gnu/java/locale/LocaleInformation_ti_ER.properties,
resource/gnu/java/locale/LocaleInformation_ti_ET.properties,
resource/gnu/java/locale/LocaleInformation_ti.properties,
resource/gnu/java/locale/LocaleInformation_tr.properties,
resource/gnu/java/locale/LocaleInformation_tr_TR.properties,
resource/gnu/java/locale/LocaleInformation_tt.properties,
resource/gnu/java/locale/LocaleInformation_tt_RU.properties,
resource/gnu/java/locale/LocaleInformation_uk.properties,
resource/gnu/java/locale/LocaleInformation_uk_UA.properties,
resource/gnu/java/locale/LocaleInformation_ur.properties,
resource/gnu/java/locale/LocaleInformation_uz_AF.properties,
resource/gnu/java/locale/LocaleInformation_uz.properties,
resource/gnu/java/locale/LocaleInformation_vi.properties,
resource/gnu/java/locale/LocaleInformation_zh_CN_Hans.properties,
resource/gnu/java/locale/LocaleInformation_zh_Hant.properties,
resource/gnu/java/locale/LocaleInformation_zh_HK_Hant.properties,
resource/gnu/java/locale/LocaleInformation_zh_MO_Hant.properties,
resource/gnu/java/locale/LocaleInformation_zh.properties,
resource/gnu/java/locale/LocaleInformation_zh_SG_Hans.properties,
resource/gnu/java/locale/LocaleInformation_zh_TW_Hant.properties:
New files.
* gnu/java/locale/LocaleInformation_aa_DJ.java,
gnu/java/locale/LocaleInformation_aa_ER.java,
gnu/java/locale/LocaleInformation_aa_ER_SAAHO.java,
gnu/java/locale/LocaleInformation_aa_ET.java,
gnu/java/locale/LocaleInformation_aa.java,
gnu/java/locale/LocaleInformation_af.java,
gnu/java/locale/LocaleInformation_af_ZA.java,
gnu/java/locale/LocaleInformation_am_ET.java,
gnu/java/locale/LocaleInformation_am.java,
gnu/java/locale/LocaleInformation_ar_DZ.java,
gnu/java/locale/LocaleInformation_ar_IN.java,
gnu/java/locale/LocaleInformation_ar_IQ.java,
gnu/java/locale/LocaleInformation_ar.java,
gnu/java/locale/LocaleInformation_ar_JO.java,
gnu/java/locale/LocaleInformation_ar_KW.java,
gnu/java/locale/LocaleInformation_ar_LB.java,
gnu/java/locale/LocaleInformation_ar_LY.java,
gnu/java/locale/LocaleInformation_ar_MA.java,
gnu/java/locale/LocaleInformation_ar_QA.java,
gnu/java/locale/LocaleInformation_ar_SA.java,
gnu/java/locale/LocaleInformation_ar_SY.java,
gnu/java/locale/LocaleInformation_ar_TN.java,
gnu/java/locale/LocaleInformation_ar_YE.java,
gnu/java/locale/LocaleInformation_as_IN.java,
gnu/java/locale/LocaleInformation_as.java,
gnu/java/locale/LocaleInformation_az_Cyrl.java,
gnu/java/locale/LocaleInformation_az.java,
gnu/java/locale/LocaleInformation_be_BY.java,
gnu/java/locale/LocaleInformation_be.java,
gnu/java/locale/LocaleInformation_bg_BG.java,
gnu/java/locale/LocaleInformation_bg.java,
gnu/java/locale/LocaleInformation_bn_IN.java,
gnu/java/locale/LocaleInformation_bn.java,
gnu/java/locale/LocaleInformation_br_FR.java,
gnu/java/locale/LocaleInformation_bs_BA.java,
gnu/java/locale/LocaleInformation_byn_ER.java,
gnu/java/locale/LocaleInformation_byn.java,
gnu/java/locale/LocaleInformation_ca_ES.java,
gnu/java/locale/LocaleInformation_ca.java,
gnu/java/locale/LocaleInformation_cs_CZ.java,
gnu/java/locale/LocaleInformation_cs.java,
gnu/java/locale/LocaleInformation_cy_GB.java,
gnu/java/locale/LocaleInformation_cy.java,
gnu/java/locale/LocaleInformation_da_DK.java,
gnu/java/locale/LocaleInformation_da.java,
gnu/java/locale/LocaleInformation_de_AT.java,
gnu/java/locale/LocaleInformation_de_BE.java,
gnu/java/locale/LocaleInformation_de_CH.java,
gnu/java/locale/LocaleInformation_de_DE.java,
gnu/java/locale/LocaleInformation_de.java,
gnu/java/locale/LocaleInformation_de_LI.java,
gnu/java/locale/LocaleInformation_de_LU.java,
gnu/java/locale/LocaleInformation_dv.java,
gnu/java/locale/LocaleInformation_dv_MV.java,
gnu/java/locale/LocaleInformation_dz_BT.java,
gnu/java/locale/LocaleInformation_dz.java,
gnu/java/locale/LocaleInformation_el_GR.java,
gnu/java/locale/LocaleInformation_el.java,
gnu/java/locale/LocaleInformation_en_AS.java,
gnu/java/locale/LocaleInformation_en_AU.java,
gnu/java/locale/LocaleInformation_en_BE.java,
gnu/java/locale/LocaleInformation_en_BW.java,
gnu/java/locale/LocaleInformation_en_BZ.java,
gnu/java/locale/LocaleInformation_en_CA.java,
gnu/java/locale/LocaleInformation_en_DK.java,
gnu/java/locale/LocaleInformation_en_GB.java,
gnu/java/locale/LocaleInformation_en_GU.java,
gnu/java/locale/LocaleInformation_en_HK.java,
gnu/java/locale/LocaleInformation_en_IE.java,
gnu/java/locale/LocaleInformation_en_IN.java,
gnu/java/locale/LocaleInformation_en.java,
gnu/java/locale/LocaleInformation_en_MH.java,
gnu/java/locale/LocaleInformation_en_MP.java,
gnu/java/locale/LocaleInformation_en_MT.java,
gnu/java/locale/LocaleInformation_en_NZ.java,
gnu/java/locale/LocaleInformation_en_PH.java,
gnu/java/locale/LocaleInformation_en_PK.java,
gnu/java/locale/LocaleInformation_en_SG.java,
gnu/java/locale/LocaleInformation_en_UM.java,
gnu/java/locale/LocaleInformation_en_US.java,
gnu/java/locale/LocaleInformation_en_US_POSIX.java,
gnu/java/locale/LocaleInformation_en_VI.java,
gnu/java/locale/LocaleInformation_en_ZA.java,
gnu/java/locale/LocaleInformation_en_ZW.java,
gnu/java/locale/LocaleInformation_eo.java,
gnu/java/locale/LocaleInformation_es_AR.java,
gnu/java/locale/LocaleInformation_es_BO.java,
gnu/java/locale/LocaleInformation_es_CL.java,
gnu/java/locale/LocaleInformation_es_CO.java,
gnu/java/locale/LocaleInformation_es_CR.java,
gnu/java/locale/LocaleInformation_es_DO.java,
gnu/java/locale/LocaleInformation_es_EC.java,
gnu/java/locale/LocaleInformation_es_ES.java,
gnu/java/locale/LocaleInformation_es_GT.java,
gnu/java/locale/LocaleInformation_es_HN.java,
gnu/java/locale/LocaleInformation_es.java,
gnu/java/locale/LocaleInformation_es_MX.java,
gnu/java/locale/LocaleInformation_es_NI.java,
gnu/java/locale/LocaleInformation_es_PA.java,
gnu/java/locale/LocaleInformation_es_PE.java,
gnu/java/locale/LocaleInformation_es_PR.java,
gnu/java/locale/LocaleInformation_es_PY.java,
gnu/java/locale/LocaleInformation_es_SV.java,
gnu/java/locale/LocaleInformation_es_US.java,
gnu/java/locale/LocaleInformation_es_UY.java,
gnu/java/locale/LocaleInformation_es_VE.java,
gnu/java/locale/LocaleInformation_et_EE.java,
gnu/java/locale/LocaleInformation_et.java,
gnu/java/locale/LocaleInformation_eu_ES.java,
gnu/java/locale/LocaleInformation_eu.java,
gnu/java/locale/LocaleInformation_fa_AF.java,
gnu/java/locale/LocaleInformation_fa_IR.java,
gnu/java/locale/LocaleInformation_fa.java,
gnu/java/locale/LocaleInformation_fi_FI.java,
gnu/java/locale/LocaleInformation_fi.java,
gnu/java/locale/LocaleInformation_fo_FO.java,
gnu/java/locale/LocaleInformation_fo.java,
gnu/java/locale/LocaleInformation_fr_BE.java,
gnu/java/locale/LocaleInformation_fr_CA.java,
gnu/java/locale/LocaleInformation_fr_CH.java,
gnu/java/locale/LocaleInformation_fr.java,
gnu/java/locale/LocaleInformation_fr_LU.java,
gnu/java/locale/LocaleInformation_ga_IE.java,
gnu/java/locale/LocaleInformation_ga.java,
gnu/java/locale/LocaleInformation_gez_ER.java,
gnu/java/locale/LocaleInformation_gez_ET.java,
gnu/java/locale/LocaleInformation_gez.java,
gnu/java/locale/LocaleInformation_gl_ES.java,
gnu/java/locale/LocaleInformation_gl.java,
gnu/java/locale/LocaleInformation_gu_IN.java,
gnu/java/locale/LocaleInformation_gu.java,
gnu/java/locale/LocaleInformation_gv_GB.java,
gnu/java/locale/LocaleInformation_gv.java,
gnu/java/locale/LocaleInformation_haw.java,
gnu/java/locale/LocaleInformation_haw_US.java,
gnu/java/locale/LocaleInformation_he_IL.java,
gnu/java/locale/LocaleInformation_he.java,
gnu/java/locale/LocaleInformation_hi_IN.java,
gnu/java/locale/LocaleInformation_hi.java,
gnu/java/locale/LocaleInformation_hr.java,
gnu/java/locale/LocaleInformation_hu_HU.java,
gnu/java/locale/LocaleInformation_hu.java,
gnu/java/locale/LocaleInformation_hy_AM.java,
gnu/java/locale/LocaleInformation_hy_AM_REVISED.java,
gnu/java/locale/LocaleInformation_hy.java,
gnu/java/locale/LocaleInformation_id_ID.java,
gnu/java/locale/LocaleInformation_id.java,
gnu/java/locale/LocaleInformation_is_IS.java,
gnu/java/locale/LocaleInformation_is.java,
gnu/java/locale/LocaleInformation_it_CH.java,
gnu/java/locale/LocaleInformation_it_IT.java,
gnu/java/locale/LocaleInformation_it.java,
gnu/java/locale/LocaleInformation_iu.java,
gnu/java/locale/LocaleInformation_iw_IL.java,
gnu/java/locale/LocaleInformation_ja.java,
gnu/java/locale/LocaleInformation_ja_JP.java,
gnu/java/locale/LocaleInformation.java,
gnu/java/locale/LocaleInformation_ka.java,
gnu/java/locale/LocaleInformation_kk.java,
gnu/java/locale/LocaleInformation_kk_KZ.java,
gnu/java/locale/LocaleInformation_kl_GL.java,
gnu/java/locale/LocaleInformation_kl.java,
gnu/java/locale/LocaleInformation_km.java,
gnu/java/locale/LocaleInformation_km_KH.java,
gnu/java/locale/LocaleInformation_kn_IN.java,
gnu/java/locale/LocaleInformation_kn.java,
gnu/java/locale/LocaleInformation_ko.java,
gnu/java/locale/LocaleInformation_kok_IN.java,
gnu/java/locale/LocaleInformation_kok.java,
gnu/java/locale/LocaleInformation_ko_KR.java,
gnu/java/locale/LocaleInformation_kw_GB.java,
gnu/java/locale/LocaleInformation_kw.java,
gnu/java/locale/LocaleInformation_ky.java,
gnu/java/locale/LocaleInformation_lo.java,
gnu/java/locale/LocaleInformation_lo_LA.java,
gnu/java/locale/LocaleInformation_lt.java,
gnu/java/locale/LocaleInformation_lt_LT.java,
gnu/java/locale/LocaleInformation_lv.java,
gnu/java/locale/LocaleInformation_lv_LV.java,
gnu/java/locale/LocaleInformation_mk.java,
gnu/java/locale/LocaleInformation_ml_IN.java,
gnu/java/locale/LocaleInformation_ml.java,
gnu/java/locale/LocaleInformation_mn.java,
gnu/java/locale/LocaleInformation_mn_MN.java,
gnu/java/locale/LocaleInformation_mr_IN.java,
gnu/java/locale/LocaleInformation_mr.java,
gnu/java/locale/LocaleInformation_ms_BN.java,
gnu/java/locale/LocaleInformation_ms.java,
gnu/java/locale/LocaleInformation_ms_MY.java,
gnu/java/locale/LocaleInformation_mt.java,
gnu/java/locale/LocaleInformation_mt_MT.java,
gnu/java/locale/LocaleInformation_nb.java,
gnu/java/locale/LocaleInformation_nb_NO.java,
gnu/java/locale/LocaleInformation_nl_BE.java,
gnu/java/locale/LocaleInformation_nl.java,
gnu/java/locale/LocaleInformation_nl_NL.java,
gnu/java/locale/LocaleInformation_nn.java,
gnu/java/locale/LocaleInformation_nn_NO.java,
gnu/java/locale/LocaleInformation_no_NO.java,
gnu/java/locale/LocaleInformation_oc_FR.java,
gnu/java/locale/LocaleInformation_om_ET.java,
gnu/java/locale/LocaleInformation_om.java,
gnu/java/locale/LocaleInformation_om_KE.java,
gnu/java/locale/LocaleInformation_or_IN.java,
gnu/java/locale/LocaleInformation_or.java,
gnu/java/locale/LocaleInformation_pa_IN.java,
gnu/java/locale/LocaleInformation_pa.java,
gnu/java/locale/LocaleInformation_pl.java,
gnu/java/locale/LocaleInformation_pl_PL.java,
gnu/java/locale/LocaleInformation_ps_AF.java,
gnu/java/locale/LocaleInformation_ps.java,
gnu/java/locale/LocaleInformation_pt_BR.java,
gnu/java/locale/LocaleInformation_pt.java,
gnu/java/locale/LocaleInformation_pt_PT.java,
gnu/java/locale/LocaleInformation_ro.java,
gnu/java/locale/LocaleInformation_ro_RO.java,
gnu/java/locale/LocaleInformation_ru.java,
gnu/java/locale/LocaleInformation_ru_RU.java,
gnu/java/locale/LocaleInformation_ru_UA.java,
gnu/java/locale/LocaleInformation_sa_IN.java,
gnu/java/locale/LocaleInformation_sa.java,
gnu/java/locale/LocaleInformation_se_NO.java,
gnu/java/locale/LocaleInformation_sid_ET.java,
gnu/java/locale/LocaleInformation_sid.java,
gnu/java/locale/LocaleInformation_sk.java,
gnu/java/locale/LocaleInformation_sk_SK.java,
gnu/java/locale/LocaleInformation_sl.java,
gnu/java/locale/LocaleInformation_so_DJ.java,
gnu/java/locale/LocaleInformation_so_ET.java,
gnu/java/locale/LocaleInformation_so.java,
gnu/java/locale/LocaleInformation_so_KE.java,
gnu/java/locale/LocaleInformation_so_SO.java,
gnu/java/locale/LocaleInformation_sq_AL.java,
gnu/java/locale/LocaleInformation_sq.java,
gnu/java/locale/LocaleInformation_sr.java,
gnu/java/locale/LocaleInformation_sr_Latn.java,
gnu/java/locale/LocaleInformation_sv_FI.java,
gnu/java/locale/LocaleInformation_sv.java,
gnu/java/locale/LocaleInformation_sv_SE.java,
gnu/java/locale/LocaleInformation_sw.java,
gnu/java/locale/LocaleInformation_sw_KE.java,
gnu/java/locale/LocaleInformation_sw_TZ.java,
gnu/java/locale/LocaleInformation_syr.java,
gnu/java/locale/LocaleInformation_syr_SY.java,
gnu/java/locale/LocaleInformation_ta_IN.java,
gnu/java/locale/LocaleInformation_ta.java,
gnu/java/locale/LocaleInformation_te_IN.java,
gnu/java/locale/LocaleInformation_te.java,
gnu/java/locale/LocaleInformation_tg_TJ.java,
gnu/java/locale/LocaleInformation_th.java,
gnu/java/locale/LocaleInformation_th_TH.java,
gnu/java/locale/LocaleInformation_ti_ER.java,
gnu/java/locale/LocaleInformation_ti_ET.java,
gnu/java/locale/LocaleInformation_tig_ER.java,
gnu/java/locale/LocaleInformation_tig.java,
gnu/java/locale/LocaleInformation_ti.java,
gnu/java/locale/LocaleInformation_tr.java,
gnu/java/locale/LocaleInformation_tr_TR.java,
gnu/java/locale/LocaleInformation_tt.java,
gnu/java/locale/LocaleInformation_tt_RU.java,
gnu/java/locale/LocaleInformation_uk.java,
gnu/java/locale/LocaleInformation_uk_UA.java,
gnu/java/locale/LocaleInformation_ur.java,
gnu/java/locale/LocaleInformation_uz_AF.java,
gnu/java/locale/LocaleInformation_uz.java,
gnu/java/locale/LocaleInformation_vi.java,
gnu/java/locale/LocaleInformation_wal_ET.java,
gnu/java/locale/LocaleInformation_wal.java,
gnu/java/locale/LocaleInformation_zh_CN_Hans.java,
gnu/java/locale/LocaleInformation_zh_Hant.java,
gnu/java/locale/LocaleInformation_zh_HK_Hant.java,
gnu/java/locale/LocaleInformation_zh.java,
gnu/java/locale/LocaleInformation_zh_MO_Hant.java,
gnu/java/locale/LocaleInformation_zh_SG_Hans.java,
gnu/java/locale/LocaleInformation_zh_TW_Hant.java:
Removed.
2005-05-18 Thomas Fitzsimmons <fitzsim@redhat.com>
* java/awt/Window.java (createBufferStrategy): Remove unnecessary
try-catch blocks.
* java/awt/Canvas.java (createBufferStrategy): Likewise.
* gnu
Diffstat (limited to 'examples')
21 files changed, 3099 insertions, 3 deletions
diff --git a/examples/gnu/classpath/examples/CORBA/NamingService/Demo.java b/examples/gnu/classpath/examples/CORBA/NamingService/Demo.java new file mode 100644 index 000000000..1d6403535 --- /dev/null +++ b/examples/gnu/classpath/examples/CORBA/NamingService/Demo.java @@ -0,0 +1,199 @@ +/* Demo.java -- Shows how to use Classpath transient naming service. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.classpath.examples.CORBA.NamingService; + +import gnu.CORBA.IOR; +import gnu.CORBA.NamingService.NamingServiceTransient; + +import org.omg.CORBA.ORB; +import org.omg.CORBA.Object; +import org.omg.CosNaming.Binding; +import org.omg.CosNaming.BindingHolder; +import org.omg.CosNaming.BindingIterator; +import org.omg.CosNaming.BindingIteratorHolder; +import org.omg.CosNaming.BindingListHolder; +import org.omg.CosNaming.NameComponent; +import org.omg.CosNaming.NamingContext; +import org.omg.CosNaming.NamingContextExt; +import org.omg.CosNaming.NamingContextExtHelper; +import org.omg.CosNaming.NamingContextHelper; + +/** + * A simple test of the naming service. + * + * The main class of the GNU Classpath transient naming service is + * {@link gnu.CORBA.NamingService}. This class must be started + * before starting this example. + * + * This example should interoperate as with GNU Classpath naming + * service, as with Sun Microsystems transient and persistent + * naming services, included in releases 1.3 and 1.4 (tnameserv and + * orbd). To work with this example, the naming service must + * be started on the local host, at the port 900. + * + * The persistent naming service is currently under development. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class Demo +{ + public static void main(final String[] args) + { + // We create the following naming graph: + // <ROOT CONTEXT> + // | + // +--- <c.d context> + // | | + // | +--- obj + // | + // +--- xobj + // + // Where both obj and xobj are CORBA objects, representing the + // default naming service. + // + System.out.println("Starting the GNU Classpath " + + "built-in transient naming service" + ); + + new Thread() + { + public void run() + { + NamingServiceTransient.main(args); + } + }.start(); + + System.out.println("Waiting for three seconds for naming service to start:"); + try + { + Thread.sleep(3000); + } + catch (InterruptedException ex) + { + } + + try + { + ORB orb = ORB.init(args, null); + + Object no = orb.resolve_initial_references("NameService"); + + System.out.println("Naming service IOR:" + orb.object_to_string(no)); + + System.out.println(IOR.parse(orb.object_to_string(no))); + + NamingContextExt namer = NamingContextExtHelper.narrow(no); + + System.out.println("Naming service: " + namer.getClass().getName()); + + NamingContext second = namer.new_context(); + + namer.rebind_context(namer.to_name("c.d"), second); + namer.rebind(namer.to_name("xobj"), no); + + second.rebind(namer.to_name("obj"), no); + + NamingContext nsec = + NamingContextHelper.narrow(namer.resolve_str("c.d")); + + System.out.println(namer.resolve(namer.to_name("c.d/obj"))); + + // In all cases, this must be the same object (the naming + // service itself). + System.out.println(nsec.resolve(new NameComponent[] + { + new NameComponent("obj", "") + } + ) + ); + System.out.println(namer.resolve_str("xobj")); + + // In all cases, this must be the same object (the naming + // service itself). + System.out.println(namer.resolve(new NameComponent[] + { + new NameComponent("c", "d"), + new NameComponent("obj", "") + } + ) + ); + + System.out.println(namer.resolve_str("c.d/obj")); + + System.out.println("Test binding list iterator:"); + + BindingListHolder lh = new BindingListHolder(); + BindingIteratorHolder lih = new BindingIteratorHolder(); + + namer.list(0, lh, lih); + + BindingIterator iter = lih.value; + BindingHolder binding = new BindingHolder(); + + while (iter.next_one(binding)) + { + Binding b = binding.value; + System.out.println("NAME: " + namer.to_string(b.binding_name) + + " TYPE " + b.binding_type.value() + ); + } + + System.out.println("Testing binding list:"); + + iter.destroy(); + + namer.list(Integer.MAX_VALUE, lh, lih); + + for (int i = 0; i < lh.value.length; i++) + { + Binding b = lh.value [ i ]; + System.out.println("NAME: " + namer.to_string(b.binding_name) + + " TYPE " + b.binding_type.value() + ); + } + } + catch (Exception ex) + { + ex.printStackTrace(); + System.exit(1); + } + + System.exit(0); + } +} diff --git a/examples/gnu/classpath/examples/CORBA/SimpleCommunication/Demo.java b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/Demo.java new file mode 100644 index 000000000..70cdb1d27 --- /dev/null +++ b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/Demo.java @@ -0,0 +1,89 @@ +/* Demo.java -- Demonstrates simple CORBA client-server communications. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.classpath.examples.CORBA.SimpleCommunication; + +import gnu.classpath.examples.CORBA.SimpleCommunication.communication.DirectTest; +import gnu.classpath.examples.CORBA.SimpleCommunication.communication.RequestTest; + + +/** + * This sample illustrates the CORBA communication between server + * and client. In this simple example both server and client are + * started on the same virtual machine. For the real interoperability + * tests, however, the server is started on the platform (library+jvm) of + * one vendor, and the client on the platform of another vendor. + * + * The interoperability is currently tested with Sun Microystems + * jre 1.4. + * + * This example required the current folder to be writable to pass + * the IOR references via shared file. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class Demo +{ + public static void main(final String[] args) + { + // Start the server. + new Thread() + { + public void run() + { + comServer.start_server(args); + } + }.start(); + + System.out.println("Waiting for three seconds for the server to start..."); + + // Pause some time for the server to start. + try { + Thread.sleep(3000); + } + catch (InterruptedException ex) { + } + + // Test the stream oriented communication. + DirectTest.main(args); + // Test the request oriented communication. + RequestTest.main(args); + + System.exit(0); + } +} diff --git a/examples/gnu/classpath/examples/CORBA/SimpleCommunication/comServer.java b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/comServer.java new file mode 100644 index 000000000..262fbcd99 --- /dev/null +++ b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/comServer.java @@ -0,0 +1,118 @@ +/* comServer.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.classpath.examples.CORBA.SimpleCommunication; + +import gnu.classpath.examples.CORBA.SimpleCommunication.communication.comServant; + +import org.omg.CORBA.ORB; + +import java.io.FileOutputStream; +import java.io.PrintStream; + +/** + * This is the server class that handles the client requests, + * delegating the functionality to the {@link comServant}. + * + * When starting, the server writes the IOR.txt file into the current + * folder. With the information, stored in this file, the server + * should be reachable over Internet, unless blocked by security tools. + * + * This code is tested for interoperability with Sun Microsystems + * java implementation 1.4.2 (08.b03). Server, client of both can + * be started either on Sun's or on Classpath CORBA implementation, + * in any combinations. + * + * BE SURE TO START THIS SERVER BEFORE STARTING THE CLIENT. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class comServer +{ + + public static void main(String[] args) + { + start_server(args); + } + + public static ORB start_server(String[] args) + { + try + { + // Create and initialize the ORB. + final ORB orb = org.omg.CORBA.ORB.init(args, null); + + // Create the servant and register it with the ORB. + comServant tester = new comServant(); + orb.connect(tester); + + // Storing the IOR reference. + String ior = orb.object_to_string(tester); + System.out.println("IOR: " + ior); + + gnu.CORBA.IOR ii = gnu.CORBA.IOR.parse(ior); + System.out.println(ii); + + // The file IOR.txt in the current folder will be used + // to find the object by clients. + FileOutputStream f = new FileOutputStream("IOR.txt"); + PrintStream p = new PrintStream(f); + p.print(ior); + p.close(); + + System.out.println("The test server ready and waiting ..."); + + new Thread() + { + public void run() + { + // Start the thread, serving the invocations from clients. + orb.run(); + } + }.start(); + + return orb; + } + catch (Exception e) + { + System.err.println("ERROR: " + e); + e.printStackTrace(System.out); + return null; + } + } +} diff --git a/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DirectTest.java b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DirectTest.java new file mode 100644 index 000000000..cf3c41d07 --- /dev/null +++ b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/DirectTest.java @@ -0,0 +1,344 @@ +/* DirectTest.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.classpath.examples.CORBA.SimpleCommunication.communication; + +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.ByteHolder; +import org.omg.CORBA.DoubleHolder; +import org.omg.CORBA.ORB; +import org.omg.CORBA.ShortHolder; +import org.omg.CORBA.StringHolder; +import org.omg.CORBA.UserException; + +import java.io.File; +import java.io.FileReader; +import java.io.IOException; + +/** + * This code uses CORBA to call various methods of the remote object, + * passing data structures in both directions. It finds the server by + * reading the IOR.txt file that must be present in the folder, + * where the program has been started. + * + * The IOR.txt file is written by the server + * {@link gnu.classpath.examples.CORBA.SimpleCommunication.comServer}. + * The server should be reachable over Internet, unless blocked by + * security tools. + * + * This code is tested for interoperability with Sun Microsystems + * java implementation 1.4.2 (08.b03). Server, client of both can + * be started either on Sun's or on Classpath CORBA implementation, + * in any combinations. + * + * BE SURE TO START THE SERVER BEFORE STARTING THE CLIENT. + * + * This version uses direct casting. This is the most convenient + * method, but it is normally used together with the IDL compiler. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class DirectTest +{ + /* + * The IOR.txt file, used to find the server and the object on the server. is written when starting the accompanying + */ + public static final String IOR_FILE = "IOR.txt"; + + /** + * The invocation target. + */ + comTester object; + + /** + * Get the object reference. + */ + public static void main(String[] args) + { + try + { + ORB orb = org.omg.CORBA.ORB.init(args, null); + + File f = new File(IOR_FILE); + char[] c = new char[ (int) f.length() ]; + FileReader fr = new FileReader(f); + fr.read(c); + fr.close(); + + String ior = new String(c); + DirectTest we = new DirectTest(); + we.object = (comTester) orb.string_to_object(ior); + we.Demo(); + orb.shutdown(false); + } + catch (IOException ex) + { + System.out.println("Cannot find or read the IOR file " + + "in the current folder" + ); + ex.printStackTrace(); + } + } + + /** Run all demos. */ + public void Demo() + { + testHello(); + testField(); + testParameters(); + testStringArray(); + testStructure(); + testWideNarrowStrings(); + testTree(); + testSystemException(); + testUserException(); + } + + /** + * Test the field getter/setter. + */ + public void testField() + { + System.out.println("***** Test the remote field getter/setter."); + System.out.println("The field value is now " + object.theField()); + System.out.println("Setting it to 555"); + object.theField(555); + System.out.println("The field value is now " + object.theField()); + } + + /** The simple invocation of the parameterless remote method. */ + public void testHello() + { + System.out.println("***** Say hello (see the server console)."); + object.sayHello(); + } + + /** + * Test passing multiple parameters in both directions. + */ + public void testParameters() + { + System.out.println("***** Pass multiple parameters."); + + // Holder classes are required to simulate passing + // "by reference" (modification is returned back to the server). + ByteHolder a_byte = new ByteHolder((byte) 0); + ShortHolder a_short = new ShortHolder((short) 3); + StringHolder a_string = new StringHolder("[string 4]"); + + // This is an 'out' parameter; the value must not be passed to servant. + DoubleHolder a_double = new DoubleHolder(56.789); + + int returned = object.passSimple(a_byte, 2, a_short, a_string, a_double); + + System.out.println(" Returned value " + returned); + System.out.println(" Returned parameters: "); + System.out.println(" octet " + a_byte.value); + System.out.println(" short " + a_short.value); + System.out.println(" string '" + a_string.value+"'"); + System.out.println(" double " + a_double.value); + } + + /** + * Test passing the string array, flexible size. + */ + public void testStringArray() + { + System.out.println("***** Pass string array."); + + String[] x = new String[] { "one", "two" }; + + // The array is passed as CORBA sequence, variable size is supported. + String[] y = object.passStrings(x); + + for (int i = 0; i < y.length; i++) + { + System.out.println(" Passed " + x [ i ] + ", returned: " + y [ i ]); + } + } + + /** + * Test passing the structures. + */ + public void testStructure() + { + System.out.println("***** Pass structure"); + + passThis arg = new passThis(); + arg.a = "A"; + arg.b = "B"; + + returnThis r = object.passStructure(arg); + + System.out.println(" Fields of the returned structure:"); + + System.out.println(" c: " + r.c); + System.out.println(" n: " + r.n); + + // The field r.arra is declared as the fixed size CORBA array. + System.out.println(" r[0]: " + r.arra [ 0 ]); + System.out.println(" r[1]: " + r.arra [ 1 ]); + System.out.println(" r[3]: " + r.arra [ 2 ]); + } + + /** + * Test catching the system exception, thrown on the remote side. + */ + public void testSystemException() + { + System.out.println("**** Test system exception:"); + try + { + // Negative parameter = system exception. + object.throwException(-55); + } + catch (BAD_OPERATION ex) + { + System.out.println(" The expected BAD_OPERATION, minor code " + + ex.minor + ", has been thrown on remote side." + ); + } + catch (UserException uex) + { + throw new InternalError(); + } + } + + /** + * Test passing the tree structure. Any shape of the tree is + * supported without rewriting the code. + */ + public void testTree() + { + // Manually create the tree of nodes: + // Root + // +-- a + // | + // +-- b + // +-- ba + // | | + // | +-- bac + // | + // +-- bb + System.out.println("***** Pass and return the tree."); + + node n = nod("Root"); + + n.children = new node[] { nod("a"), nod("b") }; + n.children [ 1 ].children = new node[] { nod("ba"), nod("bb") }; + n.children [ 1 ].children [ 0 ].children = new node[] { nod("bac") }; + + nodeHolder nh = new nodeHolder(n); + + // The server should add '++' to each node name. + object.passTree(nh); + + // Convert the returned tree to some strig representation. + StringBuffer img = new StringBuffer(); + getImage(img, nh.value); + + System.out.println("Returned tree: " + img.toString()); + } + + /** + * Test catching the user exception, thrown on the remote side. + */ + public void testUserException() + { + System.out.println("**** Test user exception:"); + try + { + // The user exception contains one user-defined field that will + // be initialised to the passed parameter. + object.throwException(123); + throw new InternalError(); + } + catch (ourUserException uex) + { + System.out.println(" The user exception with field " + uex.ourField + + ", has been thrown on remote side." + ); + } + } + + /** + * Passes wide (UTF-16) string and narrow (ISO8859_1) string. + * @see gnu.CORBA.GIOP.CharSets_OSF for supported and default + * encodings. + */ + public void testWideNarrowStrings() + { + System.out.println("**** Test 8 bit and 16 bit char strings"); + + String r = object.passCharacters("wide string", "narrow string"); + System.out.println(" returned: '" + r + "'"); + } + + /** + * Get the string representation of the passed tree. + * @param b the string buffer to accumulate the representation. + * @param n the tree (root node). + */ + private void getImage(StringBuffer b, node n) + { + b.append(n.name); + b.append(": ("); + + for (int i = 0; i < n.children.length; i++) + { + getImage(b, n.children [ i ]); + b.append(' '); + } + b.append(") "); + } + + /** + * Create a node with the given header. + * + * @param hdr the node header. + * @return the created node. + */ + private node nod(String hdr) + { + node n = new node(); + n.children = new node[ 0 ]; + n.name = hdr; + + return n; + } +} diff --git a/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/RequestTest.java b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/RequestTest.java new file mode 100644 index 000000000..3c56a3876 --- /dev/null +++ b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/RequestTest.java @@ -0,0 +1,258 @@ + + +package gnu.classpath.examples.CORBA.SimpleCommunication.communication; + +import java.io.File; +import java.io.FileReader; +import java.io.IOException; + +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.ByteHolder; +import org.omg.CORBA.DoubleHolder; +import org.omg.CORBA.ExceptionList; +import org.omg.CORBA.NVList; +import org.omg.CORBA.ORB; +import org.omg.CORBA.Request; +import org.omg.CORBA.ShortHolder; +import org.omg.CORBA.StringHolder; +import org.omg.CORBA.TCKind; + +/** + * This code uses CORBA to call various methods of the remote object, + * passing data structures in both directions. It finds the server by + * reading the IOR.txt file that must be present in the folder, + * where the program has been started. + * + * The IOR.txt file is written by the server + * {@link gnu.classpath.examples.CORBA.SimpleCommunication.comServer}. + * The server should be reachable over Internet, unless blocked by + * security tools. + * + * This code is tested for interoperability with Sun Microsystems + * java implementation 1.4.2 (08.b03). Server, client of both can + * be started either on Sun's or on Classpath CORBA implementation, + * in any combinations. + * + * BE SURE TO START THE SERVER BEFORE STARTING THE CLIENT. + * + * Test invocations using org.omg.CORBA.Request. The methods are + * called by "name", like in java.lang.reflect. + * No need to have the local pre-compiled stub classes. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class RequestTest +{ + /* + * The IOR.txt file, used to find the server and the object on the server. is written when starting the accompanying + */ + public static final String IOR_FILE = "IOR.txt"; + + /** + * The Object Request Brocker, used for various CORBA operations. + */ + ORB orb; + + /** + * Our remote object - the invocation target. + */ + org.omg.CORBA.Object object; + + /** + * Prepare for work. Read the file IOR.txt in the current folder + * and find the server using its information. + */ + public static void main(String[] args) + { + RequestTest we = new RequestTest(); + + we.orb = org.omg.CORBA.ORB.init(new String[ 0 ], null); + + char[] c = null; + try + { + File f = new File(IOR_FILE); + c = new char[ (int) f.length() ]; + + FileReader fr = new FileReader(f); + fr.read(c); + fr.close(); + } + catch (IOException ex) + { + System.out.println("Unable to write the IOR.txt into the current folder"); + ex.printStackTrace(); + } + + String ior = new String(c); + + we.object = we.orb.string_to_object(ior); + we.Demo(); + we.orb.shutdown(false); + } + + /** Run all demos. */ + public void Demo() + { + testHello(); + try + { + testParameters(); + } + catch (Exception ex) + { + // Not expected. + throw new InternalError(); + } + testSystemException(); + testUserException(); + testWideNarrowStrings(); + } + + /** + * Send the hello message, one way. + */ + public void testHello() + { + System.out.println("***** Test 'HELLO WORLD' (see the server console)."); + + Request hello = + object._create_request(null, "sayHello", orb.create_list(0), null); + + // No response expected. + hello.send_oneway(); + } + + /** + * Test passing various parameters in both directions. + */ + public void testParameters() + throws Exception + { + System.out.println("***** Test passing multiple parameters:"); + + Request r = + object._create_request(null, "passSimple", orb.create_list(0), null); + + ByteHolder a_byte = new ByteHolder((byte) 0); + ShortHolder a_short = new ShortHolder((short) 3); + StringHolder a_string = new StringHolder("[string 4]"); + + // This is an 'out' parameter; the value must not be passed to servant. + DoubleHolder a_double = new DoubleHolder(56.789); + + r.add_inout_arg().insert_octet((byte) 0); + r.add_in_arg().insert_long(2); + r.add_inout_arg().insert_short((short) 3); + r.add_inout_arg().insert_string("[string 4]"); + r.add_out_arg().type(orb.get_primitive_tc(TCKind.tk_double)); + + NVList para = r.arguments(); + + System.out.println(" --- Parameters before invocation: "); + + System.out.println(" octet " + para.item(0).value().extract_octet()); + System.out.println(" long (in parameter) " + + para.item(1).value().extract_long() + ); + System.out.println(" short " + para.item(2).value().extract_short()); + System.out.println(" string " + para.item(3).value().extract_string()); + + // For the last parameter, the value is not set. + r.set_return_type(orb.get_primitive_tc(TCKind.tk_long)); + + r.invoke(); + + para = r.arguments(); + + System.out.println(" --- Parameters after invocation:"); + + System.out.println(" octet " + para.item(0).value().extract_octet()); + System.out.println(" long (in parameter, must not be changed) " + + para.item(1).value().extract_long() + ); + System.out.println(" short " + para.item(2).value().extract_short()); + System.out.println(" string " + para.item(3).value().extract_string()); + System.out.println(" double " + para.item(4).value().extract_double()); + + System.out.println(" Returned value " + r.result().value().extract_long()); + } + + /** + * Test catching the system exception, thrown on the remote side. + */ + public void testSystemException() + { + System.out.println("**** Test system exception:"); + try + { + ExceptionList exList = orb.create_exception_list(); + exList.add(ourUserExceptionHelper.type()); + + Request rq = + object._create_request(null, "throwException", orb.create_list(1), + null, exList, null + ); + + rq.add_in_arg().insert_long(-55); + + rq.invoke(); + + throw new InternalError(); + } + catch (BAD_OPERATION ex) + { + System.out.println(" The expected BAD_OPERATION, minor code " + + ex.minor + ", has been thrown on remote side." + ); + } + } + + /** + * Test catching the user exception, thrown on the remote side. + */ + public void testUserException() + { + System.out.println("**** Test user exception:"); + + ExceptionList exList = orb.create_exception_list(); + exList.add(ourUserExceptionHelper.type()); + + Request rq = + object._create_request(null, "throwException", orb.create_list(1), null, + exList, null + ); + + rq.add_in_arg().insert_long(123); + rq.invoke(); + + ourUserException ou = (ourUserException) rq.env().exception(); + + System.out.println(" Our user exception, field " + ou.ourField + + ", has been thrown on remote side." + ); + } + + /** + * Passes wide (UTF-16) string and narrow (ISO8859_1) string. + * @see gnu.CORBA.GIOP.CharSets_OSF for supported and default + * encodings. + */ + public void testWideNarrowStrings() + throws BAD_OPERATION + { + System.out.println("**** Test 8 bit and 16 bit char strings"); + + Request rq = + object._create_request(null, "passCharacters", orb.create_list(0), null); + + rq.add_in_arg().insert_wstring("wide string"); + rq.add_in_arg().insert_string("narrow string"); + + rq.set_return_type(orb.get_primitive_tc(TCKind.tk_wstring)); + + rq.invoke(); + + System.out.println(" Returned ' " + rq.result().value().extract_wstring()); + } +} diff --git a/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_comTesterImplBase.java b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_comTesterImplBase.java new file mode 100644 index 000000000..2c5c8683c --- /dev/null +++ b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_comTesterImplBase.java @@ -0,0 +1,206 @@ +/* _comTesterImplBase.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.classpath.examples.CORBA.SimpleCommunication.communication; + +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.ByteHolder; +import org.omg.CORBA.CompletionStatus; +import org.omg.CORBA.DoubleHolder; +import org.omg.CORBA.ShortHolder; +import org.omg.CORBA.StringHolder; +import org.omg.CORBA.StringSeqHelper; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.InvokeHandler; +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.ResponseHandler; + +/** + * The base for the class that is actually implementing the functionality + * of the object on the server side ({@link comServant} of our case). + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class _comTesterImplBase + extends ObjectImpl + implements comTester, InvokeHandler +{ +/** + * When the server receives the request message from client, it + * calls this method. + * + * @param a_method the method name. + * @param in the CDR stream, from where the implementing code must + * read the method parameters. + * @param rh the response handler, used to get the stream where + * the returned values must be written. + * + * @return the stream, obtained from the response handler. + */ + public OutputStream _invoke(String a_method, InputStream in, + ResponseHandler rh + ) + { + OutputStream out; + + /* Get the field value. */ + if (a_method.equals("_get_theField")) + { + int result = (int) 0; + result = theField(); + out = rh.createReply(); + out.write_long(result); + } + else + /* Set the field value. */ + if (a_method.equals("_set_theField")) + { + int newTheField = in.read_long(); + theField(newTheField); + out = rh.createReply(); + } + else + /* Logs calls to the file. */ + if (a_method.equals("sayHello")) + { + sayHello(); + out = rh.createReply(); + } + else + /* Passes various parameters in both directions. */ + if (a_method.equals("passSimple")) + { + ByteHolder an_octet = new ByteHolder(); + an_octet.value = in.read_octet(); + + int a_long = in.read_long(); + ShortHolder a_short = new ShortHolder(); + a_short.value = in.read_short(); + + StringHolder a_string = new StringHolder(); + a_string.value = in.read_string(); + + DoubleHolder a_double = new DoubleHolder(); + int result = passSimple(an_octet, a_long, a_short, a_string, a_double); + out = rh.createReply(); + out.write_long(result); + out.write_octet(an_octet.value); + out.write_short(a_short.value); + out.write_string(a_string.value); + out.write_double(a_double.value); + } + else + /* Passes the 'wide' (usually Unicode) string and the ordinary string. */ + if (a_method.equals("passCharacters")) + { + String wide = in.read_wstring(); + String narrow = in.read_string(); + String result = null; + result = passCharacters(wide, narrow); + out = rh.createReply(); + out.write_wstring(result); + } + else + /* + Throws either 'ourUserException' with the 'ourField' field + initialised to the passed positive value + or system exception (if the parameter is zero or negative). + */ + if (a_method.equals("throwException")) + { + try + { + int parameter = in.read_long(); + throwException(parameter); + out = rh.createReply(); + } + catch (ourUserException exception) + { + out = rh.createExceptionReply(); + ourUserExceptionHelper.write(out, exception); + } + } + else + /* Passes and returns the structures. */ + if (a_method.equals("passStructure")) + { + passThis in_structure = passThisHelper.read(in); + returnThis result = null; + result = passStructure(in_structure); + out = rh.createReply(); + returnThisHelper.write(out, result); + } + else + /* Passes and returns the string sequence. */ + if (a_method.equals("passStrings")) + { + String[] arg = StringSeqHelper.read(in); + String[] result = null; + result = passStrings(arg); + out = rh.createReply(); + StringSeqHelper.write(out, result); + } + else + /** Pass and return the tree structure */ + if (a_method.equals("passTree")) + { + nodeHolder tree = new nodeHolder(); + tree.value = nodeHelper.read(in); + passTree(tree); + out = rh.createReply(); + nodeHelper.write(out, tree.value); + } + + else + throw new BAD_OPERATION("No method: " + a_method, 0, + CompletionStatus.COMPLETED_MAYBE + ); + + return out; + } + + /** + * Return an array of this object repository ids. + */ + public String[] _ids() + { + // They are the same as for the stub. + return _comTesterStub._ids; + } +} diff --git a/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_comTesterStub.java b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_comTesterStub.java new file mode 100644 index 000000000..437e81f08 --- /dev/null +++ b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_comTesterStub.java @@ -0,0 +1,426 @@ +/* _comTesterStub.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.classpath.examples.CORBA.SimpleCommunication.communication; + +import org.omg.CORBA.ByteHolder; +import org.omg.CORBA.DoubleHolder; +import org.omg.CORBA.MARSHAL; +import org.omg.CORBA.ShortHolder; +import org.omg.CORBA.StringHolder; +import org.omg.CORBA.StringSeqHelper; +import org.omg.CORBA.portable.ApplicationException; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.ObjectImpl; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.RemarshalException; + +/** + * The stub (proxy) class, representing the remote object on the client + * side. It has all the same methods as the actual implementation + * on the server side. These methods contain the code for remote + * invocation. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class _comTesterStub + extends ObjectImpl + implements comTester +{ + /** + * A string array of comTester repository ids. + */ + public static String[] _ids = + { + "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/comTester:1.0" + }; + + /** + * Return an array of comTester repository ids. + */ + public String[] _ids() + { + return _ids; + } + + /** + * Passes wide (UTF-16) string and narrow (ISO8859_1) string. + * @see gnu.CORBA.GIOP.CharSets_OSF for supported and default + * encodings. + */ + public String passCharacters(String wide, String narrow) + { + InputStream in = null; + try + { + // Get the output stream. + OutputStream out = _request("passCharacters", true); + + // Write the parameters. + + // The first string is passed as "wide" + // (usually 16 bit UTF-16) string. + out.write_wstring(wide); + + // The second string is passed as "narrow" + // (usually 8 bit ISO8859_1) string. + out.write_string(narrow); + + // Do the invocation. + in = _invoke(out); + + // Read the method return value. + String result = in.read_wstring(); + return result; + } + catch (ApplicationException ex) + { + // The exception has been throws on remote side, but we + // do not expect any. Throw the MARSHAL exception. + in = ex.getInputStream(); + throw new MARSHAL(ex.getId()); + } + catch (RemarshalException _rm) + { + // This exception means that the parameters must be re-written. + return passCharacters(wide, narrow); + } + finally + { + // Release the resources, associated with the reply stream. + _releaseReply(in); + } + } + + /** + * Passes various parameters in both directions. The parameters that + * shoud also return the values are wrapped into holders. + */ + public int passSimple(ByteHolder an_octet, int a_long, ShortHolder a_short, + StringHolder a_string, DoubleHolder a_double + ) + { + InputStream in = null; + try + { + // Get the stream where the parameters must be written: + OutputStream out = _request("passSimple", true); + + // Write the parameters. + out.write_octet(an_octet.value); + out.write_long(a_long); + out.write_short(a_short.value); + out.write_string(a_string.value); + + // Invoke the method. + in = _invoke(out); + + // Read the returned values. + int result = in.read_long(); + + // Read the inout and out parameters. + an_octet.value = in.read_octet(); + a_short.value = in.read_short(); + a_string.value = in.read_string(); + a_double.value = in.read_double(); + return result; + } + catch (ApplicationException ex) + { + // Handle excepion on remote side. + in = ex.getInputStream(); + throw new MARSHAL(ex.getId()); + } + catch (RemarshalException _rm) + { + // Handle instruction to resend the parameters. + return passSimple(an_octet, a_long, a_short, a_string, a_double); + } + finally + { + _releaseReply(in); + } + } + + /** + Passes and returns the string sequence. + */ + public String[] passStrings(String[] arg) + { + InputStream in = null; + try + { + // Get the stream where the parameters must be written: + OutputStream out = _request("passStrings", true); + + // Wrap the string array using the string sequence helper. + StringSeqHelper.write(out, arg); + + // Invoke the method. + in = _invoke(out); + + // Read the returned result using the string sequence helper. + String[] result = StringSeqHelper.read(in); + return result; + } + catch (ApplicationException ex) + { + // Handle the exception, thrown on remote side. + in = ex.getInputStream(); + throw new MARSHAL(ex.getId()); + } + catch (RemarshalException _rm) + { + return passStrings(arg); + } + finally + { + _releaseReply(in); + } + } + + /** + Passes and returns the structures. + */ + public returnThis passStructure(passThis in_structure) + { + InputStream in = null; + try + { + // Get the stream where the parameters must be written. + OutputStream out = _request("passStructure", true); + + // Write the structure, using its helper. + passThisHelper.write(out, in_structure); + + // Invoke the method. + in = _invoke(out); + + // Read the returned structer, using another helper. + returnThis result = returnThisHelper.read(in); + return result; + } + catch (ApplicationException ex) + { + in = ex.getInputStream(); + throw new MARSHAL(ex.getId()); + } + catch (RemarshalException _rm) + { + return passStructure(in_structure); + } + finally + { + _releaseReply(in); + } + } + + /** + * Pass and return the tree structure + */ + public void passTree(nodeHolder tree) + { + InputStream in = null; + try + { + // Get the stream where the parameters must be written. + OutputStream out = _request("passTree", true); + + // Write the tree (node with its chilred, grandchildren and so on), + // using the appropriate helper. + nodeHelper.write(out, tree.value); + + // Call the method. + in = _invoke(out); + + // Read the returned tree. + tree.value = nodeHelper.read(in); + } + catch (ApplicationException ex) + { + // Handle eception on remote side. + in = ex.getInputStream(); + throw new MARSHAL(ex.getId()); + } + catch (RemarshalException _rm) + { + passTree(tree); + } + finally + { + _releaseReply(in); + } + } + + /** + * One way call of the remote method. + */ + public void sayHello() + { + InputStream in = null; + try + { + // As we do not expect any response, the second + // parameter is 'false'. + OutputStream out = _request("sayHello", false); + in = _invoke(out); + } + catch (ApplicationException ex) + { + in = ex.getInputStream(); + throw new MARSHAL(ex.getId()); + } + catch (RemarshalException _rm) + { + sayHello(); + } + finally + { + _releaseReply(in); + } + } + + /** + * Get the field value. + */ + public int theField() + { + InputStream in = null; + try + { + // The special name of operation instructs just to get + // the field value rather than calling the method. + OutputStream out = _request("_get_theField", true); + in = _invoke(out); + + int result = in.read_long(); + return result; + } + catch (ApplicationException ex) + { + in = ex.getInputStream(); + throw new MARSHAL(ex.getId()); + } + catch (RemarshalException _rm) + { + return theField(); + } + finally + { + _releaseReply(in); + } + } + + /** + * Set the field value. + */ + public void theField(int newTheField) + { + InputStream in = null; + try + { + // The special name of operation instructs just to set + // the field value rather than calling the method. + OutputStream out = _request("_set_theField", true); + out.write_long(newTheField); + in = _invoke(out); + } + catch (ApplicationException ex) + { + in = ex.getInputStream(); + throw new MARSHAL(ex.getId()); + } + catch (RemarshalException _rm) + { + theField(newTheField); + } + finally + { + _releaseReply(in); + } + } + + /** + * The server side exception tests. + * + * @param parameter the server throws the user exception in the case + * of the positive value of this argument, and system + * exception otherwise. + * + * @throws ourUserException + */ + public void throwException(int parameter) + throws ourUserException + { + InputStream in = null; + try + { + // Get stream. + OutputStream out = _request("throwException", true); + + // Write parameter. + out.write_long(parameter); + + // Call method. + in = _invoke(out); + } + catch (ApplicationException ex) + { + in = ex.getInputStream(); + + // Get the exception id. + String id = ex.getId(); + + // If this is the user exception we expect to catch, read and throw + // it here. The system exception, if thrown, is handled by _invoke. + if (id.equals("IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/ourUserException:1.0") + ) + throw ourUserExceptionHelper.read(in); + else + throw new MARSHAL(id); + } + catch (RemarshalException _rm) + { + throwException(parameter); + } + finally + { + _releaseReply(in); + } + } +} diff --git a/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/comServant.java b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/comServant.java new file mode 100644 index 000000000..7f286cbbc --- /dev/null +++ b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/comServant.java @@ -0,0 +1,236 @@ +/* comServant.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.classpath.examples.CORBA.SimpleCommunication.communication; + +import org.omg.CORBA.BAD_OPERATION; +import org.omg.CORBA.ByteHolder; +import org.omg.CORBA.CompletionStatus; +import org.omg.CORBA.DoubleHolder; +import org.omg.CORBA.ShortHolder; +import org.omg.CORBA.StringHolder; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.PrintStream; + +/** + * This class handles the actual server functionality in this test + * application. When the client calls the remote method, this + * finally results calling the method of this class. + * + * The parameters, passed to the server only, are just parameters of the + * java methods. The parameters that shuld be returned to client + * are wrapped into holder classes. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class comServant + extends _comTesterImplBase +{ + /** + * The field, that can be set and checked by remote client. + */ + private int m_theField = 17; + + /** + * Passes wide (UTF-16) string and narrow (ISO8859_1) string. + * @see gnu.CORBA.GIOP.CharSets_OSF for supported and default + * encodings. Returs they generalization as a wide string. + */ + public String passCharacters(String wide, String narrow) + { + System.out.println("SERVER: **** Wide and narrow string test."); + System.out.println("SERVER: Received '" + narrow + "' and '" + wide + + "'" + ); + + return "return '" + narrow + "' and '" + wide + "'"; + } + + /** + * Accept and return parameters, having various types. + */ + public int passSimple(ByteHolder an_octet, int a_long, ShortHolder a_short, + StringHolder a_string, DoubleHolder a_double + ) + { + System.out.println("SERVER: ***** Test passing multiple parameters"); + System.out.println("SERVER: Received:"); + System.out.println("SERVER: octet " + an_octet.value); + System.out.println("SERVER: short " + a_short.value); + System.out.println("SERVER: string " + a_string.value); + + // Returning incremented values. + an_octet.value++; + a_short.value++; + + // OUT parameter, return only. + a_double.value = 1; + a_string.value += " [return]"; + return 452572; + } + + /** + * Accept and return the string arrays. + */ + public String[] passStrings(String[] args) + { + System.out.println("SERVER: ***** Transferring string arrays"); + + String[] rt = new String[ args.length ]; + for (int i = 0; i < args.length; i++) + { + System.out.println("SERVER: " + args [ i ]); + + // Returning the changed content. + rt [ i ] = args [ i ] + ":" + args [ i ]; + } + return rt; + } + + /** + * Accept and return the structures. + */ + public returnThis passStructure(passThis in_structure) + { + System.out.println("SERVER: ***** Transferring structures"); + System.out.println("SERVER: Received " + in_structure.a + ":" + + in_structure.b + ); + + // Create and send back the returned structure. + returnThis r = new returnThis(); + r.c = in_structure.a + in_structure.b; + r.n = 555; + r.arra = new int[] { 11, 22, 33 }; + return r; + } + + /** + * Pass and return the tree structure + */ + public void passTree(nodeHolder tree) + { + System.out.println("SERVER: ***** Transferring tree"); + + StringBuffer b = new StringBuffer(); + + // This both creates the tree string representation + // and changes the node names. + getImage(b, tree.value); + System.out.println("SERVER: The tree was: " + b + ", returning changed."); + } + + /** + * Just prints the hello message. + */ + public void sayHello() + { + System.out.println("SERVER: ***** Hello, world!"); + } + + /** + * Get the value of our field. + */ + public int theField() + { + System.out.println("SERVER: ***** Getting the field value, " + m_theField); + return m_theField; + } + + /** + * Set the value of our field. + */ + public void theField(int a_field) + { + System.out.println("SERVER: ***** Setting the field value to " + a_field); + m_theField = a_field; + } + + /** + * Throw an exception. + * + * @param parameter specifies which exception will be thrown. + * + * @throws ourUserException for the non negative parameter. + * @throws BAD_OPERATION for the negative parameter. + */ + public void throwException(int parameter) + throws ourUserException + { + System.out.println("SERVER: ***** Testing exceptions"); + if (parameter > 0) + { + System.out.println("SERVER: Throwing the user exception, " + + "specific field = "+parameter + ); + throw new ourUserException(parameter); + } + else + { + System.out.println("SERVER: Throwing " + + "the BAD_OPERATION, minor 456, completed" + ); + throw new BAD_OPERATION(456, CompletionStatus.COMPLETED_YES); + } + } + + /** + * Visit all tree nodes, getting the string representation + * and adding '++' to the node names. + * + * @param b the buffer to collect the string representation. + * @param n the rott tree node. + */ + private void getImage(StringBuffer b, node n) + { + b.append(n.name); + n.name = n.name + "++"; + b.append(": ("); + + for (int i = 0; i < n.children.length; i++) + { + getImage(b, n.children [ i ]); + b.append(' '); + } + b.append(") "); + } +} diff --git a/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/comTester.java b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/comTester.java new file mode 100644 index 000000000..49188b6e1 --- /dev/null +++ b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/comTester.java @@ -0,0 +1,111 @@ +/* comTester.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.classpath.examples.CORBA.SimpleCommunication.communication; + +import org.omg.CORBA.ByteHolder; +import org.omg.CORBA.DoubleHolder; +import org.omg.CORBA.ShortHolder; +import org.omg.CORBA.StringHolder; + +/** + * The interface of our remote object. Some IDL compiles split it + * into "comTester" and "comTesterOperations", but we do not see + * much sense in doing this here. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface comTester +{ + /** + * Passes wide (UTF-16) string and narrow (ISO8859_1) string. + * Both types are mapped into java String. + * + * @see gnu.CORBA.GIOP.CharSets_OSF for supported and default + * encodings. + */ + String passCharacters(String wide, String narrow); + + /** + * Passes various parameters in both directions. + * The parameters that must return the value are wrapped in holders. + */ + int passSimple(ByteHolder an_octet, int a_long, ShortHolder a_short, + StringHolder a_string, DoubleHolder a_double + ); + + /** + * Passes and returns the string sequence (flexible length). + */ + String[] passStrings(String[] arg); + + /** + * Passes and returns the structures. + */ + returnThis passStructure(passThis in_structure); + + /** + * Pass and return the tree structure + * + * @param tree the root node of the tree. + */ + void passTree(nodeHolder tree); + + /** + * Just prints the "Hello" message. + */ + void sayHello(); + + /** + * Gets the value of the field in our object. + */ + int theField(); + + /** + * Sets the value for the field in our object. + */ + void theField(int newTheField); + + /** + * Throws either 'ourUserException' with the 'ourField' field + * initialised to the passed positive value + * or system exception (if the parameter is zero or negative). + */ + void throwException(int parameter) + throws ourUserException; +} diff --git a/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/node.java b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/node.java new file mode 100644 index 000000000..4040eb769 --- /dev/null +++ b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/node.java @@ -0,0 +1,55 @@ +/* node.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.classpath.examples.CORBA.SimpleCommunication.communication; + +/** + * The support for the tree structure, used in the test of + * ability to pass and return the tree structure. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class node + implements org.omg.CORBA.portable.IDLEntity +{ + /** The node name */ + public String name = null; + + /** The node children. */ + public node[] children = null; +} diff --git a/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/nodeHelper.java b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/nodeHelper.java new file mode 100644 index 000000000..46fc0a791 --- /dev/null +++ b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/nodeHelper.java @@ -0,0 +1,160 @@ +/* nodeHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.classpath.examples.CORBA.SimpleCommunication.communication; + +import org.omg.CORBA.Any; +import org.omg.CORBA.ORB; +import org.omg.CORBA.StructMember; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * This class is used for various helper operations around the + * tree {@link} structure. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class nodeHelper +{ + /** + * The node repository id, used to identify the structure. + */ + private static String _id = + "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/node:1.0"; + + /** + * Caches the typecode, allowing to compute it only once. + */ + private static TypeCode typeCode; + + /** + * This is used to handle the recursive object references in + * CORBA - supported way. The tree node definition is recursive, + * as the node contains the sequence of the nodes as its field. + */ + private static boolean active; + + /** + * Extract the tree node from the unversal CORBA wrapper, Any. + */ + public static node extract(Any a) + { + return read(a.create_input_stream()); + } + + /** + * Get the node string identifer. + */ + public static String id() + { + return _id; + } + + /** + * Insert the node into the universal CORBA wrapper, Any. + */ + public static void insert(Any a, node that) + { + OutputStream out = a.create_output_stream(); + a.type(type()); + write(out, that); + a.read_value(out.create_input_stream(), type()); + } + + /** + * Read the node from the common data reprentation (CDR) stream. + */ + public static node read(InputStream istream) + { + node value = new node(); + value.name = istream.read_string(); + + int _len0 = istream.read_long(); + value.children = new node[ _len0 ]; + for (int i = 0; i < value.children.length; ++i) + value.children [ i ] = nodeHelper.read(istream); + return value; + } + + /** + * Get the node type code definition. + */ + public static synchronized TypeCode type() + { + // Compute the type code only once. + if (typeCode == null) + { + synchronized (TypeCode.class) + { + if (typeCode == null) + { + // To avoid the infinite recursion loop, the + // recursive reference is handled in specific way. + if (active) + return ORB.init().create_recursive_tc(_id); + active = true; + + // List all memebers of the node structure. + StructMember[] members = new StructMember[ 2 ]; + TypeCode memberType; + memberType = ORB.init().create_string_tc(0); + members [ 0 ] = new StructMember("name", memberType, null); + memberType = ORB.init().create_recursive_tc(""); + members [ 1 ] = new StructMember("children", memberType, null); + typeCode = + ORB.init().create_struct_tc(nodeHelper.id(), "node", members); + active = false; + } + } + } + return typeCode; + } + + /** + * Write the node into the common data reprentation (CDR) stream. + */ + public static void write(OutputStream ostream, node value) + { + ostream.write_string(value.name); + ostream.write_long(value.children.length); + for (int i = 0; i < value.children.length; ++i) + nodeHelper.write(ostream, value.children [ i ]); + } +} diff --git a/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/nodeHolder.java b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/nodeHolder.java new file mode 100644 index 000000000..93d53912a --- /dev/null +++ b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/nodeHolder.java @@ -0,0 +1,100 @@ +/* nodeHolder.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.classpath.examples.CORBA.SimpleCommunication.communication; + +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * The node holder is a wrapper about the node data structure. It + * can be used where the node must be passed both to and from + * the method being called. The same structure holds the tree, + * as it can be represented as a root node with children. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class nodeHolder + implements Streamable +{ + /** + * Stores the node value. + */ + public node value; + + /** + * Creates the node holder with the null initial value. + */ + public nodeHolder() + { + } + + /** + * Creates the node holder with the given initial value. + */ + public nodeHolder(node initialValue) + { + value = initialValue; + } + + /** + * Reads the node value from the common data representation (CDR) + * stream. + */ + public void _read(InputStream in) + { + value = nodeHelper.read(in); + } + + /** + * Writes the node value into common data representation (CDR) + * stream. + * @return + */ + public TypeCode _type() + { + return nodeHelper.type(); + } + + public void _write(OutputStream out) + { + nodeHelper.write(out, value); + } +} diff --git a/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/ourUserException.java b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/ourUserException.java new file mode 100644 index 000000000..aea4a8bd9 --- /dev/null +++ b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/ourUserException.java @@ -0,0 +1,70 @@ +/* ourUserException.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.classpath.examples.CORBA.SimpleCommunication.communication; + +import org.omg.CORBA.UserException; +import org.omg.CORBA.portable.IDLEntity; + +/** + * Our user exception, thrown in the tests of handling the exceptions, + * thrown on remote side. The exception contains the user - defined + * data field that is transferred from client to the server when the + * exception is thrown. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class ourUserException + extends UserException + implements IDLEntity +{ + /** + * Our specific field, transferred to client. + */ + public int ourField; + + /** + * Create the exception. + * + * @param _ourField the value of our specific field. + */ + public ourUserException(int _ourField) + { + ourField = _ourField; + } +} diff --git a/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/ourUserExceptionHelper.java b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/ourUserExceptionHelper.java new file mode 100644 index 000000000..a5b2fa671 --- /dev/null +++ b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/ourUserExceptionHelper.java @@ -0,0 +1,107 @@ +/* ourUserExceptionHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.classpath.examples.CORBA.SimpleCommunication.communication; + +import org.omg.CORBA.Any; +import org.omg.CORBA.ORB; +import org.omg.CORBA.StructMember; +import org.omg.CORBA.TCKind; +import org.omg.CORBA.TypeCode; + +/** + * The class, providing various helper operations with our user + * exception. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class ourUserExceptionHelper +{ + /** + * The exception repository id. This name is also used to find the + * mapping local CORBA class. + */ + private static String _id = + "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/ourUserException:1.0"; + + /** + * Get the exception repository id. + */ + public static String id() + { + return _id; + } + + /** + * Read the exception from the CDR stream. + */ + public static ourUserException read(org.omg.CORBA.portable.InputStream istream) + { + ourUserException value = new ourUserException(0); + + // The repository ID is not used + istream.read_string(); + value.ourField = istream.read_long(); + return value; + } + + /** + * Create the type code of this exception. + */ + public static synchronized TypeCode type() + { + StructMember[] members = new StructMember[ 1 ]; + TypeCode member = null; + member = ORB.init().get_primitive_tc(TCKind.tk_long); + members [ 0 ] = new StructMember("ourField", member, null); + return ORB.init().create_struct_tc(ourUserExceptionHelper.id(), + "ourUserException", members + ); + } + + /** + * Write the exception into the CDR stream. + */ + public static void write(org.omg.CORBA.portable.OutputStream ostream, + ourUserException value + ) + { + ostream.write_string(id()); + ostream.write_long(value.ourField); + } +} diff --git a/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/passThis.java b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/passThis.java new file mode 100644 index 000000000..f9ba02dc2 --- /dev/null +++ b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/passThis.java @@ -0,0 +1,61 @@ +/* passThis.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.classpath.examples.CORBA.SimpleCommunication.communication; + + +/** + * The data structure, passed from to the server from client in our tests. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class passThis + implements org.omg.CORBA.portable.IDLEntity +{ + /** + * The first string, stored in this structure (defined as + * "narrow string"). + */ + public String a; + + /** + * The second string, stored in this structure (define as + * "wide" (usually Unicode) string. + */ + public String b; +} diff --git a/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/passThisHelper.java b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/passThisHelper.java new file mode 100644 index 000000000..13242fd63 --- /dev/null +++ b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/passThisHelper.java @@ -0,0 +1,102 @@ +/* passThisHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.classpath.examples.CORBA.SimpleCommunication.communication; + +import org.omg.CORBA.Any; +import org.omg.CORBA.ORB; +import org.omg.CORBA.StructMember; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * The helper operations for the {@link passThis}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class passThisHelper +{ + /** + * The repository ID of the {@link passThis}. + */ + private static String id = + "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/passThis:1.0"; + + /** + * Get the repository id. + */ + public static String id() + { + return id; + } + + /** + * Read the structure from the CDR stram. + */ + public static passThis read(InputStream istream) + { + passThis value = new passThis(); + value.a = istream.read_string(); + value.b = istream.read_wstring(); + return value; + } + + /** + * Get the type code of this structure. + */ + public static synchronized TypeCode type() + { + StructMember[] members = new StructMember[ 2 ]; + TypeCode member = null; + member = ORB.init().create_string_tc(0); + members [ 0 ] = new StructMember("a", member, null); + member = ORB.init().create_string_tc(0); + members [ 1 ] = new StructMember("b", member, null); + return ORB.init().create_struct_tc(passThisHelper.id(), "passThis", members); + } + + /** + * Write the structure into the CDR stream. + */ + public static void write(OutputStream ostream, passThis value) + { + ostream.write_string(value.a); + ostream.write_wstring(value.b); + } +} diff --git a/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/passThisHolder.java b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/passThisHolder.java new file mode 100644 index 000000000..0d93cbaf6 --- /dev/null +++ b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/passThisHolder.java @@ -0,0 +1,37 @@ + + +package gnu.classpath.examples.CORBA.SimpleCommunication.communication; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +public final class passThisHolder + implements Streamable +{ + public passThis value; + + public passThisHolder() + { + } + + public passThisHolder(passThis initialValue) + { + value = initialValue; + } + + public void _read(InputStream i) + { + value = passThisHelper.read(i); + } + + public org.omg.CORBA.TypeCode _type() + { + return passThisHelper.type(); + } + + public void _write(OutputStream o) + { + passThisHelper.write(o, value); + } +} diff --git a/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/returnThis.java b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/returnThis.java new file mode 100644 index 000000000..b13b983bb --- /dev/null +++ b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/returnThis.java @@ -0,0 +1,66 @@ +/* returnThis.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.classpath.examples.CORBA.SimpleCommunication.communication; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * This data structure is returned from the server to client in our tests. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class returnThis + implements IDLEntity +{ + /** + * The string field. + */ + public String c; + + /** + * The CORBA array field. This field is handled as the fixed + * size CORBA array, but structures can also have the variable + * size CORBA sequences. + */ + public int[] arra = new int[3]; + + /** + * The int (CORBA long) field. + */ + public int n; +} diff --git a/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/returnThisHelper.java b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/returnThisHelper.java new file mode 100644 index 000000000..db6a11217 --- /dev/null +++ b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/returnThisHelper.java @@ -0,0 +1,115 @@ +/* returnThisHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.classpath.examples.CORBA.SimpleCommunication.communication; + +import org.omg.CORBA.Any; +import org.omg.CORBA.ORB; +import org.omg.CORBA.StructMember; +import org.omg.CORBA.TCKind; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * This class defines the helper operations for {@link returnThis}. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class returnThisHelper +{ + /** + * The repository id. + */ + private static String _id = + "IDL:gnu/classpath/examples/CORBA/SimpleCommunication/communication/returnThis:1.0"; + + /** + * Return the repository id. + */ + public static String id() + { + return _id; + } + + /** + * Read the structure from the CDR stream. + */ + public static returnThis read(InputStream istream) + { + returnThis value = new returnThis(); + value.n = istream.read_long(); + value.c = istream.read_wstring(); + value.arra = new int[ 3 ]; + + // Read the fixed size array. + for (int i = 0; i < 3; i++) + value.arra [ i ] = istream.read_long(); + return value; + } + + /** + * Create the typecode. + */ + public static synchronized TypeCode type() + { + StructMember[] members = new StructMember[ 3 ]; + TypeCode member = ORB.init().get_primitive_tc(TCKind.tk_long); + members [ 0 ] = new StructMember("n", member, null); + member = ORB.init().create_string_tc(0); + members [ 1 ] = new StructMember("c", member, null); + member = ORB.init().get_primitive_tc(TCKind.tk_long); + member = ORB.init().create_array_tc(3, member); + members [ 2 ] = new StructMember("arra", member, null); + return ORB.init().create_struct_tc(returnThisHelper.id(), "returnThis", + members + ); + } + + /** + * Write the structure to the CDR stream. + */ + public static void write(OutputStream ostream, returnThis value) + { + ostream.write_long(value.n); + ostream.write_wstring(value.c); + + // Write the fixed size array. + for (int i = 0; i < 3; i++) + ostream.write_long(value.arra [ i ]); + } +} diff --git a/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/returnThisHolder.java b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/returnThisHolder.java new file mode 100644 index 000000000..294e37ac3 --- /dev/null +++ b/examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/returnThisHolder.java @@ -0,0 +1,60 @@ + + +package gnu.classpath.examples.CORBA.SimpleCommunication.communication; + +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * The holder for the structure, returned from the server. + */ +public final class returnThisHolder + implements Streamable +{ + /** + * The enclosed structure. + */ + public returnThis value = null; + + /** + * Create the empty holder. + */ + public returnThisHolder() + { + } + + /** + * Crate the holder with the defined initial value. + */ + public returnThisHolder(returnThis initialValue) + { + value = initialValue; + } + + /** + * Read the value from the CDR stream. + */ + public void _read(InputStream in) + { + value = returnThisHelper.read(in); + } + + /** + * Get the typecode of this structure. + */ + public TypeCode _type() + { + return returnThisHelper.type(); + } + + /** + * Write the value from the CDR stream. + * @param out + */ + public void _write(OutputStream out) + { + returnThisHelper.write(out, value); + } +} diff --git a/examples/gnu/classpath/examples/swing/Demo.java b/examples/gnu/classpath/examples/swing/Demo.java index e6d1ef761..9301dd635 100644 --- a/examples/gnu/classpath/examples/swing/Demo.java +++ b/examples/gnu/classpath/examples/swing/Demo.java @@ -33,6 +33,7 @@ import javax.swing.event.*; import javax.swing.plaf.*; import javax.swing.plaf.basic.*; import javax.swing.plaf.metal.MetalLookAndFeel; +import javax.swing.tree.*; import javax.swing.border.*; import java.net.URL; @@ -142,12 +143,98 @@ public class Demo preferences.add(new JCheckBoxMenuItem("World Peace")); edit.add(preferences); + JMenu examples = new JMenu("Examples"); + new PopUpAction("Buttons", + mkPanel(new JComponent[] + {mkBigButton("mango"), + mkBigButton("guava"), + mkBigButton("lemon")}), + examples); + + new PopUpAction("Toggles", + mkToggle("cool and refreshing"), + examples); + + new PopUpAction("Checkbox", + mkCheckbox("ice cold"), + examples); + + new PopUpAction("Radio", + mkRadio("delicious"), + examples); + + new PopUpAction("Slider", + mkSliders(), + examples); + + new PopUpAction("List", + mkListPanel(new String[] { "hello", + "this", + "is", + "a", + "list", + "that", + "wraps", + "over"}), + examples); + + new PopUpAction("Scrollbar", + mkScrollBar(), + examples); + + new PopUpAction("Viewport", + mkViewportBox(mkBigButton("View Me!")), + examples); + + new PopUpAction("ScrollPane", + mkScrollPane(mkBigButton("Scroll Me!")), + examples); + + new PopUpAction("TabPane", + mkTabs(new String[] {"happy", + "sad", + "indifferent"}), + examples); + + new PopUpAction("Spinner", + mkSpinner(), + examples); + + new PopUpAction("TextField", + mkTextField("Hello, World!"), + examples); + + new PopUpAction("ColorChooser", + mkColorChooser(), + examples); + + new PopUpAction("ComboBox", + mkComboBox(new String[] {"Stop", + "Software", + "Hoarders", + "Support", + "GNU!"}), + examples); + + new PopUpAction("Editor", + mkEditorPane(), + examples); + + new PopUpAction("Tree", + mkTree(), + examples); + + new PopUpAction("Table", + mkTable(), + examples); + help.add(new JMenuItem("just play with the widgets")); help.add(new JMenuItem("and enjoy the sensation of")); help.add(new JMenuItem("your neural connections growing")); bar.add(file); bar.add(edit); + bar.add(examples); bar.add(help); return bar; } @@ -485,9 +572,11 @@ public class Demo JComponent component = (JComponent) frame.getContentPane(); component.setLayout(new BorderLayout()); component.add(mkToolBar(), BorderLayout.NORTH); - component.add(mkTabbedPane(), BorderLayout.CENTER); - component.add(mkButtonBar(), BorderLayout.SOUTH); - + JPanel main = new JPanel(); + main.setLayout(new BoxLayout(main, BoxLayout.Y_AXIS)); + main.add(mkTabbedPane()); + main.add(mkButtonBar()); + component.add(main, BorderLayout.CENTER); frame.pack(); frame.show(); } @@ -677,6 +766,16 @@ public class Demo private JComponent inner; private String name; + PopUpAction(String n, JComponent i, JMenu m) + { + name = n; + inner = i; + + JMenuItem item = new JMenuItem(name); + item.addActionListener(this); + m.add(item); + } + PopUpAction(String n, JComponent i, JPanel p) { name = n; @@ -698,6 +797,71 @@ public class Demo } } + private static JEditorPane mkEditorPane() + { + JEditorPane editorPane = new JEditorPane(); + editorPane.setEditable(true); + return editorPane; + } + + private static JTree mkTree() + { + DefaultMutableTreeNode root = new DefaultMutableTreeNode("Root node"); + DefaultMutableTreeNode child1 = new DefaultMutableTreeNode("Child node 1"); + DefaultMutableTreeNode child11 = + new DefaultMutableTreeNode("Child node 1.1"); + DefaultMutableTreeNode child12 = + new DefaultMutableTreeNode("Child node 1.2"); + DefaultMutableTreeNode child13 = + new DefaultMutableTreeNode("Child node 1.3"); + DefaultMutableTreeNode child2 = new DefaultMutableTreeNode("Child node 2"); + DefaultMutableTreeNode child21 = + new DefaultMutableTreeNode("Child node 2.1"); + DefaultMutableTreeNode child22 = + new DefaultMutableTreeNode("Child node 2.2"); + DefaultMutableTreeNode child23 = + new DefaultMutableTreeNode("Child node 2.3"); + DefaultMutableTreeNode child24 = + new DefaultMutableTreeNode("Child node 2.4"); + + DefaultMutableTreeNode child3 = new DefaultMutableTreeNode("Child node 3"); + root.add(child1); + root.add(child2); + root.add(child3); + child1.add(child11); + child1.add(child12); + child1.add(child13); + child2.add(child21); + child2.add(child22); + child2.add(child23); + child2.add(child24); + + JTree tree = new JTree(root); + return tree; + } + + private static JTable mkTable() + { + Object[][] tableData = new Object[][] { + { + "Field 1", "Field 2" , "Field 3" + }, + { + "Field 4", "Field 5" , "Field 6" + }, + { + "Field 7", "Field 8" , "Field 9" + }, + { + "Field 10", "Field 11" , "Field 12" + } + }; + Object[] columnNames = new Object[] {"Column 1", "Column 2", "Column 3"}; + + JTable table = new JTable(tableData, columnNames); + return table; + } + private JPanel mkButtonBar() { JPanel panel = new JPanel (); @@ -775,6 +939,18 @@ public class Demo "GNU!"}), panel); + new PopUpAction("Editor", + mkEditorPane(), + panel); + + new PopUpAction("Tree", + mkTree(), + panel); + + new PopUpAction("Table", + mkTable(), + panel); + JButton exitDisposer = mkDisposerButton(frame); panel.add(exitDisposer); |