public DataNucleusObjectStore(
      ObjectAdapterFactory adapterFactory, DataNucleusApplicationComponents applicationComponents) {
    ensureThatArg(adapterFactory, is(notNullValue()));
    ensureThatArg(applicationComponents, is(notNullValue()));

    this.state = State.NOT_YET_OPEN;
    this.transactionMode = TransactionMode.UNCHAINED;

    this.adapterFactory = adapterFactory;
    this.applicationComponents = applicationComponents;
    this.frameworkSynchronizer = applicationComponents.getFrameworkSynchronizer();
  }
  @Override
  public IsisSession openSession(final AuthenticationSession authenticationSession) {
    final PersistenceSession persistenceSession =
        persistenceSessionFactory.createPersistenceSession();
    ensureThatArg(persistenceSession, is(not(nullValue())));

    final UserProfile userProfile = userProfileLoader.getProfile(authenticationSession);
    ensureThatArg(userProfile, is(not(nullValue())));

    // inject into persistenceSession any/all application-scoped components
    // that it requires
    getSpecificationLoader().injectInto(persistenceSession);

    final IsisSessionDefault isisSessionDefault =
        newIsisSessionDefault(authenticationSession, persistenceSession, userProfile);
    return isisSessionDefault;
  }
  public ObjectReflectorDefault(
      final IsisConfiguration configuration,
      final ClassSubstitutor classSubstitutor,
      final CollectionTypeRegistry collectionTypeRegistry,
      final SpecificationTraverser specificationTraverser,
      final ProgrammingModel programmingModel,
      final Set<FacetDecorator> facetDecorators,
      final MetaModelValidator metaModelValidator) {

    ensureThatArg(configuration, is(notNullValue()));
    ensureThatArg(classSubstitutor, is(notNullValue()));
    ensureThatArg(collectionTypeRegistry, is(notNullValue()));
    ensureThatArg(specificationTraverser, is(notNullValue()));
    ensureThatArg(programmingModel, is(notNullValue()));
    ensureThatArg(facetDecorators, is(notNullValue()));
    ensureThatArg(metaModelValidator, is(notNullValue()));

    this.configuration = configuration;
    this.classSubstitutor = classSubstitutor;
    this.collectionTypeRegistry = collectionTypeRegistry;
    this.programmingModel = programmingModel;
    this.specificationTraverser = specificationTraverser;

    this.facetDecoratorSet = new FacetDecoratorSet();
    for (final FacetDecorator facetDecorator : facetDecorators) {
      this.facetDecoratorSet.add(facetDecorator);
    }

    this.metaModelValidator = metaModelValidator;
    this.facetProcessor =
        new FacetProcessor(configuration, collectionTypeRegistry, programmingModel);
  }
Esempio n. 4
0
  public IsisSessionDefault(
      final IsisSessionFactory sessionFactory,
      final AuthenticationSession authenticationSession,
      final PersistenceSession persistenceSession) {

    // global context
    ensureThatArg(sessionFactory, is(not(nullValue())), "execution context factory is required");

    // session
    ensureThatArg(
        authenticationSession, is(not(nullValue())), "authentication session is required");
    ensureThatArg(persistenceSession, is(not(nullValue())), "persistence session is required");

    this.isisSessionFactory = sessionFactory;

    this.authenticationSession = authenticationSession;
    this.persistenceSession = persistenceSession;

    setSessionOpenTime(System.currentTimeMillis());

    this.id = nextId++;
  }
  /** API: Return the specification for the specified class of object. */
  @Override
  public final ObjectSpecification loadSpecification(final String className) {
    ensureThatArg(className, is(notNullValue()), "specification class name must be specified");

    try {
      final Class<?> cls = loadBuiltIn(className);
      return internalLoadSpecification(cls);
    } catch (final ClassNotFoundException e) {
      final ObjectSpecification spec = getCache().get(className);
      if (spec == null) {
        throw new IsisException("No such class available: " + className);
      }
      return spec;
    }
  }
  public IsisSessionFactoryDefault(
      final DeploymentType deploymentType,
      final IsisConfiguration configuration,
      final SpecificationLoaderSpi specificationLoader,
      final TemplateImageLoader templateImageLoader,
      final AuthenticationManager authenticationManager,
      final AuthorizationManager authorizationManager,
      final UserProfileLoader userProfileLoader,
      final PersistenceSessionFactory persistenceSessionFactory,
      final DomainObjectContainer container,
      final List<Object> serviceList,
      final OidMarshaller oidMarshaller) {

    ensureThatArg(deploymentType, is(not(nullValue())));
    ensureThatArg(configuration, is(not(nullValue())));
    ensureThatArg(specificationLoader, is(not(nullValue())));
    ensureThatArg(templateImageLoader, is(not(nullValue())));
    ensureThatArg(authenticationManager, is(not(nullValue())));
    ensureThatArg(authorizationManager, is(not(nullValue())));
    ensureThatArg(userProfileLoader, is(not(nullValue())));
    ensureThatArg(persistenceSessionFactory, is(not(nullValue())));
    ensureThatArg(serviceList, is(not(nullValue())));

    this.deploymentType = deploymentType;
    this.configuration = configuration;
    this.templateImageLoader = templateImageLoader;
    this.specificationLoaderSpi = specificationLoader;
    this.authenticationManager = authenticationManager;
    this.authorizationManager = authorizationManager;
    this.userProfileLoader = userProfileLoader;
    this.persistenceSessionFactory = persistenceSessionFactory;
    this.container = container;
    this.serviceList = serviceList;
    this.oidMarshaller = oidMarshaller;

    validateServices(serviceList);
  }
 private ObjectAdapterMemento(final RootOid rootOid) {
   Ensure.ensureThatArg(rootOid, Oid.Matchers.isPersistent());
   this.persistentOidStr = rootOid.enString(getOidMarshaller());
   this.objectSpecId = rootOid.getObjectSpecId();
   this.type = Type.PERSISTENT;
 }