geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject cvs commit: incubator-geronimo/modules/core/src/java/org/apache/geronimo/xml/deployment GeronimoEjbJarLoader.java GeronimoJ2EELoader.java GeronimoWebAppLoader.java
Date Tue, 18 Nov 2003 04:16:22 GMT
adc         2003/11/17 20:16:22

  Modified:    modules/core/src/java/org/apache/geronimo/xml/deployment
                        GeronimoEjbJarLoader.java GeronimoJ2EELoader.java
                        GeronimoWebAppLoader.java
  Log:
  Principal/Role mappings added.
  
  Revision  Changes    Path
  1.10      +2 -1      incubator-geronimo/modules/core/src/java/org/apache/geronimo/xml/deployment/GeronimoEjbJarLoader.java
  
  Index: GeronimoEjbJarLoader.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/xml/deployment/GeronimoEjbJarLoader.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- GeronimoEjbJarLoader.java	18 Nov 2003 02:15:13 -0000	1.9
  +++ GeronimoEjbJarLoader.java	18 Nov 2003 04:16:22 -0000	1.10
  @@ -83,6 +83,7 @@
           EjbJar jar = new EjbJar();
           jar.setVersion(root.getAttribute("version"));
           jar.setClassSpace(GeronimoJ2EELoader.loadClassSpace(root));
  +        jar.setSecurity(GeronimoJ2EELoader.loadSecurity(root));
           J2EELoader.loadDisplayable(root, jar);
           jar.setModuleName(LoaderUtil.getChildContent(root, "module-name"));
           String datasourceName = LoaderUtil.getChildContent(root, "datasource-name");
  
  
  
  1.7       +80 -1     incubator-geronimo/modules/core/src/java/org/apache/geronimo/xml/deployment/GeronimoJ2EELoader.java
  
  Index: GeronimoJ2EELoader.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/xml/deployment/GeronimoJ2EELoader.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- GeronimoJ2EELoader.java	17 Nov 2003 02:03:16 -0000	1.6
  +++ GeronimoJ2EELoader.java	18 Nov 2003 04:16:22 -0000	1.7
  @@ -65,6 +65,11 @@
   import org.apache.geronimo.deployment.model.geronimo.j2ee.MessageDestination;
   import org.apache.geronimo.deployment.model.geronimo.j2ee.SecurityRoleRef;
   import org.apache.geronimo.deployment.model.geronimo.j2ee.ClassSpace;
  +import org.apache.geronimo.deployment.model.geronimo.j2ee.Security;
  +import org.apache.geronimo.deployment.model.geronimo.j2ee.RoleMappings;
  +import org.apache.geronimo.deployment.model.geronimo.j2ee.Role;
  +import org.apache.geronimo.deployment.model.geronimo.j2ee.Realm;
  +import org.apache.geronimo.deployment.model.geronimo.j2ee.Principal;
   import org.w3c.dom.Element;
   
   /**
  @@ -197,5 +202,79 @@
           classSpace.setClassSpace(LoaderUtil.getAttribute(cs, "name"));
           classSpace.setParentClassSpace((LoaderUtil.getAttribute(cs, "parent")));
           return classSpace;
  +    }
  +
  +    public static Security loadSecurity(Element e) {
  +        Element s = LoaderUtil.getChild(e, "security");
  +        Security security = new Security();
  +
  +        J2EELoader.loadDescribable(s, security);
  +
  +        security.setRoleMappings(loadRoleMappings(s));
  +
  +        return security;
  +    }
  +
  +    public static RoleMappings loadRoleMappings(Element e) {
  +        Element rm = LoaderUtil.getChild(e, "role-mappings");
  +
  +        if (rm == null) return null;
  +
  +        RoleMappings roleMappings = new RoleMappings();
  +        roleMappings.setRole(loadRoles(rm));
  +
  +        return roleMappings;
  +    }
  +
  +    public static Role[] loadRoles(Element e) {
  +        Element[] nodes = LoaderUtil.getChildren(e, "role");
  +        Role[] result = new Role[nodes.length];
  +        for(int i = 0; i < nodes.length; i++) {
  +            result[i] = loadRole(nodes[i], new Role());
  +        }
  +        return result;
  +    }
  +
  +    public static Role loadRole(Element e, Role role) {
  +        J2EELoader.loadDescribable(e, role);
  +        role.setRoleName(LoaderUtil.getAttribute(e, "role-name"));
  +        role.setRealm(loadRealms(e));
  +
  +        return role;
  +    }
  +
  +    public static Realm[] loadRealms(Element e) {
  +        Element[] nodes = LoaderUtil.getChildren(e, "realm");
  +        Realm[] result = new Realm[nodes.length];
  +        for(int i = 0; i < nodes.length; i++) {
  +            result[i] = loadRealm(nodes[i], new Realm());
  +        }
  +        return result;
  +    }
  +
  +    public static Realm loadRealm(Element e, Realm realm) {
  +        J2EELoader.loadDescribable(e, realm);
  +        realm.setRealmName(LoaderUtil.getAttribute(e, "realm-name"));
  +        realm.setPrincipal(loadPrincipals(e));
  +
  +        return realm;
  +    }
  +
  +    public static Principal[] loadPrincipals(Element e) {
  +        Element[] nodes = LoaderUtil.getChildren(e, "principal");
  +        Principal[] result = new Principal[nodes.length];
  +        for(int i = 0; i < nodes.length; i++) {
  +            result[i] = loadPrincipal(nodes[i], new Principal());
  +        }
  +        return result;
  +    }
  +
  +    public static Principal loadPrincipal(Element e, Principal principal) {
  +        J2EELoader.loadDescribable(e, principal);
  +
  +        principal.setName(LoaderUtil.getAttribute(e, "name"));
  +        principal.setClassName(LoaderUtil.getAttribute(e, "class"));
  +
  +        return principal;
       }
   }
  
  
  
  1.4       +2 -1      incubator-geronimo/modules/core/src/java/org/apache/geronimo/xml/deployment/GeronimoWebAppLoader.java
  
  Index: GeronimoWebAppLoader.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/xml/deployment/GeronimoWebAppLoader.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- GeronimoWebAppLoader.java	7 Oct 2003 17:16:37 -0000	1.3
  +++ GeronimoWebAppLoader.java	18 Nov 2003 04:16:22 -0000	1.4
  @@ -74,6 +74,7 @@
   
           WebApp webApp = new WebApp();
           loadCommonElements(webApp, root);
  +        webApp.setSecurity(GeronimoJ2EELoader.loadSecurity(root));
           webApp.setEnvEntry(J2EELoader.loadEnvEntries(root));
           webApp.setEJBRef(GeronimoJ2EELoader.loadEJBRefs(root));
           webApp.setEJBLocalRef(GeronimoJ2EELoader.loadEJBLocalRefs(root));
  
  
  

Mime
View raw message