Example #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") private static <T> T getContextualReference(javax.enterprise.inject.spi.BeanManager bm, java.util.Set<javax.enterprise.inject.spi.Bean<?>> beans, Class type)
        private static T getContextualReference <T, T1>(BeanManager bm, ISet <T1> beans, Type type)
        {
            if (beans == null || beans.Count == 0)
            {
                return(null);
            }

            // if we would resolve to multiple beans then BeanManager#resolve would throw an AmbiguousResolutionException
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: javax.enterprise.inject.spi.Bean<?> bean = bm.resolve(beans);
            Bean <object> bean = bm.resolve(beans);

            if (bean == null)
            {
                return(null);
            }
            else
            {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: javax.enterprise.context.spi.CreationalContext<?> creationalContext = bm.createCreationalContext(bean);
                CreationalContext <object> creationalContext = bm.createCreationalContext(bean);

                // if we obtain a contextual reference to a @Dependent scope bean, make sure it is released
                if (isDependentScoped(bean))
                {
                    releaseOnContextClose(creationalContext, bean);
                }

                return((T)bm.getReference(bean, type, creationalContext));
            }
        }
Example #2
0
        private static void RegisterViBeans()
        {
            //Register beans
            BeanManager.Register();

            //初始化DalBean,填充到App Internals
            var allInOneKeys = new HashSet <String>();

            foreach (var dbSet in ConnectionStringKeys.AllKeys)
            {
                allInOneKeys.Add(dbSet);
            }

            LogLevel level;

            LogManager.Logger.Prepare(ConfigurationSection.Name, ConfigurationSection.LogListeners, out level);

            Boolean tracingTurnOn         = ((ConfigurationSection.Tracing == null) || !ConfigurationSection.Tracing.Turn.Equals("off", StringComparison.InvariantCultureIgnoreCase));
            Boolean logListenerTurnOn     = (ConfigurationSection.LogListeners == null || !ConfigurationSection.LogListeners.Switch.Equals("off", StringComparison.InvariantCultureIgnoreCase));
            Int32   logConcurrentCapacity = ConfigurationSection.LogListeners != null ? ConfigurationSection.LogListeners.ConcurrentCapacity : 0;

            var dalBean = BeanManager.GetDALBean();

            dalBean.CentralLoggingLevel   = level;
            dalBean.LogListenersTurnOn    = logListenerTurnOn;
            dalBean.TracingTurnOn         = tracingTurnOn;
            dalBean.LogConcurrentCapacity = logConcurrentCapacity;

            var markDownBean = BeanManager.GetMarkDownBean();

            markDownBean.AllInOneKeys = String.Join(",", allInOneKeys);
        }
Example #3
0
        /// <param name="optional"> if <code>false</code> then the bean must exist. </param>
        /// <returns> a ContextualInstance of the given type if optional is <code>false</code>. If optional is <code>true</code> null might be returned if no bean got found. </returns>
        /// <exception cref="IllegalStateException"> if there is no bean of the given class, but only if optional is <code>false</code> </exception>
        /// <exception cref="javax.enterprise.inject.AmbiguousResolutionException"> if the given type is satisfied by more than one Bean </exception>
        /// <seealso cref= #lookup(Class, boolean) </seealso>
        public static T lookup <T>(Type clazz, bool optional)
        {
            clazz = typeof(T);
            BeanManager bm = BeanManagerLookup.BeanManager;

            return(lookup(clazz, bm, optional));
        }
Example #4
0
    private void Start()
    {
        BeanManager bean = BeanManager.instance;
        UITable     com  = transform.GetComponent <UITable>();

        com.repositionNow = true;
        for (int i = 0; i < m_StageIndex; i++)
        {
            GameObject obj = NGUITools.AddChild(com.gameObject, m_obj);

            m_ListObj.Add(obj);

            if (PlayerPrefs.GetString(bean.StageKey()[i]) == "Open")
            {
                obj.transform.FindChild("Label").GetComponent <UILabel>().text = string.Format("{0}", i + 1);
            }
            else
            {
                obj.transform.FindChild("Label").GetComponent <UILabel>().text = string.Format("잠금");
            }

            com.Reposition();
        }

        //  PlayerPrefs.DeleteAll();
    }
Example #5
0
        private static void InitPrivilegeAndAuthMap()
        {
            ModuleService ms = BeanManager.GetInstance <ModuleService>();

            AnonymPrivilege = ms.GetAnonymPrivileges();
            AnonymAuthMap   = ms.GetAnonymAuthMap();
            AllPrivilege    = ms.GetAllPrivileges(false);
        }
