Ejemplo n.º 1
0
  /*
   * (non-Javadoc)
   *
   * @see
   * com.absir.bean.config.IBeanFactoryStopping#stopping(com.absir.bean.basis
   * .BeanFactory)
   */
  @Override
  public void stopping(BeanFactory beanFactory) {
    LOGGER.info("stop begin");
    stopConnectionProvider(sessionFactory);
    for (SessionFactoryImpl sessionFactory : sessionFactoryMapName.keySet()) {
      stopConnectionProvider(sessionFactory);
    }

    Environment.setStarted(false);
    if (!driverShared) {
      Enumeration<Driver> enumeration = DriverManager.getDrivers();
      while (enumeration.hasMoreElements()) {
        Driver driver = enumeration.nextElement();
        try {
          DriverManager.deregisterDriver(driver);

        } catch (Exception e) {
          LOGGER.error("deregisterDriver " + driver, e);
        }
      }
    }

    if (driverStoppingCommand != null) {
      for (String stoppingCommand : driverStoppingCommand) {
        KernelClass.invokeCommandString(stoppingCommand);
      }

      driverStoppingCommand = null;
    }

    LOGGER.info("stop complete");
  }
Ejemplo n.º 2
0
  /*
   * (non-Javadoc)
   *
   * @see
   * com.absir.property.PropertySupply#getPropertyObject(com.absir.property
   * .PropertyObject, java.lang.reflect.Field)
   */
  @Override
  public CompareObject getPropertyObject(CompareObject propertyObject, Field field) {
    if (propertyObject == null) {
      if (field.getAnnotation(CaField.class) != null
          || (KernelClass.isBasicClass(field.getType())
              && field.getAnnotation(CaFilter.class) == null)) {
        propertyObject = compareObject;
      }
    }

    return super.getPropertyObject(propertyObject, field);
  }
Ejemplo n.º 3
0
  /*
   * (non-Javadoc)
   *
   * @see
   * com.absir.bean.core.BeanFactoryWrapper#getBeanObject(java.lang.String,
   * java.lang.Class, boolean)
   */
  @Override
  public <T> T getBeanObject(Class<T> beanType) {
    int length = parameters.length;
    for (int i = parameterIndex < 0 ? 0 : parameterIndex; i < length; i++) {
      Object parameter = parameters[parameterIndex];
      if (KernelClass.isMatchableFrom(beanType, parameter.getClass())) {
        if (parameterIndex >= 0) {
          parameterIndex = i;
        }

        return (T) parameter;
      }
    }

    return getBeanFactory().getBeanObject(beanType);
  }