Package javax.naming

Examples of javax.naming.InitialContext


  public Vector getProjectStatusList()
  {
    Vector projectStatus = new Vector();
    try {
      InitialContext ic = CVUtility.getInitialContext();
      ProjectsHelperLocalHome home = (ProjectsHelperLocalHome)ic.lookup("local/ProjectsHelper");
      ProjectsHelperLocal remote = (ProjectsHelperLocal)home.create();
      remote.setDataSource(this.dataSource);
      projectStatus = remote.getProjectStatusList();
    } catch (Exception e) {
      System.out.println("[Exception][ProjectFacadeEJB.getProjectStatusList] Exception Thrown: "
View Full Code Here


      dl.setInt(11, tsvo.getTimesheetID());
      dl.executeUpdate();

      timeSlipId = dl.getAutoGeneratedKey();

            InitialContext ic = CVUtility.getInitialContext();
            AuthorizationLocalHome authorizationHome = (AuthorizationLocalHome)ic.lookup("local/Authorization");
            AuthorizationLocal authorizationLocal = authorizationHome.create();
            authorizationLocal.setDataSource(dataSource);
            authorizationLocal.saveCurrentDefaultPermission("Time Slips", timeSlipId, userId);
    }
    catch(Exception e)
View Full Code Here

  public ArrayList getValidCustomFields(String fieldType)
  {
    ArrayList validFields = new ArrayList();
    try
    {
      InitialContext ic = CVUtility.getInitialContext();
      CustomFieldLocalHome home = (CustomFieldLocalHome)ic.lookup("local/CustomField");
      CustomFieldLocal remote = home.create();
      remote.setDataSource(this.dataSource);

      if (fieldType.equals("Both") || fieldType.equals("Individual"))
      {
View Full Code Here

    public void start() {
    dqpCore.setTransactionService((TransactionService)LogManager.createLoggingProxy(LogConstants.CTX_TXN_LOG, transactionServerImpl, new Class[] {TransactionService.class}, MessageLevel.DETAIL));

    if (this.eventDistributorName != null) {
      try {
        InitialContext ic = new InitialContext();
        this.eventDistributor = (EventDistributor) ic.lookup(this.eventDistributorName);
      } catch (NamingException ne) {
        //log at a detail level since we may not be in the all profile
        LogManager.logDetail(LogConstants.CTX_RUNTIME, ne, IntegrationPlugin.Util.getString("jndi_failed", new Date(System.currentTimeMillis()).toString())); //$NON-NLS-1$
      }
    }
    this.dqpCore.start(this);
    this.dqpCore.getDataTierManager().setEventDistributor(this.eventDistributor);   
      // create the necessary services
      createClientServices();
     
      int offset = 0;
      String portBinding = System.getProperty("jboss.service.binding.set"); //$NON-NLS-1$
      if (portBinding != null && portBinding.startsWith("ports-")) { //$NON-NLS-1$
        if (portBinding.equals("ports-default")) { //$NON-NLS-1$
          offset = 0;
        }
        else {
          try {
          offset = Integer.parseInt(portBinding.substring(portBinding.length()-2))*100;
        } catch (NumberFormatException e) {
          offset = 0;
        }
        }
      }
     
      this.csr.registerClientService(ILogon.class, logon, LogConstants.CTX_SECURITY);
      DQP dqpProxy = proxyService(DQP.class, this.dqpCore, LogConstants.CTX_DQP);
      this.csr.registerClientService(DQP.class, dqpProxy, LogConstants.CTX_DQP);
      Admin adminProxy = proxyService(Admin.class, admin, LogConstants.CTX_ADMIN_API);
      this.csr.registerClientService(Admin.class, adminProxy, LogConstants.CTX_ADMIN_API);
     
      ClientServiceRegistryImpl jdbcCsr = new ClientServiceRegistryImpl();
      jdbcCsr.registerClientService(ILogon.class, logon, LogConstants.CTX_SECURITY);
      jdbcCsr.registerClientService(DQP.class, dqpProxy, LogConstants.CTX_DQP);
     
      if (this.jdbcSocketConfiguration.getEnabled()) {
        this.jdbcSocket = new SocketListener(this.jdbcSocketConfiguration, jdbcCsr, this.dqpCore.getBufferManager(), offset);
        LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("socket_enabled","Teiid JDBC = ",(this.jdbcSocketConfiguration.getSSLConfiguration().isSslEnabled()?"mms://":"mm://")+this.jdbcSocketConfiguration.getHostAddress().getHostName()+":"+(this.jdbcSocketConfiguration.getPortNumber()+offset))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
      } else {
        LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("socket_not_enabled", "jdbc connections")); //$NON-NLS-1$ //$NON-NLS-2$
      }
     
      ClientServiceRegistryImpl adminCsr = new ClientServiceRegistryImpl(Type.Admin);
      adminCsr.registerClientService(ILogon.class, logon, LogConstants.CTX_SECURITY);
      adminCsr.registerClientService(Admin.class, adminProxy, LogConstants.CTX_ADMIN_API);
     
      if (this.adminSocketConfiguration.getEnabled()) {
        this.adminSocket = new SocketListener(this.adminSocketConfiguration, adminCsr, this.dqpCore.getBufferManager(), offset);
        LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("socket_enabled","Teiid Admin", (this.adminSocketConfiguration.getSSLConfiguration().isSslEnabled()?"mms://":"mm://")+this.adminSocketConfiguration.getHostAddress().getHostName()+":"+(this.adminSocketConfiguration.getPortNumber()+offset))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
      } else {
        LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("socket_not_enabled", "admin connections")); //$NON-NLS-1$ //$NON-NLS-2$
      }
     
      if (this.odbcSocketConfiguration.getEnabled()) {
        this.vdbRepository.odbcEnabled();
        this.odbcSocket = new ODBCSocketListener(this.odbcSocketConfiguration, this.dqpCore.getBufferManager(), offset, getMaxODBCLobSizeAllowed());
        LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("odbc_enabled","Teiid ODBC - SSL=", (this.odbcSocketConfiguration.getSSLConfiguration().isSslEnabled()?"ON":"OFF")+" Host = "+this.odbcSocketConfiguration.getHostAddress().getHostName()+" Port = "+(this.odbcSocketConfiguration.getPortNumber()+offset))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
      } else {
        LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("odbc_not_enabled")); //$NON-NLS-1$
      }     
     
      LogManager.logInfo(LogConstants.CTX_RUNTIME, IntegrationPlugin.Util.getString("engine_started", getRuntimeVersion(), new Date(System.currentTimeMillis()).toString())); //$NON-NLS-1$
      if (jndiName != null) {
        final InitialContext ic ;
        try {
          ic = new InitialContext() ;
          Util.bind(ic, jndiName, this) ;
        } catch (final NamingException ne) {
          // Add jndi_failed to bundle
            LogManager.logError(LogConstants.CTX_RUNTIME, ne, IntegrationPlugin.Util.getString("jndi_failed", new Date(System.currentTimeMillis()).toString())); //$NON-NLS-1$
        }
View Full Code Here

    });     
 
   
    public void stop() {
      if (jndiName != null) {
        final InitialContext ic ;
        try {
          ic = new InitialContext() ;
          Util.unbind(ic, jndiName) ;
        } catch (final NamingException ne) {
        }
      }
     
View Full Code Here

   {
      try
      {
         if (configuration.isUseJTA())
         {
            UserTransaction tx = (UserTransaction)new InitialContext().lookup("java:comp/UserTransaction");
            if (tx.getStatus() == Status.STATUS_NO_TRANSACTION)
            {
               tx.begin();
            }
         }
View Full Code Here

   {
      try
      {
         if (configuration.isUseJTA())
         {
            UserTransaction tx = (UserTransaction)new InitialContext().lookup("java:comp/UserTransaction");
            tx.commit();
         }           
         else
         {
            idmService_.getIdentitySession().getTransaction().commit();
View Full Code Here

    private ProfileService connect(String providerURL, String user, String password) throws AdminComponentException {
          ClassLoader originalContextClassLoader = Thread.currentThread().getContextClassLoader();
          try {
            // local connection
            if (providerURL == null) {
                  InitialContext ic  = new InitialContext();
                  return (ProfileService)ic.lookup(PROFILE_SERVICE_JNDI_NAME);
            }
           
            Properties env = new Properties();
            env.setProperty(Context.PROVIDER_URL, providerURL);
             
              // un-authenticated remote login
                env.setProperty(Context.INITIAL_CONTEXT_FACTORY, NAMING_CONTEXT_FACTORY);
                env.setProperty(Context.SECURITY_PRINCIPAL, user);
                env.setProperty(Context.SECURITY_CREDENTIALS, password);        
                env.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces"); //$NON-NLS-1$
                env.setProperty(JNP_DISABLE_DISCOVERY_JNP_INIT_PROP, "true"); //$NON-NLS-1$
                env.setProperty(JNP_TIMEOUT_JNP_INIT_PROP, String.valueOf(JNP_TIMEOUT));
                env.setProperty(JNP_SOTIMEOUT_JNP_INIT_PROP, String.valueOf(JNP_SO_TIMEOUT));
                env.setProperty(JNP_DISABLE_DISCOVERY_JNP_INIT_PROP, String.valueOf(JNP_DISABLE_DISCOVERY));
                env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces"); //$NON-NLS-1$ //$NON-NLS-2$
                InitialContext ic  = new InitialContext(env);
               
                try {
                  return (ProfileService)ic.lookup(PROFILE_SERVICE_JNDI_NAME);
                } catch(NamingException e) {
                  ProfileService ps =  (ProfileService)ic.lookup(SECURE_PROFILE_SERVICE_JNDI_NAME);
                  return (ProfileService)Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] {ProfileService.class}, new JaasSecurityHandler(ps, this.userName, this.password));
                }
          } catch(NamingException e) {
            throw new AdminComponentException(e);
          } finally {
View Full Code Here

         }
      }
      else
      {
         identitySessionFactory = (IdentitySessionFactory)new InitialContext().lookup(jndiName.getValue());
      }

   }
View Full Code Here

    public void lookupResource(ApplicationResource resource, boolean contextBound, boolean global) {
        DataSourceInfo dataSourceInfo = null;
        if (contextBound) {
            try {
                String jndiName = resolveJndiName(resource.getName(), global);
                Object o = new InitialContext().lookup(jndiName);
                resource.setLookedUp(true);
                for (Iterator it = datasourceMappers.iterator(); it.hasNext();) {
                    DatasourceAccessor accessor = (DatasourceAccessor) it.next();
                    dataSourceInfo = accessor.getInfo(o);
                    if (dataSourceInfo != null) {
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.