Package org.apache.juddi.datatype.response

Examples of org.apache.juddi.datatype.response.ServiceInfos


      handler = maker.lookup(DescriptionHandler.TAG_NAME);
      for (int i=0; i < descVector.size(); i++)
        handler.marshal((Description)descVector.elementAt(i),element);
    }

    ServiceInfos infos = info.getServiceInfos();
    if (infos != null)
    {
      handler = maker.lookup(ServiceInfosHandler.TAG_NAME);
      handler.marshal(infos,element);
    }
View Full Code Here


    if (((nameVector == null) || (nameVector.size() == 0))  &&
       ((categoryBag == null) || (categoryBag.size() == 0)) &&
       ((tModelBag == null)   || (tModelBag.size() == 0)))
    {
      ServiceList list = new ServiceList();
      list.setServiceInfos(new ServiceInfos());
      list.setGeneric(generic);
      list.setOperator(Config.getOperator());
      list.setTruncated(false);
      return list;
    }

    // Validate CategoryBag and (if neccessary) add TModelKey for: uddiorg:general_keywords
    if (categoryBag != null)
    {
      Vector keyedRefVector = categoryBag.getKeyedReferenceVector();
      if (keyedRefVector != null)
      {
        int vectorSize = keyedRefVector.size();
        if (vectorSize > 0)
        {
          for (int i=0; i<vectorSize; i++)
          {
            KeyedReference keyedRef = (KeyedReference)keyedRefVector.elementAt(i);
            String key = keyedRef.getTModelKey();
           
            // A null or zero-length tModelKey is treated as
            // though the tModelKey for uddiorg:general_keywords
            // had been specified.
            //
            if ((key == null) || (key.trim().length() == 0))
              keyedRef.setTModelKey(TModel.GENERAL_KEYWORDS_TMODEL_KEY);
          }
        }
      }
    }           
   
    // aquire a jUDDI datastore instance
    DataStore dataStore = DataStoreFactory.getDataStore();

    try
    {
      dataStore.beginTrans();

      // validate the 'name' parameters as much as possible up-front before
      // calling into the data layer for relational validation.
      if (nameVector != null)
      {
        // only allowed to specify a maximum of 5 names (implementation
        // dependent).  This value is configurable in jUDDI.
        int maxNames = Config.getMaxNameElementsAllowed();
        if ((nameVector != null) && (nameVector.size() > maxNames))
          throw new TooManyOptionsException("max_names= "+maxNames);

        // names can not exceed the maximum character length specified by the
        // UDDI specification (v2.0 specifies a max character length of 255). This
        // value is configurable in jUDDI.
        int maxNameLength = Config.getMaxNameLengthAllowed();
        for (int i=0; i<nameVector.size(); i++)
        {
          String name = ((Name)nameVector.elementAt(i)).getValue();
           if (name.length() > maxNameLength)
            throw new NameTooLongException(name+" (max="+maxNameLength+")");
        }
      }

      // validate the 'qualifiers' parameter as much as possible up-front before
      // calling into the data layer for relational validation.
      if (qualifiers != null)
      {
        Vector qVector = qualifiers.getFindQualifierVector();
        if ((qVector!=null) && (qVector.size() > 0))
        {
          for (int i=0; i<qVector.size(); i++)
          {
            FindQualifier qualifier = (FindQualifier)qVector.elementAt(i);
            String qValue = qualifier.getValue();

            if ((!qValue.equals(FindQualifier.EXACT_NAME_MATCH)) &&
                (!qValue.equals(FindQualifier.CASE_SENSITIVE_MATCH)) &&
                (!qValue.equals(FindQualifier.OR_ALL_KEYS)) &&
                (!qValue.equals(FindQualifier.OR_LIKE_KEYS)) &&
                (!qValue.equals(FindQualifier.AND_ALL_KEYS)) &&
                (!qValue.equals(FindQualifier.SORT_BY_NAME_ASC)) &&
                (!qValue.equals(FindQualifier.SORT_BY_NAME_DESC)) &&
                (!qValue.equals(FindQualifier.SORT_BY_DATE_ASC)) &&
                (!qValue.equals(FindQualifier.SORT_BY_DATE_DESC)) &&
                (!qValue.equals(FindQualifier.SERVICE_SUBSET)) &&
                (!qValue.equals(FindQualifier.COMBINE_CATEGORY_BAGS)))
              throw new UnsupportedException("findQualifier="+qValue);
          }
        }
      }

      Vector infoVector = null;
      boolean truncatedResults = false;

      // perform the search for matching business services (return only keys in requested order)
      Vector keyVector = dataStore.findService(businessKey,nameVector,categoryBag,tModelBag,qualifiers);
      if ((keyVector != null) && (keyVector.size() > 0))
      {
        // if a maxRows value has been specified and it's less than
        // the number of rows we are about to return then only return
        // maxRows specified.
        int rowCount = keyVector.size();
        if ((maxRows > 0) && (maxRows < rowCount))
        {
          rowCount = maxRows;
          truncatedResults = true;
        }

        // iterate through the business server keys fetching
        // each associated ServiceInfo in sequence.
        infoVector = new Vector(rowCount);
        for (int i=0; i<rowCount; i++)
          infoVector.addElement(dataStore.fetchServiceInfo((String)keyVector.elementAt(i)));
      }

      dataStore.commit();

      // create a new ServiceInfos instance and stuff
      // the new Vector of ServiceInfos into it.
      ServiceInfos infos = new ServiceInfos();
      infos.setServiceInfoVector(infoVector);

      // create a new ServiceList instance and stuff
      // the new serviceInfos instance into it.
      ServiceList list = new ServiceList();
      list.setGeneric(generic);
View Full Code Here

    boolean truncated = list.isTruncated();
    if (truncated)
      element.setAttribute("truncated","true");

    ServiceInfos infos = list.getServiceInfos();
    if (infos != null)
    {
      handler = maker.lookup(ServiceInfosHandler.TAG_NAME);
      handler.marshal(infos,element);
    }
View Full Code Here

    this.maker = maker;
  }

  public RegistryObject unmarshal(Element element)
  {
    ServiceInfos obj = new ServiceInfos();
    Vector nodeList = null;
    AbstractHandler handler = null;

    // Attributes
    // {none}

    // Text Node Value
    // {none}

    // Child Elements
    nodeList = XMLUtils.getChildElementsByTagName(element,ServiceInfoHandler.TAG_NAME);
    for (int i=0; i<nodeList.size(); i++)
    {
      handler = maker.lookup(ServiceInfoHandler.TAG_NAME);
      obj.addServiceInfo((ServiceInfo)handler.unmarshal((Element)nodeList.elementAt(i)));
    }

    return obj;
  }