Example #6
0
        private static void InitBeanManager(Type appEntryType)
        {
            SimpleBeanContext context = new SimpleBeanContext();

            //context.AutoScan(Assembly.GetEntryAssembly());
            context.AutoScan(Assembly.GetAssembly(appEntryType));
            context.AutoScan(Assembly.GetAssembly(typeof(WebApp)));
            BeanManager.Init(context);
        }
Example #7
0
        public virtual void notify(DelegateTask task)
        {
            // test whether cdi is setup correctly. (if not, just do not deliver the event)
            if (!testCdiSetup())
            {
                return;
            }

            BusinessProcessEvent @event = createEvent(task);

            Annotation[] qualifiers = getQualifiers(@event);
            BeanManager.fireEvent(@event, qualifiers);
        }
Example #8
0
        public static T lookup <T>(Type clazz, BeanManager bm, bool optional)
        {
            clazz = typeof(T);
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.Set<javax.enterprise.inject.spi.Bean<?>> beans = bm.getBeans(clazz);
            ISet <Bean <object> > beans = bm.getBeans(clazz);
            T instance = getContextualReference(bm, beans, clazz);

            if (!optional && instance == default(T))
            {
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
                throw new System.InvalidOperationException("CDI BeanManager cannot find an instance of requested type '" + clazz.FullName + "'");
            }
            return(instance);
        }
Example #9
0
 /// <summary>
 /// 根据Statement,返回IDataReader形式的结果集
 /// </summary>
 /// <param name="statement"></param>
 /// <returns></returns>
 public IDataReader ExecuteReader(Statement statement)
 {
     try
     {
         LogManager.Logger.Next();
         if (BeanManager.GetMarkDownBean().AppIsMarkDown)
         {
             throw new Exception("Error");
         }
         var databases = DatabaseFactory.GetDatabasesByStatement(statement);
         return(HAFactory.GetInstance(statement.DatabaseSet).ExecuteWithHa(db => db.ExecuteReader(statement), databases));
     }
     finally
     {
         LogManager.Logger.Next();
     }
 }
Example #10
0
 /// <summary>
 /// 根据Statement,返回第一行第一列
 /// </summary>
 /// <param name="statement"></param>
 /// <returns></returns>
 public Object ExecuteScalar(Statement statement)
 {
     try
     {
         LogManager.Logger.Next();
         if (BeanManager.GetMarkDownBean().AppIsMarkDown)
         {
             throw new DalMarkDownException(Resources.AppMarkDownException);
         }
         var databases = DatabaseFactory.GetDatabasesByStatement(statement);
         return(HAFactory.GetInstance(statement.DatabaseSet).ExecuteWithHa(db => db.ExecuteScalar(statement), databases));
     }
     finally
     {
         LogManager.Logger.Next();
     }
 }
Example #11
0
 /// <summary>
 /// 根据Statement,返回DataSet结果集
 /// </summary>
 /// <param name="statement"></param>
 /// <param name="tableNames"></param>
 /// <returns></returns>
 public DataSet ExecuteDataSet(Statement statement, params String[] tableNames)
 {
     try
     {
         LogManager.Logger.Next();
         if (BeanManager.GetMarkDownBean().AppIsMarkDown)
         {
             throw new DalMarkDownException(Resources.AppMarkDownException);
         }
         var databases = DatabaseFactory.GetDatabasesByStatement(statement);
         return(HAFactory.GetInstance(statement.DatabaseSet).ExecuteWithHa(db => db.ExecuteDataSet(statement, tableNames), databases));
     }
     finally
     {
         LogManager.Logger.Next();
     }
 }
Example #12
0
        public static object lookup(string name, BeanManager bm, bool optional)
        {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.Set<javax.enterprise.inject.spi.Bean<?>> beans = bm.getBeans(name);
            ISet <Bean <object> > beans = bm.getBeans(name);

            // NOTE: we use Object.class as BeanType of the ContextualReference to resolve.
            // Mark says this is not strictly spec compliant but should work on all implementations.
            // A strictly compliant implementation would
            // - collect all bean types of the bean
            // - calculate the type such that it has the most types in the set of bean types which are assignable from this type.
            object instance = getContextualReference(bm, beans, typeof(object));

            if (!optional && instance == null)
            {
                throw new System.InvalidOperationException("CDI BeanManager cannot find an instance of requested type '" + name + "'");
            }
            return(instance);
        }
