Example #1
0
        public void LoadClasses(ClassLoader parentClassLoader)
        {
            ClassesMayNull = new List<Type>();
            
            // The assembly is the container for all the types, there is no need to explicitly
            // load them as is done in Java.  In Esper, the class is loaded as a byte array which
            // the ByteArrayProvidingClassProvider must initialize.

            foreach (var clazz in Assembly.GetExportedTypes()) {
                ClassesMayNull.Add(clazz);
            }
        }
Example #2
0
        /// <summary>
        /// Generate a proxy class.  Must call the checkProxyAccess method
        /// to perform permission checks before calling this.
        /// </summary>
        private static Class GetProxyClass0(ClassLoader loader, params Class[] interfaces)
        {
            if (interfaces.Length > 65535)
            {
                throw new IllegalArgumentException("interface limit exceeded");
            }

            // If the proxy class defined by the given loader implementing
            // the given interfaces exists, this will simply return the cached copy;
            // otherwise, it will create the proxy class via the ProxyClassFactory
            return(ProxyClassCache.Get(loader, interfaces));
        }
Example #3
0
 void executePrivate( )
 {
     /* GeneXus formulas */
     /* Output device settings */
     args = new Object[] { (long)AV2TanqueroBandaCPSUAB, (long)AV3TanqueroBandaTM, (long)AV4DWT, (SdtSdtResultado)AV5SdtResultado };
     ClassLoader.Execute("acalculartanqueros", "GeneXus.Programs.acalculartanqueros", new Object[] { context }, "execute", args);
     if ((args != null) && (args.Length == 4))
     {
         AV5SdtResultado = (SdtSdtResultado)(args[3]);
     }
     this.cleanup();
 }
Example #4
0
        /// <summary>
        /// Constructs a new URLClassLoader for the specified URLs, parent
        /// class loader, and URLStreamHandlerFactory. The parent argument
        /// will be used as the parent class loader for delegation. The
        /// factory argument will be used as the stream handler factory to
        /// obtain protocol handlers when creating new jar URLs.
        ///
        /// <para>If there is a security manager, this method first
        /// calls the security manager's {@code checkCreateClassLoader} method
        /// to ensure creation of a class loader is allowed.
        ///
        /// </para>
        /// </summary>
        /// <param name="urls"> the URLs from which to load classes and resources </param>
        /// <param name="parent"> the parent class loader for delegation </param>
        /// <param name="factory"> the URLStreamHandlerFactory to use when creating URLs
        /// </param>
        /// <exception cref="SecurityException">  if a security manager exists and its
        ///             {@code checkCreateClassLoader} method doesn't allow
        ///             creation of a class loader. </exception>
        /// <exception cref="NullPointerException"> if {@code urls} is {@code null}. </exception>
        /// <seealso cref= SecurityManager#checkCreateClassLoader </seealso>
        public URLClassLoader(URL[] urls, ClassLoader parent, URLStreamHandlerFactory factory) : base(parent)
        {
            // this is to make the stack depth consistent with 1.1
            SecurityManager security = System.SecurityManager;

            if (security != null)
            {
                security.CheckCreateClassLoader();
            }
            Ucp = new URLClassPath(urls, factory);
            Acc = AccessController.Context;
        }
Example #5
0
        /// <summary>
        /// Creates a new service loader for the given service type, using the
        /// extension class loader.
        ///
        /// <para> This convenience method simply locates the extension class loader,
        /// call it <tt><i>extClassLoader</i></tt>, and then returns
        ///
        /// <blockquote><pre>
        /// ServiceLoader.load(<i>service</i>, <i>extClassLoader</i>)</pre></blockquote>
        ///
        /// </para>
        /// <para> If the extension class loader cannot be found then the system class
        /// loader is used; if there is no system class loader then the bootstrap
        /// class loader is used.
        ///
        /// </para>
        /// <para> This method is intended for use when only installed providers are
        /// desired.  The resulting service will only find and load providers that
        /// have been installed into the current Java virtual machine; providers on
        /// the application's class path will be ignored.
        ///
        /// </para>
        /// </summary>
        /// @param  <S> the class of the service type
        /// </param>
        /// <param name="service">
        ///         The interface or abstract class representing the service
        /// </param>
        /// <returns> A new service loader </returns>
        public static ServiceLoader <S> loadInstalled <S>(Class service)
        {
            ClassLoader cl   = ClassLoader.SystemClassLoader;
            ClassLoader prev = null;

            while (cl != null)
            {
                prev = cl;
                cl   = cl.Parent;
            }
            return(ServiceLoader.Load(service, prev));
        }