View Full Code Here

    return obj;
  }

  public void marshal(RegistryObject object,Element parent)
  {
    ServiceInfos infos = (ServiceInfos)object;
    String generic = getGeneric(null);
    String namespace = getUDDINamespace(generic);
    Element element = parent.getOwnerDocument().createElementNS(namespace,TAG_NAME);
    AbstractHandler handler = null;

    Vector vector = infos.getServiceInfoVector();
    if ((vector!=null) && (vector.size() > 0))
    {
      handler = maker.lookup(ServiceInfoHandler.TAG_NAME);
      for (int i=0; i < vector.size(); i++)
        handler.marshal((ServiceInfo)vector.elementAt(i),element);
View Full Code Here

      {
        throw new RegistryException(sqlex);
      }
    }

    ServiceInfos serviceInfos = new ServiceInfos();
    serviceInfos.setServiceInfoVector(serviceInfoVector);
    return serviceInfos;
  }
View Full Code Here

      {
        throw new RegistryException(sqlex);
      }
    }

    ServiceInfos serviceInfos = new ServiceInfos();
    serviceInfos.setServiceInfoVector(serviceInfoVector);
    return serviceInfos;
  }
View Full Code Here

      handler = maker.lookup(DescriptionHandler.TAG_NAME);
      for (int i=0; i < descVector.size(); i++)
        handler.marshal((Description)descVector.elementAt(i),element);
    }

    ServiceInfos infos = info.getServiceInfos();
    if (infos != null)
    {
      handler = maker.lookup(ServiceInfosHandler.TAG_NAME);
      handler.marshal(infos,element);
    }
