directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ersi...@apache.org
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 GMT
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 <a href="mailto:ersiner@apache.org">Ersin Er</a>
+ */
+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 <a href="mailto:ersiner@apache.org">Ersin Er</a>
+ */
+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 <a href="mailto:ersiner@apache.org">Ersin Er</a>
+ */
+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 <a href="mailto:ersiner@apache.org">Ersin Er</a>
+ */
+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 "<package>.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 <a href="mailto:ersiner@apache.org">Ersin Er</a>
+ */
+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 );
+    }
+    
+}



Mime
View raw message