/* * Copyright 2013 Robert von Burg <eitch@eitchnet.ch> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package li.strolch.persistence.inmemory; import li.strolch.agent.api.ComponentContainer; import li.strolch.agent.api.StrolchComponent; import li.strolch.agent.api.StrolchRealm; import li.strolch.persistence.api.ActivityDao; import li.strolch.persistence.api.AuditDao; import li.strolch.persistence.api.OrderDao; import li.strolch.persistence.api.PersistenceHandler; import li.strolch.persistence.api.ResourceDao; import li.strolch.persistence.api.StrolchTransaction; import li.strolch.privilege.model.Certificate; import li.strolch.runtime.configuration.ComponentConfiguration; /** * @author Robert von Burg <eitch@eitchnet.ch> */ public class InMemoryPersistenceHandler extends StrolchComponent implements PersistenceHandler { private InMemoryPersistence persistence; /** * @param container * @param componentName */ public InMemoryPersistenceHandler(ComponentContainer container, String componentName) { super(container, componentName); } @Override public void initialize(ComponentConfiguration configuration) throws Exception { this.persistence = new InMemoryPersistence(getContainer().getPrivilegeHandler()); super.initialize(configuration); } @Override public StrolchTransaction openTx(StrolchRealm realm, Certificate certificate, String action) { return this.persistence.openTx(realm, certificate, action); } @Override public OrderDao getOrderDao(StrolchTransaction tx) { return this.persistence.getOrderDao(tx); } @Override public ResourceDao getResourceDao(StrolchTransaction tx) { return this.persistence.getResourceDao(tx); } @Override public ActivityDao getActivityDao(StrolchTransaction tx) { return this.persistence.getActivityDao(tx); } @Override public AuditDao getAuditDao(StrolchTransaction tx) { return this.persistence.getAuditDao(tx); } @Override public void performDbInitialization() { // no-op } }