Example #6
0
        public override IDbDataParameter CreateParameter(string name, Object dbtype, int gxlength, int gxdec)
        {
            object ifxType = GXTypeToIfxType((GXType)dbtype);

            object[]         args = new object[] { name, ifxType, gxlength };
            IDbDataParameter parm = (IDbDataParameter)ClassLoader.CreateInstance(IfxAssembly, "IBM.Data.Informix.IfxParameter", args);

            ClassLoader.SetPropValue(parm, "IfxType", ifxType);
            parm.Precision = (byte)gxdec;
            parm.Scale     = (byte)gxdec;
            return(parm);
        }
Example #7
0
        internal URLClassLoader(URL[] urls, ClassLoader parent, AccessControlContext acc) : base(parent)
        {
            // this is to make the stack depth consistent with 1.1
            SecurityManager security = System.SecurityManager;

            if (security != null)
            {
                security.CheckCreateClassLoader();
            }
            Ucp      = new URLClassPath(urls);
            this.Acc = acc;
        }
Example #8
0
        private static void Main(string[] args)
        {
            var app = new CommandLineApplication {
                Name = "dynamo2terraform"
            };

            app.HelpOption("-?|-h|--help");

            var inputFilePathOption = app.Option("-i|--input <path>",
                                                 "The path to the input C# DynamoDB Model decorated with DynamoDBAttributes for parsing",
                                                 CommandOptionType.SingleValue);

            var templateFilePathOption = app.Option("-t|--template <path>",
                                                    "The path to the liquid template to be used for generating the output",
                                                    CommandOptionType.SingleValue);

            app.OnExecute(() => {
                if (!inputFilePathOption.HasValue() || !File.Exists(inputFilePathOption.Value()))
                {
                    Console.WriteLine("Could not find Input file at the path provided");
                    return(0);
                }

                if (!templateFilePathOption.HasValue() || !File.Exists(templateFilePathOption.Value()))
                {
                    Console.WriteLine("Could not find Liquid template file at path provided");
                    return(0);
                }

                var tree  = ClassLoader.GetSyntaxTreeFromPath(inputFilePathOption.Value());
                var table = DynamoParserService.Parse(tree);

                var liquidTemplate = File.ReadAllText(templateFilePathOption.Value());


                IEnumerable <string> errors;
                if (FluidTemplate.TryParse(liquidTemplate, out var template, out errors))
                {
                    var context = new TemplateContext();
                    context.MemberAccessStrategy.Register(typeof(DynamoDbTable));                     // Allows any public property of the model to be used
                    context.MemberAccessStrategy.Register(typeof(DynamoDbAttribute));
                    context.MemberAccessStrategy.Register(typeof(DynamoDbGlobalSecondaryIndex));
                    context.SetValue("table", table);

                    Console.WriteLine(template.Render(context));
                }

                return(0);
            });

            app.Execute(args);
        }
            /// <summary>
            /// The connect.
            /// </summary>
            /// <param name="context">
            /// The context.
            /// </param>
            public void Connect(Context context)
            {
                this.classLoader = context.ClassLoader;
                var bindIntent = new Intent(context, this.serviceTypeType);

                bindIntent.PutExtra(ClientMessageParameters.Messenger, this.messenger);
                bool bound = context.BindService(bindIntent, this.serviceConnection, Bind.DebugUnbind);

                if (!bound)
                {
                    Debug.WriteLine("LVLDL Service Unbound");
                }
            }
Example #10
0
        public static BpmPlatformPlugins load(ClassLoader classLoader)
        {
            BpmPlatformPlugins plugins = new BpmPlatformPlugins();

            IEnumerator <BpmPlatformPlugin> it = ServiceLoader.load(typeof(BpmPlatformPlugin), classLoader).GetEnumerator();

            while (it.MoveNext())
            {
                plugins.add(it.Current);
            }

            return(plugins);
        }
Example #11
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public static <T> T runUnderClassloader(final Operation<T> operation, final ClassLoader classLoader)
        public static T runUnderClassloader <T>(Operation <T> operation, ClassLoader classLoader)
        {
            SecurityManager sm = System.SecurityManager;

            if (sm != null)
            {
                return(AccessController.doPrivileged(new PrivilegedActionAnonymousInnerClass(operation, classLoader)));
            }
            else
            {
                return(runWithTccl(operation, classLoader));
            }
        }
Example #12
0
        /// <summary>
        /// This method is not part of the API, though it can be used (reflectively) by clients of this
        /// class to remove entries from the cache when the beans are being unloaded.
        ///
        /// Note: this method is present in the reference implementation, so we're adding it here to ease
        /// migration.
        /// </summary>
        /// <param name="classloader">
        ///            The classLoader used to load the beans. </param>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unused") private final void purgeBeanClasses(ClassLoader loader)
        private void purgeBeanClasses(ClassLoader loader)
        {
            IEnumerator <Type> classes = cache.Keys.GetEnumerator();

            while (classes.MoveNext())
            {
                if (loader == classes.Current.ClassLoader)
                {
//JAVA TO C# CONVERTER TODO TASK: .NET enumerators are read-only:
                    classes.remove();
                }
            }
        }