Example #13
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @After public void tearDownCdiProcessEngineTestCase() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void tearDownCdiProcessEngineTestCase()
        {
            org.camunda.bpm.container.RuntimeContainerDelegate_Fields.INSTANCE.get().unregisterProcessEngine(processEngine);
            beanManager   = null;
            processEngine = null;
            processEngineConfiguration = null;
            formService          = null;
            historyService       = null;
            identityService      = null;
            managementService    = null;
            repositoryService    = null;
            runtimeService       = null;
            taskService          = null;
            authorizationService = null;
            filterService        = null;
            externalTaskService  = null;
            caseService          = null;
            decisionService      = null;
            processEngineRule    = null;
        }
Example #14
0
        public static void Run(Type applicationType, dynamic settingObject, string[] args)
        {
            if (!typeof(IApplication).IsAssignableFrom(applicationType))
            {
                throw new NotSupportedException();
            }

            Settings = settingObject;

            var beanManager = new BeanManager();

            var attrScanner = new AttributeScanner(beanManager);

            var beanFactory = new BeanFactory(beanManager);

            beanFactory.CreateAllBeans();

            var application = beanManager.GetBean <IApplication>();

            application.Run(args);

            Console.ReadLine();
        }
Example #15
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUpCdiProcessEngineTestCase() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void setUpCdiProcessEngineTestCase()
        {
            if (BpmPlatform.ProcessEngineService.DefaultProcessEngine == null)
            {
                org.camunda.bpm.container.RuntimeContainerDelegate_Fields.INSTANCE.get().registerProcessEngine(processEngineRule.ProcessEngine);
            }

            beanManager   = ProgrammaticBeanLookup.lookup(typeof(BeanManager));
            processEngine = processEngineRule.ProcessEngine;
            processEngineConfiguration = (ProcessEngineConfigurationImpl)processEngineRule.ProcessEngine.ProcessEngineConfiguration;
            formService          = processEngine.FormService;
            historyService       = processEngine.HistoryService;
            identityService      = processEngine.IdentityService;
            managementService    = processEngine.ManagementService;
            repositoryService    = processEngine.RepositoryService;
            runtimeService       = processEngine.RuntimeService;
            taskService          = processEngine.TaskService;
            authorizationService = processEngine.AuthorizationService;
            filterService        = processEngine.FilterService;
            externalTaskService  = processEngine.ExternalTaskService;
            caseService          = processEngine.CaseService;
            decisionService      = processEngine.DecisionService;
        }
Example #16
0
    private void Awake()
    {
        m_IsMapLoad      = false;
        m_IsCameraMoving = false;
        m_bean           = BeanManager.instance;
        m_bean.reset();
        m_LastPosition = Vector3.zero;
        path           = System.IO.Directory.GetCurrentDirectory() + @"\Assets\Map\";
        m_StageNumber  = 0;
        m_LoadType     = 0;
        m_LastIndex    = 0;
        m_CameraIndex  = 0;
        m_Memory       = stageMemoryPull.instance;

        m_Camera = GameObject.FindGameObjectWithTag("camera");

        int index = 0;

        foreach (var v in m_Memory.m_Listprefep)
        {
            m_Memory.initObject(string.Format("Load_{0}", index), 20);
            index++;
        }
    }
Example #17
0
 public static T lookup <T>(Type clazz, BeanManager bm)
 {
     clazz = typeof(T);
     return(lookup(clazz, bm, true));
 }
Example #18
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: public void afterBeanDiscovery(@Observes AfterBeanDiscovery event, javax.enterprise.inject.spi.BeanManager manager)
        public virtual void afterBeanDiscovery(AfterBeanDiscovery @event, BeanManager manager)
        {
            @event.addContext(new BusinessProcessContext(manager));
        }
Example #19
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: public void beforeBeanDiscovery(@Observes final javax.enterprise.inject.spi.BeforeBeanDiscovery event, javax.enterprise.inject.spi.BeanManager manager)
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
        public virtual void beforeBeanDiscovery(BeforeBeanDiscovery @event, BeanManager manager)
        {
            @event.addScope(typeof(BusinessProcessScoped), true, true);

            BeanManagerLookup.localInstance = manager;
        }
 public UserApiController()
 {
     BeanManager.Autowire(this);
 }
 public TextBookApiController()
 {
     BeanManager.Autowire(this);
 }
Example #22
0
 public BusinessProcessContext(BeanManager beanManager)
 {
     this.beanManager = beanManager;
 }
