Example usage for javax.ejb EJBException EJBException

List of usage examples for javax.ejb EJBException EJBException

Introduction

In this page you can find the example usage for javax.ejb EJBException EJBException.

Prototype

public EJBException(Exception ex) 

Source Link

Document

Constructs an EJBException that embeds the originally thrown exception.

Usage

From source file:com.egt.ejb.toolkit.ToolKitSessionBean.java

private void generarAplicaciones(ToolKitMessage root, List<Aplicacion> aplicaciones) throws JMSException {
    String metodo = "generarAplicaciones";
    Bitacora.trace(this.getClass(), metodo, root);
    try {/* www.  j  a  v a 2  s  .  co  m*/
        List<AbstractMessage> messages = new ArrayList();
        ToolKitMessage message;
        for (Aplicacion aplicacion : aplicaciones) {
            message = new ToolKitMessage(EnumToolKitMessageType.GENERAR_APLICACION,
                    AplicacionConstants.FUNCION_GENERAR_APLICACION);
            message.setRecurso(aplicacion.getIdAplicacion());
            messages.add(message);
        }
        messenger.forkRequest(root, messages);
    } catch (Exception ex) {
        //          TLC.getBitacora().fatal(ex);
        throw ex instanceof EJBException ? (EJBException) ex : new EJBException(ex);
    }
}

From source file:edu.harvard.iq.dvn.core.harvest.HarvesterServiceBean.java

/**
 *
 *  SetDetailBean returned rather than the ListSetsType because we get strange errors when trying
 *  to refer to JAXB generated classes in both Web and EJB tiers.
 */// www  . j a  v a2 s . com
public List<SetDetailBean> getSets(String oaiUrl) {
    JAXBElement unmarshalObj = null;

    try {
        ListSets listSets = new ListSets(oaiUrl);
        int nodeListLength = listSets.getErrors().getLength();
        if (nodeListLength == 1) {
            System.out.println("err Node: " + listSets.getErrors().item(0));
        }

        Document doc = new ListSets(oaiUrl).getDocument();
        JAXBContext jc = JAXBContext.newInstance("edu.harvard.hmdc.vdcnet.jaxb.oai");
        Unmarshaller unmarshaller = jc.createUnmarshaller();
        unmarshalObj = (JAXBElement) unmarshaller.unmarshal(doc);
    } catch (ParserConfigurationException ex) {
        throw new EJBException(ex);
    } catch (SAXException ex) {
        throw new EJBException(ex);
    } catch (TransformerException ex) {
        throw new EJBException(ex);
    } catch (IOException ex) {
        throw new EJBException(ex);
    } catch (JAXBException ex) {
        throw new EJBException(ex);
    }
    List<SetDetailBean> sets = null;
    Object value = unmarshalObj.getValue();

    Package valPackage = value.getClass().getPackage();
    if (value instanceof edu.harvard.hmdc.vdcnet.jaxb.oai.OAIPMHtype) {
        OAIPMHtype OAIObj = (OAIPMHtype) value;
        if (OAIObj.getError() != null && OAIObj.getError().size() > 0) {
            List<OAIPMHerrorType> errList = OAIObj.getError();
            String errMessage = "";
            for (OAIPMHerrorType error : OAIObj.getError()) {
                // NO_SET_HIERARCHY is not an error from the perspective of the DVN,
                // it just means that the OAI server doesn't support sets.
                if (!error.getCode().equals(OAIPMHerrorcodeType.NO_SET_HIERARCHY)) {
                    errMessage += error.getCode() + " " + error.getValue();
                }
            }
            if (errMessage != "") {
                throw new EJBException(errMessage);
            }

        }

        ListSetsType listSetsType = OAIObj.getListSets();
        if (listSetsType != null) {
            sets = new ArrayList<SetDetailBean>();
            for (Iterator it = listSetsType.getSet().iterator(); it.hasNext();) {
                SetType elem = (SetType) it.next();
                SetDetailBean setDetail = new SetDetailBean();
                setDetail.setName(elem.getSetName());
                setDetail.setSpec(elem.getSetSpec());
                sets.add(setDetail);
            }
        }
    }
    return sets;
}

