ScriptRegistryService.java revision b98ecd998935c6c4c9b7656e12e7d56e0b0d3e4b
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2013-2014 ForgeRock AS. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*/
/**
*
* @author Laszlo Hordos
*/
@Properties({
@References({
public class ScriptRegistryService extends ScriptRegistryImpl implements RequestHandler, ScheduledService {
static {
}
}
// TODO Move to public package
// Public Constants
/**
* Setup logging for the {@link ScriptRegistryService}.
*/
// private static final LocalizedLogger logger =
// LocalizedLogger.getLocalizedLogger(ScriptRegistryService.class);
private static final ConcurrentMap<String, Object> propertiesCache = new ConcurrentHashMap<String, Object>();
private enum Action {
}
}
public Void call(Parameter scope, Function<?> callback, Object... arguments) throws ResourceException, NoSuchMethodException {
}
}
return null;
}
});
if (properties.isMap()) {
continue;
}
}
}
try {
/* TODO: Support addition config properties (currently set to defaults in commons)
JsonValue subDirValue = source.get(SOURCE_SUBDIRECTORIES).defaultTo("auto-true");
boolean subdirectories = true;
if (subDirValue.isBoolean()) {
subdirectories = subDirValue.asBoolean();
} else {
subdirectories = Boolean.parseBoolean(subDirValue.asString());
}
String type = source.get(SOURCE_TYPE).defaultTo("auto-detect").asString();
String visibility = source.get(SOURCE_VISIBILITY).defaultTo("public").asString();
*/
}
}
} catch (Exception e) {
throw e;
}
// OPENIDM-1746 Set the script registry class loader to this class, so that any libraries
// bundled as an OSGI-Fragment attached to this bundle will be "seen" by scripts.
/*
* manifestWatcher = new BundleWatcher<ManifestEntry>(context, new
* ScriptEngineManifestScanner(), null); manifestWatcher.start();
*/
}
if (properties.isMap()) {
continue;
}
}
}
}
}
}
if (null != manifestWatcher) {
}
}
}
super.setPersistenceConfig(null);
}
// encrypt(any value, string cipher, string alias)
static final long serialVersionUID = 1L;
throws ResourceException, NoSuchMethodException {
} else {
"encrypt", arguments));
}
} else {
"encrypt", arguments));
}
} else {
"encrypt", arguments));
}
try {
} catch (JsonCryptoException e) {
throw new InternalServerErrorException(e.getMessage(), e);
}
} else {
"encrypt", arguments));
}
}
});
// decrypt(any value)
static final long serialVersionUID = 1L;
throws ResourceException, NoSuchMethodException {
return cryptoService
} else {
"decrypt", arguments));
}
}
});
// isEncrypted(any value)
static final long serialVersionUID = 1L;
throws ResourceException, NoSuchMethodException {
return false;
} else {
"isEncrypted", arguments));
}
}
});
}
}
}
}
}
}
// Check if "name" is missing and "file" is used instead
}
}
return super.takeScript(scriptConfig);
}
throws ResourceException, NoSuchMethodException {
boolean useCache = false;
}
}
if (useCache) {
}
}
return result;
} else {
}
}
},
throws ResourceException, NoSuchMethodException {
}
}
},
throws ResourceException, NoSuchMethodException {
}
}
},
throws ResourceException, NoSuchMethodException {
}
}
};
static final long serialVersionUID = 1L;
}
return true;
}
return false;
}
// ----- Implementation of RequestHandler interface
try {
if (isSourceUnit(key)) {
} else {
}
}
// The script will be in the request content
// Add any additional parameters to the map of bindings
} else {
throw new NotSupportedException("Actions are not supported for resource instances");
}
case eval:
if (scriptEntry.isActive()) {
} else {
throw new ServiceUnavailableException();
}
break;
default:
}
} catch (final ResourceException e) {
handler.handleError(e);
} catch (Exception e) {
}
}
final QueryResultHandler handler) {
handler.handleError(e);
}
handler.handleError(e);
}
handler.handleError(e);
}
handler.handleError(e);
}
handler.handleError(e);
}
handler.handleError(e);
}
public void execute(ServerContext context, Map<String, Object> scheduledContext) throws ExecutionException {
try {
}
}
if (!scriptValue.isNull()) {
} else {
}
} catch (JsonValueException jve) {
throw new ExecutionException(jve);
} catch (ScriptException e) {
throw new ExecutionException(e);
} catch (ResourceException e) {
throw new ExecutionException(e);
}
}
private void execScript(Context context, ScriptEntry script, JsonValue value) throws ForbiddenException, InternalServerErrorException {
try {
} catch (ScriptThrownException ste) {
} catch (ScriptException se) {
}
}
}
}