7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste/*
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * The contents of this file are subject to the terms of the Common Development and
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * Distribution License (the License). You may not use this file except in compliance with the
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * License.
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste *
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * specific language governing permission and limitations under the License.
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste *
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * When distributing Covered Software, include this CDDL Header Notice in each file and include
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * Header, with the fields enclosed by brackets [] replaced by your own identifying
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * information: "Portions copyright [year] [name of copyright owner]".
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste *
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * Copyright 2015 ForgeRock AS.
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste */
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Joostepackage org.forgerock.openam.scripting.datastore;
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste
6197cac1b7f675588382db0a6f279614032b5568David Lunaimport org.forgerock.openam.scripting.service.ScriptConfiguration;
4701cb94cccc5ef52c5333593fe9dd5a2376a9d9Jaco Joosteimport org.forgerock.util.query.QueryFilter;
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Joosteimport org.forgerock.openam.scripting.ScriptException;
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Joosteimport java.util.Set;
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste/**
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * An interface for managing script related data in the data store.
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste *
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * @since 13.0.0
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste */
6197cac1b7f675588382db0a6f279614032b5568David Lunapublic interface ScriptingDataStore {
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste /**
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * Save the scripting data in the data store.
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * @param data The data to save.
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * @throws ScriptException if the operation was not successful
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste */
6197cac1b7f675588382db0a6f279614032b5568David Luna public void save(ScriptConfiguration data) throws ScriptException;
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste /**
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * Delete the data with the given UUID from the data store.
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * @param uuid The unique identifier for the data.
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * @throws ScriptException if the operation was not successful
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste */
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste public void delete(String uuid) throws ScriptException;
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste /**
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * Retrieve the data stored from the data store.
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * @return A set of data objects.
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * @throws ScriptException if the operation was not successful
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste */
6197cac1b7f675588382db0a6f279614032b5568David Luna public Set<ScriptConfiguration> getAll() throws ScriptException;
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste /**
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * Retrieve the data stored from the data store.
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * @return The data object with the given UUID or null if it cannot be found.
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * @throws ScriptException if the operation was not successful
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste */
6197cac1b7f675588382db0a6f279614032b5568David Luna public ScriptConfiguration get(String uuid) throws ScriptException;
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste /**
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * Check to see if data with the given UUID already.
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * @param uuid The unique identifier for the data.
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * @return True if the data already exists.
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * @throws ScriptException if the operation was not successful
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste */
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste public boolean containsUuid(String uuid) throws ScriptException;
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste /**
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * Check to see if data with the given name already exists.
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * @param name The name for the data.
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * @return True if the data already exists.
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste * @throws ScriptException if the operation was not successful
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste */
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste public boolean containsName(String name) throws ScriptException;
74b502cf428d057e78572e9fd66fb2f1861887b0Jaco Jooste
74b502cf428d057e78572e9fd66fb2f1861887b0Jaco Jooste /**
74b502cf428d057e78572e9fd66fb2f1861887b0Jaco Jooste * Retrieve the data stored from the data store based on the given query filter.
74b502cf428d057e78572e9fd66fb2f1861887b0Jaco Jooste * @param filter the query filter.
74b502cf428d057e78572e9fd66fb2f1861887b0Jaco Jooste * @return a set of matching data objects.
74b502cf428d057e78572e9fd66fb2f1861887b0Jaco Jooste * @throws ScriptException should an error occur during lookup
74b502cf428d057e78572e9fd66fb2f1861887b0Jaco Jooste */
6197cac1b7f675588382db0a6f279614032b5568David Luna public Set<ScriptConfiguration> get(QueryFilter<String> filter) throws ScriptException;
7197110fbdb6deb7868581c455516161cbcf7e0fJaco Jooste}