maguro      2005/01/20 15:48:14

  Added:       modules/itests/src/java/org/openejb/test/security/cmp
                        BasicCmp.java BasicCmp2Bean.java BasicCmpBean.java
                        BasicCmpHome.java
  Log:

  
  
  Revision  Changes    Path
  1.1                  
openejb/modules/itests/src/java/org/openejb/test/security/cmp/BasicCmp.java
  
  Index: BasicCmp.java
  ===================================================================
  /**
   * Redistribution and use of this software and associated documentation
   * ("Software"), with or without modification, are permitted provided
   * that the following conditions are met:
   *
   * 1. Redistributions of source code must retain copyright
   *    statements and notices.  Redistributions must also contain a
   *    copy of this document.
   *
   * 2. Redistributions in binary form must reproduce the
   *    above copyright notice, this list of conditions and the
   *    following disclaimer in the documentation and/or other
   *    materials provided with the distribution.
   *
   * 3. The name "OpenEJB" must not be used to endorse or promote
   *    products derived from this Software without prior written
   *    permission of The OpenEJB Group.  For written permission,
   *    please contact [EMAIL PROTECTED]
   *
   * 4. Products derived from this Software may not be called "OpenEJB"
   *    nor may "OpenEJB" appear in their names without prior written
   *    permission of The OpenEJB Group. OpenEJB is a registered
   *    trademark of The OpenEJB Group.
   *
   * 5. Due credit should be given to the OpenEJB Project
   *    (http://openejb.sf.net/).
   *
   * THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
   * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
   * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
   * THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
   * OF THE POSSIBILITY OF SUCH DAMAGE.
   *
   * Copyright 2005 (C) The OpenEJB Group. All Rights Reserved.
   *
   * $Id: BasicCmp.java,v 1.1 2005/01/20 20:48:14 maguro Exp $
   */
  package org.openejb.test.security.cmp;
  
  import java.rmi.RemoteException;
  import javax.ejb.EJBObject;
  
  
  /**
   * @version $Revision: 1.1 $ $Date: 2005/01/20 20:48:14 $
   */
  public interface BasicCmp extends EJBObject {
  
      public String getFirstName() throws RemoteException;
  
      public void setFirstName(String firstName) throws RemoteException;
  
      public String getLastName() throws RemoteException;
  
      public void setLastName(String lastName) throws RemoteException;
  
      public String noAccessMethod(String argument1) throws RemoteException;
  
      public String noAccessMethod(String argument1, String argument2) throws 
RemoteException;
  
      public String highSecurityMethod(String argument1) throws RemoteException;
  
      public String highSecurityMethod(String argument1, String argument2) 
throws RemoteException;
  
      public String mediumSecurityMethod(String argument1) throws 
RemoteException;
  
      public String mediumSecurityMethod(String argument1, String argument2) 
throws RemoteException;
  
      public String lowSecurityMethod(String argument1) throws RemoteException;
  
      public String lowSecurityMethod(String argument1, String argument2) 
throws RemoteException;
  
      public String allAccessMethod(String argument1) throws RemoteException;
  
      public String allAccessMethod(String argument1, String argument2) throws 
RemoteException;
  
      public String unassignedMethod(String argument1) throws RemoteException;
  
      public String unassignedMethod(String argument1, String argument2) throws 
RemoteException;
  
      public boolean isInRole(String roleName) throws RemoteException;
  
  }
  
  
  
  1.1                  
