grouper/contrib/cdg/src/cdg/com/devclue/grouper/session

1 view
Skip to first unread message

blair christensen

unread,
Dec 16, 2005, 4:48:02 PM12/16/05
to grouper...@listhost.uchicago.edu, grouper...@googlegroups.com
Update
of /home/cvs/i2mi/grouper/contrib/cdg/src/cdg/com/devclue/grouper/session
In directory ellis.internet2.edu:/home/blair/tmp/tmpdir/cvs-serv11088/contrib/cdg/src/cdg/com/devclue/grouper/session

Added Files:
SessionFactory.java
Log Message:
* mark old contrib items as deprecated
* import a modified version of cdg into contrib


--- /dev/null
+++ contrib/cdg/src/cdg/com/devclue/grouper/session/SessionFactory.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2005 blair christensen.
+ * All Rights Reserved.
+ *
+ * You may use and distribute under the same terms as Grouper itself.
+ */
+
+package com.devclue.grouper.session;
+
+import edu.internet2.middleware.grouper.*;
+import edu.internet2.middleware.subject.*;
+
+/**
+ * Factory for returning Grouper sessions.
+ * <p />
+ * @author blair christensen.
+ * @version $Id: SessionFactory.java,v 1.1 2005/12/16 21:48:00 blair Exp $
+ */
+public class SessionFactory {
+
+ /*
+ * PRIVATE CLASS VARIABLES
+ */
+
+ // DESIGN I can't say that I'm fond of this
+ private static GrouperSession s;
+
+
+ /*
+ * PUBLIC CLASS METHODS
+ */
+
+ /**
+ * Return a {@link GrouperSession}.
+ * <p>
+ * Currently a single, root Grouper session is created and then
+ * shared between all applications callling this method.
+ * </p>
+ * <pre class="eg">
+ * // Return a shared, root Grouper session.
+ * GrouperSession = SessionFactory.getSession();
+ * </pre>
+ * @return A Grouper session.
+ */
+ public static GrouperSession getSession() {
+ if (s != null) {
+ return s;
+ }
+ // Start session
+ try {
+ s = GrouperSession.start( SubjectFinder.findById("GrouperSystem") );
+ return s;
+ }
+ catch (Exception e) {
+ throw new RuntimeException(
+ "Unable to start session: " + e.getMessage()
+ );
+ }
+ } // public static GrouperSession getSession()
+
+}
+

Reply all
Reply to author
Forward
0 new messages