From source file:com.egt.ejb.toolkit.ToolKitSessionBean.java

@Override
public void generarWebViews() {
    try {/*from  ww w. j ava  2 s .  c o m*/
        VelocityContext context = new VelocityContext();
        String query = VelocityEngineer.write(context, "sdk-query-generar-web-query.vm").toString();
        List<Dominio> dominios = dominioFacade.findByQuery(query, EnumTipoQuery.NATIVE, REFRESH);
        generarWebViews(dominios);
        TLC.getBitacora().info(Bundle.getString("generar.views.ok"), dominios.size());
    } catch (Exception ex) {
        //          TLC.getBitacora().fatal(ex);
        throw ex instanceof EJBException ? (EJBException) ex : new EJBException(ex);
    }
}

From source file:org.ejbca.core.ejb.ca.store.CertificateStoreSessionBean.java

@Override
public boolean isRevoked(String issuerDN, BigInteger serno) {
    if (log.isTraceEnabled()) {
        log.trace(">isRevoked(), dn:" + issuerDN + ", serno=" + serno.toString(16));
    }/* w  w w.  j av a 2s .  co  m*/
    // First make a DN in our well-known format
    String dn = CertTools.stringToBCDNString(issuerDN);
    boolean ret = false;
    try {
        Collection<CertificateData> coll = CertificateData.findByIssuerDNSerialNumber(entityManager, dn,
                serno.toString());
        if (coll.size() > 0) {
            if (coll.size() > 1) {
                String msg = intres.getLocalizedMessage("store.errorseveralissuerserno", issuerDN,
                        serno.toString(16));
                //adapter.log(admin, issuerDN.hashCode(), LogConstants.MODULE_CA, new java.util.Date(), null, null, LogConstants.EVENT_ERROR_DATABASE, msg);
                log.error(msg);
            }
            Iterator<CertificateData> iter = coll.iterator();
            while (iter.hasNext()) {
                CertificateData data = iter.next();
                // if any of the certificates with this serno is revoked, return true
                if (data.getStatus() == SecConst.CERT_REVOKED) {
                    ret = true;
                    break;
                }
            }
        } else {
            // If there are no certificates with this serial number, return true (=revoked). Better safe than sorry!
            ret = true;
            if (log.isTraceEnabled()) {
                log.trace("isRevoked() did not find certificate with dn " + dn + " and serno "
                        + serno.toString(16));
            }
        }
    } catch (Exception e) {
        throw new EJBException(e);
    }
    if (log.isTraceEnabled()) {
        log.trace("<isRevoked() returned " + ret);
    }
    return ret;
}

From source file:org.ejbca.core.ejb.ra.EndEntityManagementSessionBean.java

