Hauptseite Dokumentation Forum Tracker Herunterladen

CPD Ergebnisse

Dieses Dokument enthält die Ergebnisse von PMD's CPD 4.2.5.

Duplikationen

DateiProjektZeile
org/cumulus4j/store/test/jpa/TestUtil.javaorg.cumulus4j.store.test.jpa32
org/cumulus4j/store/test/framework/TestUtil.javaorg.cumulus4j.store.test34
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);
	}
DateiProjektZeile
org/cumulus4j/store/test/jpa/account/LocalAccountantDelegate.javaorg.cumulus4j.store.test.jpa133
org/cumulus4j/store/test/account/LocalAccountantDelegate.javaorg.cumulus4j.store.test145
	)
	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)+"'");
	}
}
DateiProjektZeile
org/cumulus4j/integrationtest/gwt/server/MovieServiceImpl.javaorg.cumulus4j.integrationtest.gwt98
org/cumulus4j/integrationtest/webapp/TestService.javaorg.cumulus4j.integrationtest.webapp92
		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())
DateiProjektZeile
org/cumulus4j/store/test/jpa/JPATransactionalRunner.javaorg.cumulus4j.store.test.jpa83
org/cumulus4j/store/test/framework/JDOTransactionalRunner.javaorg.cumulus4j.store.test80
	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);
		}
	}
DateiProjektZeile
org/cumulus4j/store/query/method/StringIndexOfEvaluator.javaorg.cumulus4j.store64
org/cumulus4j/store/query/method/StringSubstringEvaluator.javaorg.cumulus4j.store64
			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.keyStoreRefID == :keyStoreRefID && this.fieldMeta_fieldID == :fieldMeta_fieldID && " +
				(invokeArg2 != null ?
DateiProjektZeile
org/cumulus4j/store/query/method/DateGetYearEvaluator.javaorg.cumulus4j.store95
org/cumulus4j/store/query/method/StringToUpperCaseEvaluator.javaorg.cumulus4j.store96
				"this.indexKey.toUpperCase() " +
				ExpressionHelper.getOperatorAsJDOQLSymbol(invokeExprEval.getParent().getExpression().getOperator(), negate) +
				" :compareToArgument"
		);
		Map<String, Object> params = new HashMap<String, Object>(2);
		params.put("keyStoreRefID", cryptoContext.getKeyStoreRefID());
		params.put("fieldMeta_fieldID", fieldMeta.getFieldID());
		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, ClassMeta classMeta) {
			return queryEvaluate(invokeExprEval, queryEvaluator, fieldMeta, compareToArgument, negate);
		}
	}
}
DateiProjektZeile
org/cumulus4j/store/query/method/DateGetDayEvaluator.javaorg.cumulus4j.store95
org/cumulus4j/store/query/method/DateGetMinuteEvaluator.javaorg.cumulus4j.store95
				"this.indexKey.length() " +
				ExpressionHelper.getOperatorAsJDOQLSymbol(invokeExprEval.getParent().getExpression().getOperator(), negate) +
				" :compareToArgument"
		);
		Map<String, Object> params = new HashMap<String, Object>(2);
		params.put("keyStoreRefID", cryptoContext.getKeyStoreRefID());
		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 'length() >= yyy'
				boolean negate
		)
		{
			super(queryEvaluator, primaryExpression);
			this.invokeExprEval = invokeExprEval;
			this.compareToArgument = compareToArgument;
			this.negate = negate;
		}

		@Override
		protected Set<Long> queryEnd(FieldMeta fieldMeta, ClassMeta classMeta) {
			return queryEvaluate(invokeExprEval, queryEvaluator, fieldMeta, compareToArgument, negate);
		}
	}
}
DateiProjektZeile
org/cumulus4j/store/test/jpa/account/LocalAccountantDelegate.javaorg.cumulus4j.store.test.jpa66
org/cumulus4j/store/test/account/LocalAccountantDelegate.javaorg.cumulus4j.store.test74
	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