Example #23
0
 public static object lookup(string name, BeanManager bm)
 {
     return(lookup(name, bm, true));
 }
Example #24
0
 // Start is called before the first frame update
 void Start()
 {
     text        = GetComponent <TextMeshProUGUI>();
     beanManager = GameObject.Find("Bean Spawner").GetComponent <BeanManager>();
 }
Example #25
0
        public static object lookup(string name)
        {
            BeanManager bm = BeanManagerLookup.BeanManager;

            return(lookup(name, bm));
        }
Example #26
0
    private void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.tag == "Ground")
        {
            Invoke(nameof(DestroyThis), 5f);
        }

        if (collision.gameObject.tag == "Bean")
        {
            BeanManager spawner = GameObject.Find("Bean Spawner").GetComponent <BeanManager>();
            spawner.time += spawner.timePerBean;
            if (spawner.time > spawner.maxTime)
            {
                spawner.time = spawner.maxTime;
            }
            Food food = collision.gameObject.GetComponent <Food>();
            if (food != null)
            {
                food.Die();
            }
            spawner.score += 100;
            Destroy(gameObject);
            Destroy(collision.gameObject);
        }
        else if (collision.gameObject.tag == "BigPeanut")
        {
            GameObject  peanut  = collision.gameObject.GetComponent <PeanutAI>().peanut;
            BeanManager spawner = GameObject.Find("Bean Spawner").GetComponent <BeanManager>();
            spawner.time += spawner.timePerBean;
            if (spawner.time > spawner.maxTime)
            {
                spawner.time = spawner.maxTime;
            }

            spawner.score += 250;
            spawner.AddObject(Instantiate(peanut, collision.gameObject.transform.position, collision.gameObject.transform.localRotation));
            spawner.AddObject(Instantiate(peanut, collision.gameObject.transform.position, collision.gameObject.transform.localRotation));
            Destroy(gameObject);
            Destroy(collision.gameObject);

            if (!PeanutSound.isPlaying)
            {
                PeanutSound.Play();
                Debug.Log("BigPeanut");
            }
        }
        else if (collision.gameObject.tag == "WaterMelon")
        {
            BeanManager spawner = GameObject.Find("Bean Spawner").GetComponent <BeanManager>();
            spawner.time += spawner.timePerBean;
            if (spawner.time > spawner.maxTime)
            {
                spawner.time = spawner.maxTime;
            }
            spawner.score += 500;
            Food food = collision.gameObject.GetComponent <Food>();
            if (food != null)
            {
                food.Die();
            }
            Destroy(gameObject);
            Destroy(collision.gameObject);
            if (!WatermelonSound.isPlaying)
            {
                Debug.Log("WaterMelon");
                WatermelonSound.Play();
            }
        }
        else if (collision.gameObject.tag == "SmallPeanut")
        {
            BeanManager spawner = GameObject.Find("Bean Spawner").GetComponent <BeanManager>();
            spawner.time += spawner.timePerBean;
            if (spawner.time > spawner.maxTime)
            {
                spawner.time = spawner.maxTime;
            }
            spawner.score += 125;
            Food food = collision.gameObject.GetComponent <Food>();
            if (food != null)
            {
                food.Die();
            }
            Destroy(gameObject);
            Destroy(collision.gameObject);
            if (!PeanutSound.isPlaying)
            {
                PeanutSound.Play();
                Debug.Log("SmallPeanut");
            }
        }
        else if (collision.gameObject.tag == "Potato")
        {
            if (gameObject.tag == "Player")
            {
                BeanManager spawner = GameObject.Find("Bean Spawner").GetComponent <BeanManager>();
                spawner.time += spawner.timePerBean;
                if (spawner.time > spawner.maxTime)
                {
                    spawner.time = spawner.maxTime;
                }
                spawner.score += 200;
                Food food = collision.gameObject.GetComponent <Food>();
                if (food != null)
                {
                    food.Die();
                }
                Destroy(gameObject);
                Destroy(collision.gameObject);
            }
        }
        active = false;
        if (gameObject.tag == "WaterMelon" || gameObject.tag == "Potato")
        {
            Debug.Log("active");
            if (collision.gameObject.tag == "Player")
            {
                Health health = collision.gameObject.GetComponent <Health>();
                if (health)
                {
                    health.Hurt();
                }
                Destroy(gameObject);
            }
        }
    }
 public HomeController()
 {
     BeanManager.Autowire(this);
 }