@Override
public void changeUser(final AuthenticationToken admin, final EndEntityInformation endEntityInformation,
        final boolean clearpwd, final boolean fromWebService)
        throws AuthorizationDeniedException, UserDoesntFullfillEndEntityProfile, WaitingForApprovalException,
        CADoesntExistsException, EjbcaException {
    final int endEntityProfileId = endEntityInformation.getEndEntityProfileId();
    final int caid = endEntityInformation.getCAId();
    final String username = endEntityInformation.getUsername();
    // Check if administrator is authorized to edit user to CA.
    assertAuthorizedToCA(admin, caid);//from w  ww  .  j a  va2 s. c  o  m
    final GlobalConfiguration globalConfiguration = getGlobalConfiguration();
    if (globalConfiguration.getEnableEndEntityProfileLimitations()) {
        // Check if administrator is authorized to edit user.
        assertAuthorizedToEndEntityProfile(admin, endEntityProfileId, AccessRulesConstants.EDIT_END_ENTITY,
                caid);
    }
    try {
        FieldValidator.validate(endEntityInformation, endEntityProfileId,
                endEntityProfileSession.getEndEntityProfileName(endEntityProfileId));
    } catch (CustomFieldException e) {
        throw new EjbcaException(ErrorCode.FIELD_VALUE_NOT_VALID, e.getMessage(), e);
    }
    String dn = CertTools.stringToBCDNString(StringTools.strip(endEntityInformation.getDN()));
    String altName = endEntityInformation.getSubjectAltName();
    if (log.isTraceEnabled()) {
        log.trace(">changeUser(" + username + ", " + dn + ", " + endEntityInformation.getEmail() + ")");
    }
    final UserData userData = UserData.findByUsername(entityManager, username);
    if (userData == null) {
        final String msg = intres.getLocalizedMessage("ra.erroreditentity", username);
        log.info(msg);
        throw new EJBException(msg);
    }
    final EndEntityProfile profile = endEntityProfileSession.getEndEntityProfileNoClone(endEntityProfileId);
    // if required, we merge the existing user dn into the dn provided by the web service.
    if (fromWebService && profile.getAllowMergeDnWebServices()) {
        if (userData != null) {
            if (userData.getSubjectDN() != null) {
                final Map<String, String> dnMap = new HashMap<String, String>();
                if (profile.getUse(DnComponents.DNEMAILADDRESS, 0)) {
                    dnMap.put(DnComponents.DNEMAILADDRESS, endEntityInformation.getEmail());
                }
                try {
                    dn = (new DistinguishedName(userData.getSubjectDN()))
                            .mergeDN(new DistinguishedName(dn), true, dnMap).toString();
                } catch (InvalidNameException e) {
                    log.debug("Invalid dn. We make it empty");
                    dn = "";
                }
            }
            if (userData.getSubjectAltName() != null) {
                final Map<String, String> dnMap = new HashMap<String, String>();
                if (profile.getUse(DnComponents.RFC822NAME, 0)) {
                    dnMap.put(DnComponents.RFC822NAME, endEntityInformation.getEmail());
                }
                try {
                    // SubjectAltName is not mandatory so
                    if (altName == null) {
                        altName = "";
                    }
                    altName = (new DistinguishedName(userData.getSubjectAltName()))
                            .mergeDN(new DistinguishedName(altName), true, dnMap).toString();
                } catch (InvalidNameException e) {
                    log.debug("Invalid altName. We make it empty");
                    altName = "";
                }
            }
        }
    }
    String newpassword = endEntityInformation.getPassword();
    if (profile.useAutoGeneratedPasswd() && newpassword != null) {
        // special case used to signal regeneraton of password
        newpassword = profile.getAutoGeneratedPasswd();
    }

    final EndEntityType type = endEntityInformation.getType();
    final ExtendedInformation ei = endEntityInformation.getExtendedinformation();
    // Check if user fulfills it's profile.
    if (globalConfiguration.getEnableEndEntityProfileLimitations()) {
        try {
            String dirattrs = null;
            if (ei != null) {
                dirattrs = ei.getSubjectDirectoryAttributes();
            }
            // It is only meaningful to verify the password if we change it in some way, and if we are not autogenerating it
            if (!profile.useAutoGeneratedPasswd() && StringUtils.isNotEmpty(newpassword)) {
                profile.doesUserFullfillEndEntityProfile(username, endEntityInformation.getPassword(), dn,
                        altName, dirattrs, endEntityInformation.getEmail(),
                        endEntityInformation.getCertificateProfileId(), clearpwd,
                        type.contains(EndEntityTypes.KEYRECOVERABLE),
                        type.contains(EndEntityTypes.SENDNOTIFICATION), endEntityInformation.getTokenType(),
                        endEntityInformation.getHardTokenIssuerId(), caid, ei);
            } else {
                profile.doesUserFullfillEndEntityProfileWithoutPassword(username, dn, altName, dirattrs,
                        endEntityInformation.getEmail(), endEntityInformation.getCertificateProfileId(),
                        type.contains(EndEntityTypes.KEYRECOVERABLE),
                        type.contains(EndEntityTypes.SENDNOTIFICATION), endEntityInformation.getTokenType(),
                        endEntityInformation.getHardTokenIssuerId(), caid, ei);
            }
        } catch (UserDoesntFullfillEndEntityProfile e) {
            final Map<String, Object> details = new LinkedHashMap<String, Object>();
            details.put("msg", intres.getLocalizedMessage("ra.errorfullfillprofile",
                    Integer.valueOf(endEntityProfileId), dn, e.getMessage()));
            auditSession.log(EjbcaEventTypes.RA_EDITENDENTITY, EventStatus.FAILURE, EjbcaModuleTypes.RA,
                    ServiceTypes.CORE, admin.toString(), String.valueOf(caid), null, username, details);
            throw e;
        }
    }
    // Check if approvals is required.
    final int numOfApprovalsRequired = getNumOfApprovalRequired(CAInfo.REQ_APPROVAL_ADDEDITENDENTITY, caid,
            endEntityInformation.getCertificateProfileId());
    if (numOfApprovalsRequired > 0) {
        final EndEntityInformation orguserdata = userData.toEndEntityInformation();
        final EditEndEntityApprovalRequest ar = new EditEndEntityApprovalRequest(endEntityInformation, clearpwd,
                orguserdata, admin, null, numOfApprovalsRequired, caid, endEntityProfileId);
        if (ApprovalExecutorUtil.requireApproval(ar, NONAPPROVABLECLASSNAMES_CHANGEUSER)) {
            approvalSession.addApprovalRequest(admin, ar);
            throw new WaitingForApprovalException(intres.getLocalizedMessage("ra.approvaledit"));
        }
    }
    // Check if the subjectDN serialnumber already exists.
    // No need to access control on the CA here just to get these flags, we have already checked above that we are authorized to the CA
    CAInfo cainfo = caSession.getCAInfoInternal(caid, null, true);
    if (cainfo.isDoEnforceUniqueSubjectDNSerialnumber()) {
        if (!isSubjectDnSerialnumberUnique(caid, dn, username)) {
            throw new EjbcaException(ErrorCode.SUBJECTDN_SERIALNUMBER_ALREADY_EXISTS,
                    "Error: SubjectDN Serialnumber already exists.");
        }
    }
    // Check name constraints
    final boolean nameChanged = // only check when name is changed so existing end-entities can be changed even if they violate NCs
            !userData.getSubjectDN().equals(CertTools.stringToBCDNString(dn))
                    || (userData.getSubjectAltName() != null && !userData.getSubjectAltName().equals(altName));
    if (nameChanged && cainfo instanceof X509CAInfo && !cainfo.getCertificateChain().isEmpty()) {
        final X509CAInfo x509cainfo = (X509CAInfo) cainfo;
        final X509Certificate cacert = (X509Certificate) cainfo.getCertificateChain().iterator().next();
        final CertificateProfile certProfile = certificateProfileSession
                .getCertificateProfile(userData.getCertificateProfileId());

        final X500NameStyle nameStyle;
        if (x509cainfo.getUsePrintableStringSubjectDN()) {
            nameStyle = PrintableStringNameStyle.INSTANCE;
        } else {
            nameStyle = CeSecoreNameStyle.INSTANCE;
        }

        final boolean ldaporder;
        if (x509cainfo.getUseLdapDnOrder() && (certProfile != null && certProfile.getUseLdapDnOrder())) {
            ldaporder = true; // will cause an error to be thrown later if name constraints are used
        } else {
            ldaporder = false;
        }

        X500Name subjectDNName = CertTools.stringToBcX500Name(dn, nameStyle, ldaporder);
        GeneralNames subjectAltName = CertTools.getGeneralNamesFromAltName(altName);
        try {
            CertTools.checkNameConstraints(cacert, subjectDNName, subjectAltName);
        } catch (IllegalNameException e) {
            throw new EjbcaException(ErrorCode.NAMECONSTRAINT_VIOLATION, e.getMessage());
        }
    }

    try {
        userData.setDN(dn);
        userData.setSubjectAltName(altName);
        userData.setSubjectEmail(endEntityInformation.getEmail());
        userData.setCaId(caid);
        userData.setType(type.getHexValue());
        userData.setEndEntityProfileId(endEntityProfileId);
        userData.setCertificateProfileId(endEntityInformation.getCertificateProfileId());
        userData.setTokenType(endEntityInformation.getTokenType());
        userData.setHardTokenIssuerId(endEntityInformation.getHardTokenIssuerId());
        userData.setCardNumber(endEntityInformation.getCardNumber());
        final int newstatus = endEntityInformation.getStatus();
        final int oldstatus = userData.getStatus();
        if (oldstatus == EndEntityConstants.STATUS_KEYRECOVERY
                && newstatus != EndEntityConstants.STATUS_KEYRECOVERY
                && newstatus != EndEntityConstants.STATUS_INPROCESS) {
            keyRecoverySession.unmarkUser(admin, username);
        }
        if (ei != null) {
            final String requestCounter = ei.getCustomData(ExtendedInformationFields.CUSTOM_REQUESTCOUNTER);
            if (StringUtils.equals(requestCounter, "0") && newstatus == EndEntityConstants.STATUS_NEW
                    && oldstatus != EndEntityConstants.STATUS_NEW) {
                // If status is set to new, we should re-set the allowed request counter to the default values
                // But we only do this if no value is specified already, i.e. 0 or null
                resetRequestCounter(admin, false, ei, username, endEntityProfileId);
            } else {
                // If status is not new, we will only remove the counter if the profile does not use it
                resetRequestCounter(admin, true, ei, username, endEntityProfileId);
            }
        }
        userData.setExtendedInformation(ei);
        userData.setStatus(newstatus);
        if (StringUtils.isNotEmpty(newpassword)) {
            if (clearpwd) {
                userData.setOpenPassword(newpassword);
            } else {
                userData.setPassword(newpassword);
            }
        }
        // We want to create this object before re-setting the time modified, because we may want to
        // use the old time modified in any notifications
        final EndEntityInformation notificationEndEntityInformation = userData.toEndEntityInformation();
        userData.setTimeModified(new Date().getTime());
        // We also want to be able to handle non-clear generated passwords in the notification, although EndEntityInformation
        // should always have a null password for autogenerated end entities the notification framework expects it to
        // exist.
        if (newpassword != null) {
            notificationEndEntityInformation.setPassword(newpassword);
        }
        // Send notification if it should be sent.
        sendNotification(admin, notificationEndEntityInformation, newstatus);
        if (newstatus != oldstatus) {
            // Only print stuff on a printer on the same conditions as for
            // notifications, we also only print if the status changes, not for
            // every time we press save
            if (type.contains(EndEntityTypes.PRINT) && (newstatus == EndEntityConstants.STATUS_NEW
                    || newstatus == EndEntityConstants.STATUS_KEYRECOVERY
                    || newstatus == EndEntityConstants.STATUS_INITIALIZED)) {
                print(profile, endEntityInformation);
            }
            final String msg = intres.getLocalizedMessage("ra.editedentitystatus", username,
                    Integer.valueOf(newstatus));
            final Map<String, Object> details = new LinkedHashMap<String, Object>();
            details.put("msg", msg);
            auditSession.log(EjbcaEventTypes.RA_EDITENDENTITY, EventStatus.SUCCESS, EjbcaModuleTypes.RA,
                    ServiceTypes.CORE, admin.toString(), String.valueOf(caid), null, username, details);
        } else {
            final String msg = intres.getLocalizedMessage("ra.editedentity", username);
            final Map<String, Object> details = new LinkedHashMap<String, Object>();
            details.put("msg", msg);
            auditSession.log(EjbcaEventTypes.RA_EDITENDENTITY, EventStatus.SUCCESS, EjbcaModuleTypes.RA,
                    ServiceTypes.CORE, admin.toString(), String.valueOf(caid), null, username, details);
        }
    } catch (Exception e) {
        final String msg = intres.getLocalizedMessage("ra.erroreditentity", username);
        final Map<String, Object> details = new LinkedHashMap<String, Object>();
        details.put("msg", msg);
        details.put("error", e.getMessage());
        auditSession.log(EjbcaEventTypes.RA_EDITENDENTITY, EventStatus.FAILURE, EjbcaModuleTypes.RA,
                ServiceTypes.CORE, admin.toString(), String.valueOf(caid), null, username, details);
        log.error("ChangeUser:", e);
        throw new EJBException(e);
    }
    if (log.isTraceEnabled()) {
        log.trace(
                "<changeUser(" + username + ", password, " + dn + ", " + endEntityInformation.getEmail() + ")");
    }
}