Example #13
0
        public Server()
        {
            Debug.WriteLine("Entering Server ctor"); // Log not yet ready here

            _server = this;

            Config.Init();
            Log.Init();

            // Initialize World Details
            ClassLoader.Init();
            Log.Verbose("Leaving Server ctor");
        }
Example #14
0
 public static Form ShowNormal
     (Type typeForm, IObject bo, Dictionary <string, object> parameters = null, int width = 0, int height = 0)
 {
     if (typeForm == null)
     {
         return(null);
     }
     using (new WaitDialog())
     {
         var o = ClassLoader.LoadClass(typeForm);
         return(ShowNormal(o as IApplicationForm, bo, parameters, width, height));
     }
 }
        public PetitClrInterpreter(ClassLoader classLoader, MethodDefinition methodDef, bool directCall, IList <ObjectInstance> args, object stubContext)
        {
            _classLoader = classLoader;
            _methInfo2   = methodDef;
            _directCall  = directCall;
            _args        = args;
            _stubContext = stubContext;

            _instructions   = methodDef.Body.Instructions.ToArray();
            _instructionPtr = 0;
            _opStack        = new Stack <ObjectInstance>();
            _localSlot      = new ObjectInstance[methodDef.Body.Variables.Count];
        }
Example #16
0
 internal static decimal GetIfxDecimal(IDataReader reader, int i)
 {
     try
     {
         decimal result;
         string  ifxDecimal = ClassLoader.Invoke(reader, "GetIfxDecimal", new object[] { i }).ToString();
         Decimal.TryParse(ifxDecimal, NumberStyles.Number, CultureInfo.InvariantCulture, out result);
         return(result);
     }catch (Exception)
     {
         return(Convert.ToInt64(reader.GetValue(i)));
     }
 }
        /**
         * Constructor.
         */
        private ModuleContext(ClassLoader loader)
        {
            _loader = loader;

            _marshalFactory = new MarshalFactory(this);
            _exprFactory    = new ExprFactory();

            string [] empty = new String[0];
            _stdClassDef = new InterpretedClassDef("stdClass", null, empty, empty);
            _stdClass    = new QuercusClass(this, _stdClassDef, null);

            _staticClasses.put(_stdClass.getName(), _stdClassDef);
        }
Example #18
0
 public Compiler()
 {
     _loaders[typeof(TileSet)]       = new TileSetLoader();
     _loaders[typeof(Map)]           = new MapLoader();
     _loaders[typeof(Dungeon)]       = new DungeonLoader();
     _loaders[typeof(TileInfo)]      = new TileInfoLoader();
     _loaders[typeof(TileObject)]    = new TileObjectLoader();
     _loaders[typeof(CreatureInfo)]  = new CreatureLoader();
     _loaders[typeof(BaseItemInfo)]  = new ItemLoader();
     _loaders[typeof(Class)]         = new ClassLoader();
     _loaders[typeof(BaseGenerator)] = new GeneratorLoader();
     _loaders[typeof(AbilityInfo)]   = new AbilityLoader();
 }
Example #19
0
 private static ITreeVisitor LoadTreeVistor(string value)
 {
     try
     {
         Type c = ClassLoader.GetSystemClassLoader().LoadClass(value);
         return((ITreeVisitor)System.Activator.CreateInstance(c));
     }
     catch (ReflectiveOperationException e)
     {
         Sharpen.Runtime.PrintStackTrace(e);
     }
     return(null);
 }
Example #20
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private Callables loadProcedures(java.net.URL jar, ClassLoader loader, Callables target) throws java.io.IOException, org.neo4j.internal.kernel.api.exceptions.KernelException
        private Callables LoadProcedures(URL jar, ClassLoader loader, Callables target)
        {
            RawIterator <Type, IOException> classes = ListClassesIn(jar, loader);

            while (classes.HasNext())
            {
                Type next = classes.Next();
                target.AddAllProcedures(_compiler.compileProcedure(next, null, false));
                target.AddAllFunctions(_compiler.compileFunction(next));
                target.AddAllAggregationFunctions(_compiler.compileAggregationFunction(next));
            }
            return(target);
        }
Example #21
0
        protected internal virtual Schema createSchema(string location, ClassLoader classLoader)
        {
            URL cmmnSchema = ReflectUtil.getResource(location, classLoader);

            try
            {
                return(schemaFactory.newSchema(cmmnSchema));
            }
            catch (SAXException)
            {
                throw new ModelValidationException("Unable to parse schema:" + cmmnSchema);
            }
        }
