001: // @@
002: // @@
003: /*
004: * Wi.Ser Framework
005: *
006: * LGPL Version: 1.8.1, 20-September-2007
007: * Copyright (C) 2005-2006 Dirk von der Weiden <dvdw@imail.de>
008: *
009: * This library is free software; you can redistribute it and/or
010: * modify it under the terms of the GNU Lesser General Public
011: * License as published by the Free Software Foundation; either
012: * version 2 of the License, or (at your option) any later version.
013: *
014: * This library is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
017: * Lesser General Public License for more details.
018: *
019: * You should have received a copy of the GNU Lesser General Public
020: * License along with this library located in LGPL.txt in the
021: * license directory; if not, write to the
022: * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
023: * Boston, MA 02111-1307, USA.
024: *
025: * If this agreement does not cover your requirements, please contact us
026: * via email to get detailed information about the commercial license
027: * or our service offerings!
028: *
029: */
030: // @@
031: package de.ug2t.connector;
032:
033: import java.util.*;
034:
035: public class CoParameterDataGetter extends ACoDataGetter {
036: private ICoParameterGetter pem_pgetter = null;
037: private String pem_source = null;
038: private String pem_cluster = null;
039:
040: public CoParameterDataGetter(ICoParameterGetter xPg,
041: String xSource, String xCluster) {
042: pem_pgetter = xPg;
043: pem_source = xSource;
044: pem_cluster = xCluster;
045: pem_pgetter.pcmf_setRoot(pem_source, pem_cluster);
046:
047: return;
048: }
049:
050: public String pcmf_getString(String xId) throws Exception {
051: if (pem_cluster == null) {
052: String res = "";
053: Iterator it = null;
054:
055: it = pem_pgetter.pcmf_getKeys(pem_source, xId);
056: while (it.hasNext())
057: res = res
058: + pem_pgetter.pcmf_getParameter(xId,
059: it.next().toString()).toString();
060:
061: return (res);
062: } else {
063: pem_pgetter.pcmf_setRoot(pem_source, pem_cluster);
064: return (pem_pgetter.pcmf_getParameter(xId).toString());
065: }
066: };
067:
068: public String pcmf_getString(int xId) throws Exception {
069: return (this .pcmf_getString(Integer.toString(xId)));
070: };
071:
072: public String pcmf_getString(Object xId) throws Exception {
073: return (this .pcmf_getString(xId.toString()));
074: };
075:
076: public Object pcmf_getObj(String xId) throws Exception {
077: if (pem_cluster == null) {
078: ArrayList res = new ArrayList();
079: Iterator it = null;
080:
081: it = pem_pgetter.pcmf_getKeys(pem_source, xId);
082: while (it.hasNext())
083: res.add(pem_pgetter.pcmf_getParameter(xId, it.next()
084: .toString()));
085:
086: return (res);
087: } else {
088: pem_pgetter.pcmf_setRoot(pem_source, pem_cluster);
089: return (pem_pgetter.pcmf_getParameter(xId));
090: }
091: };
092:
093: public Object pcmf_getObj(int xId) throws Exception {
094: return (this .pcmf_getObj(Integer.toString(xId)));
095: };
096:
097: public Object pcmf_getObj(Object xId) throws Exception {
098: return (this.pcmf_getObj(xId.toString()));
099: };
100: }
|