aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/com/iciql/DaoProxy.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/iciql/DaoProxy.java')
-rw-r--r--src/main/java/com/iciql/DaoProxy.java792
1 files changed, 792 insertions, 0 deletions
diff --git a/src/main/java/com/iciql/DaoProxy.java b/src/main/java/com/iciql/DaoProxy.java
new file mode 100644
index 0000000..db5f911
--- /dev/null
+++ b/src/main/java/com/iciql/DaoProxy.java
@@ -0,0 +1,792 @@
+/*
+ * Copyright 2014 James Moger.
+ *
+ * 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.iciql;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Array;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Proxy;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import com.iciql.Iciql.DataTypeAdapter;
+import com.iciql.Iciql.TypeAdapter;
+import com.iciql.util.JdbcUtils;
+import com.iciql.util.StringUtils;
+import com.iciql.util.Utils;
+
+/**
+ * DaoProxy creates a dynamic instance of the provided Dao interface.
+ *
+ * @author James Moger
+ *
+ * @param <X>
+ */
+final class DaoProxy<X extends Dao> implements InvocationHandler, Dao {
+
+ private final Db db;
+
+ private final Class<X> daoInterface;
+
+ private final char bindingDelimiter = ':';
+
+ private final Map<Method, IndexedSql> indexedSqlCache;
+
+ DaoProxy(Db db, Class<X> daoInterface) {
+ this.db = db;
+ this.daoInterface = daoInterface;
+ this.indexedSqlCache = new ConcurrentHashMap<Method, IndexedSql>();
+ }
+
+ /**
+ * Builds a proxy object for the DAO interface.
+ *
+ * @return a proxy object
+ */
+ @SuppressWarnings("unchecked")
+ X buildProxy() {
+
+ if (!daoInterface.isInterface()) {
+ throw new IciqlException("Dao {0} must be an interface!", daoInterface.getName());
+ }
+
+ ClassLoader classLoader = db.getClass().getClassLoader();
+
+ Set<Class<?>> interfaces = new HashSet<Class<?>>();
+ interfaces.add(Dao.class);
+ interfaces.add(daoInterface);
+ for (Class<?> clazz : daoInterface.getInterfaces()) {
+ interfaces.add(clazz);
+ }
+
+ Class<?>[] constructorParams = { InvocationHandler.class };
+ Class<?>[] allInterfaces = interfaces.toArray(new Class<?>[interfaces.size()]);
+
+ try {
+
+ Class<?> proxyClass = Proxy.getProxyClass(classLoader, allInterfaces);
+ Constructor<?> proxyConstructor = proxyClass.getConstructor(constructorParams);
+ return (X) proxyConstructor.newInstance(new Object[] { this });
+
+ } catch (Exception e) {
+ throw new IciqlException(e);
+ }
+ }
+
+ /**
+ * Invoke intercepts method calls and delegates execution to the appropriate object.
+ */
+ @Override
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ try {
+
+ if (method.getDeclaringClass() == Dao.class) {
+
+ return method.invoke(this, args);
+
+ } else if (method.isAnnotationPresent(SqlQuery.class)) {
+
+ String sql = method.getAnnotation(SqlQuery.class).value();
+ return executeQuery(method, args, sql);
+
+ } else if (method.isAnnotationPresent(SqlStatement.class)) {
+
+ String sql = method.getAnnotation(SqlStatement.class).value();
+ return executeStatement(method, args, sql);
+
+ } else {
+
+ throw new IciqlException("Can not invoke non-dao method {0}.{1}",
+ method.getDeclaringClass().getSimpleName(), method.getName());
+
+ }
+
+ } catch (InvocationTargetException te) {
+ throw te.getCause();
+ }
+ }
+
+ /**
+ * Execute a query.
+ *
+ * @param method
+ * @param methodArgs
+ * @param sql
+ * @return the result
+ */
+ private Object executeQuery(Method method, Object[] methodArgs, String sql) {
+
+ /*
+ * Determine and validate the return type
+ */
+ Class<?> returnType = method.getReturnType();
+
+ if (void.class == returnType) {
+ throw new IciqlException("You must specify a return type for @{0} {1}.{2}!",
+ SqlQuery.class.getSimpleName(), method.getDeclaringClass().getSimpleName(), method.getName());
+ }
+
+ if (Collection.class.isAssignableFrom(returnType)) {
+ throw new IciqlException("You may not return a collection for an @{0} method, please change the return type of {1}.{2} to YourClass[]!",
+ SqlQuery.class.getSimpleName(), method.getDeclaringClass().getSimpleName(), method.getName());
+ }
+
+ boolean isArray = false;
+ if (returnType.isArray()) {
+ isArray = true;
+ returnType = returnType.getComponentType();
+ }
+
+ boolean isJavaType = returnType.isEnum()
+ || returnType.isPrimitive()
+ || java.lang.Boolean.class.isAssignableFrom(returnType)
+ || java.lang.Number.class.isAssignableFrom(returnType)
+ || java.lang.String.class.isAssignableFrom(returnType)
+ || java.util.Date.class.isAssignableFrom(returnType)
+ || byte[].class.isAssignableFrom(returnType);
+
+ // determine the return type adapter, if any
+ DataTypeAdapter<?> adapter = null;
+ for (Annotation annotation : method.getAnnotations()) {
+ if (annotation.annotationType() == TypeAdapter.class) {
+ TypeAdapter typeAdapter = (TypeAdapter) annotation;
+ adapter = db.getDialect().getAdapter(typeAdapter.value());
+ break;
+ } else if (annotation.annotationType().isAnnotationPresent(TypeAdapter.class)) {
+ TypeAdapter typeAdapter = annotation.annotationType().getAnnotation(TypeAdapter.class);
+ adapter = db.getDialect().getAdapter(typeAdapter.value());
+ break;
+ }
+ }
+
+ /*
+ * Prepare & execute sql
+ */
+ PreparedSql preparedSql = prepareSql(method, methodArgs, sql);
+
+ List<Object> objects;
+ if (!isJavaType && adapter == null) {
+
+ // query of an Iciql model
+ objects = db.executeQuery(returnType, preparedSql.sql, preparedSql.parameters);
+
+ } else {
+
+ // query of (array of) standard Java type or a DataTypeAdapter type
+ objects = Utils.newArrayList();
+ ResultSet rs = db.executeQuery(preparedSql.sql, preparedSql.parameters);
+ try {
+
+ while (rs.next()) {
+
+ Object o = rs.getObject(1);
+ Object value;
+
+ if (adapter == null) {
+ // use internal Iciql type conversion
+ value = Utils.convert(o, returnType);
+ } else {
+ // use the type adapter to convert the JDBC object to a domain type
+ value = adapter.deserialize(o);
+ }
+
+ objects.add(value);
+
+ }
+
+ } catch (SQLException e) {
+ throw new IciqlException(e);
+ } finally {
+ JdbcUtils.closeSilently(rs);
+ }
+
+ }
+
+ /*
+ * Return the results
+ */
+ if (objects == null || objects.isEmpty()) {
+
+ // no results
+ if (isArray) {
+ // return an empty array
+ return Array.newInstance(returnType, 0);
+ }
+
+ // nothing to return!
+ return null;
+
+ } else if (isArray) {
+
+ // return an array of object results
+ Object array = Array.newInstance(returnType, objects.size());
+ for (int i = 0; i < objects.size(); i++) {
+ Array.set(array, i, objects.get(i));
+ }
+ return array;
+
+ }
+
+ // return first element
+ return objects.get(0);
+ }
+
+
+ /**
+ * Execute a statement.
+ *
+ * @param method
+ * @param methodArgs
+ * @param sql
+ * @return the result
+ */
+ private Object executeStatement(Method method, Object[] methodArgs, String sql) {
+
+ /*
+ * Determine and validate the return type
+ */
+ Class<?> returnType = method.getReturnType();
+
+ if (void.class != returnType && boolean.class != returnType && int.class != returnType) {
+
+ throw new IciqlException("Invalid return type '{0}' for @{1} {2}.{3}!",
+ returnType.getSimpleName(), SqlQuery.class.getSimpleName(),
+ method.getDeclaringClass().getSimpleName(), method.getName());
+ }
+
+ /*
+ * Prepare & execute sql
+ */
+ PreparedSql preparedSql = prepareSql(method, methodArgs, sql);
+ int rows = db.executeUpdate(preparedSql.sql, preparedSql.parameters);
+
+ /*
+ * Return the results
+ */
+ if (void.class == returnType) {
+
+ // return nothing
+ return null;
+
+ } else if (boolean.class == returnType) {
+
+ // return true if any rows were affected
+ return rows > 0;
+
+ } else {
+
+ // return number of rows
+ return rows;
+
+ }
+ }
+
+ /**
+ * Prepares an sql statement and execution parameters based on the supplied
+ * method and it's arguments.
+ *
+ * @param method
+ * @param methodArgs
+ * @param sql
+ * @return a prepared sql statement and arguments
+ */
+ private PreparedSql prepareSql(Method method, Object[] methodArgs, String sql) {
+
+ if (methodArgs == null || methodArgs.length == 0) {
+ // no method arguments
+ return new PreparedSql(sql, null);
+ }
+
+ IndexedSql indexedSql = indexedSqlCache.get(method);
+
+ if (indexedSql == null) {
+
+ // index the sql and method args
+ indexedSql = indexSql(method, sql);
+
+ // cache the indexed sql for re-use
+ indexedSqlCache.put(method, indexedSql);
+ }
+
+ final PreparedSql preparedSql = indexedSql.prepareSql(db, methodArgs);
+ return preparedSql;
+ }
+
+ /**
+ * Indexes an sql statement and method args based on the supplied
+ * method and it's arguments.
+ *
+ * @param method
+ * @param sql
+ * @return an indexed sql statement and arguments
+ */
+ private IndexedSql indexSql(Method method, String sql) {
+
+ Map<String, IndexedArgument> parameterIndex = buildParameterIndex(method);
+
+ // build a regex to extract parameter names from the sql statement
+ StringBuilder sb = new StringBuilder();
+ sb.append(bindingDelimiter);
+ sb.append("{1}(\\?");
+ for (String name : parameterIndex.keySet()) {
+ sb.append("|");
+ // strip binding delimeter from name
+ sb.append(name);
+ }
+ sb.append(')');
+
+ // identify parameters, replace with the '?' PreparedStatement
+ // delimiter and build the PreparedStatement parameters array
+ final String regex = sb.toString();
+ final Pattern p = Pattern.compile(regex);
+ final Matcher m = p.matcher(sql);
+ final StringBuffer buffer = new StringBuffer();
+
+ List<IndexedArgument> indexedArgs = Utils.newArrayList();
+ int count = 0;
+ while (m.find()) {
+ String binding = m.group(1);
+ m.appendReplacement(buffer, "?");
+
+ IndexedArgument indexedArg;
+ if ("?".equals(binding)) {
+ // standard ? JDBC placeholder
+ indexedArg = parameterIndex.get("arg" + count);
+ } else {
+ // named placeholder
+ indexedArg = parameterIndex.get(binding);
+ }
+
+ if (indexedArg == null) {
+ throw new IciqlException("Unbound SQL parameter '{0}' in {1}.{2}",
+ binding, method.getDeclaringClass().getSimpleName(), method.getName());
+ }
+ indexedArgs.add(indexedArg);
+
+ count++;
+ }
+ m.appendTail(buffer);
+
+ final String statement = buffer.toString();
+
+ // create an IndexedSql container for the statement and indexes
+ return new IndexedSql(statement, Collections.unmodifiableList(indexedArgs));
+
+ }
+
+ /**
+ * Builds an index of parameter name->(position,typeAdapter) from the method arguments
+ * array. This index is calculated once per method.
+ *
+ * @param method
+ * @return a bindings map of ("name", IndexedArgument) pairs
+ */
+ private Map<String, IndexedArgument> buildParameterIndex(Method method) {
+
+ Map<String, IndexedArgument> index = new TreeMap<String, IndexedArgument>();
+
+ Annotation [][] annotationsMatrix = method.getParameterAnnotations();
+ for (int i = 0; i < annotationsMatrix.length; i++) {
+
+ Annotation [] annotations = annotationsMatrix[i];
+
+ /*
+ * Conditionally map the bean properties of the method argument
+ * class to Method and Field instances.
+ */
+ BindBean bean = getAnnotation(BindBean.class, annotations);
+ if (bean != null) {
+ final String prefix = bean.value();
+ final Class<?> argumentClass = method.getParameterTypes()[i];
+ Map<String, IndexedArgument> beanIndex = buildBeanIndex(i, prefix, argumentClass);
+ index.putAll(beanIndex);
+ }
+
+ Class<? extends DataTypeAdapter<?>> typeAdapter = Utils.getDataTypeAdapter(annotations);
+ final IndexedArgument indexedArgument = new IndexedArgument(i, typeAdapter);
+
+ // :N - 1-indexed, like JDBC ResultSet
+ index.put("" + (i + 1), indexedArgument);
+
+ // argN - 0-indexed, like Reflection
+ index.put("arg" + i, indexedArgument);
+
+ // Bound name
+ Bind binding = getAnnotation(Bind.class, annotations);
+ if (binding!= null && !binding.value().isEmpty()) {
+ index.put(binding.value(), indexedArgument);
+ }
+
+ // try mapping Java 8 argument names, may overwrite argN
+ try {
+ Class<?> nullArgs = null;
+ Method getParameters = method.getClass().getMethod("getParameters", nullArgs);
+ if (getParameters != null) {
+ Object [] parameters = (Object []) getParameters.invoke(method, nullArgs);
+ if (parameters != null) {
+ Object o = parameters[i];
+ Method getName = o.getClass().getMethod("getName", nullArgs);
+ String j8name = getName.invoke(o, nullArgs).toString();
+ if (!j8name.isEmpty()) {
+ index.put(j8name, indexedArgument);
+ }
+ }
+ }
+ } catch (Throwable t) {
+ }
+ }
+
+ return index;
+ }
+
+ /**
+ * Builds an index of parameter name->(position,method) from the method arguments
+ * array. This index is calculated once per method.
+ *
+ * @param argumentIndex
+ * @param prefix
+ * @param beanClass
+ * @return a bindings map of ("prefix.property", IndexedArgument) pairs
+ */
+ private Map<String, IndexedArgument> buildBeanIndex(int argumentIndex, String prefix, Class<?> beanClass) {
+
+ final String beanPrefix = StringUtils.isNullOrEmpty(prefix) ? "" : (prefix + ".");
+ final Map<String, IndexedArgument> index = new TreeMap<String, IndexedArgument>();
+
+ // map JavaBean property getters
+ for (Method method : beanClass.getMethods()) {
+
+ if (Modifier.isStatic(method.getModifiers())
+ || method.getReturnType() == void.class
+ || method.getParameterTypes().length > 0
+ || method.getDeclaringClass() == Object.class) {
+
+ // not a JavaBean property
+ continue;
+ }
+
+ final String propertyName;
+ final String name = method.getName();
+ if (name.startsWith("get")) {
+ propertyName = method.getName().substring(3);
+ } else if (name.startsWith("is")) {
+ propertyName = method.getName().substring(2);
+ } else {
+ propertyName = null;
+ }
+
+ if (propertyName == null) {
+ // not a conventional JavaBean property
+ continue;
+ }
+
+ final String binding = beanPrefix + preparePropertyName(propertyName);
+ final IndexedArgument indexedArg = new IndexedArgument(argumentIndex, method);
+
+ index.put(binding, indexedArg);
+ }
+
+ // map public instance fields
+ for (Field field : beanClass.getFields()) {
+
+ if (Modifier.isStatic(field.getModifiers())) {
+ // not a JavaBean property
+ continue;
+ }
+
+ final String binding = beanPrefix + preparePropertyName(field.getName());
+ final IndexedArgument indexedArg = new IndexedArgument(argumentIndex, field);
+
+ index.put(binding, indexedArg);
+
+ }
+
+ return index;
+ }
+
+ @SuppressWarnings("unchecked")
+ private <T> T getAnnotation(Class<T> annotationClass, Annotation [] annotations) {
+ if (annotations != null) {
+ for (Annotation annotation : annotations) {
+ if (annotation.annotationType() == annotationClass) {
+ return (T) annotation;
+ }
+ }
+ }
+ return null;
+ }
+
+ private String preparePropertyName(String value) {
+ return Character.toLowerCase(value.charAt(0)) + value.substring(1);
+ }
+
+ /*
+ *
+ * Standard Dao method implementations delegate to the underlying Db
+ *
+ */
+
+ @Override
+ public final Db db() {
+ return db;
+ }
+
+ @Override
+ public final <T> boolean insert(T t) {
+ return db.insert(t);
+ }
+
+ @Override
+ public final <T> void insertAll(List<T> t) {
+ db.insertAll(t);
+ }
+
+ @Override
+ public final <T> long insertAndGetKey(T t) {
+ return db.insertAndGetKey(t);
+ }
+
+ @Override
+ public final <T> List<Long> insertAllAndGetKeys(List<T> t) {
+ return db.insertAllAndGetKeys(t);
+ }
+
+ @Override
+ public final <T> boolean update(T t) {
+ return db.update(t);
+ }
+
+ @Override
+ public final <T> void updateAll(List<T> t) {
+ db.updateAll(t);
+ }
+
+ @Override
+ public final <T> void merge(T t) {
+ db.merge(t);
+ }
+
+ @Override
+ public final <T> boolean delete(T t) {
+ return db.delete(t);
+ }
+
+ @Override
+ public final <T> void deleteAll(List<T> t) {
+ db.deleteAll(t);
+ }
+
+ @Override
+ public final void close() {
+ db.close();
+ }
+
+ /**
+ * Container class to hold the prepared JDBC SQL statement and execution
+ * parameters.
+ */
+ private class PreparedSql {
+ final String sql;
+ final Object [] parameters;
+
+ PreparedSql(String sql, Object [] parameters) {
+ this.sql = sql;
+ this.parameters = parameters;
+ }
+
+ @Override
+ public String toString() {
+ return sql;
+ }
+
+ }
+
+ /**
+ * Container class to hold a parsed JDBC SQL statement and
+ * IndexedParameters.
+ * <p>
+ * Instances of this class are cached because they are functional processing
+ * containers as they contain Method and Field references for binding beans
+ * and matching to method arguments.
+ * </p>
+ */
+ private class IndexedSql {
+ final String sql;
+ final List<IndexedArgument> indexedArgs;
+
+ IndexedSql(String sql, List<IndexedArgument> indexedArgs) {
+ this.sql = sql;
+ this.indexedArgs = indexedArgs;
+ }
+
+ /**
+ * Prepares the method arguments for statement execution.
+ *
+ * @param db
+ * @param methodArgs
+ * @return the prepared sql statement and parameters
+ */
+ PreparedSql prepareSql(Db db, Object [] methodArgs) {
+
+ Object [] parameters = new Object[indexedArgs.size()];
+
+ for (int i = 0; i < indexedArgs.size(); i++) {
+
+ IndexedArgument indexedArg = indexedArgs.get(i);
+ Object methodArg = methodArgs[indexedArg.index];
+
+ Object value = methodArg;
+ Class<? extends DataTypeAdapter<?>> typeAdapter = indexedArg.typeAdapter;
+
+ if (indexedArg.method != null) {
+
+ // execute the bean method
+ try {
+
+ value = indexedArg.method.invoke(methodArg);
+ typeAdapter = Utils.getDataTypeAdapter(indexedArg.method.getAnnotations());
+
+ } catch (Exception e) {
+ throw new IciqlException(e);
+ }
+
+ } else if (indexedArg.field != null) {
+
+ // extract the field value
+ try {
+
+ value = indexedArg.field.get(methodArg);
+ typeAdapter = Utils.getDataTypeAdapter(indexedArg.field.getAnnotations());
+
+ } catch (Exception e) {
+ throw new IciqlException(e);
+ }
+
+ } else if (typeAdapter == null) {
+
+ // identify the type adapter for the argument class
+ typeAdapter = Utils.getDataTypeAdapter(methodArg.getClass().getAnnotations());
+ }
+
+ // prepare the parameter
+ parameters[i] = prepareParameter(db, value, typeAdapter);
+
+ }
+
+ return new PreparedSql(sql, parameters);
+
+ }
+
+ /**
+ * Prepares a method argument to an sql parameter for transmission to a
+ * database.
+ *
+ * @param db
+ * @param arg
+ * @param typeAdapter
+ * @return a prepared parameter
+ */
+ private Object prepareParameter(Db db, Object arg, Class<? extends DataTypeAdapter<?>> typeAdapter) {
+
+ if (typeAdapter != null) {
+
+ // use a type adapter to serialize the method argument
+ Object o = db.getDialect().serialize(arg, typeAdapter);
+ return o;
+
+ } else {
+
+ // use the method argument
+ return arg;
+
+ }
+
+ }
+
+ @Override
+ public String toString() {
+ return sql;
+ }
+ }
+
+ /**
+ * IndexedArgument holds cached information about how to process an method
+ * argument by it's index in the method arguments array.
+ * <p>
+ * An argument may be passed-through, might be bound to a bean property,
+ * might be transformed with a type adapter, or a combination of these.
+ * </p>
+ */
+ private class IndexedArgument {
+ final int index;
+ final Class<? extends DataTypeAdapter<?>> typeAdapter;
+ final Method method;
+ final Field field;
+
+ IndexedArgument(int index, Class<? extends DataTypeAdapter<?>> typeAdapter) {
+ this.index = index;
+ this.typeAdapter = typeAdapter;
+ this.method = null;
+ this.field = null;
+ }
+
+ IndexedArgument(int methodArgIndex, Method method) {
+ this.index = methodArgIndex;
+ this.typeAdapter = null;
+ this.method = method;
+ this.field = null;
+ }
+
+ IndexedArgument(int methodArgIndex, Field field) {
+ this.index = methodArgIndex;
+ this.typeAdapter = null;
+ this.method = null;
+ this.field = field;
+ }
+
+ @Override
+ public String toString() {
+
+ String accessor;
+ if (method != null) {
+ accessor = "M:" + method.getDeclaringClass().getSimpleName() + "." + method.getName();
+ } else if (field != null) {
+ accessor = "F:" + field.getDeclaringClass().getSimpleName() + "." + field.getName();
+ } else {
+ accessor = "A:arg";
+ }
+
+ return index + ":" + accessor + (typeAdapter == null ? "" : (":" + typeAdapter.getSimpleName()));
+ }
+
+ }
+
+}
ion value='backport/49288/stable29'>backport/49288/stable29 Nextcloud server, a safe home for all your data: https://github.com/nextcloud/serverwww-data
aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external/l10n/es_EC.json
blob: 8a911e6e776cc3d39be1b66e03e8dce3e1f0b211 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
{ "translations": {
    "External storages" : "Almacenamiento externo",
    "Personal" : "Personal",
    "System" : "Sistema",
    "Grant access" : "Conceder acceso",
    "Error configuring OAuth1" : "Se presentó un error al configurar OAuth1",
    "Please provide a valid app key and secret." : "Por favor proporciona una llave de aplicación y secreto válidos.",
    "Error configuring OAuth2" : "Se presentó un error al configurar OAuth2",
    "Generate keys" : "Generar llaves",
    "Error generating key pair" : "Se presentó un error al generar el juego de llaves",
    "All users. Type to select user or group." : "Todos los usuarios. Escribe para seleccionar el usuario o grupo",
    "(group)" : "(grupo)",
    "Compatibility with Mac NFD encoding (slow)" : "Compatibilidad con codificación Mac NFD (lenta)",
    "Admin defined" : "Administrador definido",
    "Are you sure you want to delete this external storage?" : "¿Estás seguro que quieres borrar este almacenamiento externo?",
    "Delete storage?" : "¿Borrar almacenamiento?",
    "Saved" : "Guardado",
    "Saving..." : "Guardando...",
    "Save" : "Guardar",
    "Empty response from the server" : "Respuesta del servidor vacía",
    "Couldn't access. Please log out and in again to activate this mount point" : "No fue posible accesar. Por favor sal de la sesión y vuelve a entrar para activar este punto de montaje",
    "Couldn't get the information from the remote server: {code} {type}" : "No fue posible obtener la información del servidor remoto: {code} {type}",
    "Couldn't get the list of external mount points: {type}" : "No fue posible obtener la lista de puntos de montaje externos: {type}",
    "There was an error with message: " : "Se presentó un problema con el mensaje:",
    "External mount error" : "Error de montaje externo",
    "external-storage" : "almacenamiento externo",
    "Couldn't fetch list of Windows network drive mount points: Empty response from server" : "No fue posible obtener el listado de los puntos de motaje de unidades de red Windows. Respuesta vacía del servidor",
    "Some of the configured external mount points are not connected. Please click on the red row(s) for more information" : "Algunos de los puntos de montaje externos configurados no se encuentran conectados. Por favor has click en los renglon(es) en rojo para más información",
    "Please enter the credentials for the {mount} mount" : "Por favor ingresa las credenciales para el montaje {mount}",
    "Username" : "Usuario",
    "Password" : "Contraseña",
    "Credentials saved" : "Credenciales guardadas",
    "Credentials saving failed" : "Se ha presentado una falla al guardar las credenciales",
    "Credentials required" : "Se requieren credenciales",
    "Storage with ID \"%d\" not found" : "El almacenamiento con ID \"%d\" no fue encontrado",
    "Invalid backend or authentication mechanism class" : "Backend o clase de mecanismo de autenticación inválido ",
    "Invalid mount point" : "Punto de montaje inválido",
    "Objectstore forbidden" : "Objectstore prohibido",
    "Invalid storage backend \"%s\"" : "Almacenamiento de backend \"%s\" inválido ",
    "Not permitted to use backend \"%s\"" : "No está permitido usar el backend \"%s\"",
    "Not permitted to use authentication mechanism \"%s\"" : "No está permitido el uso del mecanismo de autenticación \"%s\"",
    "Unsatisfied backend parameters" : "Parametros del backend no satisfechos",
    "Unsatisfied authentication mechanism parameters" : "Parámetros no satisfechos del mecanismo de autenticación",
    "Insufficient data: %s" : "Datos insuficientes: %s",
    "%s" : "%s",
    "Storage with ID \"%d\" is not user editable" : "El almacenamiento con ID \"%d\" no puede ser editado por el usuario",
    "Access key" : "Llave de acceso",
    "Secret key" : "Llave secreta",
    "Builtin" : "Integrado",
    "None" : "Ninguno",
    "OAuth1" : "OAuth1",
    "App key" : "Llave de la aplicación",
    "App secret" : "Secreto de la aplicación",
    "OAuth2" : "OAuth2",
    "Client ID" : "ID del cliente",
    "Client secret" : "Secreto del cliente",
    "OpenStack v2" : "OpenStack v2",
    "Tenant name" : "Nombre de inquilino",
    "Identity endpoint URL" : "URL del punto de enlace de Identidad",
    "OpenStack v3" : "OpenStack v3",
    "Domain" : "Dominio",
    "Rackspace" : "Rackspace",
    "API key" : "Llave de API",
    "Global credentials" : "Credenciales globales",
    "Log-in credentials, save in database" : "Credenciales de inicio de sesión, guardar en la base de datos",
    "Username and password" : "Usuario y contraseña",
    "Log-in credentials, save in session" : "Credenciales de inicio de sesión, guardar en la sesión",
    "User entered, store in database" : "Usuario ingresado, almacenar en la base de datos",
    "RSA public key" : "Llave pública RSA",
    "Public key" : "Llave pública",
    "Amazon S3" : "Amazon S3",
    "Bucket" : "Bucket",
    "Hostname" : "Nombre del servidor",
    "Port" : "Puerto",
    "Region" : "Región",
    "Enable SSL" : "Habilitar SSL",
    "Enable Path Style" : "Habilitar Estilo de Ruta",
    "Legacy (v2) authentication" : "Autenticación legada (v2)",
    "WebDAV" : "WebDAV",
    "URL" : "URL",
    "Remote subfolder" : "Subcarpeta remota",
    "Secure https://" : "https:// seguro",
    "FTP" : "FTP",
    "Host" : "Servidor",
    "Secure ftps://" : "ftps:// seguro",
    "Local" : "Local",
    "Location" : "Ubicación",
    "Nextcloud" : "Nextcloud",
    "SFTP" : "SFTP",
    "Root" : "Raíz",
    "SFTP with secret key login" : "Inicio de sesión SFTP con llave secreta",
    "SMB / CIFS" : "SMB / CIFS",
    "Share" : "Compartir",
    "SMB / CIFS using OC login" : "SMB / CIFS usando inicio de sesión OC",
    "Username as share" : "Usuario como elemento compartido",
    "OpenStack Object Storage" : "OpenStack Object Storage",
    "Service name" : "Nombre del servicio",
    "Request timeout (seconds)" : "Tiemo de vida de la solicitud (segudos)",
    "The cURL support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it." : "El soporte para cURL en PHP no se encuentra habilitado o instalado. El montaje de %s no es posible. Por favor solicita a tu administador su instalación. ",
    "The FTP support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it." : "El soporte para FTP en PHP no se encuentra habilitado o instalado. El montaje de %s no es posible. Por favor solicita a tu administador su instalación. ",
    "\"%s\" is not installed. Mounting of %s is not possible. Please ask your system administrator to install it." : "\"%s\" no se encuentra instalado. El montaje de %s no es posible. Por favor solicita a tu administrador su instalación.  ",
    "External storage support" : "Soporte de almacenamiento externo",
    "No external storage configured or you don't have the permission to configure them" : "No se ha configurado almacenamiento externo o bien no cuentas con los permisos para configurarlos",
    "Name" : "Nombre",
    "Storage type" : "Tipo de almacenamiento",
    "Scope" : "Alcance",
    "Enable encryption" : "Habilitar encripción",
    "Enable previews" : "Habilitar vistas previas",
    "Enable sharing" : "Habilitar compartir",
    "Check for changes" : "Verificar si hay cambios",
    "Never" : "Nunca",
    "Once every direct access" : "Una vez cada acceso directo",
    "Read only" : "Sólo lectura",
    "Folder name" : "Nombre de la carpeta",
    "External storage" : "Almacenamiento externo",
    "Authentication" : "Autenticación",
    "Configuration" : "Configuración",
    "Available for" : "Disponible para",
    "Click to recheck the configuration" : "Haz click para volver a marcar la configuración",
    "Add storage" : "Agregar almacenamiento",
    "Advanced settings" : "Configuraciones avanzadas",
    "Allow users to mount external storage" : "Permitir a los usuarios montar almacenamiento externo",
    "Fetching request tokens failed. Verify that your app key and secret are correct." : "Se presentó una falla al buscar las fichas de solicitud. Por favor verifica que tu llave de aplicación y tu secreto sean correctos. ",
    "Fetching access tokens failed. Verify that your app key and secret are correct." : "Se presentó una falla al buscar las fichas de acceso. Por favor verifica que tu llave de aplicación y tu secreto sean correctos. ",
    "Step 1 failed. Exception: %s" : "Paso 1 falló. Excepción: %s",
    "Step 2 failed. Exception: %s" : "Paso 2 falló. Excepción: %s",
    "Dropbox App Configuration" : "Configuración de la aplicación Dropbox",
    "Google Drive App Configuration" : "Configuración de la Aplicación de Google Drive",
    "OpenStack" : "OpenStack",
    "Dropbox" : "Dropbox",
    "Google Drive" : "Google Drive",
    "No external storage configured" : "No se ha configurado el almacenamiento externo",
    "You can add external storages in the personal settings" : "Puedes agregar almacenamiento externo en las configuraciones personales",
    "Delete" : "Borrar",
    "Allow users to mount the following external storage" : "Permitir a los usuarios montar el siguiente almacenamiento externo",
    "Are you sure you want to delete this external storage" : "¿Estás seguro de que quieres borrar este almacenamiento externo?"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}