Example #22
0
 /// <summary>
 /// Search the system for given class and return this.
 /// </summary>
 /// <param name="className">see System.Type.AssemblyQualifedName</param>
 /// <param name="cl">ClassLoader - ignored</param>
 /// <param name="initialize">ignored - ever like true</param>
 /// <returns></returns>
 public static Class forName(String className, bool initialize, ClassLoader cl)
 {
     //throws ClassNotFoundException {
     try
     {
         System.Type t = System.Type.GetType(className);
         if (null == t) throw new java.lang.ClassNotFoundException(className);
         return new Class(t);
     }
     catch
     {
         throw new java.lang.ClassNotFoundException(className);
     }
 }
Example #23
0
        public void initialize( )
        {
            gxTv_SdtBAS_DataPackage_Datapackage   = "";
            gxTv_SdtBAS_DataPackage_Mode          = "";
            gxTv_SdtBAS_DataPackage_Datapackage_Z = "";
            IGxSilentTrn obj;

            obj = (IGxSilentTrn)ClassLoader.FindInstance("bas_datapackage", "GeneXus.Programs.bas_datapackage_bc", new Object[] { context }, constructorCallingAssembly);;
            obj.initialize();
            obj.SetSDT(this, 1);
            setTransaction(obj);
            obj.SetMode("INS");
            return;
        }
Example #24
0
        public void initialize( )
        {
            gxTv_SdtBR_PatientReTenant_Bas_tenanttenantcode = "";
            gxTv_SdtBR_PatientReTenant_Mode = "";
            gxTv_SdtBR_PatientReTenant_Bas_tenanttenantcode_Z = "";
            IGxSilentTrn obj;

            obj = (IGxSilentTrn)ClassLoader.FindInstance("br_patientretenant", "GeneXus.Programs.br_patientretenant_bc", new Object[] { context }, constructorCallingAssembly);;
            obj.initialize();
            obj.SetSDT(this, 1);
            setTransaction(obj);
            obj.SetMode("INS");
            return;
        }
Example #25
0
 public InformixConnectionWrapper()
 {
     try
     {
         GXLogging.Debug(log, "Creating Informix data provider ");
         _connection = (IDbConnection)ClassLoader.CreateInstance(GxInformix.IfxAssembly, "IBM.Data.Informix.IfxConnection");
         GXLogging.Debug(log, "Informix data provider created");
     }
     catch (Exception ex)
     {
         GXLogging.Error(log, "Informix data provider Ctr error " + ex.Message + ex.StackTrace);
         throw ex;
     }
 }
Example #26
0
        public void initialize( )
        {
            gxTv_SdtSecFunctionalityRole_Secfunctionalitydescription = "";
            gxTv_SdtSecFunctionalityRole_Mode = "";
            gxTv_SdtSecFunctionalityRole_Secfunctionalitydescription_Z = "";
            IGxSilentTrn obj;

            obj = (IGxSilentTrn)ClassLoader.FindInstance("secfunctionalityrole", "GeneXus.Programs.wwpbaseobjects.secfunctionalityrole_bc", new Object[] { context }, constructorCallingAssembly);;
            obj.initialize();
            obj.SetSDT(this, 1);
            setTransaction(obj);
            obj.SetMode("INS");
            return;
        }
Example #27
0
        public void initialize( )
        {
            gxTv_SdtSYS_SerialNumber_Serialkey   = "";
            gxTv_SdtSYS_SerialNumber_Mode        = "";
            gxTv_SdtSYS_SerialNumber_Serialkey_Z = "";
            IGxSilentTrn obj;

            obj = (IGxSilentTrn)ClassLoader.FindInstance("sys_serialnumber", "GeneXus.Programs.sys_serialnumber_bc", new Object[] { context }, constructorCallingAssembly);;
            obj.initialize();
            obj.SetSDT(this, 1);
            setTransaction(obj);
            obj.SetMode("INS");
            return;
        }
Example #28
0
        public void initialize( )
        {
            gxTv_SdtXT_DefindcodeType_Xt_defindcodetypename = "";
            gxTv_SdtXT_DefindcodeType_Mode = "";
            gxTv_SdtXT_DefindcodeType_Xt_defindcodetypename_Z = "";
            IGxSilentTrn obj;

            obj = (IGxSilentTrn)ClassLoader.FindInstance("xt_defindcodetype", "GeneXus.Programs.xt_defindcodetype_bc", new Object[] { context }, constructorCallingAssembly);;
            obj.initialize();
            obj.SetSDT(this, 1);
            setTransaction(obj);
            obj.SetMode("INS");
            return;
        }