openejb/modules/itests/src/java/org/openejb/test/security/cmp/BasicCmp2Bean.java
  
  Index: BasicCmp2Bean.java
  ===================================================================
  /**
   * Redistribution and use of this software and associated documentation
   * ("Software"), with or without modification, are permitted provided
   * that the following conditions are met:
   *
   * 1. Redistributions of source code must retain copyright
   *    statements and notices.  Redistributions must also contain a
   *    copy of this document.
   *
   * 2. Redistributions in binary form must reproduce the
   *    above copyright notice, this list of conditions and the
   *    following disclaimer in the documentation and/or other
   *    materials provided with the distribution.
   *
   * 3. The name "OpenEJB" must not be used to endorse or promote
   *    products derived from this Software without prior written
   *    permission of The OpenEJB Group.  For written permission,
   *    please contact [EMAIL PROTECTED]
   *
   * 4. Products derived from this Software may not be called "OpenEJB"
   *    nor may "OpenEJB" appear in their names without prior written
   *    permission of The OpenEJB Group. OpenEJB is a registered
   *    trademark of The OpenEJB Group.
   *
   * 5. Due credit should be given to the OpenEJB Project
   *    (http://openejb.sf.net/).
   *
   * THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
   * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
   * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
   * THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
   * OF THE POSSIBILITY OF SUCH DAMAGE.
   *
   * Copyright 2005 (C) The OpenEJB Group. All Rights Reserved.
   *
   * $Id: BasicCmp2Bean.java,v 1.1 2005/01/20 20:48:14 maguro Exp $
   */
  package org.openejb.test.security.cmp;
  
  import java.util.Hashtable;
  import javax.ejb.CreateException;
  import javax.ejb.EntityBean;
  import javax.ejb.EntityContext;
  
  
  /**
   * @version $Revision: 1.1 $ $Date: 2005/01/20 20:48:14 $
   */
  public abstract class BasicCmp2Bean implements EntityBean {
  
      public static int key = 1000;
  
      public EntityContext entityContext;
      public Hashtable allowedOperationsTable = new Hashtable();
  
      public abstract Integer getId();
  
      public abstract void setId(Integer primaryKey);
  
      public abstract String getFirstName();
  
      public abstract void setFirstName(String firstName);
  
      public abstract String getLastName();
  
      public abstract void setLastName(String lastName);
  
      public String noAccessMethod(String argument1) {
          return argument1;
      }
  
      public String noAccessMethod(String argument1, String argument2) {
          return argument1 + argument2;
      }
  
      public String highSecurityMethod(String argument1) {
          return argument1;
      }
  
      public String highSecurityMethod(String argument1, String argument2) {
          return argument1 + argument2;
      }
  
      public String mediumSecurityMethod(String argument1) {
          return argument1;
      }
  
      public String mediumSecurityMethod(String argument1, String argument2) {
          return argument1 + argument2;
      }
  
      public String lowSecurityMethod(String argument1) {
          return argument1;
      }
  
      public String lowSecurityMethod(String argument1, String argument2) {
          return argument1 + argument2;
      }
  
      public String allAccessMethod(String argument1) {
          return argument1;
      }
  
      public String allAccessMethod(String argument1, String argument2) {
          return argument1 + argument2;
      }
  
      public String unassignedMethod(String argument1) {
          return argument1;
      }
  
      public String unassignedMethod(String argument1, String argument2) {
          return argument1 + argument2;
      }
  
      public boolean isInRole(String roleName) {
          return entityContext.isCallerInRole(roleName);
      }
  
      public Integer ejbCreate(String firstName, String lastName) throws 
CreateException {
          setId(new Integer(key++));
          setFirstName(firstName);
          setLastName(lastName);
  
          return null;
      }
  
      public void ejbPostCreate(String firstName, String lastName) {
      }
  
      public void ejbLoad() {
      }
  
      public void setEntityContext(EntityContext ctx) {
          entityContext = ctx;
      }
  
      public void unsetEntityContext() {
          entityContext = null;
      }
  
      public void ejbStore() {
      }
  
      public void ejbRemove() {
      }
  
      public void ejbActivate() {
      }
  
      public void ejbPassivate() {
      }
  
  }
  
  
  
  1.1                  
