001 /*
002 * Copyright 2011-2012 UnboundID Corp.
003 *
004 * This program is free software; you can redistribute it and/or modify
005 * it under the terms of the GNU General Public License (GPLv2 only)
006 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
007 * as published by the Free Software Foundation.
008 *
009 * This program is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012 * GNU General Public License for more details.
013 *
014 * You should have received a copy of the GNU General Public License
015 * along with this program; if not, see <http://www.gnu.org/licenses>.
016 */
017
018 package com.unboundid.scim.sdk;
019
020 import com.unboundid.scim.data.BaseResource;
021
022 /**
023 * This class defines an API for a backend that can be plugged into the SCIM
024 * server.
025 */
026 public abstract class SCIMBackend
027 {
028 /**
029 * The mutable configuration settings for the backend.
030 */
031 private final SCIMBackendConfig config = new SCIMBackendConfig();
032
033
034
035 /**
036 * Performs any cleanup which may be necessary when this backend is to be
037 * taken out of service.
038 */
039 public abstract void finalizeBackend();
040
041
042
043 /**
044 * Retrieve the mutable configuration settings for the backend.
045 * @return The mutable configuration settings for the backend.
046 */
047 public SCIMBackendConfig getConfig()
048 {
049 return config;
050 }
051
052
053
054 /**
055 * Perform basic authentication using the provided information.
056 *
057 * @param userID The user ID to be authenticated.
058 * @param password The user password to be verified.
059 *
060 * @return {@code true} if the provided user ID and password are valid.
061 */
062 public abstract boolean authenticate(final String userID,
063 final String password);
064
065
066
067 /**
068 * Retrieve all or selected attributes of a resource.
069 *
070 * @param request The Get Resource request.
071 *
072 * @return The response to the request.
073 *
074 * @throws SCIMException if an error occurs while processing the request.
075 */
076 public abstract BaseResource getResource(
077 final GetResourceRequest request) throws SCIMException;
078
079
080
081 /**
082 * Retrieve selected resources.
083 *
084 * @param request The Get Resources request.
085 *
086 * @return The response to the request.
087 *
088 * @throws SCIMException if an error occurs while processing the request.
089 */
090 public abstract Resources getResources(
091 final GetResourcesRequest request) throws SCIMException;
092
093
094
095 /**
096 * Create a new resource.
097 *
098 *
099 * @param request The Post Resource request.
100 *
101 * @return The response to the request.
102 *
103 * @throws SCIMException if an error occurs while processing the request.
104 */
105 public abstract BaseResource postResource(
106 final PostResourceRequest request) throws SCIMException;
107
108
109
110 /**
111 * Delete a specific resource.
112 *
113 *
114 * @param request The Delete Resource request.
115 *
116 * @throws SCIMException if an error occurs while processing the request.
117 */
118 public abstract void deleteResource(
119 final DeleteResourceRequest request) throws SCIMException;
120
121
122
123 /**
124 * Replace the contents of an existing resource.
125 *
126 *
127 * @param request The Put Resource request.
128 *
129 * @return The response to the request.
130 *
131 * @throws SCIMException if an error occurs while processing the request.
132 */
133 public abstract BaseResource putResource(
134 final PutResourceRequest request) throws SCIMException;
135 }