DateiProjektZeile
org/cumulus4j/store/test/jpa/account/Anchor.javaorg.cumulus4j.store.test.jpa85
org/cumulus4j/store/test/account/Anchor.javaorg.cumulus4j.store.test98
	}

	@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 + ']';
	}
}
DateiProjektZeile
org/cumulus4j/store/query/method/StringMatchesEvaluator.javaorg.cumulus4j.store87
org/cumulus4j/store/query/method/StringStartsWithEvaluator.javaorg.cumulus4j.store86
				(negate ? "!this.indexKey.startsWith(:invokeArg)" : "this.indexKey.startsWith(:invokeArg) ")
		);
		Map<String, Object> params = new HashMap<String, Object>(3);
		params.put("keyStoreRefID", cryptoContext.getKeyStoreRefID());
		params.put("fieldMeta_fieldID", fieldMeta.getFieldID());
		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, ClassMeta classMeta) {
			return queryEvaluate(queryEvaluator, fieldMeta, invokeArgument, negate);
		}
	}
}
DateiProjektZeile
org/cumulus4j/store/query/method/StringEqualsEvaluator.javaorg.cumulus4j.store86
org/cumulus4j/store/query/method/StringEqualsIgnoreCaseEvaluator.javaorg.cumulus4j.store86
				(negate ? "!this.indexKey.toUpperCase() == :invokeArg.toUpperCase()" : "this.indexKey.toUpperCase() == :invokeArg.toUpperCase()")
		);
		Map<String, Object> params = new HashMap<String, Object>(3);
		params.put("keyStoreRefID", cryptoContext.getKeyStoreRefID());
		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 'equalsIgnorecase(xxx)'
				boolean negate
		)
		{
			super(queryEvaluator, primaryExpression);
			this.invokeArgument = invokeArgument;
			this.negate = negate;
		}

		@Override
		protected Set<Long> queryEnd(FieldMeta fieldMeta, ClassMeta classMeta) {
			return queryEvaluate(queryEvaluator, fieldMeta, invokeArgument, negate);
		}
	}
}
DateiProjektZeile
org/cumulus4j/store/query/method/StringEndsWithEvaluator.javaorg.cumulus4j.store86
org/cumulus4j/store/query/method/StringMatchesEvaluator.javaorg.cumulus4j.store87
				(negate ? "!this.indexKey.matches(:invokeArg)" : "this.indexKey.matches(:invokeArg) ")
		);
		Map<String, Object> params = new HashMap<String, Object>(3);
		params.put("keyStoreRefID", cryptoContext.getKeyStoreRefID());
		params.put("fieldMeta_fieldID", fieldMeta.getFieldID());
		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 'matches(xxx)'
				boolean negate
		)
		{
			super(queryEvaluator, primaryExpression);
			this.invokeArgument = invokeArgument;
			this.negate = negate;
		}

		@Override
		protected Set<Long> queryEnd(FieldMeta fieldMeta, ClassMeta classMeta) {
			return queryEvaluate(queryEvaluator, fieldMeta, invokeArgument, negate);
DateiProjektZeile
org/cumulus4j/store/query/method/StringMatchesEvaluator.javaorg.cumulus4j.store56
org/cumulus4j/store/query/method/StringStartsWithEvaluator.javaorg.cumulus4j.store55
			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.keyStoreRefID == :keyStoreRefID && this.fieldMeta_fieldID == :fieldMeta_fieldID && " +
				(negate ? "!this.indexKey.startsWith(:invokeArg)" : "this.indexKey.startsWith(:invokeArg) ")
DateiProjektZeile
org/cumulus4j/store/query/method/StringEqualsEvaluator.javaorg.cumulus4j.store55
org/cumulus4j/store/query/method/StringEqualsIgnoreCaseEvaluator.javaorg.cumulus4j.store55
			throw new IllegalStateException("{String}.equalsIgnoreCase(...) 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 'equalsIgnoreCase(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.keyStoreRefID == :keyStoreRefID && this.fieldMeta == :fieldMeta && " +
				(negate ? "!this.indexKey.toUpperCase() == :invokeArg.toUpperCase()" : "this.indexKey.toUpperCase() == :invokeArg.toUpperCase()")
DateiProjektZeile
org/cumulus4j/store/query/JDOQLQuery.javaorg.cumulus4j.store74
org/cumulus4j/store/query/JPQLQuery.javaorg.cumulus4j.store72
	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();

			Cumulus4jStoreManager storeManager = (Cumulus4jStoreManager) ec.getStoreManager();
			CryptoContext cryptoContext = new CryptoContext(storeManager.getEncryptionCoordinateSetManager(), storeManager.getKeyStoreRefManager(), ec, pmConn);
			storeManager.getDatastoreVersionManager().applyOnce(cryptoContext);

			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 {
				// http://sourceforge.net/tracker/?func=detail&aid=3514690&group_id=517465&atid=2102911
				// Must NOT call this.setCandidateClass(...), because 1st it's already assigned and 2nd it clears the compilation.
				// Marco :-)
//				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(),
DateiProjektZeile
org/cumulus4j/store/query/method/StringEqualsEvaluator.javaorg.cumulus4j.store55
org/cumulus4j/store/query/method/StringStartsWithEvaluator.javaorg.cumulus4j.store55
			throw new IllegalStateException("matches(...) 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 'matches(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(
DateiProjektZeile
org/cumulus4j/store/query/method/StringToLowerCaseEvaluator.javaorg.cumulus4j.store64
org/cumulus4j/store/query/method/StringToUpperCaseEvaluator.javaorg.cumulus4j.store64
			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.keyStoreRefID == :keyStoreRefID && this.fieldMeta_fieldID == :fieldMeta_fieldID && " +
DateiProjektZeile
org/cumulus4j/store/query/method/DateGetDayEvaluator.javaorg.cumulus4j.store101
org/cumulus4j/store/query/method/StringToUpperCaseEvaluator.javaorg.cumulus4j.store102
		params.put("fieldMeta_fieldID", fieldMeta.getFieldID());
		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,
				boolean negate
		)
		{
			super(queryEvaluator, primaryExpression);
			this.invokeExprEval = invokeExprEval;
			this.compareToArgument = compareToArgument;
			this.negate = negate;
		}

		@Override
		protected Set<Long> queryEnd(FieldMeta fieldMeta, ClassMeta classMeta) {
			return queryEvaluate(invokeExprEval, queryEvaluator, fieldMeta, compareToArgument, negate);
		}
	}
}
DateiProjektZeile
org/cumulus4j/store/query/method/DateGetDayEvaluator.javaorg.cumulus4j.store64
org/cumulus4j/store/query/method/StringToLowerCaseEvaluator.javaorg.cumulus4j.store64
			throw new IllegalStateException("String.toLowerCase(...) 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 'toLowerCase() >= 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(
DateiProjektZeile
org/cumulus4j/store/query/eval/AndExpressionEvaluator.javaorg.cumulus4j.store93
org/cumulus4j/store/query/eval/OrExpressionEvaluator.javaorg.cumulus4j.store84
			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) {
DateiProjektZeile
org/cumulus4j/store/query/method/DateGetYearEvaluator.javaorg.cumulus4j.store95
org/cumulus4j/store/query/method/StringSubstringEvaluator.javaorg.cumulus4j.store104
						"this.indexKey.substring(" + invokeArg1 + ") ") +
				ExpressionHelper.getOperatorAsJDOQLSymbol(invokeExprEval.getParent().getExpression().getOperator(), negate) +
				" :compareToArgument"
		);
		Map<String, Object> params = new HashMap<String, Object>(2);
		params.put("keyStoreRefID", cryptoContext.getKeyStoreRefID());
		params.put("fieldMeta_fieldID", fieldMeta.getFieldID());
		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;