Example #29
0
 public InformixConnectionWrapper(String connectionString, GxConnectionCache connCache, IsolationLevel isolationLevel)
 {
     try
     {
         _connection       = (IDbConnection)ClassLoader.CreateInstance(GxInformix.IfxAssembly, "IBM.Data.Informix.IfxConnection", new object[] { connectionString });
         m_isolationLevel  = isolationLevel;
         m_connectionCache = connCache;
     }
     catch (Exception ex)
     {
         GXLogging.Error(log, "Informix data provider Ctr error " + ex.Message + ex.StackTrace);
         throw ex;
     }
 }
 public PostgresqlConnectionWrapper(String connectionString, GxConnectionCache connCache, IsolationLevel isolationLevel)
 {
     try
     {
         _connection       = (IDbConnection)ClassLoader.CreateInstance(GxPostgreSql.NpgsqlAssembly, "Npgsql.NpgsqlConnection", new object[] { connectionString });
         m_isolationLevel  = isolationLevel;
         m_connectionCache = connCache;
     }
     catch (Exception ex)
     {
         GXLogging.Error(log, "Npgsql data provider Ctr error " + ex.Message + ex.StackTrace);
         throw ex;
     }
 }
Example #31
0
        public void initialize( )
        {
            gxTv_SdtBR_Pathology_Specimen_Br_pathology_specimen_name = "";
            gxTv_SdtBR_Pathology_Specimen_Mode = "";
            gxTv_SdtBR_Pathology_Specimen_Br_pathology_specimen_name_Z = "";
            IGxSilentTrn obj;

            obj = (IGxSilentTrn)ClassLoader.FindInstance("br_pathology_specimen", "GeneXus.Programs.br_pathology_specimen_bc", new Object[] { context }, constructorCallingAssembly);;
            obj.initialize();
            obj.SetSDT(this, 1);
            setTransaction(obj);
            obj.SetMode("INS");
            return;
        }
		public override void RestoreState(IParcelable state, ClassLoader loader)
		{
			Bundle bundle = (Bundle)state;
			int pages = bundle.GetInt(_statePages);
			if (0 < pages)
			{
				for (int i = 0; i < pages; i++)
				{
					int position = bundle.GetInt(CreateCacheIndex(i));
					Fragment f = _fm.GetFragment(bundle, CreateCacheKey(position));
					_pages.Put(position, f);
				}
			}

			IParcelable p = (IParcelable)bundle.GetParcelable(_stateSuperState);
			base.RestoreState(p, loader);
		}
Example #33
0
        //UPGRADE_ISSUE: Class 'java.lang.ClassLoader' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javalangClassLoader"'
        /// <summary> Creates an instance of an AudioDevice implementation. 
        /// </summary>
        /// <param name="loader	The"><code>ClassLoader</code> to use to
        /// load the named class, or null to use the
        /// system class loader.
        /// </param>
        /// <param name="name		The">name of the class to load.
        /// </param>
        /// <returns>			A newly-created instance of the audio device class.
        /// 
        /// </returns>
        protected internal virtual AudioDevice instantiate(ClassLoader loader, System.String name)
        {
            AudioDevice dev = null;

            System.Type cls = null;
            if (loader == null)
            {
                //UPGRADE_TODO: Format of parameters of method 'java.lang.Class.forName' are different in the equivalent in .NET. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1092"'
                cls = System.Type.GetType(name);
            }
            else
            {
                //UPGRADE_ISSUE: Method 'java.lang.ClassLoader.loadClass' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javalangClassLoader"'
                cls = loader.loadClass(name);
            }

            System.Object o = SupportClass.CreateNewInstance(cls);
            dev = (AudioDevice) o;

            return dev;
        }
Example #34
0
		//
		// get class path
		//
		static ClassLoaderUtil()
		{

			if (loader == null)
			{
				LOGGER.info("using system class loader!");
				loader = ClassLoader.SystemClassLoader;
			}

			try
			{

				URL url = loader.getResource("");
				// get class path
				classPath = url.Path;
				classPath = URLDecoder.decode(classPath, "utf-8");

				// 如果是jar包内的,则返回当前路径
				if (classPath.Contains(".jar!"))
				{
					LOGGER.warn("using config file inline jar!" + classPath);
					classPath = System.getProperty("user.dir");

					//
					addCurrentWorkingDir2Classpath(classPath);
				}

			}
			catch (Exception)
			{
				LOGGER.warn("cannot get classpath using getResource(), now using user.dir");
				classPath = System.getProperty("user.dir");

				//
				addCurrentWorkingDir2Classpath(classPath);
			}

			LOGGER.info("classpath: {}", classPath);
		}
