Return-Path: X-Original-To: apmail-jackrabbit-oak-commits-archive@minotaur.apache.org Delivered-To: apmail-jackrabbit-oak-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 04A489839 for ; Mon, 23 Apr 2012 12:38:28 +0000 (UTC) Received: (qmail 50434 invoked by uid 500); 23 Apr 2012 12:38:27 -0000 Delivered-To: apmail-jackrabbit-oak-commits-archive@jackrabbit.apache.org Received: (qmail 50409 invoked by uid 500); 23 Apr 2012 12:38:27 -0000 Mailing-List: contact oak-commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: oak-commits@jackrabbit.apache.org Delivered-To: mailing list oak-commits@jackrabbit.apache.org Received: (qmail 50369 invoked by uid 99); 23 Apr 2012 12:38:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Apr 2012 12:38:26 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Apr 2012 12:38:20 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id DE74123888CD; Mon, 23 Apr 2012 12:37:59 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1329213 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel: NodeValidator.java NodeValidatorProvider.java Date: Mon, 23 Apr 2012 12:37:59 -0000 To: oak-commits@jackrabbit.apache.org From: jukka@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120423123759.DE74123888CD@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jukka Date: Mon Apr 23 12:37:59 2012 New Revision: 1329213 URL: http://svn.apache.org/viewvc?rev=1329213&view=rev Log: OAK-68: Extension point for commit validation First draft of such an extension point Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/NodeValidator.java jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/NodeValidatorProvider.java Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/NodeValidator.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/NodeValidator.java?rev=1329213&view=auto ============================================================================== --- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/NodeValidator.java (added) +++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/NodeValidator.java Mon Apr 23 12:37:59 2012 @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.oak.kernel; + +import org.apache.jackrabbit.oak.api.CommitFailedException; +import org.apache.jackrabbit.oak.api.PropertyState; +import org.apache.jackrabbit.oak.kernel.NodeState; + +/** + * Content change validator. An instance of this interface is used to + * validate changes against a specific {@link NodeState}. + */ +public interface NodeValidator { + + void propertyAdded(PropertyState after) + throws CommitFailedException; + + void propertyChanged(PropertyState before, PropertyState after) + throws CommitFailedException; + + void propertyDeleted(PropertyState before) + throws CommitFailedException; + + NodeValidator childNodeAdded(String name, NodeState after) + throws CommitFailedException; + + NodeValidator childNodeChanged( + String name, NodeState before, NodeState after) + throws CommitFailedException; + + NodeValidator childNodeDeleted(String name, NodeState before) + throws CommitFailedException; + +} Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/NodeValidatorProvider.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/NodeValidatorProvider.java?rev=1329213&view=auto ============================================================================== --- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/NodeValidatorProvider.java (added) +++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/NodeValidatorProvider.java Mon Apr 23 12:37:59 2012 @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.oak.kernel; + +import org.apache.jackrabbit.oak.kernel.NodeState; + +/** + * Extension point for plugging in different kinds of validation rules + * for content changes. + */ +public interface NodeValidatorProvider { + + /** + * Returns a validator for checking the changes between the given + * two root states. + * + * @param before original root state + * @param after modified root state + * @return validator for checking the modifications + */ + NodeValidator getRootValidator(NodeState before, NodeState after); + +}