Examples of DiscoveryException


Examples of com.esri.gpt.catalog.discovery.DiscoveryException

   
    // determine the discoverable target, set the underlying storable
    Discoverable discoverable = propertyClause.getTarget();
    if (discoverable == null) {
      String sErr = "The PropertyClause.target is null.";
      throw new DiscoveryException(sErr);
    }
    if (discoverable.getStorable() == null) {
      String sErr = "The PropertyClause.target.storeable is null.";
      throw new DiscoveryException(sErr);
    } else {
      Storeable storeable = (Storeable)discoverable.getStorable();
      this.baseFieldName = storeable.getName();
      if (this.baseFieldName.endsWith(".intersects")) {
        this.inclusive = true;
        this.baseFieldName = this.baseFieldName.substring(0,this.baseFieldName.length()-11);
      } else if (this.baseFieldName.endsWith(".within")) {
        this.inclusive = false;
        this.baseFieldName = this.baseFieldName.substring(0,this.baseFieldName.length()-7);
      }
      this.intervalMetaFieldName = this.baseFieldName+".imeta";
      this.multiplicityFieldName = this.baseFieldName+".num";
      this.summaryMetaFieldName = this.baseFieldName+".meta";
    }
   
    // initialize values
    boolean bInclusive = this.inclusive;
    String sLiteral = Val.chkStr(propertyClause.getLiteral());
    String sLower = "";
    String sUpper = "";
    String sErr = null;
    String sErrSfx = " is not supported for timeperiod fields,"+
                     " use PropertyIsBetween.";
   
    if (propertyClause instanceof PropertyIsBetween) {
      PropertyIsBetween between = (PropertyIsBetween)propertyClause;
      sLower = Val.chkStr(between.getLowerBoundary());
      sUpper = Val.chkStr(between.getUpperBoundary());
      this.queryLower = this.parseDateTime(sLower,false);
      this.queryUpper = this.parseDateTime(sUpper,true);
     
    } else if ((propertyClause instanceof PropertyIsEqualTo||
               (propertyClause instanceof PropertyIsNotEqualTo)) {
      Query q = null;
      sLower = Val.chkStr(sLiteral);
      sUpper = Val.chkStr(sLiteral);
      this.queryLower = this.parseDateTime(sLower,false);
      if (this.queryLower == null) {
       sErr = "Timeperiod literal cannot be null for PropertyIsEqualTo/PropertyIsNotEqualTo";
      } else {
       this.queryUpper = this.parseDateTime(sUpper,true);
       if (propertyClause instanceof PropertyIsEqualTo) {
         q = this.makeEquals();
       } else {
         q = this.makeNotEquals();
       }
       appendQuery(activeBooleanQuery,activeLogicalClause,q);
       return;
      }
     
    } else if (propertyClause instanceof PropertyIsGreaterThan) {
      bInclusive = false; // use within logic
      sLower = sLiteral;
      this.queryLower = this.parseDateTime(sLower,false);
      if (this.queryLower != null) {
        this.queryLower = new Long(this.queryLower.longValue() + 1);
      }
     
    } else if (propertyClause instanceof PropertyIsGreaterThanOrEqualTo) {
      bInclusive = false; // use within logic
      sLower = sLiteral;
      this.queryLower = this.parseDateTime(sLower,false);
     
    } else if (propertyClause instanceof PropertyIsLessThan) {
      bInclusive = false; // use within logic
      sUpper = sLiteral;
      this.queryUpper = this.parseDateTime(sUpper,false);
      if (this.queryUpper != null) {
        this.queryUpper = new Long(this.queryUpper.longValue() - 1);
      }
     
    } else if (propertyClause instanceof PropertyIsLessThanOrEqualTo) {
      bInclusive = false; // use within logic
      sUpper = sLiteral;
      this.queryUpper = this.parseDateTime(sUpper,true);
     
    } else if (propertyClause instanceof PropertyIsNull) {
      appendQuery(activeBooleanQuery,activeLogicalClause,this.makeNull());
      return;
     
    } else if (propertyClause instanceof PropertyIsLike) { 
      sErr = "PropertyIsLike"+sErrSfx;
     
    } else {
      sErr = "Unrecognized property clause type: "+propertyClause.getClass().getName();
    }
    if (sErr != null) {
      throw new DiscoveryException(sErr);
    }
   
    // check for upper < lower
    if ((this.queryLower != null) && (this.queryUpper != null)) {
      if (this.queryUpper.longValue() < this.queryLower.longValue()) {
View Full Code Here

Examples of com.proofpoint.discovery.client.DiscoveryException

                int statusCode = response.getStatusCode();
                if (statusCode == 404 && servicesEmpty) {
                    statusCode = 200;
                }
                if (!isSuccess(statusCode)) {
                    throw new DiscoveryException(String.format("Announcement failed with status code %s: %s", statusCode, getBodyForError(response)));
                }

                return extractMaxAge(response);
            }
        });
View Full Code Here