Example #35
0
		/// <summary>Attempt to load the class of the given name.</summary>
		/// <remarks>
		/// Attempt to load the class of the given name. Note that the type parameter
		/// isn't checked.
		/// </remarks>
		public static Type ClassOrNull(ClassLoader loader, string className)
		{
			try
			{
				return loader.LoadClass(className);
			}
			catch (TypeLoadException)
			{
			}
			catch (SecurityException)
			{
			}
			catch (LinkageError)
			{
			}
			catch (ArgumentException)
			{
			}
			// Can be thrown if name has characters that a class name
			// can not contain
			return null;
		}
Example #36
0
			public _ObjectInputStream_1358(ClassLoader loader, InputStream baseArg1) : base(baseArg1
				)
			{
				this.loader = loader;
			}
Example #37
0
		/// <summary>
		/// Attempts to decode Base64 data and deserialize a Java
		/// Object within.
		/// </summary>
		/// <remarks>
		/// Attempts to decode Base64 data and deserialize a Java
		/// Object within. Returns <tt>null</tt> if there was an error.
		/// If <tt>loader</tt> is not null, it will be the class loader
		/// used when deserializing.
		/// </remarks>
		/// <param name="encodedObject">The Base64 data to decode</param>
		/// <param name="options">Various parameters related to decoding</param>
		/// <param name="loader">Optional class loader to use in deserializing classes.</param>
		/// <returns>The decoded and deserialized object</returns>
		/// <exception cref="System.ArgumentNullException">if encodedObject is null</exception>
		/// <exception cref="System.IO.IOException">if there is a general error</exception>
		/// <exception cref="System.TypeLoadException">
		/// if the decoded object is of a
		/// class that cannot be found by the JVM
		/// </exception>
		/// <since>2.3.4</since>
		public static object DecodeToObject(string encodedObject, int options, ClassLoader
			 loader)
		{
			// Decode and gunzip if necessary
			byte[] objBytes = Decode(encodedObject, options);
			ByteArrayInputStream bais = null;
			ObjectInputStream ois = null;
			object obj = null;
			try
			{
				bais = new ByteArrayInputStream(objBytes);
				// If no custom class loader is provided, use Java's builtin OIS.
				if (loader == null)
				{
					ois = new ObjectInputStream(bais);
				}
				else
				{
					// end if: no loader provided
					// Else make a customized object input stream that uses
					// the provided class loader.
					ois = new _ObjectInputStream_1358(loader, bais);
				}
				// Class loader knows of this class.
				// end else: not null
				// end resolveClass
				// end ois
				// end else: no custom class loader
				obj = ois.ReadObject();
			}
			catch (IOException e)
			{
				// end try
				throw;
			}
			catch (TypeLoadException e)
			{
				// Catch and throw in order to execute finally{}
				// end catch
				throw;
			}
			finally
			{
				// Catch and throw in order to execute finally{}
				// end catch
				try
				{
					bais.Close();
				}
				catch (Exception)
				{
				}
				try
				{
					ois.Close();
				}
				catch (Exception)
				{
				}
			}
			// end finally
			return obj;
		}
Example #38
0
		/// <exception cref="System.MissingMethodException"></exception>
		/// <exception cref="Sharpen.InstantiationException"></exception>
		/// <exception cref="System.MemberAccessException"></exception>
		/// <exception cref="System.Reflection.TargetInvocationException"></exception>
		private static ShellConsole.JLineShellConsoleV2 GetJLineShellConsoleV2(ClassLoader classLoader, Type readerClass, Scriptable scope, Encoding cs)
		{
			// ConsoleReader reader = new ConsoleReader();
			ConstructorInfo<object> c = readerClass.GetConstructor();
			object reader = c.NewInstance();
			// reader.setBellEnabled(false);
			TryInvoke(reader, "setBellEnabled", BOOLEAN_ARG, false);
			// reader.addCompleter(new FlexibleCompletor(prefixes));
			Type completorClass = Kit.ClassOrNull(classLoader, "jline.console.completer.Completer");
			object completor = Proxy.NewProxyInstance(classLoader, new Type[] { completorClass }, new FlexibleCompletor(completorClass, scope));
			TryInvoke(reader, "addCompleter", new Type[] { completorClass }, completor);
			return new ShellConsole.JLineShellConsoleV2(reader, cs);
		}
Example #39
0
 /**
  * Resets this Uberspect class loader.
  * @param cloader the class loader to use
  * @since 2.1
  */
 public void setLoader(ClassLoader cloader) {
     base().setLoader(cloader);
 }