openejb/modules/itests/src/java/org/openejb/test/security/cmp/BasicCmpBean.java
  
  Index: BasicCmpBean.java
  ===================================================================
  /**
   * Redistribution and use of this software and associated documentation
   * ("Software"), with or without modification, are permitted provided
   * that the following conditions are met:
   *
   * 1. Redistributions of source code must retain copyright
   *    statements and notices.  Redistributions must also contain a
   *    copy of this document.
   *
   * 2. Redistributions in binary form must reproduce the
   *    above copyright notice, this list of conditions and the
   *    following disclaimer in the documentation and/or other
   *    materials provided with the distribution.
   *
   * 3. The name "OpenEJB" must not be used to endorse or promote
   *    products derived from this Software without prior written
   *    permission of The OpenEJB Group.  For written permission,
   *    please contact [EMAIL PROTECTED]
   *
   * 4. Products derived from this Software may not be called "OpenEJB"
   *    nor may "OpenEJB" appear in their names without prior written
   *    permission of The OpenEJB Group. OpenEJB is a registered
   *    trademark of The OpenEJB Group.
   *
   * 5. Due credit should be given to the OpenEJB Project
   *    (http://openejb.sf.net/).
   *
   * THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
   * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
   * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
   * THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
   * OF THE POSSIBILITY OF SUCH DAMAGE.
   *
   * Copyright 2005 (C) The OpenEJB Group. All Rights Reserved.
   *
   * $Id: BasicCmpBean.java,v 1.1 2005/01/20 20:48:14 maguro Exp $
   */
  package org.openejb.test.security.cmp;
  
  import javax.ejb.CreateException;
  import javax.ejb.EntityBean;
  import javax.ejb.EntityContext;
  
  
  /**
   * @version $Revision: 1.1 $ $Date: 2005/01/20 20:48:14 $
   */
  public class BasicCmpBean implements EntityBean {
  
      public static int key = 1000;
  
      public Integer id;
      public String firstName;
      public String lastName;
      public EntityContext entityContext;
  
      public String getFirstName() {
          return firstName;
      }
  
      public void setFirstName(String firstName) {
          this.firstName = firstName;
      }
  
      public String getLastName() {
          return lastName;
      }
  
      public void setLastName(String lastName) {
          this.lastName = lastName;
      }
  
      public String noAccessMethod(String argument1) {
          return argument1;
      }
  
      public String noAccessMethod(String argument1, String argument2) {
          return argument1 + argument2;
      }
  
      public String highSecurityMethod(String argument1) {
          return argument1;
      }
  
      public String highSecurityMethod(String argument1, String argument2) {
          return argument1 + argument2;
      }
  
      public String mediumSecurityMethod(String argument1) {
          return argument1;
      }
  
      public String mediumSecurityMethod(String argument1, String argument2) {
          return argument1 + argument2;
      }
  
      public String lowSecurityMethod(String argument1) {
          return argument1;
      }
  
      public String lowSecurityMethod(String argument1, String argument2) {
          return argument1 + argument2;
      }
  
      public String allAccessMethod(String argument1) {
          return argument1;
      }
  
      public String allAccessMethod(String argument1, String argument2) {
          return argument1 + argument2;
      }
  
      public String unassignedMethod(String argument1) {
          return argument1;
      }
  
      public String unassignedMethod(String argument1, String argument2) {
          return argument1 + argument2;
      }
  
      public boolean isInRole(String roleName) {
          return entityContext.isCallerInRole(roleName);
      }
  
      public Integer ejbCreate(String firstName, String lastName) throws 
CreateException {
          this.id = new Integer(key++);
          this.firstName = firstName;
          this.lastName = lastName;
  
          return null;
      }
  
      public void ejbPostCreate(String firstName, String lastName) throws 
CreateException {
      }
  
      public void ejbLoad() {
      }
  
      public void setEntityContext(EntityContext ctx) {
          entityContext = ctx;
      }
  
      public void unsetEntityContext() {
          entityContext = null;
      }
  
      public void ejbStore() {
      }
  
      public void ejbRemove() {
      }
  
      public void ejbActivate() {
      }
  
      public void ejbPassivate() {
      }
  }
  
  
  
  1.1                  
openejb/modules/itests/src/java/org/openejb/test/security/cmp/BasicCmpHome.java
  
  Index: BasicCmpHome.java
  ===================================================================
  /**
   * Redistribution and use of this software and associated documentation
   * ("Software"), with or without modification, are permitted provided
   * that the following conditions are met:
   *
   * 1. Redistributions of source code must retain copyright
   *    statements and notices.  Redistributions must also contain a
   *    copy of this document.
   *
   * 2. Redistributions in binary form must reproduce the
   *    above copyright notice, this list of conditions and the
   *    following disclaimer in the documentation and/or other
   *    materials provided with the distribution.
   *
   * 3. The name "OpenEJB" must not be used to endorse or promote
   *    products derived from this Software without prior written
   *    permission of The OpenEJB Group.  For written permission,
   *    please contact [EMAIL PROTECTED]
   *
   * 4. Products derived from this Software may not be called "OpenEJB"
   *    nor may "OpenEJB" appear in their names without prior written
   *    permission of The OpenEJB Group. OpenEJB is a registered
   *    trademark of The OpenEJB Group.
   *
   * 5. Due credit should be given to the OpenEJB Project
   *    (http://openejb.sf.net/).
   *
   * THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
   * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
   * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
   * THE OPENEJB GROUP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
   * OF THE POSSIBILITY OF SUCH DAMAGE.
   *
   * Copyright 2005 (C) The OpenEJB Group. All Rights Reserved.
   *
   * $Id: BasicCmpHome.java,v 1.1 2005/01/20 20:48:14 maguro Exp $
   */
  package org.openejb.test.security.cmp;
  
  import java.rmi.RemoteException;
  import java.util.Collection;
  import javax.ejb.CreateException;
  import javax.ejb.EJBHome;
  import javax.ejb.FinderException;
  
  
  /**
   * @version $Revision: 1.1 $ $Date: 2005/01/20 20:48:14 $
   */
  public interface BasicCmpHome extends EJBHome {
  
      public BasicCmp create(String firstName, String lastName) throws 
CreateException, RemoteException;
  
      public BasicCmp findByPrimaryKey(Integer primarykey) throws 
FinderException, RemoteException;
  
      public Collection findEmptyCollection() throws FinderException, 
RemoteException;
  
      public Collection findByLastName(String lastName) throws FinderException, 
RemoteException;
  
  }
  
  
  

Reply via email to