Package com.sun.enterprise.tools.common.dd.connector

Examples of com.sun.enterprise.tools.common.dd.connector.MapElement


   public int getWidth() {
       return 4;
   }
  
   public Object getAttributeDetail(int row, int col) {
       MapElement me = rm.getMapElement(row);
       if (col == 0)
           return me.getAttributeValue(MapElement.BACKEND_PRINCIPAL, 0, "user-name"); // , col); //NOI18N
       if (col == 1)
           return me.getAttributeValue(MapElement.BACKEND_PRINCIPAL, 0, "password");//, col); //NOI18N
       if (col == 2)
           return me.getAttributeValue(MapElement.BACKEND_PRINCIPAL, 0, "credential");//, col); //NOI18N
       if (col == 3) {
/*          
           String allPrincipals = ""; // NOI18N
           int rowCount = me.sizePrincipal();
           for (int i = 0; i < rowCount; i++) {
               Principal p = me.getPrincipal(i);
               allPrincipals += (String) p.getAttributeValue("user-name"); //NOI18N
               allPrincipals += ", "; // NOI18N
           }
           int len = allPrincipals.length();
           if (1 < len)
               allPrincipals = allPrincipals.substring(0,len-2);
           return allPrincipals;
*/
           Vector vec = new Vector();
           for (int i = 0; i < me.sizePrincipal(); i++) {
               Principal prin = me.getPrincipal(i);
               String[] element = new String[2];
               element[0] = prin.getAttributeValue("user-name");   //NOI18N
               element[1] = prin.getDescription();
               vec.add(element);
           }
View Full Code Here


    public void setAttributeDetail(Object v, int r, int c) {
        String input = null;
        if (c != 3)
            input = (String) v;
        while (r >= getLength()) {
            MapElement nme = new MapElement();
            nme.setBackendPrincipal(true);
            rm.addMapElement(nme);
            Reporter.info("add a MapElement")//NOI18N
        }
        MapElement me = rm.getMapElement(r);
        if ((c != 3 &&(null == input || 0 == input.trim().length())) || (c == 3 && ((Vector)v).size() == 0)) {
            // test for need to delete
            if (r >= getLength())
                return;
           
            boolean rowHasValue = false;
            String value = null;
            if (c != 0) {
                value = me.getAttributeValue(MapElement.BACKEND_PRINCIPAL, 0, "user-name"); //NOI18N
                if (null != value && value.trim().length() > 0)
                    rowHasValue = true;
            }
            if (c != 1) {
                value = me.getAttributeValue(MapElement.BACKEND_PRINCIPAL, 0, "password"); //NOI18N
                if (null != value && value.trim().length() > 0)
                    rowHasValue = true;
            }
            if (c != 2) {
                value = me.getAttributeValue(MapElement.BACKEND_PRINCIPAL, 0, "credential"); //NOI18N
                if (null != value && value.trim().length() > 0)
                    rowHasValue = true;
            }
            if (c != 3) {
                if (0 != me.sizePrincipal())
                    rowHasValue = true;
            }
           
//            int otherDex = c - 1;
//            if (otherDex < 0)
//                otherDex = -otherDex;
//            String otherVal = ra.getAttributeValue(ResourceAdapter.PROPERTY, r, //NOI18N
//                intToAttribute(otherDex));
//            String otherVal = ra.getAttributeValue(ResourceAdapter.PROPERTY, r, //NOI18N
//                intToAttribute(otherDex));
            if (!rowHasValue) {
                Reporter.info("remove a MapElement");   //NOI18N
                rm.removeMapElement(me);
                return;
            }
//                ra.removePropertyElement(r);
//                return;
//            }
//            input = " ";
        }
        while (r >= getLength()) {
            Reporter.info("add a MapElement");   //NOI18N
            me = new MapElement();
            me.setBackendPrincipal(true);
            rm.addMapElement(me);
        }
       if (0 == c)
           me.setAttributeValue(MapElement.BACKEND_PRINCIPAL, 0, "user-name", (String) v); //NOI18N
       if (1 == c)
           me.setAttributeValue(MapElement.BACKEND_PRINCIPAL, 0, "password", (String) v); //NOI18N
       if (2 == c)
           me.setAttributeValue(MapElement.BACKEND_PRINCIPAL, 0, "credential",(String) v); //NOI18N
        if (3 == c) {
/*           
            java.util.StringTokenizer toker =
                new java.util.StringTokenizer((String)v,","); // NOI18N
            Principal[] ps = new Principal[toker.countTokens()];
            int i = 0;
            while (toker.hasMoreTokens()) {
                String tok = toker.nextToken();
                Principal p = new Principal();
                p.setAttributeValue("user-name",tok); //NOI18N
                ps[i] = p;
                i++;
            }
            me.setPrincipal(ps);
*/
            Vector vec = (Vector)v;
            Reporter.info(new Integer(vec.size()));
            Principal[] principals = new Principal[vec.size()];
            for (int i = 0; i < vec.size(); i++) {
                Principal prin = new Principal();
                String[] principal = (String[])vec.elementAt(i);
//                Reporter.info("(" + principal[0] + ")   (" + principal[1] + ")");   //NOI18N
                prin.setAttributeValue("user-name", principal[0])//NOI18N
                prin.setDescription(principal[1]);
                principals[i] = prin;
            }
            me.setPrincipal(principals);
//            Reporter.info(new Integer(me.sizePrincipal()));
        }
            //ra.addPropertyElement(true);
        //System.out.println("SETAttributeDetail on " + ra.hashCode()); //NOI18N
        //ra.setPropertyElement(r,true);
View Full Code Here

            }
        }
        rm = new RoleMap();
        int unameVal = 100;
        for (int i = 0; i < rowCount; i++) {
            MapElement me = new MapElement();
            me.setBackendPrincipal(true);
            me.setAttributeValue(MapElement.BACKEND_PRINCIPAL, 0, "user-name", ""+i); //NOI18N
            me.setAttributeValue(MapElement.BACKEND_PRINCIPAL, 0, "password", ""+i); //NOI18N
            me.setAttributeValue(MapElement.BACKEND_PRINCIPAL, 0, "credential", ""+i); //NOI18N
            for (int j = 0; j < rowCount; j++) {
                Principal p = new Principal();
                p.setAttributeValue("user-name", ""+unameVal); //NOI18N
                unameVal++;
                me.addPrincipal(p);
            }
            rm.addMapElement(me);
           
            //ra.addPropertyElement(true);
            //ra.setAttributeValue(ResourceAdapter.PROPERTY,i,"name",""+i); //NOI18N
View Full Code Here

TOP

Related Classes of com.sun.enterprise.tools.common.dd.connector.MapElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.