Example #40
0
		/// <summary>Create class loader for generated classes.</summary>
		/// <remarks>
		/// Create class loader for generated classes.
		/// The method calls
		/// <see cref="ContextFactory.CreateClassLoader(Sharpen.ClassLoader)">ContextFactory.CreateClassLoader(Sharpen.ClassLoader)</see>
		/// using the result of
		/// <see cref="GetFactory()">GetFactory()</see>
		/// .
		/// </remarks>
		public virtual GeneratedClassLoader CreateClassLoader(ClassLoader parent)
		{
			ContextFactory f = GetFactory();
			return f.CreateClassLoader(parent);
		}
Example #41
0
		public NativeJavaPackage(string packageName, ClassLoader classLoader) : this(false, packageName, classLoader)
		{
		}
 /// <summary>
 /// The connect.
 /// </summary>
 /// <param name="context">
 /// The context.
 /// </param>
 public void Connect(Context context)
 {
     this.classLoader = context.ClassLoader;
     var bindIntent = new Intent(context, this.serviceTypeType);
     bindIntent.PutExtra(ClientMessageParameters.Messenger, this.messenger);
     bool bound = context.BindService(bindIntent, this.serviceConnection, Bind.DebugUnbind);
     if (!bound)
     {
         Debug.WriteLine("LVLDL Service Unbound");
     }
 }
Example #43
0
 public static MethodType fromMethodDescriptorString(String arg0, ClassLoader arg1)
 {
     return Static.CallMethod<MethodType>(typeof(MethodType), "fromMethodDescriptorString", "(Ljava/lang/String;Ljava/lang/ClassLoader;)Ljava/lang/invoke/MethodType;", arg0, arg1);
 }
Example #44
0
		public void SetApplicationClassLoader(ClassLoader loader)
		{
			if (@sealed)
			{
				OnSealedMutation();
			}
			if (loader == null)
			{
				// restore default behaviour
				applicationClassLoader = null;
				return;
			}
			if (!Kit.TestIfCanLoadRhinoClasses(loader))
			{
				throw new ArgumentException("Loader can not resolve Rhino classes");
			}
			applicationClassLoader = loader;
		}
		public override void RestoreState (Android.OS.IParcelable state, ClassLoader loader)
		{
			
		}
Example #46
0
        // Z:\jsc.svn\core\ScriptCoreLibJava\BCLImplementation\System\ServiceModel\ClientBase.cs

        public static object newProxyInstance(ClassLoader loader, Class[] interfaces, InvocationHandler invocationHandler)
        {
            return null;
        }
Example #47
0
		public DefiningClassLoader(ClassLoader parentLoader)
		{
			this.parentLoader = parentLoader;
		}
Example #48
0
		/// <summary>
		/// Create
		/// <see cref="GeneratedClassLoader">GeneratedClassLoader</see>
		/// with restrictions imposed by
		/// staticDomain and all current stack frames.
		/// The method uses the SecurityController instance associated with the
		/// current
		/// <see cref="Context">Context</see>
		/// to construct proper dynamic domain and create
		/// corresponding class loader.
		/// <par>
		/// If no SecurityController is associated with the current
		/// <see cref="Context">Context</see>
		/// ,
		/// the method calls
		/// <see cref="Context.CreateClassLoader(Sharpen.ClassLoader)">Context.CreateClassLoader(Sharpen.ClassLoader)</see>
		/// .
		/// </summary>
		/// <param name="parent">
		/// parent class loader. If null,
		/// <see cref="Context.GetApplicationClassLoader()">Context.GetApplicationClassLoader()</see>
		/// will be used.
		/// </param>
		/// <param name="staticDomain">static security domain.</param>
		public static GeneratedClassLoader CreateLoader(ClassLoader parent, object staticDomain)
		{
			Context cx = Context.GetContext();
			if (parent == null)
			{
				parent = cx.GetApplicationClassLoader();
			}
			SecurityController sc = cx.GetSecurityController();
			GeneratedClassLoader loader;
			if (sc == null)
			{
				loader = cx.CreateClassLoader(parent);
			}
			else
			{
				object dynamicDomain = sc.GetDynamicSecurityDomain(staticDomain);
				loader = sc.CreateClassLoader(parent, dynamicDomain);
			}
			return loader;
		}