From source file:com.egt.ejb.toolkit.ToolKitSessionBean.java

@Override
public void generarAplicacion() {
    //      List<Aplicacion> aplicaciones = aplicacionFacade.findAll(REFRESH);
    List<Aplicacion> aplicaciones = getAplicaciones();
    try {//from w  ww  . j av  a  2  s . co m
        generarAplicacion(aplicaciones);
        TLC.getBitacora().info(Bundle.getString("generar.aplicaciones.ok"), aplicaciones.size());
    } catch (Exception ex) {
        //          TLC.getBitacora().fatal(ex);
        throw ex instanceof EJBException ? (EJBException) ex : new EJBException(ex);
    }
}

From source file:edu.harvard.iq.dvn.core.harvest.HarvesterServiceBean.java

public HarvestFormatType findHarvestFormatTypeByMetadataPrefix(String metadataPrefix) {
    String queryStr = "SELECT f FROM HarvestFormatType f WHERE f.metadataPrefix = '" + metadataPrefix + "'";
    Query query = em.createQuery(queryStr);
    List resultList = query.getResultList();
    HarvestFormatType hft = null;/*from ww w .j  a v a  2s .c  o  m*/
    if (resultList.size() > 1) {
        throw new EJBException(
                "More than one HarvestFormatType found with metadata Prefix= '" + metadataPrefix + "'");
    }
    if (resultList.size() == 1) {
        hft = (HarvestFormatType) resultList.get(0);
    }
    return hft;
}

