Example usage for java.rmi RemoteException printStackTrace

List of usage examples for java.rmi RemoteException printStackTrace

Introduction

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

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:net.i2cat.csade.life2.backoffice.bl.StatisticsManager.java

public String getDatosProfiles() {
    ObjStats[] st = null;//from ww w .j av a 2 s . c  o m
    ArrayList<Pair> datos = new ArrayList<Pair>();
    HashMap<Integer, Pair> hm = new HashMap<Integer, Pair>();
    Pair p;
    try {
        String sql = "SELECT t2.role as idStat,count(*) as Event,\"\" as User_login,null as dTime,0 as duration,\"\" as lat,\"\" as lon,\"\" as device,\"\" as query,0 as lng  FROM (SELECT s.*,u.role FROM Stat AS s INNER JOIN user_profile AS u ON s.User_login=u.Login AND s.event="
                + StatsDAO.LOGIN_EVENT + " ) AS t2 GROUP BY (role)";
        st = sd.listStatsSQL(sql);
    } catch (RemoteException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (ServiceException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    for (int i = 0; i < st.length; i++) {
        if (!hm.containsKey(new Integer(st[i].getIdStat()))) {
            datos.add(new Pair(PlatformUser.roleNames[st[i].getIdStat()], st[i].getIEvent()));
            hm.put(new Integer(st[i].getIdStat()),
                    new Pair(PlatformUser.roleNames[st[i].getIdStat()], st[i].getIEvent()));
        } else {
            Pair anterior = hm.get(new Integer(st[i].getIdStat()));
            datos.remove(anterior);
            anterior = new Pair(PlatformUser.roleNames[st[i].getIdStat()],
                    anterior.getValue() + st[i].getIEvent());
            datos.add(anterior);
            hm.put(new Integer(st[i].getIdStat()), anterior);
        }
    }
    return datos.toString();
}

From source file:net.i2cat.csade.life2.backoffice.bl.StatisticsManager.java

public String getDatosNewUsersByDay(int days, int role, String lng) {
    ObjStats[] st = null;/*from w w w. j a va  2  s.co  m*/
    ArrayList<Pair> datos = new ArrayList<Pair>();
    Pair p;
    String sql;
    try {
        if (role >= 0 && !"all".equals(lng))
            sql = "SELECT 0 as idStat,count(*) as Event,\"\" as User_login,DATE(dTime) as dTime,0 as duration,\"\" as lat,\"\" as lon,\"\" as device,\"\" as query,0 as lng  FROM (SELECT * FROM  `Stat` INNER JOIN user_profile ON user_profile.Login=`Stat`.User_login AND user_profile.Role="
                    + role + " AND user_profile.Language like '" + lng + "' WHERE event=" + StatsDAO.USER_ADDED
                    + " and DATE(dTime)<=CURDATE() and (DATE(dTime)>DATE_ADD(CURDATE(), INTERVAL -" + days
                    + " DAY)) ) AS t2 GROUP BY DATE(dTime)";
        else if (role >= 0)
            sql = "SELECT 0 as idStat,count(*) as Event,\"\" as User_login,DATE(dTime) as dTime,0 as duration,\"\" as lat,\"\" as lon,\"\" as device,\"\" as query,0 as lng  FROM (SELECT * FROM  `Stat` INNER JOIN user_profile ON user_profile.Login=`Stat`.User_login AND user_profile.Role="
                    + role + " WHERE event=" + StatsDAO.USER_ADDED
                    + " and DATE(dTime)<=CURDATE() and (DATE(dTime)>DATE_ADD(CURDATE(), INTERVAL -" + days
                    + " DAY)) ) AS t2 GROUP BY DATE(dTime)";
        else if (!"all".equals(lng))
            sql = "SELECT 0 as idStat,count(*) as Event,\"\" as User_login,DATE(dTime) as dTime,0 as duration,\"\" as lat,\"\" as lon,\"\" as device,\"\" as query,0 as lng  FROM (SELECT * FROM  `Stat` INNER JOIN user_profile ON user_profile.Login=`Stat`.User_login AND user_profile.Language like '"
                    + lng + "' WHERE event=" + StatsDAO.USER_ADDED
                    + " and DATE(dTime)<=CURDATE() and (DATE(dTime)>DATE_ADD(CURDATE(), INTERVAL -" + days
                    + " DAY)) ) AS t2 GROUP BY DATE(dTime)";
        else
            sql = "SELECT 0 as idStat,count(*) as Event,\"\" as User_login,DATE(dTime) as dTime,0 as duration,\"\" as lat,\"\" as lon,\"\" as device,\"\" as query,0 as lng  FROM (SELECT * FROM  `Stat` WHERE event="
                    + StatsDAO.USER_ADDED
                    + " and DATE(dTime)<=CURDATE() and (DATE(dTime)>DATE_ADD(CURDATE(), INTERVAL -" + days
                    + " DAY)) ) AS t2 GROUP BY DATE(dTime)";
        st = sd.listStatsSQL(sql);
    } catch (RemoteException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (ServiceException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    for (int i = 0; i < st.length; i++) {
        datos.add(new Pair(this.weDontSpeakAmericano(st[i].getDTime()), st[i].getIEvent()));
    }

    return datos.toString();
}

From source file:net.i2cat.csade.life2.backoffice.bl.StatisticsManager.java

/**
 * Returns the necessary data to build a pie with the tipe of connections
 * @return/*ww w.java 2s. c  o  m*/
 */
public String getDatosDispositivos() {

    int iPads = 0, androids = 0, others = 0;

    try {
        androids = sd.countStats(" Event=" + StatsDAO.LOGIN_EVENT + " and Device like '%ndroid%' "); //
        iPads = sd.countStats("Event=" + StatsDAO.LOGIN_EVENT + " and Device like '%iPad%'");
        others = sd.countStats(" Event=" + StatsDAO.LOGIN_EVENT) + (-androids) + (-iPads);
    } catch (RemoteException e) {
        iPads = 0;
        androids = 0;
        others = 0;
        e.printStackTrace();
    } catch (ServiceException e) {
        iPads = 0;
        androids = 0;
        others = 0;
        e.printStackTrace();
    }
    Pair p1 = new Pair("Ipad connections", iPads);
    Pair p2 = new Pair("Android connections", androids);
    Pair p3 = new Pair("PCs and others", others);

    ArrayList<Pair> datos = new ArrayList<Pair>();
    datos.add(p1);
    datos.add(p2);
    datos.add(p3);
    return datos.toString();
}

From source file:com.redsqirl.CanvasBean.java

/**
 * Init the canvas at the begining of a session
 *//*from   w w w.  j  ava  2  s . co m*/
public void init() {

    logger.debug("init canvas");

    FacesContext context = FacesContext.getCurrentInstance();
    userInfoBean = (UserInfoBean) context.getApplication().evaluateExpressionGet(context, "#{userInfoBean}",
            UserInfoBean.class);

    workflowMap = new HashMap<String, DataFlow>();
    setNameWorkflow("canvas-1");

    mapWorkflowType = new LinkedHashMap<String, String>();
    setWorkflowType("W");
    mapWorkflowType.put(getNameWorkflow(), getWorkflowType());

    setIdMap(new HashMap<String, Map<String, String>>());
    getIdMap().put(getNameWorkflow(), new HashMap<String, String>());

    DataFlowInterface dfi;
    try {

        dfi = getworkFlowInterface();
        if (dfi.getWorkflow(getNameWorkflow()) == null) {
            dfi.addWorkflow(getNameWorkflow());
        }
        logger.info("add new Workflow " + getNameWorkflow());

        setDf(dfi.getWorkflow(getNameWorkflow()));
        getDf().getAllWANameWithClassName();

        workflowMap.put(getNameWorkflow(), getDf());

        calcWorkflowUrl();
        modelMan = new ModelManager();

        userName = getUserInfoBean().getUserName();
    } catch (RemoteException e) {
        e.printStackTrace();
        logger.error(e.getMessage());
    } catch (Exception e) {
        e.printStackTrace();
        logger.error(e.getMessage());
    }

}

From source file:oe.cms.runtime.timeTrigger.InTimeTriggerImpl.java

public void initStart(HttpServletRequest requ) {
    try {//from   w w w  . j a  va 2s  . c  om
        if ("true".equals(EnvEntryInfo.env.fetchEnvValue("init"))) {
            BuildCmsJpp.todo(requ);
        }
    } catch (RemoteException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:org.apache.ojb.ejb.odmg.StressTest.java

private int getArticleCount() throws Exception {
    try {//  w  ww  . j a  v  a 2 s . co  m
        return bean.getArticleCount();
    } catch (java.rmi.RemoteException e) {
        e.printStackTrace();
        throw e;
    }
}

From source file:org.apache.stratos.manager.grouping.deployer.DefaultServiceGroupDeployer.java

public void deployServiceGroupDefinition(Object serviceGroupDefinitionObj)
        throws InvalidServiceGroupException, ServiceGroupDefinitioException, ADCException {

    ServiceGroupDefinition serviceGroupDefinition = null;
    ServiceGroup serviceGroup = null;/*  w w w .  j  a v a 2 s .  c  om*/

    if (serviceGroupDefinitionObj == null) {
        if (log.isDebugEnabled()) {
            log.debug("deploying service group is null ");
        }
        throw new InvalidServiceGroupException("Service Group definition not found");
    }

    if (serviceGroupDefinitionObj instanceof ServiceGroupDefinition) {
        serviceGroupDefinition = (ServiceGroupDefinition) serviceGroupDefinitionObj;

        if (log.isDebugEnabled()) {
            log.debug("deploying service group with name " + serviceGroupDefinition.getName());
        }

        // convert serviceGroupDefinition to serviceGroup
        serviceGroup = this.populateServiceGroupPojo(serviceGroupDefinition);
    } else {
        log.error("trying to deploy invalid service group ");
        throw new InvalidServiceGroupException("Invalid Service Group definition");
    }

    // if any cartridges are specified in the group, they should be already deployed
    if (serviceGroupDefinition.getCartridges() != null) {

        if (log.isDebugEnabled()) {
            log.debug("checking cartridges in service group " + serviceGroupDefinition.getName());
        }

        List<String> cartridgeTypes = serviceGroupDefinition.getCartridges();

        Set<String> duplicates = this.findDuplicates(cartridgeTypes);

        if (duplicates.size() > 0) {

            StringBuffer buf = new StringBuffer();
            for (String dup : duplicates) {
                buf.append(dup).append(" ");
            }
            if (log.isDebugEnabled()) {
                log.debug("duplicate cartridges defined: " + buf.toString());
            }
            throw new InvalidServiceGroupException(
                    "Invalid Service Group definition, duplicate cartridges defined:" + buf.toString());
        }

        CloudControllerServiceClient ccServiceClient = null;

        try {
            ccServiceClient = CloudControllerServiceClient.getServiceClient();

        } catch (AxisFault axisFault) {
            throw new ADCException(axisFault);
        }

        for (String cartridgeType : cartridgeTypes) {
            try {
                if (ccServiceClient.getCartridgeInfo(cartridgeType) == null) {
                    // cartridge is not deployed, can't continue
                    log.error("invalid cartridge found in service group " + cartridgeType);
                    throw new InvalidServiceGroupException(
                            "No Cartridge Definition found with type " + cartridgeType);
                }
            } catch (RemoteException e) {
                throw new ADCException(e);
            } catch (CloudControllerServiceUnregisteredCartridgeExceptionException e) {
                throw new ADCException(e);
            }
        }
    }

    // if any sub groups are specified in the group, they should be already deployed
    if (serviceGroupDefinition.getSubGroups() != null) {

        if (log.isDebugEnabled()) {
            log.debug("checking subGroups in service group " + serviceGroupDefinition.getName());
        }

        List<String> subGroupNames = serviceGroupDefinition.getSubGroups();

        Set<String> duplicates = this.findDuplicates(subGroupNames);

        if (duplicates.size() > 0) {

            StringBuffer buf = new StringBuffer();
            for (String dup : duplicates) {
                buf.append(dup).append(" ");
            }
            if (log.isDebugEnabled()) {
                log.debug("duplicate subGroups defined: " + buf.toString());
            }
            throw new InvalidServiceGroupException(
                    "Invalid Service Group definition, duplicate subGroups defined:" + buf.toString());
        }

        for (String subGroupName : subGroupNames) {
            if (getServiceGroupDefinition(subGroupName) == null) {
                // sub group not deployed, can't continue
                if (log.isDebugEnabled()) {
                    log.debug("invalid sub group found in service group " + subGroupName);
                }
                throw new InvalidServiceGroupException(
                        "No Service Group Definition found with name " + subGroupName);
            }
        }
    }

    AutoscalerServiceClient asServiceClient = null;

    try {
        asServiceClient = AutoscalerServiceClient.getServiceClient();

        if (log.isDebugEnabled()) {
            log.debug("deplying to cloud controller service group " + serviceGroupDefinition.getName());
        }

        asServiceClient.deployServiceGroup(serviceGroup);

    } catch (AxisFault axisFault) {
        throw new ADCException(axisFault);
    } catch (RemoteException e) {
        throw new ADCException(e);
    } catch (AutoScalerServiceInvalidServiceGroupExceptionException e) {
        e.printStackTrace();
    }
}

From source file:org.apache.stratos.manager.grouping.deployer.DefaultServiceGroupDeployer.java

public ServiceGroupDefinition[] getServiceGroupDefinitions() throws ADCException {

    if (log.isDebugEnabled()) {
        log.debug("getting service group from cloud controller ");
    }//  w  w  w  . ja  v a 2 s .  co  m

    AutoscalerServiceClient asServiceClient;

    try {
        asServiceClient = AutoscalerServiceClient.getServiceClient();

        ServiceGroup[] serviceGroups = asServiceClient.getServiceGroups();
        if (serviceGroups == null || serviceGroups.length == 0) {
            return null;
        }

        ServiceGroupDefinition[] serviceGroupDefinitions = new ServiceGroupDefinition[serviceGroups.length];
        for (int i = 0; i < serviceGroups.length; i++) {
            serviceGroupDefinitions[i] = populateServiceGroupDefinitionPojo(serviceGroups[i]);
        }
        return serviceGroupDefinitions;

    } catch (AxisFault axisFault) {
        throw new ADCException(axisFault);
    } catch (RemoteException e) {
        throw new ADCException(e);
    } catch (AutoScalerServiceAutoScalerExceptionException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        return null;
    }
}

From source file:org.jenkins_ci.update_center.Main.java

private RemotePage findPage(String artifactId, Document pomDoc, ConfluencePluginList cpl) throws IOException {
    try {//from  w w w  . j  a  va 2s  .c o  m
        String p = Plugin.OVERRIDES.getProperty(artifactId);
        if (p != null) {
            return cpl.getPage(p);
        }
    } catch (RemoteException e) {
        System.err.println("** Override failed for " + artifactId);
        e.printStackTrace();
    }

    if (pomDoc != null) {
        String wikiPage = selectSingleValue(pomDoc, "/project/url");
        if (wikiPage != null) {
            try {
                return cpl.getPage(wikiPage); // found the confluence page successfully
            } catch (RemoteException e) {
                System.err.println("** Failed to fetch " + wikiPage);
                e.printStackTrace();
            } catch (IllegalArgumentException e) {
                System.err.println(e.getMessage());
            }
        }
    }

    // try to guess the Wiki page
    try {
        return cpl.findNearest(artifactId);
    } catch (RemoteException e) {
        System.err.println("** Failed to locate nearest");
        e.printStackTrace();
    }

    return null;
}

From source file:org.jenkins_ci.update_center.Main.java

private String[] readLabels(RemotePage wikiPage, ConfluencePluginList cpl) {
    if (wikiPage != null) {
        try {//from w w  w  .j a va  2  s.co m
            return cpl.getLabels(wikiPage);
        } catch (RemoteException e) {
            System.err.println("Failed to fetch labels for " + wikiPage.getUrl());
            e.printStackTrace();
        }
    }
    return new String[0];
}