Example #49
0
 /// <summary>
 /// Set the context class loader
 /// </summary>
 /// <param name="cl"></param>
 public void setContextClassLoader(ClassLoader cl)
 {
     if (null == cl) throw new NullPointerException("Classloader can not be null");
     this.contextClassLoader = cl;
 }
        public override void RestoreState(IParcelable state, ClassLoader loader)
        {
            if (state == null)
                return;

            var bundle = (Bundle)state;
            bundle.SetClassLoader(loader);
            var fss = bundle.GetParcelableArray("states");
            _savedState.Clear();
            _fragments.Clear();

            var tags = bundle.GetStringArrayList("tags");
            if (tags != null)
                _savedFragmentTags = tags.ToList();
            else
                _savedFragmentTags.Clear();

            if (fss != null)
            {
                for (var i = 0; i < fss.Length; i++)
                {
                    var parcelable = fss.ElementAt(i);
                    var savedState = parcelable.JavaCast<Fragment.SavedState>();
                    _savedState.Add(savedState);
                }
            }

            var keys = bundle.KeySet();
            foreach (var key in keys)
            {
                if (!key.StartsWith("f"))
                    continue;

                var index = Integer.ParseInt(key.Substring(1));

                if (_fragmentManager.Fragments == null) return;

                var f = _fragmentManager.GetFragment(bundle, key);
                if (f != null)
                {
                    while (_fragments.Count() <= index)
                        _fragments.Add(null);

                    f.SetMenuVisibility(false);
                    _fragments[index] = f;
                }
            }
        }
            /// <summary>
            /// The disconnect.
            /// </summary>
            /// <param name="context">
            /// The context.
            /// </param>
            public void Disconnect(Context context)
            {
                if (this.isBound)
                {
                    context.UnbindService(this.serviceConnection);
                    this.isBound = false;
                }

                this.classLoader = null;
            }
 public override void RestoreState (IParcelable state, ClassLoader loader)
 {
     //Don't call restore to prevent crash on rotation
     //base.RestoreState (state, loader);
 }
Example #53
0
 /// <summary>
 /// Reloads the factory list from the given <seealso cref="ClassLoader"/>.
 /// Changes to the factories are visible after the method ends, all
 /// iterators (<seealso cref="#availableTokenizers()"/>,...) stay consistent. 
 /// 
 /// <para><b>NOTE:</b> Only new factories are added, existing ones are
 /// never removed or replaced.
 /// 
 /// </para>
 /// <para><em>This method is expensive and should only be called for discovery
 /// of new factories on the given classpath/classloader!</em>
 /// </para>
 /// </summary>
 public static void ReloadTokenizers(ClassLoader classloader)
 {
     loader.reload(classloader);
 }
Example #54
0
		/// <summary>
		/// Get class loader-like object that can be used
		/// to define classes with the given security context.
		/// </summary>
		/// <remarks>
		/// Get class loader-like object that can be used
		/// to define classes with the given security context.
		/// </remarks>
		/// <param name="parentLoader">
		/// parent class loader to delegate search for classes
		/// not defined by the class loader itself
		/// </param>
		/// <param name="securityDomain">
		/// some object specifying the security
		/// context of the code that is defined by the returned class loader.
		/// </param>
		public abstract GeneratedClassLoader CreateClassLoader(ClassLoader parentLoader, object securityDomain);
Example #55
0
 /// <summary>
 /// Reloads the factory list from the given <seealso cref="ClassLoader"/>.
 /// Changes to the factories are visible after the method ends, all
 /// iterators (<seealso cref="#availableCharFilters()"/>,...) stay consistent. 
 /// 
 /// <para><b>NOTE:</b> Only new factories are added, existing ones are
 /// never removed or replaced.
 /// 
 /// </para>
 /// <para><em>This method is expensive and should only be called for discovery
 /// of new factories on the given classpath/classloader!</em>
 /// </para>
 /// </summary>
 public static void reloadCharFilters(ClassLoader classloader)
 {
     loader.reload(classloader);
 }
Example #56
0
		/// <summary>Check that testClass is accessible from the given loader.</summary>
		/// <remarks>Check that testClass is accessible from the given loader.</remarks>
		internal static bool TestIfCanLoadRhinoClasses(ClassLoader loader)
		{
			Type testClass = ScriptRuntime.ContextFactoryClass;
			Type x = Kit.ClassOrNull(loader, testClass.FullName);
			if (x != testClass)
			{
				// The check covers the case when x == null =>
				// loader does not know about testClass or the case
				// when x != null && x != testClass =>
				// loader loads a class unrelated to testClass
				return false;
			}
			return true;
		}
Example #57
0
		internal NativeJavaTopPackage(ClassLoader loader) : base(true, string.Empty, loader)
		{
		}
Example #58
0
 /// <summary>
 /// Return the System ClassLoader
 /// </summary>
 /// <returns></returns>
 public ClassLoader getContextClassLoader()
 {
     if (null == contextClassLoader)
     {
         this.contextClassLoader =  ClassLoader.getSystemClassLoader();
     }
     return this.contextClassLoader;
 }
Example #59
0
		internal NativeJavaPackage(bool internalUsage, string packageName, ClassLoader classLoader)
		{
			this.packageName = packageName;
			this.classLoader = classLoader;
		}