From source file:org.ejbca.core.ejb.ca.store.CertificateStoreSessionBean.java

@TransactionAttribute(TransactionAttributeType.REQUIRED)
@Override// w  w w . ja  v  a2  s  . co  m
public void addCertReqHistoryData(Admin admin, Certificate cert, UserDataVO useradmindata) {
    final String issuerDN = CertTools.getIssuerDN(cert);
    final String username = useradmindata.getUsername();
    if (log.isTraceEnabled()) {
        log.trace(">addCertReqHistoryData(" + CertTools.getSerialNumberAsString(cert) + ", " + issuerDN + ", "
                + username + ")");
    }
    try {
        entityManager.persist(new CertReqHistoryData(cert, issuerDN, useradmindata));
        final String msg = intres.getLocalizedMessage("store.storehistory", username);
        logSession.log(admin, issuerDN.hashCode(), LogConstants.MODULE_CA, new Date(), username, cert,
                LogConstants.EVENT_INFO_STORECERTIFICATE, msg);
    } catch (Exception e) {
        final String msg = intres.getLocalizedMessage("store.errorstorehistory", useradmindata.getUsername());
        logSession.log(admin, issuerDN.hashCode(), LogConstants.MODULE_CA, new Date(), username, cert,
                LogConstants.EVENT_ERROR_STORECERTIFICATE, msg);
        throw new EJBException(e);
    }
    if (log.isTraceEnabled()) {
        log.trace("<addCertReqHistoryData()");
    }
}

From source file:it.doqui.index.ecmengine.business.publishing.EcmEnginePublisherBean.java

/**
 * Metodo chiamato dall'invocazione del metodo {@code create()} sulla
 * Home Interface dell'EJB di pubblicazione dei servizi. Esso si occupa del reperimento
 * degli EJB wrapper dei servizi applicativi, dell'inizializzazione del logger e dello
 * stopwatch./*from w w w  . j ava 2s  .c  o  m*/
 *
 * @throws EJBException Se si verificano errori durante l'inizializzazione dell'EJB.
 * @throws RemoteException Se si verificano errori durante la comunicazione remota.
 */
public void ejbCreate() throws EJBException, RemoteException {
    logger = LogFactory.getLog(ECMENGINE_BUSINESS_LOG_CATEGORY);
    logger.debug("[EcmEnginePublisherBean::ejbCreate] BEGIN");

    try {
        this.initialContext = new InitialContext();

        logger.debug("[EcmEnginePublisherBean::ejbCreate] Lookup dei servizi applicativi.");
        this.authenticationServiceHome = (AuthenticationSvcHome) lookup(
                FoundationBeansConstants.AUTHENTICATION_SERVICE_NAME_LOCAL);
        this.authorityServiceHome = (AuthoritySvcHome) lookup(
                FoundationBeansConstants.AUTHORITY_SERVICE_NAME_LOCAL);
        this.contentServiceHome = (ContentSvcHome) lookup(FoundationBeansConstants.CONTENT_SERVICE_NAME_LOCAL);
        this.dictionaryServiceHome = (DictionarySvcHome) lookup(
                FoundationBeansConstants.DICTIONARY_SERVICE_NAME_LOCAL);
        this.fileFolderServiceHome = (FileFolderSvcHome) lookup(
                FoundationBeansConstants.FILEFOLDER_SERVICE_NAME_LOCAL);
        this.namespaceServiceHome = (NamespaceSvcHome) lookup(
                FoundationBeansConstants.NAMESPACE_SERVICE_NAME_LOCAL);
        this.nodeServiceHome = (NodeSvcHome) lookup(FoundationBeansConstants.NODE_SERVICE_NAME_LOCAL);
        this.nodeArchiveServiceHome = (NodeArchiveSvcHome) lookup(
                FoundationBeansConstants.NODE_ARCHIVE_SERVICE_NAME_LOCAL);
        this.ownableServiceHome = (OwnableSvcHome) lookup(FoundationBeansConstants.OWNABLE_SERVICE_NAME_LOCAL);
        this.permissionServiceHome = (PermissionSvcHome) lookup(
                FoundationBeansConstants.PERMISSION_SERVICE_NAME_LOCAL);
        this.personServiceHome = (PersonSvcHome) lookup(FoundationBeansConstants.PERSON_SERVICE_NAME_LOCAL);
        this.searchServiceHome = (SearchSvcHome) lookup(FoundationBeansConstants.SEARCH_SERVICE_NAME_LOCAL);
        this.transactionServiceHome = (TransactionSvcHome) lookup(
                FoundationBeansConstants.TRANSACTION_SERVICE_NAME_LOCAL);
        this.lockServiceHome = (LockSvcHome) lookup(FoundationBeansConstants.LOCK_SERVICE_NAME_LOCAL);
        this.checkOutCheckInHome = (CheckOutCheckInSvcHome) lookup(
                FoundationBeansConstants.CHECKOUT_CHECKIN_NAME_LOCAL);
        this.copyHome = (CopySvcHome) lookup(FoundationBeansConstants.COPY_NAME_LOCAL);
        this.versionHome = (VersionSvcHome) lookup(FoundationBeansConstants.VERSION_NAME_LOCAL);
        this.actionHome = (ActionSvcHome) lookup(FoundationBeansConstants.ACTION_SERVICE_NAME_LOCAL);
        this.ruleHome = (RuleSvcHome) lookup(FoundationBeansConstants.RULE_SERVICE_NAME_LOCAL);
        this.tenantAdminHome = (TenantAdminSvcHome) lookup(
                FoundationBeansConstants.TENANT_ADMIN_SERVICE_NAME_LOCAL);
        this.repoAdminHome = (RepoAdminSvcHome) lookup(FoundationBeansConstants.REPO_ADMIN_SERVICE_NAME_LOCAL);
        this.jobHome = (JobSvcHome) lookup(FoundationBeansConstants.JOB_SERVICE_NAME_LOCAL);
        this.auditHome = (AuditSvcHome) lookup(FoundationBeansConstants.AUDIT_SERVICE_NAME_LOCAL);
        this.auditTrailHome = (AuditTrailSvcHome) lookup(
                FoundationBeansConstants.AUDIT_TRAIL_SERVICE_NAME_LOCAL);
        this.mimetypeHome = (MimetypeSvcHome) lookup(FoundationBeansConstants.MIMETYPE_SERVICE_NAME_LOCAL);
        this.integrityHome = (IntegritySvcHome) lookup(FoundationBeansConstants.INTEGRITY_SERVICE_NAME_LOCAL);
        this.fileFormatHome = (FileFormatSvcHome) lookup(
                FoundationBeansConstants.FILE_FORMAT_SERVICE_NAME_LOCAL);
        this.categoryHome = (CategorySvcHome) lookup(FoundationBeansConstants.CATEGORY_SERVICE_NAME_LOCAL);
        this.exporterHome = (ExportSvcHome) lookup(FoundationBeansConstants.EXPORTER_SERVICE_NAME_LOCAL);
        this.importerHome = (ImportSvcHome) lookup(FoundationBeansConstants.IMPORTER_SERVICE_NAME_LOCAL);

        logger.debug("[EcmEnginePublisherBean::ejbCreate] Creazione dei servizi applicativi.");
        this.authenticationService = this.authenticationServiceHome.create();
        this.authorityService = this.authorityServiceHome.create();
        this.contentService = this.contentServiceHome.create();
        this.dictionaryService = this.dictionaryServiceHome.create();
        this.nodeService = this.nodeServiceHome.create();
        this.nodeArchiveService = this.nodeArchiveServiceHome.create();
        this.ownableService = this.ownableServiceHome.create();
        this.permissionService = this.permissionServiceHome.create();
        this.personService = this.personServiceHome.create();
        this.searchService = this.searchServiceHome.create();
        this.transactionService = this.transactionServiceHome.create();
        this.lockService = this.lockServiceHome.create();
        this.checkOutCheckInService = this.checkOutCheckInHome.create();
        this.copyService = this.copyHome.create();
        this.versionService = this.versionHome.create();
        this.actionService = this.actionHome.create();
        this.ruleService = this.ruleHome.create();
        this.tenantAdminService = this.tenantAdminHome.create();
        this.repoAdminService = this.repoAdminHome.create();
        this.jobService = this.jobHome.create();
        this.auditService = this.auditHome.create();
        this.auditTrailService = this.auditTrailHome.create();
        this.mimetypeService = this.mimetypeHome.create();
        this.integrityService = this.integrityHome.create();
        this.namespaceService = this.namespaceServiceHome.create();
        this.fileFolderService = this.fileFolderServiceHome.create();
        this.fileFormatService = this.fileFormatHome.create();
        this.categoryService = this.categoryHome.create();
        this.exporterService = this.exporterHome.create();
        this.importerService = this.importerHome.create();

    } catch (NamingException e) {
        logger.error("[EcmEnginePublisherBean::ejbCreate] Errore nel lookup dei bean dei "
                + "servizi applicativi: " + e.getMessage());
        throw new EJBException("Errore nel lookup dei bean dei servizi applicativi.");
    } catch (CreateException e) {
        logger.error("[EcmEnginePublisherBean::ejbCreate] Errore nella creazione dei bean dei"
                + "servizi applicativi: " + e.getMessage());
        throw new EJBException("Errore nella creazione dei bean dei servizi applicativi.");
    } finally {
        logger.debug("[EcmEnginePublisherBean::ejbCreate] END");
    }
}

From source file:org.ejbca.core.ejb.ca.store.CertificateStoreSessionBean.java

@TransactionAttribute(TransactionAttributeType.REQUIRED)
@Override/*from   w  ww  . ja v a2 s .  c o  m*/
public void removeCertReqHistoryData(Admin admin, String certFingerprint) {
    if (log.isTraceEnabled()) {
        log.trace(">removeCertReqHistData(" + certFingerprint + ")");
    }
    try {
        String msg = intres.getLocalizedMessage("store.removehistory", certFingerprint);
        logSession.log(admin, admin.getCaId(), LogConstants.MODULE_CA, new java.util.Date(), null, null,
                LogConstants.EVENT_INFO_STORECERTIFICATE, msg);
        CertReqHistoryData crh = CertReqHistoryData.findById(entityManager, certFingerprint);
        if (crh == null) {
            if (log.isDebugEnabled()) {
                log.debug("Trying to remove CertReqHistory that does not exist: " + certFingerprint);
            }
        } else {
            entityManager.remove(crh);
        }
    } catch (Exception e) {
        String msg = intres.getLocalizedMessage("store.errorremovehistory", certFingerprint);
        logSession.log(admin, admin.getCaId(), LogConstants.MODULE_CA, new java.util.Date(), null, null,
                LogConstants.EVENT_ERROR_STORECERTIFICATE, msg);
        throw new EJBException(e);
    }
    log.trace("<removeCertReqHistData()");
}