Examples of io.airlift.discovery.client.DiscoveryException

    @Override
    public HiveMetastoreClient createMetastoreClient()
    {
        List<ServiceDescriptor> descriptors = Lists.newArrayList(Iterables.filter(selector.selectAllServices(), runningPredicate()));
        if (descriptors.isEmpty()) {
            throw new DiscoveryException("No metastore servers available for pool: " + selector.getPool());
        }

        Collections.shuffle(descriptors);
        TTransportException lastException = null;
        for (ServiceDescriptor descriptor : descriptors) {
            String thrift = descriptor.getProperties().get("thrift");
            if (thrift != null) {
                try {
                    HostAndPort metastore = HostAndPort.fromString(thrift);
                    checkArgument(metastore.hasPort());
                    return clientFactory.create(metastore.getHostText(), metastore.getPort());
                }
                catch (IllegalArgumentException ignored) {
                    // Ignore entries with parse issues
                }
                catch (TTransportException e) {
                    lastException = e;
                }
            }
        }

        throw new DiscoveryException("Unable to connect to any metastore servers in pool: " + selector.getPool(), lastException);
    }
View Full Code Here

Examples of org.apache.commons.discovery.DiscoveryException

                                                              setLogParamClasses);
           
            if (setLog == null) {
                String msg = "Internal Error: " + clazz.getName() + " required to implement 'public static void setLog(Log)'";
                log.fatal(msg);
                throw new DiscoveryException(msg);
            }
        } catch (SecurityException se) {
            String msg = "Required Security Permissions not present";
            log.fatal(msg, se);
            throw new DiscoveryException(msg, se);
        }

        if (log.isDebugEnabled())
            log.debug("Class meets requirements: " + clazz.getName());
View Full Code Here

Examples of org.apache.commons.discovery.DiscoveryException

                try {
                    setLog = clazz.getMethod("setLog", setLogParamClasses);
                } catch(Exception e) {
                    String msg = "Internal Error: pre-check for " + clazz.getName() + " failed?!";
                    log.fatal(msg, e);
                    throw new DiscoveryException(msg, e);
                }
   
                Object[] setLogParam = new Object[] { factory.getInstance(clazz.getName()) };
               
                try {
                    setLog.invoke(null, setLogParam);
                } catch(Exception e) {
                    String msg = "Internal Error: setLog failed for " + clazz.getName();
                    log.fatal(msg, e);
                    throw new DiscoveryException(msg, e);
                }
            }
        }
    }
View Full Code Here

Examples of org.apache.commons.discovery.DiscoveryException

            if (setLog == null) {
                String msg = "Internal Error: "
                    + clazz.getName()
                    + " required to implement 'public static void setLog(Log)'";
                log.fatal(msg);
                throw new DiscoveryException(msg);
            }
        } catch (SecurityException se) {
            String msg = "Required Security Permissions not present";
            log.fatal(msg, se);
            throw new DiscoveryException(msg, se);
        }

        if (log.isDebugEnabled()) {
            log.debug("Class meets requirements: " + clazz.getName());
        }
View Full Code Here

Examples of org.apache.commons.discovery.DiscoveryException

                try {
                    setLog = clazz.getMethod("setLog", setLogParamClasses);
                } catch(Exception e) {
                    String msg = "Internal Error: pre-check for " + clazz.getName() + " failed?!";
                    log.fatal(msg, e);
                    throw new DiscoveryException(msg, e);
                }

                Object[] setLogParam = new Object[] { factory.getInstance(clazz.getName()) };

                try {
                    setLog.invoke(null, setLogParam);
                } catch(Exception e) {
                    String msg = "Internal Error: setLog failed for " + clazz.getName();
                    log.fatal(msg, e);
                    throw new DiscoveryException(msg, e);
                }
            }
        }
    }
View Full Code Here

Examples of org.apache.commons.discovery.DiscoveryException

     * @param impl The class has to be verified is a SPI implementation/extension
     * @throws DiscoveryException if the input implementation class is not an SPI implementation
     */
    public static void verifyAncestory(Class<?> spi, Class<?> impl) throws DiscoveryException {
        if (spi == null) {
            throw new DiscoveryException("No interface defined!");
        }

        if (impl == null) {
            throw new DiscoveryException("No implementation defined for " + spi.getName());
        }

        if (!spi.isAssignableFrom(impl)) {
            throw new DiscoveryException("Class "
                    + impl.getName()
                    + " does not implement "
                    + spi.getName());
        }
    }
View Full Code Here

Examples of org.apache.commons.discovery.DiscoveryException

                    error = e;
                }
            }
        }

        throw new DiscoveryException("No implementation defined for " + spi.getSPName(), error);
        // return null;
    }
View Full Code Here

Examples of org.apache.commons.discovery.DiscoveryException

                    put(contextLoader, spi.getSPName(), obj);
                }
            } catch (DiscoveryException de) {
                throw de;
            } catch (Exception e) {
                throw new DiscoveryException("Unable to instantiate implementation class for " + spi.getSPName(), e);
            }
        }

        return obj;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.