DateiProjektZeile
org/cumulus4j/store/query/method/StringEqualsEvaluator.javaorg.cumulus4j.store90
org/cumulus4j/store/query/method/StringMatchesEvaluator.javaorg.cumulus4j.store91
		params.put("fieldMeta_fieldID", fieldMeta.getFieldID());
		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 'matches(xxx)'
				boolean negate
		)
		{
			super(queryEvaluator, primaryExpression);
			this.invokeArgument = invokeArgument;
			this.negate = negate;
		}

		@Override
		protected Set<Long> queryEnd(FieldMeta fieldMeta, ClassMeta classMeta) {
			return queryEvaluate(queryEvaluator, fieldMeta, invokeArgument, negate);
		}
	}
}
DateiProjektZeile
org/cumulus4j/keymanager/back/shared/KeyEncryptionUtil.javaorg.cumulus4j.keymanager.back.shared199
org/cumulus4j/store/crypto/keymanager/KeyManagerCryptoSession.javaorg.cumulus4j.store.crypto.keymanager375
			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);
DateiProjektZeile
org/cumulus4j/store/query/method/StringEndsWithEvaluator.javaorg.cumulus4j.store90
org/cumulus4j/store/query/method/StringEqualsEvaluator.javaorg.cumulus4j.store90
		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, ClassMeta classMeta) {
			return queryEvaluate(queryEvaluator, fieldMeta, invokeArgument, negate);
DateiProjektZeile
org/cumulus4j/store/EncryptionHandler.javaorg.cumulus4j.store160
org/cumulus4j/store/EncryptionHandler.javaorg.cumulus4j.store247
				logger.error("encryptIndexEntry: Dumping plaintext failed: " + e, e);
			}
		}

		CryptoSession cryptoSession = cryptoContext.getCryptoSession();
		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);
