All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.usergrid.persistence.EntityManagerFactory Maven / Gradle / Ivy

There is a newer version: 0.0.27.1
Show newest version
/*******************************************************************************
 * Copyright 2012 Apigee Corporation
 * 
 * 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 org.usergrid.persistence;

import org.usergrid.persistence.entities.Group;

import java.util.Map;
import java.util.UUID;

// TODO: Auto-generated Javadoc
/**
 * The interface class that specifies the operations that can be performed on
 * the Usergrid Datastore. This interface is designed to be implemented by
 * different backends. Although these operations are meant to take advantage of
 * the capabilities of Cassandra, they should be implementable using other
 * relational databases such as MySql or NoSQL databases such as GAE or MongoDB.
 */
public interface EntityManagerFactory {

	/**
	 * A string description provided by the implementing class.
	 * 
	 * @return description text
	 * @throws Exception
	 *             the exception
	 */
	public abstract String getImpementationDescription() throws Exception;

	/**
	 * Gets the entity manager.
	 * 
	 * @param applicationId
	 *            the application id
	 * @return EntityDao for the specfied parameters
	 */
	public abstract EntityManager getEntityManager(UUID applicationId);

	/**
	 * Creates a new application.
	 * 
	 * @param name
	 *            a unique application name.
	 * @return the newly created application id.
	 * @throws Exception
	 *             the exception
	 */
	public abstract UUID createApplication(String organizationName, String name) throws Exception;

	/**
	 * Creates a Application entity. All entities except for applications must be
	 * attached to a Application.
	 * 
	 * @param name
	 *            the name of the application to create.
	 * @param properties
	 *            property values to create in the new entity or null.
	 * @return the newly created application id.
	 * @throws Exception
	 *             the exception
	 */
	public abstract UUID createApplication(String organizationName, String name,
			Map properties) throws Exception;

	public abstract UUID importApplication(String organization, UUID applicationId, String name,
			Map properties) throws Exception;

	/**
	 * Returns the application id for the application name.
	 * 
	 * @param name
	 *            a unique application name.
	 * @return the Application id or null.
	 * @throws Exception
	 *             the exception
	 */
	public abstract UUID lookupApplication(String name) throws Exception;

	/**
	 * Returns all the applications in the system.
	 * 
	 * @return all the applications.
	 * @throws Exception
	 *             the exception
	 */
	public abstract Map getApplications() throws Exception;

	public abstract void setup() throws Exception;

	public abstract Map getServiceProperties();

	public abstract boolean updateServiceProperties(Map properties);

	public abstract boolean setServiceProperty(String name, String value);

	public abstract boolean deleteServiceProperty(String name);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy