Example usage for java.rmi RemoteException RemoteException

List of usage examples for java.rmi RemoteException RemoteException

Introduction

In this page you can find the example usage for java.rmi RemoteException RemoteException.

Prototype

public RemoteException(String s) 

Source Link

Document

Constructs a RemoteException with the specified detail message.

Usage

From source file:com.vmware.identity.idm.server.IdentityManager.java

public IdentityManager(IConfigStoreFactory configFactory, IProviderFactory pdFactory)
        throws RemoteException, IDMException {
    super();// www. j ava 2s  . c o  m

    try {
        ssoHealthStatistics.setUpTimeIDMService();
        IdmDomainState.getInstance();

        this.configStoreFactory = configFactory;
        this.providerFactory = pdFactory;

        _tenantCache = new TenantCache();
        _tenantCrlCache = new TenantCrlCache();

        IdmServerConfig settings = IdmServerConfig.getInstance();
        _defaultAttributes = settings.getDefaultAttributesList();

        if (_defaultAttributes == null) {
            _defaultAttributes = Collections.emptyList();
        }

        _configStore = this.configStoreFactory.getConfigStore();
        if (_configStore == null) {
            throw new RemoteException("Failed to initialize config store");
        }

        String systemTenant = registerServiceProviderAsTenant();

        // prepare tenant cache
        initializeTenantCache();

        ensureValidTenant(systemTenant);

        // Create 'SystemConfiguration.Administrators' well-known group specific to the system tenant
        ensureWellKnownConfigurationUsersGroupExist(systemTenant);

        // start the cache checking thread
        Thread t = new IdmCachePeriodicChecker();
        t.start();

        // start the crl cache checking thread
        ManageCrlCacheChecker();

        logger.info("Identity Manager initialized successfully");
    } catch (Exception ex) {
        logger.error("Identity Manager failed to initialize", ex);

        throw ServerUtils.getRemoteException(ex);
    }
}

From source file:com.amalto.core.delegator.IXtentisWSDelegator.java

@Override
public WSStringArray getConceptsInDataCluster(WSGetConceptsInDataCluster wsGetConceptsInDataCluster)
        throws RemoteException {
    try {/*from  ww  w  . jav a  2  s. c o  m*/
        Collection<String> concepts = Util.getItemCtrl2Local().getConceptsInDataCluster(
                new DataClusterPOJOPK(wsGetConceptsInDataCluster.getWsDataClusterPK().getPk()));
        return new WSStringArray(concepts.toArray(new String[concepts.size()]));
    } catch (XtentisException e) {
        throw (new RemoteException(e.getLocalizedMessage()));
    } catch (Exception e) {
        throw new RemoteException(
                (e.getCause() == null ? e.getLocalizedMessage() : e.getCause().getLocalizedMessage()), e);
    }
}

From source file:com.vmware.identity.SharedUtils.java

private ILoginManager getLoginManager() throws NotBoundException, MalformedURLException, RemoteException {
    String endpointURL = String.format("rmi://%s:%d/IdentityManager", this._realIdmHostName, Tenant.RMI_PORT);

    boolean bNotBound = false;
    boolean bRemoteException = false;

    for (int i = 0; i < RETRY_COUNT; i++) {
        bNotBound = false;//www.  j ava 2 s .  c o m
        bRemoteException = false;

        try {
            return (ILoginManager) Naming.lookup(endpointURL);
        } catch (NotBoundException e) {
            bNotBound = true;
        } catch (RemoteException e) {
            bRemoteException = true;
        }

        try {
            Thread.sleep(RETRY_TIMEOUT_SECS * 1000);
        } catch (InterruptedException e) {
        }
    }

    if (bNotBound) {
        throw new NotBoundException(
                String.format("Failed to bind to [%s] after [%d] attempts", endpointURL, RETRY_COUNT));
    } else if (bRemoteException) {
        throw new RemoteException(
                String.format("Failed due to remote exception when looking up " + "[%s] after [%d] attempts",
                        endpointURL, RETRY_COUNT));
    } else {
        throw new RuntimeException(
                String.format("Failed to contact [%s] after [%d] attempts", endpointURL, RETRY_COUNT));
    }
}

From source file:com.collabnet.ccf.pi.sfee.v44.SFEETrackerHandler.java

/**
 * Verifies tracker ID/*www .  j  a  v a  2s.  c o  m*/
 * 
 * @param sessionId
 *            User session id.
 * @param projectId
 *            Project from which to list trackers.
 * @return true if tracker ID could be verified
 * @throws RemoteException
 *             when an error is encountered in listing trackers.
 * @throws IOException
 *             when an error is encountered in reading user input.
 */
public boolean verifyTracker(String sessionId, String projectId, String trackerId)
        throws RemoteException, IOException {
    TrackerSoapList trackerList = mTrackerApp.getTrackerList(sessionId, projectId);
    TrackerSoapRow[] trackerRows = trackerList.getDataRows();

    if (trackerRows.length == 0) {
        throw new RemoteException("No trackers available!");
    }
    for (int i = 0; i < trackerRows.length; i++) {
        TrackerSoapRow trackerRow = trackerRows[i];
        if (trackerId.equals(trackerRow.getId())) {
            log.info("Pulling out artifacts from tracker item " + trackerRow.getTitle());
            return true;
        }
    }
    return false;
}

From source file:com.amalto.core.delegator.IXtentisWSDelegator.java

private WSItemPKsByCriteriaResponse doGetItemPKsByCriteria(WSGetItemPKsByCriteria wsGetItemPKsByCriteria,
        boolean useFTSearch) throws RemoteException {
    // With Universe, this method must be reviewed since various concepts
    // may be store in various revisions
    try {// w  w  w .j  a  v a 2  s  . c o m
        String dataClusterName = wsGetItemPKsByCriteria.getWsDataClusterPK().getPk();
        // Check if user is allowed to read the cluster
        ILocalUser user = LocalUser.getLocalUser();
        boolean authorized = false;
        if (MDMConfiguration.getAdminUser().equals(user.getUsername())) {
            authorized = true;
        } else if (user.userCanRead(DataClusterPOJO.class, dataClusterName)) {
            authorized = true;
        }
        if (!authorized) {
            throw new RemoteException(
                    "Unauthorized read access on data cluster '" + dataClusterName + "' by user '" //$NON-NLS-1$ //$NON-NLS-2$
                            + user.getUsername() + "'"); //$NON-NLS-1$
        }
        // If not all concepts are store in the same revision,
        // force the concept to be specified by the user.
        // It would be too demanding to get all the concepts in all revisions (?)
        // The meat of this method should be ported to ItemCtrlBean
        String conceptName = wsGetItemPKsByCriteria.getConceptName();
        ItemPKCriteria criteria = new ItemPKCriteria();
        criteria.setClusterName(dataClusterName);
        criteria.setConceptName(conceptName);
        criteria.setContentKeywords(wsGetItemPKsByCriteria.getContentKeywords());
        criteria.setKeysKeywords(wsGetItemPKsByCriteria.getKeysKeywords());
        criteria.setKeys(wsGetItemPKsByCriteria.getKeys());
        criteria.setCompoundKeyKeywords(false);
        criteria.setFromDate(wsGetItemPKsByCriteria.getFromDate());
        criteria.setToDate(wsGetItemPKsByCriteria.getToDate());
        criteria.setMaxItems(wsGetItemPKsByCriteria.getMaxItems());
        criteria.setSkip(wsGetItemPKsByCriteria.getSkip());
        criteria.setUseFTSearch(useFTSearch);
        List<String> results = com.amalto.core.util.Util.getItemCtrl2Local().getItemPKsByCriteria(criteria);
        XPath xpath = XPathFactory.newInstance().newXPath();
        DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
        WSItemPKsByCriteriaResponseResults[] res = new WSItemPKsByCriteriaResponseResults[results.size()];
        int i = 0;
        for (String result : results) {
            if (i == 0) {
                res[i++] = new WSItemPKsByCriteriaResponseResults(System.currentTimeMillis(),
                        new WSItemPK(wsGetItemPKsByCriteria.getWsDataClusterPK(), result, null), ""); //$NON-NLS-1$
                continue;
            }
            Element r = documentBuilder.parse(new InputSource(new StringReader(result))).getDocumentElement();
            long t = new Long(xpath.evaluate("t", r)); //$NON-NLS-1$
            String cn = xpath.evaluate("n", r); //$NON-NLS-1$
            String taskId = xpath.evaluate("taskId", r); //$NON-NLS-1$

            NodeList idsList = (NodeList) xpath.evaluate("./ids/i", r, XPathConstants.NODESET); //$NON-NLS-1$
            String[] ids = new String[idsList.getLength()];
            for (int j = 0; j < idsList.getLength(); j++) {
                ids[j] = (idsList.item(j).getFirstChild() == null ? "" //$NON-NLS-1$
                        : idsList.item(j).getFirstChild().getNodeValue());
            }
            res[i++] = new WSItemPKsByCriteriaResponseResults(t,
                    new WSItemPK(wsGetItemPKsByCriteria.getWsDataClusterPK(), cn, ids), taskId);
        }
        return new WSItemPKsByCriteriaResponse(res);

    } catch (Exception e) {
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug(e.getMessage(), e);
        }
        throw new RemoteException(
                (e.getCause() == null ? e.getLocalizedMessage() : e.getCause().getLocalizedMessage()), e);
    }
}

