Commits

Dan Connolly  committed 72c2162

capsec exploration

  • Participants
  • Parent commits b7e2dd8

Comments (0)

Files changed (11)

File src/edu/kumc/informatics/heron/capsec/CasTicket.java

+package edu.kumc.informatics.heron.capsec;
+
+public class CasTicket {
+	public String getName() {
+		return "@@stub";
+	}
+}

File src/edu/kumc/informatics/heron/capsec/DROC.java

+package edu.kumc.informatics.heron.capsec;
+
+public class DROC {
+	private Enterprise _org;
+	
+	public DROC(Enterprise org) {
+		_org = org;
+	}
+	public void notify(SponsorshipRequest q) {
+		_org.recognize(q.by());
+		//...
+	}
+}

File src/edu/kumc/informatics/heron/capsec/Employee.java

+package edu.kumc.informatics.heron.capsec;
+
+public interface Employee {
+	public String getFullName();
+}

File src/edu/kumc/informatics/heron/capsec/Enterprise.java

+package edu.kumc.informatics.heron.capsec;
+
+
+public class Enterprise {
+	public Employee affiliate(CasTicket who) {
+		// look up in LDAP...
+		return new EnterpriseEmployee(who.getName());
+	}
+
+	public Employee qualifiedFaculty(CasTicket who) {
+		// look up in LDAP...
+		// 	public static final String excluded_jobcode = "24600";
+		//if (who_e._isFaculty() && ! who_e_jobCode.equals(excluded_jobcode)) {
+		//	return new HeronSponsor(who_e);
+		//}
+		return new EnterpriseEmployee(who.getName());
+	}
+	
+	public Employee recognize(Employee who) throws IllegalArgumentException {
+		try {
+			return (EnterpriseEmployee)who;
+		} catch (ClassCastException e) {
+			throw new IllegalArgumentException("not mine@@");
+		}
+	}
+
+	static class EnterpriseEmployee implements Employee {
+		protected EnterpriseEmployee(String n) {
+			// @@stub
+		}
+
+		public String getFullName() {
+			return "@@stub";
+		}
+	}
+}

File src/edu/kumc/informatics/heron/capsec/Sponsor.java

+package edu.kumc.informatics.heron.capsec;
+
+public interface Sponsor {
+	public SponsorshipRequest fileRequest(String title, Employee who);
+}

File src/edu/kumc/informatics/heron/capsec/SponsorshipRequest.java

+package edu.kumc.informatics.heron.capsec;
+
+public interface SponsorshipRequest {
+	public Employee by();
+}

File src/edu/kumc/informatics/heron/capsec/SystemAccessRecords.java

+package edu.kumc.informatics.heron.capsec;
+
+import edu.kumc.informatics.heron.capsec.Enterprise;
+
+public class SystemAccessRecords {
+	private Enterprise _org;
+	public SystemAccessRecords(Enterprise org) {
+		_org = org;
+	}
+
+	public Sponsor makeSponsor(CasTicket who) {
+		Employee who_e = _org.qualifiedFaculty(who);
+		// look up who in DB
+		return new SystemSponsor(_org, who_e);
+	}
+
+	protected static class SystemSponsor implements Sponsor {
+		private Enterprise _org;
+		private Employee _as_employee;
+
+		public SystemSponsor(Enterprise org, Employee me) {
+			_org = org;
+			_as_employee = me;
+		}
+		
+		public SponsorshipRequest fileRequest(String title, Employee who) 
+		throws IllegalArgumentException {
+			Employee who_e = _org.recognize(who);
+			// insert into DB...
+			return new SystemSponsorshipRequest(title,
+					_org, _as_employee, who_e);
+		}
+	}
+
+	protected static class SystemSponsorshipRequest implements SponsorshipRequest{
+		private Employee _by;
+		
+		public SystemSponsorshipRequest(String title,
+				Enterprise org, Employee sponsor, Employee who) {
+			//save args as per case class pattern...
+		}
+		
+		public Employee by() {
+			return _by;
+		}
+	}
+}

File src/edu/kumc/informatics/heron/capsec/package-info.java

+@org.joe_e.IsJoeE package edu.kumc.informatics.heron.capsec;

File src/webapp/META-INF/MANIFEST.MF

+Manifest-Version: 1.0
+Class-Path: 
+

File src/webapp/WEB-INF/faces-config.xml

+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE faces-config PUBLIC
+    "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
+    "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
+
+<faces-config>
+
+</faces-config>

File src/webapp/WEB-INF/web.xml

+<?xml version="1.0" encoding="UTF-8"?>
+<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+	<display-name>heron-adm</display-name>
+	<servlet>
+		<servlet-name>Faces Servlet</servlet-name>
+		<servlet-class>
+		javax.faces.webapp.FacesServlet</servlet-class>
+		<load-on-startup>1</load-on-startup>
+	</servlet>
+	<servlet-mapping>
+		<servlet-name>Faces Servlet</servlet-name>
+		<url-pattern>/faces/*</url-pattern>
+	</servlet-mapping>
+	<welcome-file-list>
+		<welcome-file>index.html</welcome-file>
+		<welcome-file>index.htm</welcome-file>
+		<welcome-file>index.jsp</welcome-file>
+		<welcome-file>default.html</welcome-file>
+		<welcome-file>default.htm</welcome-file>
+		<welcome-file>default.jsp</welcome-file>
+	</welcome-file-list>
+</web-app>