View Full Code Here

       ((nameVector == null) || (nameVector.size() == 0))  &&
       ((categoryBag == null) || (categoryBag.size() == 0)) &&
       ((tModelBag == null)   || (tModelBag.size() == 0)))
    {
      ServiceList list = new ServiceList();
      list.setServiceInfos(new ServiceInfos());
      list.setGeneric(generic);
      list.setOperator(Config.getOperator());
      list.setTruncated(false);
      return list;
    }

    // Validate CategoryBag and (if neccessary) add TModelKey for: uddiorg:general_keywords
    if (categoryBag != null)
    {
      Vector keyedRefVector = categoryBag.getKeyedReferenceVector();
      if (keyedRefVector != null)
      {
        int vectorSize = keyedRefVector.size();
        if (vectorSize > 0)
        {
          for (int i=0; i<vectorSize; i++)
          {
            KeyedReference keyedRef = (KeyedReference)keyedRefVector.elementAt(i);
            String key = keyedRef.getTModelKey();
           
            // A null or zero-length tModelKey is treated as
            // though the tModelKey for uddiorg:general_keywords
            // had been specified.
            //
            if ((key == null) || (key.trim().length() == 0))
              keyedRef.setTModelKey(TModel.GENERAL_KEYWORDS_TMODEL_KEY);
          }
        }
      }
    }           
   
    // aquire a jUDDI datastore instance
    DataStore dataStore = DataStoreFactory.getDataStore();

    try
    {
      dataStore.beginTrans();

      // validate the 'name' parameters as much as possible up-front before
      // calling into the data layer for relational validation.
      if (nameVector != null)
      {
        // only allowed to specify a maximum of 5 names (implementation
        // dependent).  This value is configurable in jUDDI.
        int maxNames = Config.getMaxNameElementsAllowed();
        if ((nameVector != null) && (nameVector.size() > maxNames))
          throw new TooManyOptionsException("find_service: "+
              "names="+nameVector.size()+", "+
              "maxNames=" + maxNames);

        // names can not exceed the maximum character length specified by the
        // UDDI specification (v2.0 specifies a max character length of 255). This
        // value is configurable in jUDDI.
        int maxNameLength = Config.getMaxNameLengthAllowed();
        for (int i=0; i<nameVector.size(); i++)
        {
          String name = ((Name)nameVector.elementAt(i)).getValue();
           if (name.length() > maxNameLength)
            throw new NameTooLongException("find_service: "+
                "name="+name+", "+
                "length="+name.length()+", "+
                "maxNameLength="+maxNameLength);
        }
      }

      // validate the 'qualifiers' parameter as much as possible up-front before
      // calling into the data layer for relational validation.
      if (qualifiers != null)
      {
        Vector qVector = qualifiers.getFindQualifierVector();
        if ((qVector!=null) && (qVector.size() > 0))
        {
          for (int i=0; i<qVector.size(); i++)
          {
            FindQualifier qualifier = (FindQualifier)qVector.elementAt(i);
            String qValue = qualifier.getValue();

            if ((!qValue.equals(FindQualifier.EXACT_NAME_MATCH)) &&
                (!qValue.equals(FindQualifier.CASE_SENSITIVE_MATCH)) &&
                (!qValue.equals(FindQualifier.OR_ALL_KEYS)) &&
                (!qValue.equals(FindQualifier.OR_LIKE_KEYS)) &&
                (!qValue.equals(FindQualifier.AND_ALL_KEYS)) &&
                (!qValue.equals(FindQualifier.SORT_BY_NAME_ASC)) &&
                (!qValue.equals(FindQualifier.SORT_BY_NAME_DESC)) &&
                (!qValue.equals(FindQualifier.SORT_BY_DATE_ASC)) &&
                (!qValue.equals(FindQualifier.SORT_BY_DATE_DESC)) &&
                (!qValue.equals(FindQualifier.SERVICE_SUBSET)) &&
                (!qValue.equals(FindQualifier.COMBINE_CATEGORY_BAGS)))
              throw new UnsupportedException("find_service: "+
                  "findQualifier="+qValue);
          }
        }
      }

      Vector infoVector = null;
      boolean truncatedResults = false;

      // perform the search for matching business services (return only keys in requested order)
      Vector keyVector = dataStore.findService(businessKey,nameVector,categoryBag,tModelBag,qualifiers);
      if ((keyVector != null) && (keyVector.size() > 0))
      {
        // if a maxRows value has been specified and it's less than
        // the number of rows we are about to return then only return
        // maxRows specified.
        int rowCount = keyVector.size();
        if ((maxRows > 0) && (maxRows < rowCount))
        {
          rowCount = maxRows;
          truncatedResults = true;
        }

        // iterate through the business server keys fetching
        // each associated ServiceInfo in sequence.
        infoVector = new Vector(rowCount);
        for (int i=0; i<rowCount; i++)
          infoVector.addElement(dataStore.fetchServiceInfo((String)keyVector.elementAt(i)));
      }

      dataStore.commit();

      // create a new ServiceInfos instance and stuff
      // the new Vector of ServiceInfos into it.
      ServiceInfos infos = new ServiceInfos();
      infos.setServiceInfoVector(infoVector);

      // create a new ServiceList instance and stuff
      // the new serviceInfos instance into it.
      ServiceList list = new ServiceList();
      list.setGeneric(generic);
View Full Code Here

      {
        throw new RegistryException(sqlex);
      }
    }

    ServiceInfos serviceInfos = new ServiceInfos();
    serviceInfos.setServiceInfoVector(serviceInfoVector);
    return serviceInfos;
  }
View Full Code Here

TOP

Related Classes of org.apache.juddi.datatype.response.ServiceInfos

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.