From source file:com.amalto.core.delegator.IXtentisWSDelegator.java

@Override
public WSItem getItem(WSGetItem wsGetItem) throws RemoteException {
    try {/*from w  ww.j av a  2s .  c o m*/
        if (wsGetItem.getWsItemPK().getIds() == null) {
            throw (new RemoteException("input ids is null!")); //$NON-NLS-1$
        }
        ItemPOJOPK pk = new ItemPOJOPK(
                new DataClusterPOJOPK(wsGetItem.getWsItemPK().getWsDataClusterPK().getPk()),
                wsGetItem.getWsItemPK().getConceptName(), wsGetItem.getWsItemPK().getIds());
        ItemPOJO pojo = Util.getItemCtrl2Local().getItem(pk);
        return new WSItem(wsGetItem.getWsItemPK().getWsDataClusterPK(), pojo.getDataModelName(),
                wsGetItem.getWsItemPK().getConceptName(), wsGetItem.getWsItemPK().getIds(),
                pojo.getInsertionTime(), pojo.getTaskId(), pojo.getProjectionAsString());
    } catch (Exception e) {
        if (LOGGER.isDebugEnabled()) {
            String err = "ERROR SYSTRACE: " + e.getMessage(); //$NON-NLS-1$
            LOGGER.debug(err, e);
        }
        EntityNotFoundException cause = getCauseExceptionByType(e, EntityNotFoundException.class);
        if (cause != null) {
            throw new RemoteException(StringUtils.EMPTY, new CoreException("entity_not_found", cause)); //$NON-NLS-1$
        }
        throw (new RemoteException(e.getLocalizedMessage(), e));
    }
}

From source file:com.amalto.core.server.DefaultItem.java

@Override
public List<String> getConceptsInDataCluster(DataClusterPOJOPK dataClusterPOJOPK) throws XtentisException {
    String dataModelName = dataClusterPOJOPK.getUniqueId();
    try {/*from  w  w w.j  a v a  2s.  c  o m*/
        List<String> concepts = new ArrayList<String>();
        Server server = ServerContext.INSTANCE.get();
        StorageAdmin storageAdmin = server.getStorageAdmin();
        Storage storage = storageAdmin.get(dataModelName, storageAdmin.getType(dataModelName));
        ILocalUser user = LocalUser.getLocalUser();
        boolean authorized = false;
        if (MDMConfiguration.getAdminUser().equals(user.getUsername())) {
            authorized = true;
        } else if (user.userCanRead(DataClusterPOJO.class, dataModelName)) {
            authorized = true;
        }
        if (!authorized) {
            throw new RemoteException("Unauthorized read access on data cluster " + dataModelName + " by user "
                    + user.getUsername());
        }
        // This should be moved to ItemCtrl
        MetadataRepository repository = storage.getMetadataRepository();
        Collection<ComplexTypeMetadata> types;
        if (DispatchWrapper.isMDMInternal(dataClusterPOJOPK.getUniqueId())) {
            types = SystemStorageWrapper.filter(repository, dataModelName);
        } else {
            types = MetadataUtils.sortTypes(repository, MetadataUtils.SortType.LENIENT);
        }
        for (ComplexTypeMetadata type : types) {
            concepts.add(type.getName());
        }
        return concepts;
    } catch (Exception e) {
        String err = "Unable to search for concept names in the data cluster '" + dataModelName + "'";
        LOGGER.error(err, e);
        throw new XtentisException(err, e);
    }
}

From source file:com.amalto.core.delegator.IXtentisWSDelegator.java

@Override
public WSPipeline extractUsingTransformer(WSExtractUsingTransformer wsExtractUsingTransformer)
        throws RemoteException {
    throw new RemoteException("Not supported."); //$NON-NLS-1$
}

From source file:com.idega.core.accesscontrol.business.LoginBusinessBean.java

/**
 * Gets the last login record date before current logged record ( second last
 * entry)/*from  www  .  ja v  a  2 s  . co  m*/
 *
 * @param userId
 * @return
 */
public static java.sql.Date getLastLoginByUser(Integer userId) throws RemoteException {
    try {
        return getLoginRecordHome().getLastLoginByUserID(userId);
    } catch (FinderException e) {
        throw new RemoteException(e.getMessage());
    }
}

From source file:com.idega.core.accesscontrol.business.LoginBusinessBean.java

/**
 * Gets the last login record date before current logged record ( second last
 * entry)//from  ww  w  .  ja  v a2s.  com
 *
 * @param userId
 * @return
 */
public static java.sql.Date getLastLoginByLogin(Integer loginId) throws RemoteException {
    try {
        return getLoginRecordHome().getLastLoginByLoginID(loginId);
    } catch (FinderException e) {
        throw new RemoteException(e.getMessage());
    }
}