コード例 #1
0
  @Override
  public synchronized void start(final StartContext context) {

    final RiverMarshallerFactory factory = new RiverMarshallerFactory();
    final MarshallingConfiguration configuration = new MarshallingConfiguration();
    configuration.setClassResolver(ModularClassResolver.getInstance(moduleLoader.getValue()));

    this.configuration = configuration;
    this.factory = factory;
    if (pathRelativeTo != null) {
      callbackHandle =
          pathManager
              .getValue()
              .registerCallback(
                  pathRelativeTo,
                  PathManager.ReloadServerCallback.create(),
                  PathManager.Event.UPDATED,
                  PathManager.Event.REMOVED);
    }
    baseDir = new File(pathManager.getValue().resolveRelativePathEntry(path, pathRelativeTo));
    if (!baseDir.exists()) {
      if (createIfNotExists) {
        if (!baseDir.mkdirs()) {
          throw MESSAGES.failToCreateTimerFileStoreDir(baseDir);
        }
      } else {
        throw MESSAGES.timerFileStoreDirNotExist(baseDir);
      }
    }
    if (!baseDir.isDirectory()) {
      throw MESSAGES.invalidTimerFileStoreDir(baseDir);
    }
  }
コード例 #2
0
 @Override
 public MarshallingConfiguration apply(ModuleLoader loader) {
   MarshallingConfiguration config = new MarshallingConfiguration();
   config.setClassResolver(ModularClassResolver.getInstance(loader));
   config.setClassTable(new SimpleClassTable(Serializable.class, Externalizable.class));
   return config;
 }
コード例 #3
0
  /**
   * Construct a new instance.
   *
   * @param componentConfiguration the component configuration
   */
  public StatefulSessionComponentCreateService(
      final ComponentConfiguration componentConfiguration,
      final ApplicationExceptions ejbJarConfiguration) {
    super(componentConfiguration, ejbJarConfiguration);

    final StatefulComponentDescription componentDescription =
        (StatefulComponentDescription) componentConfiguration.getComponentDescription();
    final ClassLoader classLoader = componentConfiguration.getModuleClassLoader();
    final InterceptorFactory tcclInterceptorFactory =
        new ImmediateInterceptorFactory(new ContextClassLoaderInterceptor(classLoader));
    final InterceptorFactory namespaceContextInterceptorFactory =
        componentConfiguration.getNamespaceContextInterceptorFactory();

    this.afterBeginMethod = componentDescription.getAfterBegin();
    this.afterBegin =
        (this.afterBeginMethod != null)
            ? Interceptors.getChainedInterceptorFactory(
                tcclInterceptorFactory,
                namespaceContextInterceptorFactory,
                CurrentInvocationContextInterceptor.FACTORY,
                invokeMethodOnTarget(this.afterBeginMethod))
            : null;
    this.afterCompletionMethod = componentDescription.getAfterCompletion();
    this.afterCompletion =
        (this.afterCompletionMethod != null)
            ? Interceptors.getChainedInterceptorFactory(
                tcclInterceptorFactory,
                namespaceContextInterceptorFactory,
                CurrentInvocationContextInterceptor.FACTORY,
                invokeMethodOnTarget(this.afterCompletionMethod))
            : null;
    this.beforeCompletionMethod = componentDescription.getBeforeCompletion();
    this.beforeCompletion =
        (this.beforeCompletionMethod != null)
            ? Interceptors.getChainedInterceptorFactory(
                tcclInterceptorFactory,
                namespaceContextInterceptorFactory,
                CurrentInvocationContextInterceptor.FACTORY,
                invokeMethodOnTarget(this.beforeCompletionMethod))
            : null;
    this.prePassivate =
        Interceptors.getChainedInterceptorFactory(
            componentConfiguration.getPrePassivateInterceptors());
    this.postActivate =
        Interceptors.getChainedInterceptorFactory(
            componentConfiguration.getPostActivateInterceptors());
    this.statefulTimeout = componentDescription.getStatefulTimeout();
    // the interceptor chain for EJB e.x remove methods
    this.ejb2XRemoveMethod =
        Interceptors.getChainedInterceptorFactory(
            StatefulSessionSynchronizationInterceptor.factory(
                componentDescription.getTransactionManagementType()),
            new ImmediateInterceptorFactory(new StatefulRemoveInterceptor(false)),
            Interceptors.getTerminalInterceptorFactory());
    this.cache = componentDescription.getCache();
    this.loader = componentConfiguration.getModuleClassLoader();
    MarshallingConfiguration marshallingConfiguration = new MarshallingConfiguration();
    marshallingConfiguration.setClassResolver(
        ModularClassResolver.getInstance(componentConfiguration.getModuleLoader()));
    marshallingConfiguration.setSerializabilityChecker(
        new StatefulSessionBeanSerializabilityChecker(componentConfiguration.getComponentClass()));
    marshallingConfiguration.setClassTable(new StatefulSessionBeanClassTable());
    // ObjectTable which handles serialization of EJB proxies
    marshallingConfiguration.setObjectTable(new EJBClientContextIdentifierObjectTable());
    this.marshallingConfigurations =
        Collections.singletonMap(CURRENT_MARSHALLING_VERSION, marshallingConfiguration);
    this.serializableInterceptorContextKeys = componentConfiguration.getInterceptorContextKeys();
    this.passivationCapable = componentDescription.isPassivationApplicable();
  }