Package com.sun.enterprise.deployment

Examples of com.sun.enterprise.deployment.ResourcePrincipal


            ResourceReferenceDescriptor resourceReference;
            SunWebApp iasBean =
                    ((WebBundleDescriptor)webBundleDescriptor).getSunDescriptor();
            ResourceRef[] rr = iasBean.getResourceRef();
            DefaultResourcePrincipal drp;
            ResourcePrincipal rp;
           
            for (int i=0; i<resources.length; i++) {
                resourceReference = new ResourceReferenceDescriptor(
                        resources[i].getName(), resources[i].getDescription(),
                        resources[i].getType());
                resourceReference.setJndiName(resources[i].getName());
                if (rr!=null) {
                    for (int j=0; j<rr.length; j++) {
                        if (resources[i].getName().equals(rr[j].getResRefName())) {
                            resourceReference.setJndiName(rr[i].getJndiName());
                            drp = rr[i].getDefaultResourcePrincipal();
                            if (drp!=null) {
                                rp = new ResourcePrincipal(drp.getName(), drp.getPassword());
                                resourceReference.setResourcePrincipal(rp);
                            }
                        }
                    }
                }
View Full Code Here


    /**
     * notification of the end of XML parsing for this node
     */
    public void postParsing() {  
        if (getParentNode().getDescriptor() instanceof ResourceReferenceDescriptor) {
            ((ResourceReferenceDescriptor) getParentNode().getDescriptor()).setResourcePrincipal(new ResourcePrincipal(name, passwd));
        } else {
            getParentNode().addDescriptor(new ResourcePrincipal(name, passwd));
        }
    }
View Full Code Here

            try {
          ResourceReferenceDescriptor rrd = descriptor.getResourceReferenceByName(resourceRef.getResRefName());
          rrd.setJndiName(resourceRef.getJndiName());
              DefaultResourcePrincipal drp = resourceRef.getDefaultResourcePrincipal();
              if (drp!=null) {
        ResourcePrincipal rp = new ResourcePrincipal(drp.getName(), drp.getPassword());
            rrd.setResourcePrincipal(rp);
          }
            } catch (IllegalArgumentException iae) {
                DOLUtils.getDefaultLogger().warning(iae.getMessage());
            }
View Full Code Here

    public void configureResources() {
        SipApplication sipApp = convergedContext.getSipApplication();
        SunSipApp sunSipApp = convergedContext.getSipApplication().getSunSipDescriptor();
        ResourceRef[] rr = sunSipApp.getResourceRef();
        DefaultResourcePrincipal drp;
        ResourcePrincipal rp;
        ResourceReferenceDescriptor resRefDesc;
        ContextResourceDecorator decorator;

        if (rr != null) {
            for (int j = 0; j < rr.length; j++) {
                if (sipApp.getResourceReferenceByName(rr[j].getResRefName()) != null) {
                    sipApp.getResourceReferenceByName(rr[j].getResRefName()).setJndiName(rr[j].getJndiName());
                    drp = rr[j].getDefaultResourcePrincipal();

                    if (drp != null) {
                        rp = new ResourcePrincipal(drp.getName(), drp.getPassword());
                        sipApp.getResourceReferenceByName(rr[j].getResRefName()).setResourcePrincipal(rp);
                    }
                }
            }
        }
View Full Code Here

                rrd.setJndiName(resourceRef.getJndiName());

                DefaultResourcePrincipal drp = resourceRef.getDefaultResourcePrincipal();

                if (drp != null) {
                    ResourcePrincipal rp = new ResourcePrincipal(drp.getName(),
                            drp.getPassword());
                    rrd.setResourcePrincipal(rp);
                }
            } catch (IllegalArgumentException iae) {
                DOLUtils.getDefaultLogger().warning(iae.getMessage());
View Full Code Here

        HashMap userMap = new HashMap();
        HashMap groupMap = new HashMap();
        // Add user-backendPrincipal mappings to Map1
        for (int i = 0; i < securityMaps.length; i++) {
            ConnectorSecurityMap map = securityMaps[i];
            ResourcePrincipal principal = generateResourcePrincipal(map);

            String[] principalNames = map.getPrincipals();
            for (int j = 0; j < principalNames.length; j++) {
                userMap.put(principalNames[j], principal);
            }
View Full Code Here

                 ConnectorSecurityMap securityMap) {

        EisBackendPrincipal backendPrincipal = securityMap.getBackendPrincipal();
        String userName = backendPrincipal.getUserName();
        String password = backendPrincipal.getPassword();
        ResourcePrincipal resPrincipal =
                      new ResourcePrincipal(userName,password);
        return resPrincipal;
    }
View Full Code Here

                            "WARNING [AS-EJB mdb-connection-factory] : jndi-name {0} should start with jms/",
                            new Object[]{jndiName}));
                    }
                }
               
                ResourcePrincipal defPrinci = mdbConnFacDesc.getDefaultResourcePrincipal();
                if(defPrinci != null){
                    String name = defPrinci.getName();
                    if(name == null || name.length()==0){
                        oneFailed = true;
                        addErrorDetails(result, compName);
                        result.failed(smh.getLocalString(getClass().getName()+".failed1",
                            "FAILED [AS-EJB default-resource-principal] : name cannot be an empty string"));
                    }else{
                        addGoodDetails(result, compName);
                        result.passed(smh.getLocalString(getClass().getName()+".passed1",
                            "PASSED [AS-EJB default-resource-principal] : name is {0}",new Object[]{name}));
                    }

                    String password = defPrinci.getPassword();
                    if(password == null || password.length()==0)
                    {
                        addWarningDetails(result, compName);
                        result.warning(smh.getLocalString(getClass().getName()+".warning2",
                            "WARNING [AS-EJB default-resource-principal] : password is an empty string"));
View Full Code Here

                Iterator it = resRef.iterator();
                while (it.hasNext()){
                    ResourceReferenceDescriptor resDesc = ((ResourceReferenceDescriptor)it.next());
                    String refName = resDesc.getName();
                    String refJndiName = resDesc.getJndiName();
                    ResourcePrincipal resPrinci = resDesc.getResourcePrincipal();
                   if(resPrinci == null)
                    {
                        try
                        {
                           resDesc = descriptor.getResourceReferenceByName(refName);
                            String resAuth = resDesc.getAuthorization();
                            if(resAuth.equals(ResourceReferenceDescriptor.APPLICATION_AUTHORIZATION))
                            {
                               addErrorDetails(result, compName);
                               result.failed(smh.getLocalString(getClass().getName()+".failed",
                                    "FAILED [AS-EJB resource-ref] : res-auth for res-ref-name {0} is defined as Application." +
                                    "Therefore the default-resource-principal should be supplied with valid properties",
                                    new Object[] {refName}));
                            }
                            else
                            {
                               addNaDetails(result, compName);
                               result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable",
                                    "NOT APPLICABLE [AS-EJB resource-ref] : default-resource-principal Element not defined"));
                            }
                        }
                        catch(IllegalArgumentException iaex)
                        {
                           addErrorDetails(result, compName);
                           result.failed(smh.getLocalString(getClass().getName()+".failed2",
                                "FAILED [AS-EJB resource-ref] : res-ref-name {0} is not defined in the ejb-jar.xml",
                                new Object[]{refName}));
                        }
                    }else
                    {
                        String name = resPrinci.getName();
                        if(name == null || name.length()==0)
                        {
                            oneFailed = true;
                            addErrorDetails(result, compName);
                            result.failed(smh.getLocalString(getClass().getName()+".failed3",
                                "FAILED [AS-EJB default-resource-principal] :  name cannot be an empty string"));
                        }
                        else
                        {
                           addGoodDetails(result, compName);
                           result.passed(smh.getLocalString(getClass().getName()+".passed",
                                "PASSED [AS-EJB default-resource-principal] : name is {0}",new Object[]{name}));
                        }
                       
                        String password = resPrinci.getPassword();
                        if(password == null || password.length()==0)
                        {
                           addWarningDetails(result, compName);
                           result.warning(smh.getLocalString(getClass().getName()+".warning1",
                                "WARNING [AS-EJB default-resource-principal] : password is an empty string"));
View Full Code Here

      }
            ConnectorRuntime.getRuntime().switchOnMatching(rarName, poolName);
            return internalGetConnection(mcf, null, cxRequestInfo,
                resourceShareable, jndiNameToUse, conn, false );
        } else {
            ResourcePrincipal prin =null;
            Set principalSet =null;
            Principal callerPrincipal = null;
            SecurityContext securityContext = null;
            ConnectorRuntime connectorRuntime = ConnectorRuntime.getRuntime();
            if(connectorRuntime.isServer() &&
             (securityContext = SecurityContext.getCurrent()) != null &&
       (callerPrincipal = securityContext.getCallerPrincipal()) != null &&
       (principalSet = securityContext.getPrincipalSet()) != null) {
                AuthenticationService authService =
                    connectorRuntime.getAuthenticationService(rarName,poolName);
                if(authService != null) {
                    prin = (ResourcePrincipal)authService.mapPrincipal(
                            callerPrincipal, principalSet);
                }
            }

            if (prin == null) {
                prin = ref.getResourcePrincipal();
                if (prin == null) {
                    _logger.log(Level.FINE,"default-resource-principal not" +
                    "specified for " + jndiNameToUse + ". Defaulting to" +
        " user/password specified in the pool");

                    prin = defaultPrin;
                } else if (!prin.equals(defaultPrin)){
                    ConnectorRuntime.getRuntime().switchOnMatching(rarName, poolName);
                }
            }
            return internalGetConnection(mcf, prin, cxRequestInfo,
                resourceShareable, jndiNameToUse, conn, false);
View Full Code Here

TOP

Related Classes of com.sun.enterprise.deployment.ResourcePrincipal

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.