CPD ErgebnisseDieses Dokument enthält die Ergebnisse von PMD's CPD 4.2.5. DuplikationenDatei | Projekt | Zeile |
---|
org/cumulus4j/store/test/jpa/TestUtil.java | org.cumulus4j.store.test.jpa | 32 | org/cumulus4j/store/test/framework/TestUtil.java | org.cumulus4j.store.test | 32 | public class TestUtil
{
private static void populateMap(Properties destination, Properties source)
{
Map<String, String> propertiesMap = new HashMap<String, String>(System.getProperties().size());
for (Map.Entry<?, ?> me : System.getProperties().entrySet())
propertiesMap.put(me.getKey() == null ? null : me.getKey().toString(), me.getValue() == null ? null : me.getValue().toString());
for (Map.Entry<?, ?> me : source.entrySet()) {
String key = me.getKey() == null ? null : me.getKey().toString();
String value = me.getValue() == null ? null : me.getValue().toString();
if (value != null)
value = IOUtil.replaceTemplateVariables(value, propertiesMap);
if (value == null || "_NULL_".equals(value))
destination.remove(key);
else
destination.put(key, value);
}
}
/**
* Load a properties file. This is a convenience method delegating to {@link #loadProperties(String, boolean)}
* with <code>logToSystemOut == false</code> (it will thus use SLF4J to log).
* @param fileName the simple name of the properties file (no path!).
* @return the loaded and merged properties.
*/
public static Properties loadProperties(String fileName)
{
return loadProperties(fileName, false);
}
/**
* Load a properties file. The file is first loaded as resource and then merged with a file from the user's home directory
* (if it exists). Settings that are declared in the user's specific file override the settings from the non-user-specific
* file in the resources.
* @param fileName the simple name of the properties file (no path!).
* @param logToSystemOut whether to log to system out. This is useful, if the properties file to search is a <code>log4j.properties</code>.
* @return the loaded and merged properties.
*/
public static Properties loadProperties(String fileName, boolean logToSystemOut)
{
Properties result = new Properties();
try {
Properties defaultProps = new Properties();
InputStream in = TestUtil.class.getClassLoader().getResourceAsStream(fileName);
defaultProps.load(in);
in.close();
populateMap(result, defaultProps);
File userPropsFile = new File(IOUtil.getUserHome(), fileName);
if (userPropsFile.exists()) {
Properties userProps = new Properties();
in = new FileInputStream(userPropsFile);
userProps.load(in);
in.close();
populateMap(result, userProps);
}
else {
String msg = "loadProperties: File " + userPropsFile.getAbsolutePath() + " does not exist. Thus not overriding any settings with user-specific ones.";
if (logToSystemOut)
System.out.println(msg);
else
LoggerFactory.getLogger(TestUtil.class).info(msg);
}
} catch (IOException x) {
throw new RuntimeException(x);
}
return result;
}
private static boolean loggingConfigured = false;
public static void configureLoggingOnce()
{
if (loggingConfigured)
return;
loggingConfigured = true;
Properties properties = loadProperties("cumulus4j-test-log4j.properties", true);
PropertyConfigurator.configure(properties);
}
} |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/test/jpa/JPATransactionalRunner.java | org.cumulus4j.store.test.jpa | 83 | org/cumulus4j/store/test/framework/JDOTransactionalRunner.java | org.cumulus4j.store.test | 82 | public JDOTransactionalRunner(Class<?> testClass) throws InitializationError {
super(testClass);
}
@Override
protected Statement methodInvoker(FrameworkMethod method, Object test)
{
Statement superMethodInvoker = super.methodInvoker(method, test);
return new TransactionalInvokeMethod(method, test, superMethodInvoker);
}
private class TxRunBefores extends Statement {
private final Statement fNext;
private final Object fTarget;
private final List<FrameworkMethod> fBefores;
public TxRunBefores(Statement next, List<FrameworkMethod> befores, Object target) {
fNext= next;
fBefores= befores;
fTarget= target;
}
@Override
public void evaluate() throws Throwable {
for (FrameworkMethod before : fBefores)
runInTransaction(fTarget, before);
fNext.evaluate();
}
}
private class TxRunAfters extends Statement {
private final Statement fNext;
private final Object fTarget;
private final List<FrameworkMethod> fAfters;
public TxRunAfters(Statement next, List<FrameworkMethod> afters, Object target) {
fNext= next;
fAfters= afters;
fTarget= target;
}
@Override
public void evaluate() throws Throwable {
List<Throwable> errors = new ArrayList<Throwable>();
errors.clear();
try {
fNext.evaluate();
} catch (Throwable e) {
errors.add(e);
} finally {
for (FrameworkMethod each : fAfters)
try {
runInTransaction(fTarget, each);
} catch (Throwable e) {
errors.add(e);
}
}
MultipleFailureException.assertEmpty(errors);
}
}
@Override
protected Statement withBefores(FrameworkMethod method, Object target, Statement statement) {
List<FrameworkMethod> befores = getTestClass().getAnnotatedMethods(Before.class);
return befores.isEmpty() ? statement : new TxRunBefores(statement, befores, target);
}
@Override
protected Statement withAfters(FrameworkMethod method, Object target, Statement statement) {
List<FrameworkMethod> afters= getTestClass().getAnnotatedMethods(After.class);
return afters.isEmpty() ? statement : new TxRunAfters(statement, afters, target);
}
// @Override
// protected List<MethodRule> rules(Object test) {
// List<MethodRule> superRules = super.rules(test);
// List<MethodRule> result = new ArrayList<MethodRule>(superRules.size() + 1);
// result.addAll(superRules);
// result.add(transactionalRule);
// return result;
// }
//
// private MethodRule transactionalRule = new MethodRule() {
// @Override
// public Statement apply(Statement base, FrameworkMethod method, Object target) {
// return new TransactionalInvokeMethod(method, target, base);
// }
// };
private void runInTransaction(final Object test, final FrameworkMethod method)
throws Throwable
{
runInTransaction(test, new Statement() {
@Override
public void evaluate() throws Throwable {
method.invokeExplosively(test);
}
});
}
public static void setEncryptionCoordinates(PersistenceManager pm) |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/query/JDOQLQuery.java | org.cumulus4j.store | 58 | org/cumulus4j/store/query/JPQLQuery.java | org.cumulus4j.store | 56 | public JPQLQuery(ExecutionContext ec) {
super(ec);
}
// END DataNucleus 3.0.0-m6 and 3.0.0-release
// BEGIN DataNucleus 3.0.1 and newer
// public JPQLQuery(StoreManager storeMgr, ExecutionContext ec, AbstractJPQLQuery q) {
// super(storeMgr, ec, q);
// }
//
// public JPQLQuery(StoreManager storeMgr, ExecutionContext ec, String query) {
// super(storeMgr, ec, query);
// }
//
// public JPQLQuery(StoreManager storeMgr, ExecutionContext ec) {
// super(storeMgr, ec);
// }
// END DataNucleus 3.0.1 and newer
@Override
protected Object performExecute(@SuppressWarnings("rawtypes") Map parameters) {
ManagedConnection mconn = ec.getStoreManager().getConnection(ec);
try {
PersistenceManagerConnection pmConn = (PersistenceManagerConnection)mconn.getConnection();
PersistenceManager pmData = pmConn.getDataPM();
boolean inMemory = evaluateInMemory();
boolean inMemory_applyFilter = true;
List<Object> candidates = null;
if (this.candidateCollection != null) {
if (candidateCollection.isEmpty()) {
return Collections.EMPTY_LIST;
}
@SuppressWarnings("unchecked")
Collection<? extends Object> c = this.candidateCollection;
candidates = new ArrayList<Object>(c);
}
else {
if (candidateExtent != null) {
this.setCandidateClass(candidateExtent.getCandidateClass());
this.setSubclasses(candidateExtent.hasSubclasses());
}
if (inMemory) {
// Retrieve all candidates and perform all evaluation in-memory
Set<ClassMeta> classMetas = QueryHelper.getCandidateClassMetas((Cumulus4jStoreManager) ec.getStoreManager(),
ec, candidateClass, subclasses);
candidates = QueryHelper.getAllPersistentObjectsForCandidateClasses(pmData, ec, classMetas);
}
else {
try
{
// Apply filter in datastore
@SuppressWarnings("unchecked")
Map<String, Object> parameterValues = parameters;
JDOQueryEvaluator queryEvaluator = new JDOQueryEvaluator(this, compilation, parameterValues, clr, pmConn);
candidates = queryEvaluator.execute();
if (queryEvaluator.isComplete()) {
inMemory_applyFilter = false;
}
else {
NucleusLogger.QUERY.debug("Query evaluation of filter in datastore was incomplete so doing further work in-memory");
}
}
catch (UnsupportedOperationException uoe) {
// Some part of the filter is not yet supported, so fallback to in-memory evaluation
// Retrieve all candidates and perform all evaluation in-memory
NucleusLogger.QUERY.info("Query filter is not totally evaluatable in-datastore using Cumulus4j currently, so evaluating in-memory : "+uoe.getMessage());
Set<ClassMeta> classMetas = QueryHelper.getCandidateClassMetas((Cumulus4jStoreManager) ec.getStoreManager(),
ec, candidateClass, subclasses);
candidates = QueryHelper.getAllPersistentObjectsForCandidateClasses(pmData, ec, classMetas);
}
}
}
// Evaluate any remaining query components in-memory
JavaQueryEvaluator evaluator = new JPQLEvaluator(this, candidates, compilation, parameters, ec.getClassLoaderResolver()); |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/test/jpa/account/LocalAccountantDelegate.java | org.cumulus4j.store.test.jpa | 133 | org/cumulus4j/store/test/account/LocalAccountantDelegate.java | org.cumulus4j.store.test | 145 | )
private Map<String, Account> accounts;
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((organisationID == null) ? 0 : organisationID.hashCode());
result = prime * result + ((localAccountantDelegateID == null) ? 0 : localAccountantDelegateID.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
LocalAccountantDelegate other = (LocalAccountantDelegate) obj;
return (
equals(this.localAccountantDelegateID, other.localAccountantDelegateID) &&
equals(this.organisationID, other.organisationID)
);
}
private static final boolean equals(String s1, String s2)
{
if (s1 == null)
return s2 == null;
else
return s1.equals(s2);
}
@Override
public String toString() {
return this.getClass().getName() + '@' + Integer.toHexString(System.identityHashCode(this)) + '[' + organisationID + ',' + localAccountantDelegateID + ']';
}
public void setAccount(String currencyID, Account account)
{
if (account == null)
accounts.remove(currencyID);
else
accounts.put(currencyID, account);
}
public Map<String, Account> getAccounts() {
return Collections.unmodifiableMap(accounts);
}
public void test()
{
String currencyID = "EUR";
Account account = accounts.get(currencyID);
if (account == null)
throw new IllegalStateException("The VoucherLocalAccountantDelegate does not contain an account for currencyID '"+currencyID+"'!!! id='"+JDOHelper.getObjectId(this)+"'");
}
} |
Datei | Projekt | Zeile |
---|
org/cumulus4j/integrationtest/gwt/server/MovieServiceImpl.java | org.cumulus4j.integrationtest.gwt | 98 | org/cumulus4j/integrationtest/webapp/TestService.java | org.cumulus4j.integrationtest.webapp | 92 | StringBuilder resultSB = new StringBuilder();
PersistenceManager pm = getPersistenceManager(cryptoManagerID, cryptoSessionID);
try {
// tx1: persist some data
pm.currentTransaction().begin();
pm.getExtent(Movie.class);
{
Movie movie = new Movie();
movie.setName("MMM " + System.currentTimeMillis());
movie = pm.makePersistent(movie);
Rating rating = new Rating();
rating.setName("RRR " + System.currentTimeMillis());
rating = pm.makePersistent(rating);
movie.setRating(rating);
}
{
Movie movie = new Movie();
movie.setName("MMM " + System.currentTimeMillis());
movie = pm.makePersistent(movie);
Person person = new Person();
person.setName("PPP " + System.currentTimeMillis());
person = pm.makePersistent(person);
movie.getStarring().add(person);
pm.currentTransaction().commit();
}
pm = getPersistenceManager(cryptoManagerID, cryptoSessionID);
// TODO I just had this exception. Obviously the PM is closed when its tx is committed - this is IMHO wrong and a DN bug.
// I have to tell Andy.
// Marco :-)
// javax.jdo.JDOFatalUserException: Persistence Manager has been closed
// at org.datanucleus.api.jdo.JDOPersistenceManager.assertIsOpen(JDOPersistenceManager.java:2189)
// at org.datanucleus.api.jdo.JDOPersistenceManager.newQuery(JDOPersistenceManager.java:1286)
// at org.datanucleus.api.jdo.JDOPersistenceManager.newQuery(JDOPersistenceManager.java:1237)
// at org.datanucleus.api.jdo.JDOPersistenceManager.newQuery(JDOPersistenceManager.java:1349)
// at org.cumulus4j.store.query.QueryHelper.getAllPersistentObjectsForCandidateClasses(QueryHelper.java:60)
// at org.cumulus4j.store.query.QueryEvaluator.execute(QueryEvaluator.java:272)
// at org.cumulus4j.store.query.JDOQLQuery.performExecute(JDOQLQuery.java:83)
// at org.datanucleus.store.query.Query.executeQuery(Query.java:1744)
// at org.datanucleus.store.query.Query.executeWithArray(Query.java:1634)
// at org.datanucleus.store.query.Query.execute(Query.java:1607)
// at org.datanucleus.store.DefaultCandidateExtent.iterator(DefaultCandidateExtent.java:62)
// at org.datanucleus.api.jdo.JDOExtent.iterator(JDOExtent.java:120)
// at org.cumulus4j.integrationtest.webapp.TestService.testPost(TestService.java:86)
// at org.cumulus4j.integrationtest.webapp.TestService.testGet(TestService.java:106)
// at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
// at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
// at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
// at java.lang.reflect.Method.invoke(Method.java:597)
// at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:168)
// at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:71)
// at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:280)
// at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
// at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
// at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
// at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
// at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1341)
// at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1273)
// at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1223)
// at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1213)
// at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:414)
// at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
// at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
// at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
// at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:546)
// at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:483)
// at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
// at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:516)
// at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:230)
// at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:956)
// at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:411)
// at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:188)
// at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:891)
// at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
// at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:247)
// at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:151)
// at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:114)
// at org.eclipse.jetty.server.Server.handle(Server.java:353)
// at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:598)
// at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:1059)
// at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:590)
// at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:212)
// at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:427)
// at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:510)
// at org.eclipse.jetty.io.nio.SelectChannelEndPoint.access$000(SelectChannelEndPoint.java:34)
// at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
// at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:450)
// at java.lang.Thread.run(Thread.java:662)
// tx2: read some data
pm.currentTransaction().begin();
for (Iterator<Movie> it = pm.getExtent(Movie.class).iterator(); it.hasNext(); ) {
Movie movie = it.next();
resultSB.append(" * ").append(movie.getName()).append('\n');
}
pm.currentTransaction().commit();
return "OK: " + this.getClass().getName() + "\n\nSome movies:\n" + resultSB;
} finally {
if (pm.currentTransaction().isActive()) |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/query/method/StringIndexOfEvaluator.java | org.cumulus4j.store | 63 | org/cumulus4j/store/query/method/StringSubstringEvaluator.java | org.cumulus4j.store | 63 | throw new IllegalStateException("String.substring(...) expects 1 or 2 arguments, but there are " +
invokeExprEval.getExpression().getArguments().size());
// Evaluate the invoke argument
Object[] invokeArgs = ExpressionHelper.getEvaluatedInvokeArguments(queryEval, invokeExprEval.getExpression());
if (invokedExpr instanceof PrimaryExpression) {
return new MethodResolver(invokeExprEval, queryEval, (PrimaryExpression) invokedExpr, invokeArgs[0],
(invokeArgs.length > 1 ? invokeArgs[1] : null),
compareToArgument, resultDesc.isNegated()).query();
}
else {
if (!invokeExprEval.getLeft().getResultSymbols().contains(resultDesc.getSymbol()))
return null;
return queryEvaluate(invokeExprEval, queryEval, resultDesc.getFieldMeta(), invokeArgs[0],
(invokeArgs.length > 1 ? invokeArgs[1] : null), compareToArgument, resultDesc.isNegated());
}
}
private Set<Long> queryEvaluate(
InvokeExpressionEvaluator invokeExprEval,
QueryEvaluator queryEval,
FieldMeta fieldMeta,
Object invokeArg1, // the xxx1 in 'substring(xxx1)'
Object invokeArg2, // the xxx2 in 'substring(xxx1, xxx2)'
Object compareToArgument, // the yyy in 'substring(...) >= yyy'
boolean negate
) {
CryptoContext cryptoContext = queryEval.getCryptoContext();
ExecutionContext executionContext = queryEval.getExecutionContext();
IndexEntryFactory indexEntryFactory = queryEval.getStoreManager().getIndexFactoryRegistry().getIndexEntryFactory(
executionContext, fieldMeta, true
);
Query q = queryEval.getPersistenceManagerForIndex().newQuery(indexEntryFactory.getIndexEntryClass());
q.setFilter(
"this.fieldMeta == :fieldMeta && " +
(invokeArg2 != null ? |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/test/jpa/account/LocalAccountantDelegate.java | org.cumulus4j.store.test.jpa | 66 | org/cumulus4j/store/test/account/LocalAccountantDelegate.java | org.cumulus4j.store.test | 74 | private String description;
public LocalAccountantDelegate(LocalAccountantDelegateID localAccountantDelegateID) {
this(localAccountantDelegateID.organisationID, localAccountantDelegateID.localAccountantDelegateID);
}
public LocalAccountantDelegate(String organisationID, String localAccountantDelegateID) {
this.organisationID = organisationID;
this.localAccountantDelegateID = localAccountantDelegateID;
accounts = new HashMap<String, Account>();
}
public LocalAccountantDelegate(LocalAccountantDelegate parent, LocalAccountantDelegateID localAccountantDelegateID) {
this(parent, localAccountantDelegateID.organisationID, localAccountantDelegateID.localAccountantDelegateID);
}
public LocalAccountantDelegate(LocalAccountantDelegate parent, String organisationID, String localAccountantDelegateID) {
this(organisationID, localAccountantDelegateID);
this.extendedAccountantDelegate = parent;
accounts = new HashMap<String, Account>();
}
public String getOrganisationID() {
return organisationID;
}
public String getLocalAccountantDelegateID() {
return localAccountantDelegateID;
}
public LocalAccountantDelegate getExtendedAccountantDelegate() {
return extendedAccountantDelegate;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getName2() {
return name2;
}
public void setName2(String name2) {
this.name2 = name2;
}
public Date getCreationDate() {
return creationDate;
}
public void setCreationDate(Date date) {
this.creationDate = date;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Join |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/test/jpa/account/Anchor.java | org.cumulus4j.store.test.jpa | 85 | org/cumulus4j/store/test/account/Anchor.java | org.cumulus4j.store.test | 98 | }
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((organisationID == null) ? 0 : organisationID.hashCode());
result = prime * result + ((anchorID == null) ? 0 : anchorID.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
Anchor other = (Anchor) obj;
if (anchorID == null) {
if (other.anchorID != null)
return false;
} else if (!anchorID.equals(other.anchorID))
return false;
if (organisationID == null) {
if (other.organisationID != null)
return false;
} else if (!organisationID.equals(other.organisationID))
return false;
return true;
}
@Override
public String toString() {
return this.getClass().getName() + '@' + Integer.toHexString(System.identityHashCode(this)) + '[' + organisationID + ',' + anchorTypeID + ',' + anchorID + ']';
}
} |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/query/method/DateGetDayEvaluator.java | org.cumulus4j.store | 94 | org/cumulus4j/store/query/method/StringLengthEvaluator.java | org.cumulus4j.store | 95 | "this.indexKey.toUpperCase() " +
ExpressionHelper.getOperatorAsJDOQLSymbol(invokeExprEval.getParent().getExpression().getOperator(), negate) +
" :compareToArgument"
);
Map<String, Object> params = new HashMap<String, Object>(2);
params.put("fieldMeta", fieldMeta);
params.put("compareToArgument", compareToArgument);
@SuppressWarnings("unchecked")
Collection<? extends IndexEntry> indexEntries = (Collection<? extends IndexEntry>) q.executeWithMap(params);
Set<Long> result = new HashSet<Long>();
for (IndexEntry indexEntry : indexEntries) {
IndexValue indexValue = queryEval.getEncryptionHandler().decryptIndexEntry(cryptoContext, indexEntry);
result.addAll(indexValue.getDataEntryIDs());
}
q.closeAll();
return result;
}
private class MethodResolver extends PrimaryExpressionResolver
{
private InvokeExpressionEvaluator invokeExprEval;
private Object compareToArgument;
private boolean negate;
public MethodResolver(
InvokeExpressionEvaluator invokeExprEval,
QueryEvaluator queryEvaluator, PrimaryExpression primaryExpression,
Object compareToArgument, // the yyy in 'toUpperCase() == yyy'
boolean negate
)
{
super(queryEvaluator, primaryExpression);
this.invokeExprEval = invokeExprEval;
this.compareToArgument = compareToArgument;
this.negate = negate;
}
@Override
protected Set<Long> queryEnd(FieldMeta fieldMeta) {
return queryEvaluate(invokeExprEval, queryEvaluator, fieldMeta, compareToArgument, negate);
}
}
} |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/query/method/CollectionSizeEvaluator.java | org.cumulus4j.store | 75 | org/cumulus4j/store/query/method/MapSizeEvaluator.java | org.cumulus4j.store | 75 | private Set<Long> queryMapSize(
InvokeExpressionEvaluator invokeExprEval,
QueryEvaluator queryEval,
FieldMeta fieldMeta,
Object compareToArgument, // the yyy in 'indexOf(xxx) >= yyy'
boolean negate
) {
CryptoContext cryptoContext = queryEval.getCryptoContext();
IndexEntryFactory indexEntryFactory = queryEval.getStoreManager().getIndexFactoryRegistry().getIndexEntryFactoryForContainerSize();
Query q = queryEval.getPersistenceManagerForIndex().newQuery(indexEntryFactory.getIndexEntryClass());
q.setFilter(
"this.fieldMeta == :fieldMeta && this.indexKey " +
ExpressionHelper.getOperatorAsJDOQLSymbol(invokeExprEval.getParent().getExpression().getOperator(), negate) +
" :compareToArgument"
);
Map<String, Object> params = new HashMap<String, Object>(3);
params.put("fieldMeta", fieldMeta);
params.put("compareToArgument", compareToArgument);
@SuppressWarnings("unchecked")
Collection<? extends IndexEntry> indexEntries = (Collection<? extends IndexEntry>) q.executeWithMap(params);
Set<Long> result = new HashSet<Long>();
for (IndexEntry indexEntry : indexEntries) {
IndexValue indexValue = queryEval.getEncryptionHandler().decryptIndexEntry(cryptoContext, indexEntry);
result.addAll(indexValue.getDataEntryIDs());
}
q.closeAll();
return result;
}
private class MapSizeResolver extends PrimaryExpressionResolver |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/query/method/StringEqualsEvaluator.java | org.cumulus4j.store | 54 | org/cumulus4j/store/query/method/StringStartsWithEvaluator.java | org.cumulus4j.store | 54 | throw new IllegalStateException("startsWith(...) expects exactly one argument, but there are " +
invokeExprEval.getExpression().getArguments().size());
// Evaluate the invoke argument
Object invokeArgument = ExpressionHelper.getEvaluatedInvokeArgument(queryEval, invokeExprEval.getExpression());
if (invokedExpr instanceof PrimaryExpression) {
return new MethodResolver(queryEval, (PrimaryExpression) invokedExpr, invokeArgument, resultDesc.isNegated()).query();
}
else {
if (!invokeExprEval.getLeft().getResultSymbols().contains(resultDesc.getSymbol()))
return null;
return queryEvaluate(queryEval, resultDesc.getFieldMeta(), invokeArgument, resultDesc.isNegated());
}
}
private Set<Long> queryEvaluate(
QueryEvaluator queryEval,
FieldMeta fieldMeta,
Object invokeArgument, // the xxx in 'startsWith(xxx)'
boolean negate
) {
CryptoContext cryptoContext = queryEval.getCryptoContext();
ExecutionContext executionContext = queryEval.getExecutionContext();
IndexEntryFactory indexEntryFactory = queryEval.getStoreManager().getIndexFactoryRegistry().getIndexEntryFactory(
executionContext, fieldMeta, true
);
Query q = queryEval.getPersistenceManagerForIndex().newQuery(indexEntryFactory.getIndexEntryClass());
q.setFilter(
"this.fieldMeta == :fieldMeta && " +
(negate ? "!this.indexKey.startsWith(:invokeArg)" : "this.indexKey.startsWith(:invokeArg) ") |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/query/method/StringEqualsEvaluator.java | org.cumulus4j.store | 85 | org/cumulus4j/store/query/method/StringStartsWithEvaluator.java | org.cumulus4j.store | 85 | (negate ? "!this.indexKey.startsWith(:invokeArg)" : "this.indexKey.startsWith(:invokeArg) ")
);
Map<String, Object> params = new HashMap<String, Object>(3);
params.put("fieldMeta", fieldMeta);
params.put("invokeArg", invokeArgument);
@SuppressWarnings("unchecked")
Collection<? extends IndexEntry> indexEntries = (Collection<? extends IndexEntry>) q.executeWithMap(params);
Set<Long> result = new HashSet<Long>();
for (IndexEntry indexEntry : indexEntries) {
IndexValue indexValue = queryEval.getEncryptionHandler().decryptIndexEntry(cryptoContext, indexEntry);
result.addAll(indexValue.getDataEntryIDs());
}
q.closeAll();
return result;
}
private class MethodResolver extends PrimaryExpressionResolver
{
private Object invokeArgument;
private boolean negate;
public MethodResolver(
QueryEvaluator queryEvaluator, PrimaryExpression primaryExpression,
Object invokeArgument, // the xxx in 'startsWith(xxx)'
boolean negate
)
{
super(queryEvaluator, primaryExpression);
this.invokeArgument = invokeArgument;
this.negate = negate;
}
@Override
protected Set<Long> queryEnd(FieldMeta fieldMeta) {
return queryEvaluate(queryEvaluator, fieldMeta, invokeArgument, negate);
}
}
} |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/query/method/StringLengthEvaluator.java | org.cumulus4j.store | 63 | org/cumulus4j/store/query/method/StringToUpperCaseEvaluator.java | org.cumulus4j.store | 63 | throw new IllegalStateException("String.toUpperCase(...) expects exactly no arguments, but there are " +
invokeExprEval.getExpression().getArguments().size());
if (invokedExpr instanceof PrimaryExpression) {
return new MethodResolver(invokeExprEval, queryEval, (PrimaryExpression) invokedExpr,
compareToArgument, resultDesc.isNegated()).query();
}
else {
if (!invokeExprEval.getLeft().getResultSymbols().contains(resultDesc.getSymbol()))
return null;
return queryEvaluate(invokeExprEval, queryEval, resultDesc.getFieldMeta(),
compareToArgument, resultDesc.isNegated());
}
}
private Set<Long> queryEvaluate(
InvokeExpressionEvaluator invokeExprEval,
QueryEvaluator queryEval,
FieldMeta fieldMeta,
Object compareToArgument, // the yyy in 'toUpperCase() >= yyy'
boolean negate
) {
CryptoContext cryptoContext = queryEval.getCryptoContext();
ExecutionContext executionContext = queryEval.getExecutionContext();
IndexEntryFactory indexEntryFactory = queryEval.getStoreManager().getIndexFactoryRegistry().getIndexEntryFactory(
executionContext, fieldMeta, true
);
Query q = queryEval.getPersistenceManagerForIndex().newQuery(indexEntryFactory.getIndexEntryClass());
q.setFilter(
"this.fieldMeta == :fieldMeta && " + |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/query/method/DateGetDayEvaluator.java | org.cumulus4j.store | 63 | org/cumulus4j/store/query/method/StringToLowerCaseEvaluator.java | org.cumulus4j.store | 63 | throw new IllegalStateException("String.length() expects no arguments, but there are " +
invokeExprEval.getExpression().getArguments().size());
if (invokedExpr instanceof PrimaryExpression) {
return new MethodResolver(invokeExprEval, queryEval, (PrimaryExpression) invokedExpr,
compareToArgument, resultDesc.isNegated()).query();
}
else {
if (!invokeExprEval.getLeft().getResultSymbols().contains(resultDesc.getSymbol()))
return null;
return queryEvaluate(invokeExprEval, queryEval, resultDesc.getFieldMeta(),
compareToArgument, resultDesc.isNegated());
}
}
private Set<Long> queryEvaluate(
InvokeExpressionEvaluator invokeExprEval,
QueryEvaluator queryEval,
FieldMeta fieldMeta,
Object compareToArgument, // the yyy in 'length() >= yyy'
boolean negate
) {
CryptoContext cryptoContext = queryEval.getCryptoContext();
ExecutionContext executionContext = queryEval.getExecutionContext();
IndexEntryFactory indexEntryFactory = queryEval.getStoreManager().getIndexFactoryRegistry().getIndexEntryFactory(
executionContext, fieldMeta, true
);
Query q = queryEval.getPersistenceManagerForIndex().newQuery(indexEntryFactory.getIndexEntryClass());
q.setFilter( |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/query/method/StringEndsWithEvaluator.java | org.cumulus4j.store | 85 | org/cumulus4j/store/query/method/StringEqualsIgnoreCaseEvaluator.java | org.cumulus4j.store | 85 | (negate ? "!this.indexKey == :invokeArg" : "this.indexKey == :invokeArg")
);
Map<String, Object> params = new HashMap<String, Object>(3);
params.put("fieldMeta", fieldMeta);
params.put("invokeArg", invokeArgument);
@SuppressWarnings("unchecked")
Collection<? extends IndexEntry> indexEntries = (Collection<? extends IndexEntry>) q.executeWithMap(params);
Set<Long> result = new HashSet<Long>();
for (IndexEntry indexEntry : indexEntries) {
IndexValue indexValue = queryEval.getEncryptionHandler().decryptIndexEntry(cryptoContext, indexEntry);
result.addAll(indexValue.getDataEntryIDs());
}
q.closeAll();
return result;
}
private class MethodResolver extends PrimaryExpressionResolver
{
private Object invokeArgument;
private boolean negate;
public MethodResolver(
QueryEvaluator queryEvaluator, PrimaryExpression primaryExpression,
Object invokeArgument, // the xxx in 'equals(xxx)'
boolean negate
)
{
super(queryEvaluator, primaryExpression);
this.invokeArgument = invokeArgument;
this.negate = negate;
}
@Override
protected Set<Long> queryEnd(FieldMeta fieldMeta) {
return queryEvaluate(queryEvaluator, fieldMeta, invokeArgument, negate); |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/query/method/CollectionIsEmptyEvaluator.java | org.cumulus4j.store | 66 | org/cumulus4j/store/query/method/MapIsEmptyEvaluator.java | org.cumulus4j.store | 66 | private Set<Long> queryMapIsEmpty(
QueryEvaluator queryEval,
FieldMeta fieldMeta,
boolean negate
) {
CryptoContext cryptoContext = queryEval.getCryptoContext();
IndexEntryFactory indexEntryFactory = queryEval.getStoreManager().getIndexFactoryRegistry().getIndexEntryFactoryForContainerSize();
Query q = queryEval.getPersistenceManagerForIndex().newQuery(indexEntryFactory.getIndexEntryClass());
q.setFilter(
"this.fieldMeta == :fieldMeta && " +
(negate ? "this.indexKey != 0" : "this.indexKey == 0")
);
Map<String, Object> params = new HashMap<String, Object>(3);
params.put("fieldMeta", fieldMeta);
@SuppressWarnings("unchecked")
Collection<? extends IndexEntry> indexEntries = (Collection<? extends IndexEntry>) q.executeWithMap(params);
Set<Long> result = new HashSet<Long>();
for (IndexEntry indexEntry : indexEntries) {
IndexValue indexValue = queryEval.getEncryptionHandler().decryptIndexEntry(cryptoContext, indexEntry);
result.addAll(indexValue.getDataEntryIDs());
}
q.closeAll();
return result;
}
private class MapIsEmptyResolver extends PrimaryExpressionResolver |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/query/eval/AndExpressionEvaluator.java | org.cumulus4j.store | 92 | org/cumulus4j/store/query/eval/OrExpressionEvaluator.java | org.cumulus4j.store | 83 | return new AndExpressionEvaluator(this)._queryResultDataEntryIDsIgnoringNegation(resultDescriptor);
else
return _queryResultDataEntryIDsIgnoringNegation(resultDescriptor);
}
protected Set<Long> _queryResultDataEntryIDsIgnoringNegation(ResultDescriptor resultDescriptor)
{
if (getLeft() == null)
throw new IllegalStateException("getLeft() == null");
if (getRight() == null)
throw new IllegalStateException("getRight() == null");
Set<Long> leftResult = null;
boolean leftEvaluated = true;
try {
leftResult = getLeft().queryResultDataEntryIDs(resultDescriptor);
}
catch (UnsupportedOperationException uoe) {
leftEvaluated = false;
getQueryEvaluator().setIncomplete();
NucleusLogger.QUERY.debug("Unsupported operation in LEFT : "+getLeft().getExpression() + " so deferring evaluation to in-memory");
}
Set<Long> rightResult = null;
boolean rightEvaluated = true;
try {
rightResult = getRight().queryResultDataEntryIDs(resultDescriptor);
}
catch (UnsupportedOperationException uoe) {
rightEvaluated = false;
getQueryEvaluator().setIncomplete();
NucleusLogger.QUERY.debug("Unsupported operation in RIGHT : "+getRight().getExpression() + " so deferring evaluation to in-memory");
}
if (leftEvaluated && !rightEvaluated) { |
Datei | Projekt | Zeile |
---|
org/cumulus4j/keymanager/back/shared/KeyEncryptionUtil.java | org.cumulus4j.keymanager.back.shared | 199 | org/cumulus4j/store/crypto/keymanager/KeyManagerCryptoSession.java | org.cumulus4j.store.crypto.keymanager | 375 | int dataLength = outOff - dataOff - macLength;
int macOff = dataOff + dataLength;
if (macCalculator != null) {
byte[] newMAC = new byte[macCalculator.getMacSize()];
macCalculator.update(out, dataOff, dataLength);
macCalculator.doFinal(newMAC, 0);
if (newMAC.length != macLength)
throw new IOException("MACs have different length! Expected MAC has " + macLength + " bytes and newly calculated MAC has " + newMAC.length + " bytes!");
for (int i = 0; i < macLength; ++i) {
byte expected = out[macOff + i];
if (expected != newMAC[i])
throw new IOException("MAC mismatch! mac[" + i + "] was expected to be " + expected + " but was " + newMAC[i]);
}
}
byte[] decrypted = new byte[dataLength];
System.arraycopy(out, dataOff, decrypted, 0, decrypted.length); |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/Cumulus4jPersistenceHandler.java | org.cumulus4j.store | 98 | org/cumulus4j/store/Cumulus4jPersistenceHandler.java | org.cumulus4j.store | 202 | encryptionHandler.encryptDataEntry(cryptoContext, dataEntry, objectContainer);
// persist index
for (Map.Entry<Long, ?> me : objectContainer.getFieldID2value().entrySet()) {
long fieldID = me.getKey();
Object fieldValue = me.getValue();
FieldMeta fieldMeta = classMeta.getFieldMeta(fieldID);
AbstractMemberMetaData dnMemberMetaData = dnClassMetaData.getMetaDataForManagedMemberAtAbsolutePosition(fieldMeta.getDataNucleusAbsoluteFieldNumber());
// sanity checks
if (dnMemberMetaData == null)
throw new IllegalStateException("dnMemberMetaData == null!!! class == \"" + classMeta.getClassName() + "\" fieldMeta.dataNucleusAbsoluteFieldNumber == " + fieldMeta.getDataNucleusAbsoluteFieldNumber() + " fieldMeta.fieldName == \"" + fieldMeta.getFieldName() + "\"");
if (!fieldMeta.getFieldName().equals(dnMemberMetaData.getName()))
throw new IllegalStateException("Meta data inconsistency!!! class == \"" + classMeta.getClassName() + "\" fieldMeta.dataNucleusAbsoluteFieldNumber == " + fieldMeta.getDataNucleusAbsoluteFieldNumber() + " fieldMeta.fieldName == \"" + fieldMeta.getFieldName() + "\" != dnMemberMetaData.name == \"" + dnMemberMetaData.getName() + "\""); |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/query/method/DateGetDayEvaluator.java | org.cumulus4j.store | 94 | org/cumulus4j/store/query/method/StringSubstringEvaluator.java | org.cumulus4j.store | 103 | "this.indexKey.substring(" + invokeArg1 + ") ") +
ExpressionHelper.getOperatorAsJDOQLSymbol(invokeExprEval.getParent().getExpression().getOperator(), negate) +
" :compareToArgument"
);
Map<String, Object> params = new HashMap<String, Object>(2);
params.put("fieldMeta", fieldMeta);
params.put("compareToArgument", compareToArgument);
@SuppressWarnings("unchecked")
Collection<? extends IndexEntry> indexEntries = (Collection<? extends IndexEntry>) q.executeWithMap(params);
Set<Long> result = new HashSet<Long>();
for (IndexEntry indexEntry : indexEntries) {
IndexValue indexValue = queryEval.getEncryptionHandler().decryptIndexEntry(cryptoContext, indexEntry);
result.addAll(indexValue.getDataEntryIDs());
}
q.closeAll();
return result;
}
private class MethodResolver extends PrimaryExpressionResolver
{
private InvokeExpressionEvaluator invokeExprEval;
private Object invokePos1; |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/Cumulus4jPersistenceHandler.java | org.cumulus4j.store | 126 | org/cumulus4j/store/Cumulus4jPersistenceHandler.java | org.cumulus4j.store | 251 | ExecutionContext ec = op.getExecutionContext();
ManagedConnection mconn = storeManager.getConnection(ec);
try {
PersistenceManagerConnection pmConn = (PersistenceManagerConnection)mconn.getConnection();
PersistenceManager pmData = pmConn.getDataPM();
CryptoContext cryptoContext = new CryptoContext(encryptionCoordinateSetManager, ec, pmConn);
Object object = op.getObject();
Object objectID = op.getExternalObjectId();
String objectIDString = objectID.toString();
ClassMeta classMeta = storeManager.getClassMeta(ec, object.getClass());
AbstractClassMetaData dnClassMetaData = storeManager.getMetaDataManager().getMetaDataForClass(object.getClass(), ec.getClassLoaderResolver());
DataEntry dataEntry = DataEntry.getDataEntry(pmData, classMeta, objectIDString);
if (dataEntry == null)
throw new NucleusObjectNotFoundException("Object does not exist in datastore: class=" + classMeta.getClassName() + " oid=" + objectIDString); |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/EncryptionHandler.java | org.cumulus4j.store | 185 | org/cumulus4j/store/EncryptionHandler.java | org.cumulus4j.store | 272 | logger.error("encryptIndexEntry: Dumping plaintext failed: " + e, e);
}
}
CryptoSession cryptoSession = getCryptoSession(cryptoContext.getExecutionContext());
Ciphertext ciphertext = cryptoSession.encrypt(cryptoContext, plaintext);
if (ciphertext == null)
throw new IllegalStateException("cryptoSession.encrypt(plaintext) returned null! cryptoManagerID=" + cryptoSession.getCryptoManager().getCryptoManagerID() + " cryptoSessionID=" + cryptoSession.getCryptoSessionID());
if (ciphertext.getKeyID() < 0)
throw new IllegalStateException("cryptoSession.encrypt(plaintext) returned a ciphertext with keyID < 0! cryptoManagerID=" + cryptoSession.getCryptoManager().getCryptoManagerID() + " cryptoSessionID=" + cryptoSession.getCryptoSessionID());
if (DEBUG_DUMP) {
try {
FileOutputStream fout = new FileOutputStream(new File(getDebugDumpDir(), debugDumpFileName + ".crypt"));
fout.write(ciphertext.getData());
fout.close();
} catch (IOException e) {
logger.error("encryptIndexEntry: Dumping ciphertext failed: " + e, e); |
Datei | Projekt | Zeile |
---|
org/cumulus4j/integrationtest/webapp/App.java | org.cumulus4j.integrationtest.webapp | 35 | org/cumulus4j/store/crypto/keymanager/rest/KeyManagerBackWebApp.java | org.cumulus4j.store.crypto.keymanager | 47 | JAXBContextResolver.class
};
private static final Set<Class<?>> serviceClassesSet;
static {
Set<Class<?>> s = new HashSet<Class<?>>(serviceClassesArray.length);
for (Class<?> c : serviceClassesArray)
s.add(c);
serviceClassesSet = Collections.unmodifiableSet(s);
}
@Override
public Set<Class<?>> getClasses() {
return serviceClassesSet;
}
private Set<Object> singletons;
@Override
public Set<Object> getSingletons()
{
if (singletons == null) {
Set<Object> s = new HashSet<Object>();
// s.add(new KeyStoreProvider(keyStore));
// s.add(new SessionManagerProvider(new SessionManager(keyStore)));
singletons = Collections.unmodifiableSet(s);
}
return singletons;
}
} |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/Cumulus4jStoreManager.java | org.cumulus4j.store | 378 | org/cumulus4j/store/Cumulus4jStoreManager.java | org.cumulus4j.store | 406 | public void validateSchema(Set<String> classNames, Properties props) {
Cumulus4jConnectionFactory cf =
(Cumulus4jConnectionFactory) connectionMgr.lookupConnectionFactory(txConnectionFactoryName);
JDOPersistenceManagerFactory pmfData = (JDOPersistenceManagerFactory) cf.getPMFData();
JDOPersistenceManagerFactory pmfIndex = (JDOPersistenceManagerFactory) cf.getPMFIndex();
if (pmfData.getNucleusContext().getStoreManager() instanceof SchemaAwareStoreManager) {
SchemaAwareStoreManager schemaMgr = (SchemaAwareStoreManager) pmfData.getNucleusContext().getStoreManager();
Set<String> cumulus4jClassNames = new HashSet<String>();
Collection<Class> pmfClasses = pmfData.getManagedClasses();
for (Class cls : pmfClasses) {
cumulus4jClassNames.add(cls.getName());
}
schemaMgr.validateSchema(cumulus4jClassNames, new Properties()); |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/test/jpa/account/SummaryAccount.java | org.cumulus4j.store.test.jpa | 40 | org/cumulus4j/store/test/account/SummaryAccount.java | org.cumulus4j.store.test | 56 | )
protected Set<Account> summedAccounts;
public void addSummedAccount(Account account) {
_addSummedAccount(account);
account._addSummaryAccount(this);
}
protected void _addSummedAccount(Account account) {
summedAccounts.add(account);
}
public void removeSummedAccount(Account account) {
_removeSummedAccount(account);
account._removeSummaryAccount(this);
}
public void _removeSummedAccount(Account account) {
summedAccounts.remove(account);
}
public Collection<Account> getSummedAccounts() {
return Collections.unmodifiableCollection(summedAccounts);
}
public SummaryAccount(String organisationID, String anchorID)
{
super(organisationID, anchorID);
summedAccounts = new HashSet<Account>();
}
} |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/query/eval/AndExpressionEvaluator.java | org.cumulus4j.store | 66 | org/cumulus4j/store/query/eval/OrExpressionEvaluator.java | org.cumulus4j.store | 57 | public OrExpressionEvaluator(AndExpressionEvaluator negatedExpressionEvaluator)
{
this(negatedExpressionEvaluator.getQueryEvaluator(), negatedExpressionEvaluator.getParent(), negatedExpressionEvaluator.getExpression());
this.negatedExpressionEvaluator = negatedExpressionEvaluator;
}
@Override
public AbstractExpressionEvaluator<? extends Expression> getLeft() {
if (negatedExpressionEvaluator != null)
return negatedExpressionEvaluator.getLeft();
return super.getLeft();
}
@Override
public AbstractExpressionEvaluator<? extends Expression> getRight() {
if (negatedExpressionEvaluator != null)
return negatedExpressionEvaluator.getRight();
return super.getRight();
}
@Override
protected Set<Long> _queryResultDataEntryIDs(ResultDescriptor resultDescriptor)
{
if (resultDescriptor.isNegated())
return new AndExpressionEvaluator(this)._queryResultDataEntryIDsIgnoringNegation(resultDescriptor); |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/test/jpa/account/Anchor.java | org.cumulus4j.store.test.jpa | 50 | org/cumulus4j/store/test/account/Anchor.java | org.cumulus4j.store.test | 54 | @Column(length=100)
private String anchorID;
protected Anchor() { }
public Anchor(String organisationID, String anchorTypeID, String anchorID)
{
this.organisationID = organisationID;
this.anchorTypeID = anchorTypeID;
this.anchorID = anchorID;
}
public static String getPrimaryKey(String organisationID, String anchorTypeID, String anchorID)
{
return organisationID + '/' + anchorTypeID + "/" + anchorID;
}
public String getPrimaryKey()
{
return getPrimaryKey(organisationID, anchorTypeID, anchorID);
}
public String getOrganisationID()
{
return organisationID;
}
public String getAnchorTypeID()
{
return anchorTypeID;
}
public String getAnchorID()
{
return anchorID;
} |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/test/jpa/account/Account.java | org.cumulus4j.store.test.jpa | 47 | org/cumulus4j/store/test/account/Account.java | org.cumulus4j.store.test | 64 | public Account(AnchorID anchorID)
{
this(anchorID.organisationID, anchorID.anchorID);
if (!ANCHOR_TYPE_ID_ACCOUNT.equals(anchorID.anchorTypeID))
throw new IllegalArgumentException("anchorID.anchorTypeID != ANCHOR_TYPE_ID_ACCOUNT");
}
public Account(String organisationID, String anchorID)
{
super(organisationID, ANCHOR_TYPE_ID_ACCOUNT, anchorID);
this.summaryAccounts = new HashSet<SummaryAccount>();
}
/**
* The balance in the smallest unit available in the Currency of this Account. This is e.g.
* Cent for EUR.
*
* @return Returns the balance.
*/
public long getBalance() {
return balance;
}
protected void adjustBalance(boolean isDebit, long amount) {
if (isDebit)
this.balance = this.balance - amount;
else
this.balance = this.balance + amount;
} |
Datei | Projekt | Zeile |
---|
org/cumulus4j/keymanager/back/shared/KeyEncryptionUtil.java | org.cumulus4j.keymanager.back.shared | 77 | org/cumulus4j/store/crypto/keymanager/KeyManagerCryptoSession.java | org.cumulus4j.store.crypto.keymanager | 195 | mac = macCalculator.doFinal(plaintext.getData());
if (macCalculator.getParameters() instanceof ParametersWithIV) {
ParametersWithIV pwiv = (ParametersWithIV) macCalculator.getParameters();
macIV = pwiv.getIV();
macKey = ((KeyParameter)pwiv.getParameters()).getKey();
}
else if (macCalculator.getParameters() instanceof KeyParameter) {
macKey = ((KeyParameter)macCalculator.getParameters()).getKey();
}
else
throw new IllegalStateException("macCalculator.getParameters() returned an instance of an unknown type: " + (macCalculator.getParameters() == null ? null : macCalculator.getParameters().getClass().getName())); |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/query/method/CollectionContainsEvaluator.java | org.cumulus4j.store | 60 | org/cumulus4j/store/query/method/MapContainsKeyEvaluator.java | org.cumulus4j.store | 46 | throw new IllegalStateException("containsValue(...) expects exactly one argument, but there are " +
invokeExprEval.getExpression().getArguments().size());
if (invokedExpr instanceof PrimaryExpression) {
// Evaluate the invoke argument
Expression invokeArgExpr = invokeExprEval.getExpression().getArguments().get(0);
Object invokeArgument;
if (invokeArgExpr instanceof Literal)
invokeArgument = ((Literal)invokeArgExpr).getLiteral();
else if (invokeArgExpr instanceof ParameterExpression)
invokeArgument = QueryUtils.getValueForParameterExpression(queryEval.getParameterValues(), (ParameterExpression)invokeArgExpr);
else if (invokeArgExpr instanceof VariableExpression)
return new ExpressionHelper.ContainsVariableResolver(
queryEval, (PrimaryExpression) invokedExpr, FieldMetaRole.mapValue, (VariableExpression) invokeArgExpr, |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/crypto/keymanager/CryptoCache.java | org.cumulus4j.store.crypto.keymanager | 636 | org/cumulus4j/store/crypto/keymanager/messagebroker/pmf/MessageBrokerPMF.java | org.cumulus4j.store.crypto.keymanager | 253 | private final void initTimerTaskOrRemoveExpiredPendingRequestsPeriodically()
{
if (!cleanupTimerInitialised) {
synchronized (AbstractCryptoManager.class) {
if (!cleanupTimerInitialised) {
if (getCleanupTimerEnabled())
cleanupTimer = new Timer();
cleanupTimerInitialised = true;
}
}
}
if (!cleanupTaskInitialised) {
synchronized (this) {
if (!cleanupTaskInitialised) {
if (cleanupTimer != null) {
long periodMSec = getCleanupTimerPeriod();
cleanupTimer.schedule(new CleanupTask(this, periodMSec), periodMSec, periodMSec);
}
cleanupTaskInitialised = true;
}
}
}
if (cleanupTimer == null) {
logger.trace("[{}] initTimerTaskOrRemoveExpiredPendingRequestsPeriodically: No timer enabled => calling removeExpiredEntries(false) now.", thisID); |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/test/jpa/JPATransactionalRunner.java | org.cumulus4j.store.test.jpa | 260 | org/cumulus4j/store/test/framework/JDOTransactionalRunner.java | org.cumulus4j.store.test | 228 | pm.close();
} catch (Throwable t) {
logger.warn("Rolling back or closing PM failed: " + t, t);
}
}
}
}
private class TransactionalInvokeMethod extends Statement
{
@SuppressWarnings("unused")
private FrameworkMethod method;
private Object test;
private Statement delegate;
public TransactionalInvokeMethod(FrameworkMethod method, Object test, Statement delegate) {
this.method = method;
this.test = test;
this.delegate = delegate;
}
@Override
public void evaluate() throws Throwable {
runInTransaction(test, delegate);
// PersistenceManager pm = null;
// TransactionalTest transactionalTest = null;
// if (test instanceof TransactionalTest) {
// transactionalTest = (TransactionalTest) test;
//
// if (pmf == null) {
// logger.info("run: Setting up PersistenceManagerFactory.");
// pmf = JDOHelper.getPersistenceManagerFactory(TestUtil.loadProperties("cumulus4j-test-datanucleus.properties"));
// }
//
// pm = pmf.getPersistenceManager();
// transactionalTest.setPersistenceManager(pm);
// pm.currentTransaction().begin();
// }
// try {
// delegate.evaluate();
//
// pm = transactionalTest.getPersistenceManager();
// if (pm != null && !pm.isClosed() && pm.currentTransaction().isActive())
// pm.currentTransaction().commit();
// } finally {
// pm = transactionalTest.getPersistenceManager();
// if (pm != null && !pm.isClosed()) {
// try {
// if (pm.currentTransaction().isActive())
// pm.currentTransaction().rollback();
//
// pm.close();
// } catch (Throwable t) {
// logger.warn("Rolling back or closing PM failed: " + t, t);
// }
// }
// }
}
}
private static final void doNothing() { }
} |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/query/method/StringIndexOfEvaluator.java | org.cumulus4j.store | 112 | org/cumulus4j/store/query/method/StringToLowerCaseEvaluator.java | org.cumulus4j.store | 101 | params.put("compareToArgument", compareToArgument);
@SuppressWarnings("unchecked")
Collection<? extends IndexEntry> indexEntries = (Collection<? extends IndexEntry>) q.executeWithMap(params);
Set<Long> result = new HashSet<Long>();
for (IndexEntry indexEntry : indexEntries) {
IndexValue indexValue = queryEval.getEncryptionHandler().decryptIndexEntry(cryptoContext, indexEntry);
result.addAll(indexValue.getDataEntryIDs());
}
q.closeAll();
return result;
}
private class MethodResolver extends PrimaryExpressionResolver
{
private InvokeExpressionEvaluator invokeExprEval;
private Object compareToArgument; |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/query/method/MapSizeEvaluator.java | org.cumulus4j.store | 91 | org/cumulus4j/store/query/method/StringSubstringEvaluator.java | org.cumulus4j.store | 107 | Map<String, Object> params = new HashMap<String, Object>(2);
params.put("fieldMeta", fieldMeta);
params.put("compareToArgument", compareToArgument);
@SuppressWarnings("unchecked")
Collection<? extends IndexEntry> indexEntries = (Collection<? extends IndexEntry>) q.executeWithMap(params);
Set<Long> result = new HashSet<Long>();
for (IndexEntry indexEntry : indexEntries) {
IndexValue indexValue = queryEval.getEncryptionHandler().decryptIndexEntry(cryptoContext, indexEntry);
result.addAll(indexValue.getDataEntryIDs());
}
q.closeAll();
return result;
}
private class MethodResolver extends PrimaryExpressionResolver |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/query/method/DateGetYearEvaluator.java | org.cumulus4j.store | 100 | org/cumulus4j/store/query/method/StringIndexOfEvaluator.java | org.cumulus4j.store | 112 | params.put("compareToArgument", compareToArgument);
@SuppressWarnings("unchecked")
Collection<? extends IndexEntry> indexEntries = (Collection<? extends IndexEntry>) q.executeWithMap(params);
Set<Long> result = new HashSet<Long>();
for (IndexEntry indexEntry : indexEntries) {
IndexValue indexValue = queryEval.getEncryptionHandler().decryptIndexEntry(cryptoContext, indexEntry);
result.addAll(indexValue.getDataEntryIDs());
}
q.closeAll();
return result;
}
private class MethodResolver extends PrimaryExpressionResolver
{
private InvokeExpressionEvaluator invokeExprEval;
private Object invokeArg; |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/query/method/DateGetYearEvaluator.java | org.cumulus4j.store | 98 | org/cumulus4j/store/query/method/MapSizeEvaluator.java | org.cumulus4j.store | 91 | Map<String, Object> params = new HashMap<String, Object>(3);
params.put("fieldMeta", fieldMeta);
params.put("compareToArgument", compareToArgument);
@SuppressWarnings("unchecked")
Collection<? extends IndexEntry> indexEntries = (Collection<? extends IndexEntry>) q.executeWithMap(params);
Set<Long> result = new HashSet<Long>();
for (IndexEntry indexEntry : indexEntries) {
IndexValue indexValue = queryEval.getEncryptionHandler().decryptIndexEntry(cryptoContext, indexEntry);
result.addAll(indexValue.getDataEntryIDs());
}
q.closeAll();
return result;
}
private class MapSizeResolver extends PrimaryExpressionResolver |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/query/method/DateGetSecondEvaluator.java | org.cumulus4j.store | 100 | org/cumulus4j/store/query/method/StringIndexOfEvaluator.java | org.cumulus4j.store | 112 | params.put("compareToArgument", compareToArgument);
@SuppressWarnings("unchecked")
Collection<? extends IndexEntry> indexEntries = (Collection<? extends IndexEntry>) q.executeWithMap(params);
Set<Long> result = new HashSet<Long>();
for (IndexEntry indexEntry : indexEntries) {
IndexValue indexValue = queryEval.getEncryptionHandler().decryptIndexEntry(cryptoContext, indexEntry);
result.addAll(indexValue.getDataEntryIDs());
}
q.closeAll();
return result;
}
private class MethodResolver extends PrimaryExpressionResolver
{
private InvokeExpressionEvaluator invokeExprEval;
private Object invokeArg; |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/query/method/DateGetSecondEvaluator.java | org.cumulus4j.store | 98 | org/cumulus4j/store/query/method/MapSizeEvaluator.java | org.cumulus4j.store | 91 | Map<String, Object> params = new HashMap<String, Object>(3);
params.put("fieldMeta", fieldMeta);
params.put("compareToArgument", compareToArgument);
@SuppressWarnings("unchecked")
Collection<? extends IndexEntry> indexEntries = (Collection<? extends IndexEntry>) q.executeWithMap(params);
Set<Long> result = new HashSet<Long>();
for (IndexEntry indexEntry : indexEntries) {
IndexValue indexValue = queryEval.getEncryptionHandler().decryptIndexEntry(cryptoContext, indexEntry);
result.addAll(indexValue.getDataEntryIDs());
}
q.closeAll();
return result;
}
private class MapSizeResolver extends PrimaryExpressionResolver |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/query/method/DateGetMonthEvaluator.java | org.cumulus4j.store | 100 | org/cumulus4j/store/query/method/StringIndexOfEvaluator.java | org.cumulus4j.store | 112 | params.put("compareToArgument", compareToArgument);
@SuppressWarnings("unchecked")
Collection<? extends IndexEntry> indexEntries = (Collection<? extends IndexEntry>) q.executeWithMap(params);
Set<Long> result = new HashSet<Long>();
for (IndexEntry indexEntry : indexEntries) {
IndexValue indexValue = queryEval.getEncryptionHandler().decryptIndexEntry(cryptoContext, indexEntry);
result.addAll(indexValue.getDataEntryIDs());
}
q.closeAll();
return result;
}
private class MethodResolver extends PrimaryExpressionResolver
{
private InvokeExpressionEvaluator invokeExprEval;
private Object invokeArg; |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/query/method/DateGetMonthEvaluator.java | org.cumulus4j.store | 98 | org/cumulus4j/store/query/method/MapSizeEvaluator.java | org.cumulus4j.store | 91 | Map<String, Object> params = new HashMap<String, Object>(3);
params.put("fieldMeta", fieldMeta);
params.put("compareToArgument", compareToArgument);
@SuppressWarnings("unchecked")
Collection<? extends IndexEntry> indexEntries = (Collection<? extends IndexEntry>) q.executeWithMap(params);
Set<Long> result = new HashSet<Long>();
for (IndexEntry indexEntry : indexEntries) {
IndexValue indexValue = queryEval.getEncryptionHandler().decryptIndexEntry(cryptoContext, indexEntry);
result.addAll(indexValue.getDataEntryIDs());
}
q.closeAll();
return result;
}
private class MapSizeResolver extends PrimaryExpressionResolver |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/query/method/DateGetMinuteEvaluator.java | org.cumulus4j.store | 100 | org/cumulus4j/store/query/method/StringIndexOfEvaluator.java | org.cumulus4j.store | 112 | params.put("compareToArgument", compareToArgument);
@SuppressWarnings("unchecked")
Collection<? extends IndexEntry> indexEntries = (Collection<? extends IndexEntry>) q.executeWithMap(params);
Set<Long> result = new HashSet<Long>();
for (IndexEntry indexEntry : indexEntries) {
IndexValue indexValue = queryEval.getEncryptionHandler().decryptIndexEntry(cryptoContext, indexEntry);
result.addAll(indexValue.getDataEntryIDs());
}
q.closeAll();
return result;
}
private class MethodResolver extends PrimaryExpressionResolver
{
private InvokeExpressionEvaluator invokeExprEval;
private Object invokeArg; |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/query/method/DateGetMinuteEvaluator.java | org.cumulus4j.store | 98 | org/cumulus4j/store/query/method/MapSizeEvaluator.java | org.cumulus4j.store | 91 | Map<String, Object> params = new HashMap<String, Object>(3);
params.put("fieldMeta", fieldMeta);
params.put("compareToArgument", compareToArgument);
@SuppressWarnings("unchecked")
Collection<? extends IndexEntry> indexEntries = (Collection<? extends IndexEntry>) q.executeWithMap(params);
Set<Long> result = new HashSet<Long>();
for (IndexEntry indexEntry : indexEntries) {
IndexValue indexValue = queryEval.getEncryptionHandler().decryptIndexEntry(cryptoContext, indexEntry);
result.addAll(indexValue.getDataEntryIDs());
}
q.closeAll();
return result;
}
private class MapSizeResolver extends PrimaryExpressionResolver |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/query/method/DateGetHourEvaluator.java | org.cumulus4j.store | 100 | org/cumulus4j/store/query/method/StringIndexOfEvaluator.java | org.cumulus4j.store | 112 | params.put("compareToArgument", compareToArgument);
@SuppressWarnings("unchecked")
Collection<? extends IndexEntry> indexEntries = (Collection<? extends IndexEntry>) q.executeWithMap(params);
Set<Long> result = new HashSet<Long>();
for (IndexEntry indexEntry : indexEntries) {
IndexValue indexValue = queryEval.getEncryptionHandler().decryptIndexEntry(cryptoContext, indexEntry);
result.addAll(indexValue.getDataEntryIDs());
}
q.closeAll();
return result;
}
private class MethodResolver extends PrimaryExpressionResolver
{
private InvokeExpressionEvaluator invokeExprEval;
private Object invokeArg; |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/query/method/DateGetHourEvaluator.java | org.cumulus4j.store | 98 | org/cumulus4j/store/query/method/MapSizeEvaluator.java | org.cumulus4j.store | 91 | Map<String, Object> params = new HashMap<String, Object>(3);
params.put("fieldMeta", fieldMeta);
params.put("compareToArgument", compareToArgument);
@SuppressWarnings("unchecked")
Collection<? extends IndexEntry> indexEntries = (Collection<? extends IndexEntry>) q.executeWithMap(params);
Set<Long> result = new HashSet<Long>();
for (IndexEntry indexEntry : indexEntries) {
IndexValue indexValue = queryEval.getEncryptionHandler().decryptIndexEntry(cryptoContext, indexEntry);
result.addAll(indexValue.getDataEntryIDs());
}
q.closeAll();
return result;
}
private class MapSizeResolver extends PrimaryExpressionResolver |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/query/method/DateGetDayEvaluator.java | org.cumulus4j.store | 100 | org/cumulus4j/store/query/method/StringIndexOfEvaluator.java | org.cumulus4j.store | 112 | params.put("compareToArgument", compareToArgument);
@SuppressWarnings("unchecked")
Collection<? extends IndexEntry> indexEntries = (Collection<? extends IndexEntry>) q.executeWithMap(params);
Set<Long> result = new HashSet<Long>();
for (IndexEntry indexEntry : indexEntries) {
IndexValue indexValue = queryEval.getEncryptionHandler().decryptIndexEntry(cryptoContext, indexEntry);
result.addAll(indexValue.getDataEntryIDs());
}
q.closeAll();
return result;
}
private class MethodResolver extends PrimaryExpressionResolver
{
private InvokeExpressionEvaluator invokeExprEval;
private Object invokeArg; |
Datei | Projekt | Zeile |
---|
org/cumulus4j/store/query/method/CollectionSizeEvaluator.java | org.cumulus4j.store | 91 | org/cumulus4j/store/query/method/DateGetHourEvaluator.java | org.cumulus4j.store | 98 | Map<String, Object> params = new HashMap<String, Object>(2);
params.put("fieldMeta", fieldMeta);
params.put("compareToArgument", compareToArgument);
@SuppressWarnings("unchecked")
Collection<? extends IndexEntry> indexEntries = (Collection<? extends IndexEntry>) q.executeWithMap(params);
Set<Long> result = new HashSet<Long>();
for (IndexEntry indexEntry : indexEntries) {
IndexValue indexValue = queryEval.getEncryptionHandler().decryptIndexEntry(cryptoContext, indexEntry);
result.addAll(indexValue.getDataEntryIDs());
}
q.closeAll();
return result;
}
private class MethodResolver extends PrimaryExpressionResolver |
|
Dokumentation
Über uns
Projektdokumentation
Babel
Versionen
|