コード例 #1
0
 public AcGlobalCoTerminusAirportCacheBase() {
   AcSchema schema = AcSchema.createGlobalSchema();
   _serviceConfig = AcServiceConfig.createSchema(schema, false);
   _service = new AcGlobalCoTerminusAirportServiceClient(_serviceConfig);
   _allAvailableList = null;
   _allByGlobalCoTerminusIdMap = null;
 }
コード例 #2
0
  protected ApplicationContext prepareParentContext(final AcServiceConfig serviceConfig)
      throws AcServiceException {
    AcCoreContext coreContext = serviceConfig.getCoreContext();
    GenericApplicationContext parentContext = new GenericApplicationContext();
    DefaultListableBeanFactory beanFactory = parentContext.getDefaultListableBeanFactory();

    // add service config
    beanFactory.registerSingleton(AcServiceConfig.SERVICE_CONFIG_BEAN_NAME, serviceConfig);

    // add core context
    beanFactory.registerSingleton(AcServiceConfig.CORE_CONTEXT_BEAN_NAME, coreContext);

    // add session
    beanFactory.registerSingleton(AcServiceConfig.SESSION_BEAN_NAME, coreContext.getSession());

    // add profile
    beanFactory.registerSingleton(
        AcServiceConfig.PROFILE_BEAN_NAME, coreContext.getSession().getProfile());

    // add data repository
    beanFactory.registerSingleton(
        AcServiceConfig.REPOSITORY_BEAN_NAME, coreContext.getDataRepository());

    // add service preferences
    beanFactory.registerSingleton(
        AcServiceConfig.PREFERENCES_BEAN_NAME, serviceConfig.getServicePreferences());

    // add dictionary
    beanFactory.registerSingleton(
        AcServiceConfig.DICTIONARY_BEAN_NAME,
        coreContext.getSession().getProfile().getDictionary());

    for (String serviceClassName : metadata().getDependsServiceClassNames()) {
      try {
        AcService dependService = coreContext.getServiceByClassName(serviceClassName);
        beanFactory.registerSingleton(serviceClassName, dependService);
      } catch (Exception e) {
        throw new AcServiceException("load depend service error: " + serviceClassName, e);
      }
    }

    // ready for parent context
    parentContext.refresh();
    return parentContext;
  }
コード例 #3
0
 protected void initPropertiesPlaceHolder(
     ConfigurableApplicationContext context, AcServiceConfig serviceConfig) {
   // prepare properties from service config
   Properties prop = new Properties();
   for (String key : serviceConfig.getKeys()) {
     // NOTE: use data from service property (preferences + default)
     prop.setProperty(key, serviceConfig.getProperty(key));
   }
   // TODO (other better way) other core reserved properties
   prop.setProperty(
       "ac.context.sessionId",
       String.valueOf(serviceConfig.getCoreContext().getSession().getSessionId()));
   prop.setProperty(
       "ac.context.profileId",
       String.valueOf(serviceConfig.getCoreContext().getSession().getProfile().getProfileId()));
   PropertyPlaceholderConfigurer propConfig = new PropertyPlaceholderConfigurer();
   propConfig.setProperties(prop);
   context.addBeanFactoryPostProcessor(propConfig);
 }
コード例 #4
0
 public AcAbstractAccountServiceManaged(AcServiceConfig config) {
   AcDbAccountAccess a = new AcDbAccountAccess(config.getSchema());
   _serviceRegistry = new AcAccountServiceImplRegistry(config, a);
 }
コード例 #5
0
 protected void validateConfig(AcServiceConfig serviceConfig, String key)
     throws AcServiceException {
   if (serviceConfig.getProperty(key) == null) {
     throw new AcServiceException("service property '" + key + "' not found");
   }
 }
コード例 #6
0
 public AcGlobalTimeZoneCacheBase() {
   AcSchema schema = AcSchema.createGlobalSchema();
   _serviceConfig = AcServiceConfig.createSchema(schema, false);
   _service = new AcGlobalTimeZoneServiceClient(_serviceConfig);
   _allAvailableList = null;
 }
コード例 #7
0
 public AcSchema getSchema() {
   return _serviceConfig.getSchema();
 }