Package javax.naming

Examples of javax.naming.InitialContext


  private BPAFDataSource ds = null;
 
  public ProcessHistoryPluginImpl() {
      try
      {
        InitialContext ctx = new InitialContext();       
        EntityManagerFactory emf  = (EntityManagerFactory)ctx.lookup("bpel/EntityManagerFactory");
        if (null == emf) {
          throw new IllegalStateException("EntityManagerFactory is null");
        }
        ds = new DefaultBPAFDataSource(emf);
      }
View Full Code Here


  private CacheManager cacheManager;
 
  private org.jboss.cache.Cache cache;
 
  public void start() throws Exception {
    Context ctx = new InitialContext();
    cacheManager = (CacheManager) ctx.lookup("java:CacheManager");
    cache = cacheManager.getCache("riftsaw-cache", true);
    cache.start();
  }
View Full Code Here

        this.webServiceHost = serverConfig.getWebServiceHost();
        this.webServicePort = serverConfig.getWebServicePort();

        try
        {
            InitialContext ctx = new InitialContext();
            engine = (BPELEngine)ctx.lookup("bpel/Engine");
        }
        catch (NamingException e)
        {
            throw new RuntimeException("Failed to initialize BPEL engine");
        }
View Full Code Here

 
  public ProcessMgmtImpl()
  {
    try
    {
      InitialContext ctx = new InitialContext();
      engine = (BPELEngine)ctx.lookup("bpel/Engine");
    }
    catch (NamingException e)
    {
      throw new RuntimeException("Failed to initialize BPEL engine");
    }
View Full Code Here

            dl.executeUpdate();
          }
        }
      }

      InitialContext ic = CVUtility.getInitialContext();
      AuthorizationLocalHome authorizationHome = (AuthorizationLocalHome)ic.lookup("local/Authorization");
      AuthorizationLocal authorizationLocal = authorizationHome.create();
      authorizationLocal.setDataSource(dataSource);
      authorizationLocal.saveCurrentDefaultPermission("Projects", projectId, userId);
    }catch (Exception e){
      System.out.println("[Exception][ProjectEJB.addProject] Exception Thrown: " + e);
View Full Code Here

  private int getAtticTransactionID(int indvID, String dumpType, HashMap hm)
  {
    int transID = 0;
    try
    {
      InitialContext ctx = CVUtility.getInitialContext();
      CvAtticLocalHome home = (CvAtticLocalHome)ctx.lookup("local/CvAttic");
      CvAtticLocal remote = home.create();
      remote.setDataSource(this.dataSource);
      transID = remote.getAtticTransactionID(indvID, dumpType, hm);
    }catch (Exception e){
      System.out.println("Error in sendToAttic(int) Method of Projects " + e);
View Full Code Here

   */
  private void sendToAttic(int indvID, int transactionID, String recordType, HashMap primaryMembers)
  {
    try
    {
      InitialContext ctx = CVUtility.getInitialContext();
      CvAtticLocalHome home = (CvAtticLocalHome)ctx.lookup("local/CvAttic");
      CvAtticLocal remote = home.create();
      remote.setDataSource(this.dataSource);
      remote.dumpData(indvID, transactionID, recordType, primaryMembers);
    }catch (Exception e){
      System.out.println("Error in sendToAttic Method of Projects " + e);
View Full Code Here

      if (! CVUtility.isModuleVisible("Tasks", userId, this.dataSource))
      {
        throw new AuthorizationFailedException("User does not have access to Tasks");
      }

      InitialContext ic = CVUtility.getInitialContext();
      ActivityHelperLocalHome home = (ActivityHelperLocalHome)ic.lookup("local/ActivityHelper");
      ActivityHelperLocal remote = (ActivityHelperLocal) home.create();
      remote.setDataSource(dataSource);

      ActivityVO actVo = new ActivityVO();
      actVo.setEntityID(0);
      actVo.setIndividualID(tvo.getIndividualID());
      actVo.setActivityType(8);
      actVo.setOwner(userId);
      actVo.setTitle(tvo.getTitle());
      actVo.setActivityDetails(tvo.getActivityDetails());
      actVo.setActivityStartDate(tvo.getStart());
      actVo.setActivityDueDate(tvo.getEnd());
      actVo.setVisibility("PUBLIC");
      activityId = remote.addActivity(actVo,userId);

      int taskCount = 1;
      dl.setSql("projecttask.selecttaskcount");
      dl.setInt(1, tvo.getProjectID());

      Collection countCol = dl.executeQuery();
      Iterator itCount = countCol.iterator();

      if (itCount.hasNext())
      {
        HashMap hm = (HashMap)itCount.next();
        if (hm.get("count(projecttaskcount)") != null)
        {
          taskCount = ((Integer)hm.get("count(projecttaskcount)")).intValue();
        }else{
          taskCount = 0;
        }
      }

      dl.clearParameters();

      dl.setSql("projecttask.addtask");
      dl.setInt(1, activityId);
      dl.setInt(2, tvo.getProjectID());
      dl.setInt(3, tvo.getParentID());
      dl.setString(4, tvo.getIsMileStone());
      dl.setInt(5, ++taskCount);
      dl.executeUpdate();

      HashMap assigned = (HashMap)tvo.getAssignedTo();
      Iterator ite = null;
      if (assigned != null)
      {
        ite = assigned.keySet().iterator();
        while (ite.hasNext())
        {
          int assignedTo = ((Integer)ite.next()).intValue();

          dl.setSql("projecttask.addtaskassigned");
          dl.setInt(1, activityId);
          dl.setInt(2, assignedTo);
          dl.executeUpdate();
          dl.clearParameters();
        }
      }

      Collection actions = tvo.getActivityAction();
      if (actions != null)
      {
        ite = actions.iterator();
        while (ite.hasNext())
        {
          ActivityActionVO action = (ActivityActionVO)ite.next();

          dl.setSql("projecttask.addtaskalertaction");
          dl.setString(1, action.getActionType());
          dl.setString(2, tvo.getMessage());
          dl.executeUpdate();

          int actionId = dl.getAutoGeneratedKey();
          dl.clearParameters();

          ArrayList recipients = action.getRecipient();

          if (recipients != null)
          {
            Iterator it1 = recipients.iterator();
            while (it1.hasNext())
            {
              dl.setSql("projecttask.addtaskalert");
              dl.setInt(1, activityId);
              dl.setInt(2, actionId);
              dl.setInt(3, ((Integer)it1.next()).intValue());
              dl.executeUpdate();
            }
          }   // end if (recipients != null)
        }   // end while (ite.hasNext())
      }   // end if (actions != null)

      Vector customField = tvo.getCustomField();
      if (customField != null && customField.size() != 0)
      {
        for (int i = 0; i < customField.size(); i++)
        {
          CustomFieldVO cvo = (CustomFieldVO)customField.get(i);
          if (cvo.getFieldID() != 0)
          {
            dl.setSql("project.addcustomfieldscalar");
            dl.setInt(1, cvo.getFieldID());
            dl.setInt(2, activityId);
            dl.setString(3, cvo.getValue());
            dl.executeUpdate();
          }
        }
      }

      // TODO: we may not need to do this as tasks are activites and activites don't seem to use recordauth.
      AuthorizationLocalHome authorizationHome = (AuthorizationLocalHome)ic.lookup("local/Authorization");
      AuthorizationLocal authorizationLocal = authorizationHome.create();
      authorizationLocal.setDataSource(dataSource);
      authorizationLocal.saveCurrentDefaultPermission("Tasks", activityId, userId);
    }catch (Exception e){
      System.out.println("[Exception][TaskEJB.addTask] Exception Thrown: " + e);
View Full Code Here

    try
    {
      CVDal dl = new CVDal(dataSource);

      InitialContext ic = CVUtility.getInitialContext();
      ActivityHelperLocalHome home = (ActivityHelperLocalHome)ic.lookup("local/ActivityHelper");
      ActivityHelperLocal remote = (ActivityHelperLocal) home.create();
      remote.setDataSource(dataSource);
      ActivityVO actVo = new ActivityVO();
      actVo = remote.getActivity(taskId,userId);
View Full Code Here

      tdbvo = getDBVO(tvo.getActivityID());
      tvo = (TaskVO)CVUtility.replaceVO(tdbvo, tvo, "Tasks", userId, this.dataSource);

      CVDal dl = new CVDal(dataSource);

      InitialContext ic = CVUtility.getInitialContext();
      ActivityHelperLocalHome home = (ActivityHelperLocalHome)ic.lookup("local/ActivityHelper");
      ActivityHelperLocal remote = (ActivityHelperLocal) home.create();
      remote.setDataSource(dataSource);

      ActivityVO actVo = new ActivityVO();
      actVo.setActivityID(tvo.getActivityID());
View Full Code Here

TOP

Related Classes of javax.naming.InitialContext

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.