Package com.sun.enterprise.deployment

Examples of com.sun.enterprise.deployment.ResourcePrincipal


                            "WARNING [AS-EJB cmp-resource] : The jndi-name  is {0}, the preferred jndi-name should start with  jdbc/ or jdo/"
                            , new Object[]{jndiName}));
                    }
                }

                ResourcePrincipal defPrincipal = cmpResource.getResourcePrincipal();
                if(defPrincipal!=null){
//                    String name = defPrincipal.getName();
                    String name = getXPathValue("sun-ejb-jar/enterprise-beans/cmp-resource/default-resource-principal/name");
                    if( name == null || name.length()==0){
                        oneFailed=true; //4698046
View Full Code Here


                            "WARNING [AS-EJB cmp-resource] : The jndi-name  is {0}, the preferred jndi-name should start with  jdbc/ or jdo/"
                            , new Object[]{jndiName}));
                    }
                }

                ResourcePrincipal defPrincipal = cmpResource.getResourcePrincipal();
                if(defPrincipal!=null){
//                    String name = defPrincipal.getName();
                    String name = getXPathValue("sun-ejb-jar/enterprise-beans/cmp-resource/default-resource-principal/name");
                    if( name == null || name.length()==0){
                        oneFailed=true; //4698046
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

                password = prop.getValue();
            }
        }

        //Now return the ResourcePrincipal
        return new ResourcePrincipal(userName, password);

    }
View Full Code Here

                    for (int i = 0; i < mcfs.length; i++) {
                        PasswordCredential pc = new PasswordCredential(
                                dbUser, dbPassword.toCharArray());
                        pc.setManagedConnectionFactory(mcfs[i]);
                        Principal prin =
                                new ResourcePrincipal(dbUser, dbPassword);
                        subject.getPrincipals().add(prin);
                        subject.getPrivateCredentials().add(pc);
                        ManagedConnection mc = mcfs[i].
                                createManagedConnection(subject, null);
                        connList.add(mc);
                        try {
                            XAResource xares = mc.getXAResource();
                            if (xares != null) {
                                xaresList.add(xares);
                            }
                        } catch (ResourceException ex) {
                            // ignored. Not at XA_TRANSACTION level
                        }
                    }

                } else {
                    ManagedConnectionFactory mcf =
                            crt.obtainManagedConnectionFactory(poolInfo);
                    PasswordCredential pc = new PasswordCredential(
                            dbUser, dbPassword.toCharArray());
                    pc.setManagedConnectionFactory(mcf);
                    Principal prin = new ResourcePrincipal(dbUser, dbPassword);
                    subject.getPrincipals().add(prin);
                    subject.getPrivateCredentials().add(pc);
                    ManagedConnection mc = mcf.createManagedConnection(subject, null);
                    connList.add(mc);
                    try {
View Full Code Here

        HashMap userMap = new HashMap();
        HashMap groupMap = new HashMap();
        // Add user-backendPrincipal mappings to Map1
        for (ConnectorSecurityMap map : securityMaps) {
            ResourcePrincipal principal = generateResourcePrincipal(map);

            List<String> principalNames = map.getPrincipals();
            for (String principalName : principalNames) {
                userMap.put(principalName, principal);
            }
View Full Code Here

            ConnectorSecurityMap securityMap) {

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

            }
            ConnectorRuntime.getRuntime().switchOnMatching(rarName, poolInfo);
            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();
            //TODO V3 is SecurityContext.getCurrent() the right way ? Does it need to be injected ?
            if (connectorRuntime.isServer() &&
                    (securityContext = SecurityContext.getCurrent()) != null &&
                    (callerPrincipal = securityContext.getCallerPrincipal()) != null &&
                    (principalSet = securityContext.getPrincipalSet()) != null) {
                AuthenticationService authService =
                        connectorRuntime.getAuthenticationService(rarName, poolInfo);
                if (authService != null) {
                    prin = (ResourcePrincipal) authService.mapPrincipal(
                            callerPrincipal, principalSet);
                }
            }

            if (prin == null) {
                prin = ref.getResourcePrincipal();
                if (prin == null) {
                    if (getLogger().isLoggable(Level.FINE)) {
                        getLogger().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, poolInfo);
                }
            }
            return internalGetConnection(mcf, prin, cxRequestInfo,
                    resourceShareable, jndiNameToUse, conn, false);
View Full Code Here

     * @return
     * @throws javax.resource.ResourceException
     */
    protected Subject getDefaultSubject(PoolInfo poolInfo, ManagedConnectionFactory mcf,
            ResourcePrincipal prin) throws ResourceException {
        ResourcePrincipal resourcePrincipal = null;
        if (prin == null) {
            try {
                resourcePrincipal = getDefaultResourcePrincipal(poolInfo, mcf);
            } catch (NamingException ne) {
                _logger.log(Level.WARNING, "jdbc.pool_not_reachable",
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.