CoParameterDataGetter.java :  » J2EE » WiSerFramework » de » ug2t » connector » Java Open Source

Java Open Source » J2EE » WiSerFramework 
WiSerFramework » de » ug2t » connector » CoParameterDataGetter.java
// @@
// @@
/*
 * Wi.Ser Framework
 *
 * LGPL Version: 1.8.1, 20-September-2007  
 * Copyright (C) 2005-2006 Dirk von der Weiden <dvdw@imail.de>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library located in LGPL.txt in the 
 * license directory; if not, write to the 
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA  02111-1307, USA.
 * 
 * If this agreement does not cover your requirements, please contact us
 * via email to get detailed information about the commercial license 
 * or our service offerings!
 *
 */
// @@

package de.ug2t.connector;

import java.util.*;

public class CoParameterDataGetter extends ACoDataGetter
{
  private ICoParameterGetter pem_pgetter = null;
  private String             pem_source  = null;
  private String             pem_cluster = null;

  public CoParameterDataGetter(ICoParameterGetter xPg, String xSource, String xCluster)
  {
    pem_pgetter = xPg;
    pem_source = xSource;
    pem_cluster = xCluster;
    pem_pgetter.pcmf_setRoot(pem_source, pem_cluster);

    return;
  }

  public String pcmf_getString(String xId) throws Exception
  {
    if (pem_cluster == null)
    {
      String res = "";
      Iterator it = null;

      it = pem_pgetter.pcmf_getKeys(pem_source, xId);
      while (it.hasNext())
        res = res + pem_pgetter.pcmf_getParameter(xId, it.next().toString()).toString();

      return (res);
    }
    else
    {
      pem_pgetter.pcmf_setRoot(pem_source, pem_cluster);
      return (pem_pgetter.pcmf_getParameter(xId).toString());
    }
  };

  public String pcmf_getString(int xId) throws Exception
  {
    return (this.pcmf_getString(Integer.toString(xId)));
  };

  public String pcmf_getString(Object xId) throws Exception
  {
    return (this.pcmf_getString(xId.toString()));
  };

  public Object pcmf_getObj(String xId) throws Exception
  {
    if (pem_cluster == null)
    {
      ArrayList res = new ArrayList();
      Iterator it = null;

      it = pem_pgetter.pcmf_getKeys(pem_source, xId);
      while (it.hasNext())
        res.add(pem_pgetter.pcmf_getParameter(xId, it.next().toString()));

      return (res);
    }
    else
    {
      pem_pgetter.pcmf_setRoot(pem_source, pem_cluster);
      return (pem_pgetter.pcmf_getParameter(xId));
    }
  };

  public Object pcmf_getObj(int xId) throws Exception
  {
    return (this.pcmf_getObj(Integer.toString(xId)));
  };

  public Object pcmf_getObj(Object xId) throws Exception
  {
    return (this.pcmf_getObj(xId.toString()));
  };
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.