DateiProjektZeile
org/cumulus4j/store/test/jpa/JPATransactionalRunner.javaorg.cumulus4j.store.test.jpa150
org/cumulus4j/store/test/framework/JDOTransactionalRunner.javaorg.cumulus4j.store.test164
		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);
	}

	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 void setEncryptionCoordinates(PersistenceManager pm)
DateiProjektZeile
org/cumulus4j/integrationtest/webapp/App.javaorg.cumulus4j.integrationtest.webapp35
org/cumulus4j/store/crypto/keymanager/rest/KeyManagerBackWebApp.javaorg.cumulus4j.store.crypto.keymanager47
		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;
	}
}
DateiProjektZeile
org/cumulus4j/store/Cumulus4jPersistenceHandler.javaorg.cumulus4j.store253
org/cumulus4j/store/Cumulus4jPersistenceHandler.javaorg.cumulus4j.store435
	public void updateObject(ObjectProvider op, int[] fieldNumbers)
	{
		// Check if read-only so update not permitted
		storeManager.assertReadOnlyForUpdateOfObject(op);

		if (op.getEmbeddedOwners() != null && op.getEmbeddedOwners().length > 0) {
			return; // don't handle embedded objects here!
		}

		ExecutionContext ec = op.getExecutionContext();
		ManagedConnection mconn = storeManager.getConnection(ec);
		try {
			PersistenceManagerConnection pmConn = (PersistenceManagerConnection)mconn.getConnection();
			PersistenceManager pmData = pmConn.getDataPM();
			CryptoContext cryptoContext = new CryptoContext(encryptionCoordinateSetManager, keyStoreRefManager, ec, pmConn);
			getStoreManager().getDatastoreVersionManager().applyOnce(cryptoContext);

			boolean error = true;
			ObjectContainerHelper.enterTemporaryReferenceScope();
			try {

				Object object = op.getObject();
				Object objectID = op.getExternalObjectId();
DateiProjektZeile
org/cumulus4j/store/Cumulus4jStoreManager.javaorg.cumulus4j.store798
org/cumulus4j/store/Cumulus4jStoreManager.javaorg.cumulus4j.store852
	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());
DateiProjektZeile
org/cumulus4j/store/Cumulus4jPersistenceHandler.javaorg.cumulus4j.store163
org/cumulus4j/store/Cumulus4jPersistenceHandler.javaorg.cumulus4j.store394
					insertObjectIndex(cryptoContext, classMeta, dataEntry, fieldMeta, embeddedObjectContainer);
			}
		}
		else {
			AbstractMemberMetaData dnMemberMetaData = fieldMeta.getDataNucleusMemberMetaData(cryptoContext.getExecutionContext());

			// 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() + "\"");
DateiProjektZeile
org/cumulus4j/store/test/jpa/account/SummaryAccount.javaorg.cumulus4j.store.test.jpa40
org/cumulus4j/store/test/account/SummaryAccount.javaorg.cumulus4j.store.test56
	)
	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>();
	}
}
DateiProjektZeile
org/cumulus4j/store/query/method/CollectionSizeEvaluator.javaorg.cumulus4j.store92
org/cumulus4j/store/query/method/DateGetYearEvaluator.javaorg.cumulus4j.store99
		Map<String, Object> params = new HashMap<String, Object>(2);
		params.put("keyStoreRefID", cryptoContext.getKeyStoreRefID());
		params.put("fieldMeta_fieldID", fieldMeta.getFieldID());
		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
DateiProjektZeile
org/cumulus4j/store/query/eval/AndExpressionEvaluator.javaorg.cumulus4j.store67
org/cumulus4j/store/query/eval/OrExpressionEvaluator.javaorg.cumulus4j.store58
	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);
DateiProjektZeile
org/cumulus4j/store/test/jpa/account/Anchor.javaorg.cumulus4j.store.test.jpa50
org/cumulus4j/store/test/account/Anchor.javaorg.cumulus4j.store.test54
	@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;
	}
DateiProjektZeile
org/cumulus4j/store/query/method/DateGetDayEvaluator.javaorg.cumulus4j.store99
org/cumulus4j/store/query/method/MapSizeEvaluator.javaorg.cumulus4j.store92
		Map<String, Object> params = new HashMap<String, Object>(3);
		params.put("keyStoreRefID", cryptoContext.getKeyStoreRefID());
		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
