com.adaptrex.core.Adaptrex Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of adaptrex-core Show documentation
Show all versions of adaptrex-core Show documentation
The Core Adaptrex Framework
/*
* Copyright 2012 Adaptrex, LLC.
*
* 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 com.adaptrex.core;
import javax.ws.rs.core.Request;
import com.adaptrex.core.persistence.api.ORMPersistenceManager;
import com.adaptrex.core.rest.RestService;
import com.adaptrex.core.services.AdaptrexServices;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* An instance of this class is the main entry point into Adaptrex services. Your webapp
* needs to bootstrap Adaptrex before it can be used. For
* more information on bootstrapping, see {@link AdaptrexContextListener AdaptrexContextListener}
*
* In general, most interactions with Adaptrex use the following:
*
* - Built in presentation components (JSF, JSP, Tapestry, etc)
* - Store and Model CRUD methods (REST API)
*
* In those cases, you do not need to access the Adaptrex service directly. If you do
* need access to some services (such as AdaptrexPersistence) you can retrieve them directly
* from the Adaptrex service instance. You can always retrieve the service by calling
* Adaptrex.getAdaptrex() or by whatever other mechanism you have enabled in your application
*/
public class Adaptrex {
private Logger log = LoggerFactory.getLogger(Adaptrex.class);
public Adaptrex() {}
public ORMPersistenceManager getPersistenceManager() {
return AdaptrexServices.getPersistenceManager();
}
public ORMPersistenceManager getPersistenceManager(String factoryName) {
return AdaptrexServices.getPersistenceManager(factoryName);
}
public RestService getRest() {
return new RestService();
}
}