From commits-return-10633-apmail-directory-commits-archive=directory.apache.org@directory.apache.org Sat Oct 14 20:07:36 2006 Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 73928 invoked from network); 14 Oct 2006 20:07:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 14 Oct 2006 20:07:35 -0000 Received: (qmail 34709 invoked by uid 500); 14 Oct 2006 20:07:35 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 34682 invoked by uid 500); 14 Oct 2006 20:07:35 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 34671 invoked by uid 99); 14 Oct 2006 20:07:35 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 14 Oct 2006 13:07:35 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 14 Oct 2006 13:07:34 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 8CAB11A981F; Sat, 14 Oct 2006 13:07:13 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r464006 - in /directory/sandbox/ersiner/sptriggerdemo/src/main/java: apachecon/ apachecon/us06/ apachecon/us06/ersiner/ apachecon/us06/ersiner/fr14/ apachecon/us06/ersiner/fr14/sp/ apachecon/us06/ersiner/fr14/spdemo/ apachecon/us06/ersiner/... Date: Sat, 14 Oct 2006 20:07:13 -0000 To: commits@directory.apache.org From: ersiner@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20061014200713.8CAB11A981F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: ersiner Date: Sat Oct 14 13:07:12 2006 New Revision: 464006 URL: http://svn.apache.org/viewvc?view=rev&rev=464006 Log: Organized ApacheCon presentation materuial. Added: directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/ directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/ directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/ directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/sp/ - copied from r463661, directory/sandbox/ersiner/sptriggerdemo/src/main/java/sptriggerdemo/common/ directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/sp/BackupUtilities.java - copied, changed from r463987, directory/sandbox/ersiner/sptriggerdemo/src/main/java/sptriggerdemo/common/BackupUtilities.java directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/sp/Greeter.java - copied, changed from r463987, directory/sandbox/ersiner/sptriggerdemo/src/main/java/sptriggerdemo/common/Greeter.java directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/spdemo/ directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/spdemo/SPDemo01.java directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/spdemo/SPDemo02.java directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/spdemo/SPDemo03.java directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/triggerdemo/ directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/triggerdemo/TriggerDemo01.java directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/triggerdemo/TriggerDemo02.java Removed: directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/sp/MailingListManager.java directory/sandbox/ersiner/sptriggerdemo/src/main/java/sptriggerdemo/ Modified: directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/sp/BulkOperations.java Copied: directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/sp/BackupUtilities.java (from r463987, directory/sandbox/ersiner/sptriggerdemo/src/main/java/sptriggerdemo/common/BackupUtilities.java) URL: http://svn.apache.org/viewvc/directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/sp/BackupUtilities.java?view=diff&rev=464006&p1=directory/sandbox/ersiner/sptriggerdemo/src/main/java/sptriggerdemo/common/BackupUtilities.java&r1=463987&p2=directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/sp/BackupUtilities.java&r2=464006 ============================================================================== --- directory/sandbox/ersiner/sptriggerdemo/src/main/java/sptriggerdemo/common/BackupUtilities.java (original) +++ directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/sp/BackupUtilities.java Sat Oct 14 13:07:12 2006 @@ -1,4 +1,4 @@ -package sptriggerdemo.common; +package apachecon.us06.ersiner.fr14.sp; import javax.naming.Name; import javax.naming.NamingException; Modified: directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/sp/BulkOperations.java URL: http://svn.apache.org/viewvc/directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/sp/BulkOperations.java?view=diff&rev=464006&r1=463661&r2=464006 ============================================================================== --- directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/sp/BulkOperations.java (original) +++ directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/sp/BulkOperations.java Sat Oct 14 13:07:12 2006 @@ -1,4 +1,4 @@ -package sptriggerdemo.common; +package apachecon.us06.ersiner.fr14.sp; import javax.naming.Name; import javax.naming.NamingEnumeration; Copied: directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/sp/Greeter.java (from r463987, directory/sandbox/ersiner/sptriggerdemo/src/main/java/sptriggerdemo/common/Greeter.java) URL: http://svn.apache.org/viewvc/directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/sp/Greeter.java?view=diff&rev=464006&p1=directory/sandbox/ersiner/sptriggerdemo/src/main/java/sptriggerdemo/common/Greeter.java&r1=463987&p2=directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/sp/Greeter.java&r2=464006 ============================================================================== --- directory/sandbox/ersiner/sptriggerdemo/src/main/java/sptriggerdemo/common/Greeter.java (original) +++ directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/sp/Greeter.java Sat Oct 14 13:07:12 2006 @@ -1,4 +1,4 @@ -package sptriggerdemo.common; +package apachecon.us06.ersiner.fr14.sp; import javax.naming.NamingException; Added: directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/spdemo/SPDemo01.java URL: http://svn.apache.org/viewvc/directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/spdemo/SPDemo01.java?view=auto&rev=464006 ============================================================================== --- directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/spdemo/SPDemo01.java (added) +++ directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/spdemo/SPDemo01.java Sat Oct 14 13:07:12 2006 @@ -0,0 +1,69 @@ +/* + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package apachecon.us06.ersiner.fr14.spdemo; + + +import java.util.Hashtable; + +import javax.naming.NamingException; +import javax.naming.ldap.InitialLdapContext; +import javax.naming.ldap.LdapContext; + +import org.apache.directory.shared.ldap.sp.JavaStoredProcedureUtils; + +import apachecon.us06.ersiner.fr14.sp.Greeter; + + + +/** + * SPDemo01 + * + * @author Ersin Er + */ +public class SPDemo01 +{ + private static String host = "localhost"; + private static int port = 1024; + + + private static LdapContext connectToServer() throws NamingException + { + Hashtable env = new Hashtable(); + env.put( "java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory" ); + env.put( "java.naming.provider.url", "ldap://" + host + ":" + port + "/ou=system" ); + env.put( "java.naming.security.principal", "uid=admin,ou=system" ); + env.put( "java.naming.security.credentials", "secret" ); + env.put( "java.naming.security.authentication", "simple" ); + return new InitialLdapContext( env, null ); + } + + + public static void main( String[] args ) throws NamingException + { + LdapContext ctx = connectToServer(); + + LdapContext spCtx = ( LdapContext ) ctx.lookup( "ou=Stored Procedures" ); + + //JavaStoredProcedureUtils.loadStoredProcedureClass( spCtx, Greeter.class ); + + String spName = Greeter.class.getName() + ".helloWorld"; + Object[] params = new Object[] {}; + + JavaStoredProcedureUtils.callStoredProcedure( ctx, spName, params ); + } +} Added: directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/spdemo/SPDemo02.java URL: http://svn.apache.org/viewvc/directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/spdemo/SPDemo02.java?view=auto&rev=464006 ============================================================================== --- directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/spdemo/SPDemo02.java (added) +++ directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/spdemo/SPDemo02.java Sat Oct 14 13:07:12 2006 @@ -0,0 +1,71 @@ +/* + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package apachecon.us06.ersiner.fr14.spdemo; + + +import java.util.Hashtable; + +import javax.naming.NamingException; +import javax.naming.ldap.InitialLdapContext; +import javax.naming.ldap.LdapContext; + +import org.apache.directory.shared.ldap.sp.JavaStoredProcedureUtils; + +import apachecon.us06.ersiner.fr14.sp.Greeter; + + + +/** + * SPDemo02 + * + * @author Ersin Er + */ +public class SPDemo02 +{ + private static String host = "localhost"; + private static int port = 1024; + + + private static LdapContext connectToServer() throws NamingException + { + Hashtable env = new Hashtable(); + env.put( "java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory" ); + env.put( "java.naming.provider.url", "ldap://" + host + ":" + port + "/ou=system" ); + env.put( "java.naming.security.principal", "uid=admin,ou=system" ); + env.put( "java.naming.security.credentials", "secret" ); + env.put( "java.naming.security.authentication", "simple" ); + return new InitialLdapContext( env, null ); + } + + + public static void main( String[] args ) throws NamingException + { + LdapContext ctx = connectToServer(); + + LdapContext spCtx = ( LdapContext ) ctx.lookup( "ou=Stored Procedures" ); + + //JavaStoredProcedureUtils.loadStoredProcedureClass( spCtx, Greeter.class ); + + String spName = Greeter.class.getName() + ".sayHello"; + Object[] params = new Object[] { + new String ( "John" ), new Integer( 3 ) }; + + Object response = JavaStoredProcedureUtils.callStoredProcedure( ctx, spName, params ); + System.out.println( "Response: " + response ); + } +} Added: directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/spdemo/SPDemo03.java URL: http://svn.apache.org/viewvc/directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/spdemo/SPDemo03.java?view=auto&rev=464006 ============================================================================== --- directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/spdemo/SPDemo03.java (added) +++ directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/spdemo/SPDemo03.java Sat Oct 14 13:07:12 2006 @@ -0,0 +1,72 @@ +/* + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package apachecon.us06.ersiner.fr14.spdemo; + + +import java.util.Hashtable; + +import javax.naming.NamingException; +import javax.naming.ldap.InitialLdapContext; +import javax.naming.ldap.LdapContext; + +import org.apache.directory.shared.ldap.name.LdapDN; +import org.apache.directory.shared.ldap.sp.JavaStoredProcedureUtils; +import org.apache.directory.shared.ldap.sp.LdapContextParameter; + +import apachecon.us06.ersiner.fr14.sp.BulkOperations; + + + +/** + * SPDemo03 + * + * @author Ersin Er + */ +public class SPDemo03 +{ + private static String host = "localhost"; + private static int port = 1024; + + + private static LdapContext connectToServer() throws NamingException + { + Hashtable env = new Hashtable(); + env.put( "java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory" ); + env.put( "java.naming.provider.url", "ldap://" + host + ":" + port + "/ou=system" ); + env.put( "java.naming.security.principal", "uid=admin,ou=system" ); + env.put( "java.naming.security.credentials", "secret" ); + env.put( "java.naming.security.authentication", "simple" ); + return new InitialLdapContext( env, null ); + } + + + public static void main( String[] args ) throws NamingException + { + LdapContext ctx = connectToServer(); + + LdapContext spCtx = ( LdapContext ) ctx.lookup( "ou=Stored Procedures" ); + + JavaStoredProcedureUtils.loadStoredProcedureClass( spCtx, BulkOperations.class ); + + String spName = BulkOperations.class.getName() + ".deleteSubtree"; + Object[] params = new Object[] { new LdapContextParameter( "ou=system" ), + new LdapDN( "ou=Mailing Lists") }; + + JavaStoredProcedureUtils.callStoredProcedure( ctx, spName, params ); + } +} Added: directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/triggerdemo/TriggerDemo01.java URL: http://svn.apache.org/viewvc/directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/triggerdemo/TriggerDemo01.java?view=auto&rev=464006 ============================================================================== --- directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/triggerdemo/TriggerDemo01.java (added) +++ directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/triggerdemo/TriggerDemo01.java Sat Oct 14 13:07:12 2006 @@ -0,0 +1,78 @@ +/* + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package apachecon.us06.ersiner.fr14.triggerdemo; + + +import java.util.Hashtable; + +import javax.naming.NamingException; +import javax.naming.ldap.InitialLdapContext; +import javax.naming.ldap.LdapContext; + +import org.apache.directory.shared.ldap.sp.JavaStoredProcedureUtils; +import org.apache.directory.shared.ldap.trigger.TriggerUtils; + +import apachecon.us06.ersiner.fr14.sp.BackupUtilities; + + + +/** + * Demo utility for Stored Procedures and Triggers. + * + * @author Ersin Er + */ +public class TriggerDemo01 +{ + private static String host = "localhost"; + private static int port = 1024; + + + private static LdapContext connectToServer() throws NamingException + { + Hashtable env = new Hashtable(); + env.put( "java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory" ); + env.put( "java.naming.provider.url", "ldap://" + host + ":" + port + "/ou=system" ); + env.put( "java.naming.security.principal", "uid=admin,ou=system" ); + env.put( "java.naming.security.credentials", "secret" ); + env.put( "java.naming.security.authentication", "simple" ); + return new InitialLdapContext( env, null ); + } + + + public static void main( String[] args ) throws NamingException + { + LdapContext ctx = connectToServer(); + + TriggerUtils.defineTriggerExecutionSpecificPoint( ctx ); + + // Load the stored procedure unit which has the stored procedure to be triggered. + JavaStoredProcedureUtils.loadStoredProcedureClass( ctx, BackupUtilities.class ); + + LdapContext entry = ( LdapContext ) ctx.lookup( "ou=Test Entry 01" ); + + /** + * AFTER Delete CALL ".BackupUtilities.backupDeleted" + * ( $ldapContext "", $name, $operationPrincipal, $deletedEntry ); + */ + String triggerSpec = "AFTER Delete CALL \"" + BackupUtilities.class.getName() + + ".backupDeleted\" ( $ldapContext \"\", $name, $operationPrincipal, $deletedEntry )"; + + TriggerUtils.loadEntryTriggerSpecification( entry, triggerSpec ); + } + +} Added: directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/triggerdemo/TriggerDemo02.java URL: http://svn.apache.org/viewvc/directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/triggerdemo/TriggerDemo02.java?view=auto&rev=464006 ============================================================================== --- directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/triggerdemo/TriggerDemo02.java (added) +++ directory/sandbox/ersiner/sptriggerdemo/src/main/java/apachecon/us06/ersiner/fr14/triggerdemo/TriggerDemo02.java Sat Oct 14 13:07:12 2006 @@ -0,0 +1,75 @@ +/* + * Copyright 2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package apachecon.us06.ersiner.fr14.triggerdemo; + + +import java.util.Hashtable; + +import javax.naming.NamingException; +import javax.naming.ldap.InitialLdapContext; +import javax.naming.ldap.LdapContext; + +import org.apache.directory.shared.ldap.sp.JavaStoredProcedureUtils; +import org.apache.directory.shared.ldap.trigger.TriggerUtils; + +import apachecon.us06.ersiner.fr14.sp.BackupUtilities; + + + +/** + * ApacheCon US 2006 + * LDAP Stored Procedures and Triggers Arrive in ApacheDS + * TriggerDemo02: Prescriptive Triggers. + * + * @author Ersin Er + */ +public class TriggerDemo02 +{ + private static String host = "localhost"; + private static int port = 1024; + + + private static LdapContext connectToServer() throws NamingException + { + Hashtable env = new Hashtable(); + env.put( "java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory" ); + env.put( "java.naming.provider.url", "ldap://" + host + ":" + port + "/ou=system" ); + env.put( "java.naming.security.principal", "uid=admin,ou=system" ); + env.put( "java.naming.security.credentials", "secret" ); + env.put( "java.naming.security.authentication", "simple" ); + return new InitialLdapContext( env, null ); + } + + + public static void main( String[] args ) throws NamingException + { + LdapContext ctx = connectToServer(); + + TriggerUtils.defineTriggerExecutionSpecificPoint( ctx ); + + JavaStoredProcedureUtils.loadStoredProcedureClass( ctx, BackupUtilities.class ); + + String subtreeSpec = "{ base \"ou=People\", minimum 1, specificationFilter item:person }"; + + String triggerSpec = "AFTER Delete CALL \"" + BackupUtilities.class.getName() + + ".backupDeleted\" ( $ldapContext \"\", $name, $operationPrincipal, $deletedEntry )"; + + TriggerUtils.createTriggerExecutionSubentry( ctx, "triggerSubentry1", subtreeSpec, triggerSpec ); + } + +}