DateiProjektZeile
org/cumulus4j/store/test/jpa/account/Account.javaorg.cumulus4j.store.test.jpa47
org/cumulus4j/store/test/account/Account.javaorg.cumulus4j.store.test64
	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;
	}
DateiProjektZeile
org/cumulus4j/keymanager/back/shared/KeyEncryptionUtil.javaorg.cumulus4j.keymanager.back.shared77
org/cumulus4j/store/crypto/keymanager/KeyManagerCryptoSession.javaorg.cumulus4j.store.crypto.keymanager195
				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()));
DateiProjektZeile
org/cumulus4j/store/Cumulus4jPersistenceHandler.javaorg.cumulus4j.store192
org/cumulus4j/store/Cumulus4jPersistenceHandler.javaorg.cumulus4j.store456
				Object object = op.getObject();
				Object objectID = op.getExternalObjectId();
				String objectIDString = objectID.toString();
				final ClassMeta classMeta = storeManager.getClassMeta(ec, object.getClass());
				AbstractClassMetaData dnClassMetaData = storeManager.getMetaDataManager().getMetaDataForClass(object.getClass(), ec.getClassLoaderResolver());

				DataEntry dataEntry = new DataEntryDAO(pmData, cryptoContext.getKeyStoreRefID()).getDataEntry(classMeta, objectIDString);
				if (dataEntry == null)
					throw new NucleusObjectNotFoundException("Object does not exist in datastore: class=" + classMeta.getClassName() + " oid=" + objectIDString);

				ObjectContainer objectContainerOld = encryptionHandler.decryptDataEntry(cryptoContext, dataEntry);
DateiProjektZeile
org/cumulus4j/store/query/method/CollectionContainsEvaluator.javaorg.cumulus4j.store61
org/cumulus4j/store/query/method/MapContainsKeyEvaluator.javaorg.cumulus4j.store46
			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,
DateiProjektZeile
org/cumulus4j/store/ObjectContainerHelper.javaorg.cumulus4j.store143
org/cumulus4j/store/ObjectContainerHelper.javaorg.cumulus4j.store158
	private static void assertNoEmptyTemporaryReferenceDataEntry() {
		Map<String, TemporaryReferenceDataEntry> objectID2tempRefMap = temporaryReferenceDataEntryMapThreadLocal.get();
		if (objectID2tempRefMap == null || objectID2tempRefMap.isEmpty())
			return;

		for (TemporaryReferenceDataEntry trde : objectID2tempRefMap.values()) {
			PersistenceManager pmData = trde.cryptoContext.getPersistenceManagerForData();
			DataEntryDAO dataEntryDAO = new DataEntryDAO(pmData, trde.cryptoContext.getKeyStoreRefID());
			DataEntry dataEntry = dataEntryDAO.getDataEntry(trde.dataEntryID);
			if (dataEntry != null && (dataEntry.getValue() == null || dataEntry.getValue().length == 0))
DateiProjektZeile
org/cumulus4j/store/Cumulus4jPersistenceHandler.javaorg.cumulus4j.store90
org/cumulus4j/store/Cumulus4jPersistenceHandler.javaorg.cumulus4j.store184
		ExecutionContext ec = op.getExecutionContext();
		ManagedConnection mconn = storeManager.getConnection(ec);
		try {
			PersistenceManagerConnection pmConn = (PersistenceManagerConnection)mconn.getConnection();
			PersistenceManager pmData = pmConn.getDataPM();
			CryptoContext cryptoContext = new CryptoContext(encryptionCoordinateSetManager, keyStoreRefManager, ec, pmConn);
			getStoreManager().getDatastoreVersionManager().applyOnce(cryptoContext);

			Object object = op.getObject();
			Object objectID = op.getExternalObjectId();
			String objectIDString = objectID.toString();
			final ClassMeta classMeta = storeManager.getClassMeta(ec, object.getClass());
DateiProjektZeile
org/cumulus4j/store/query/method/DateGetDayEvaluator.javaorg.cumulus4j.store101
org/cumulus4j/store/query/method/StringSubstringEvaluator.javaorg.cumulus4j.store110
		params.put("fieldMeta_fieldID", fieldMeta.getFieldID());
		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;
DateiProjektZeile
org/cumulus4j/store/query/method/DateGetDayEvaluator.javaorg.cumulus4j.store102
org/cumulus4j/store/query/method/StringIndexOfEvaluator.javaorg.cumulus4j.store114
		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;
Dokumentation
Über uns
Projektdokumentation
Babel
Versionen