system.security.PermissionSet Maven / Gradle / Ivy
/*
* MIT License
*
* Copyright (c) 2024 MASES s.r.l.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**************************************************************************************
*
* This code was generated from a template using JCOReflector v. 1.14.0.0
*
* Manual changes to this file may cause unexpected behavior in your application.
* Manual changes to this file will be overwritten if the code is regenerated.
*
*************************************************************************************/
package system.security;
import org.mases.jcobridge.*;
import org.mases.jcobridge.netreflection.*;
import java.util.ArrayList;
// Import section
import system.security.permissions.PermissionState;
import system.security.PermissionSet;
import system.security.IPermission;
import system.security.IPermissionImplementation;
import system.security.SecurityElement;
import system.Array;
import system.runtime.serialization.IDeserializationCallback;
import system.runtime.serialization.IDeserializationCallbackImplementation;
/**
* The base .NET class managing System.Security.PermissionSet, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
*
*
* .NET documentation at https://docs.microsoft.com/en-us/dotnet/api/System.Security.PermissionSet
*
*
* Powered by JCOBridge: more info at https://www.jcobridge.com
*
* @author MASES s.r.l https://masesgroup.com
* @version 1.14.0.0
*/
public class PermissionSet extends NetObjectEnumerable implements system.runtime.serialization.IDeserializationCallback {
/**
* Fully assembly qualified name: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
*/
public static final String assemblyFullName = "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
/**
* Assembly name: mscorlib
*/
public static final String assemblyShortName = "mscorlib";
/**
* Qualified class name: System.Security.PermissionSet
*/
public static final String className = "System.Security.PermissionSet";
static JCOBridge bridge = JCOBridgeInstance.getInstance(assemblyFullName);
/**
* The type managed from JCOBridge. See {@link JCType}
*/
public static JCType classType = createType();
static JCEnum enumInstance = null;
JCObject classInstance = null;
static JCType createType() {
try {
String classToCreate = className + ", "
+ (JCOReflector.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName);
if (JCOReflector.getDebug())
JCOReflector.writeLog("Creating %s", classToCreate);
JCType typeCreated = bridge.GetType(classToCreate);
if (JCOReflector.getDebug())
JCOReflector.writeLog("Created: %s",
(typeCreated != null) ? typeCreated.toString() : "Returned null value");
return typeCreated;
} catch (JCException e) {
JCOReflector.writeLog(e);
return null;
}
}
void addReference(String ref) throws Throwable {
try {
bridge.AddReference(ref);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
/**
* Internal constructor. Use with caution
*/
public PermissionSet(java.lang.Object instance) throws Throwable {
super(instance);
if (instance instanceof JCObject) {
classInstance = (JCObject) instance;
} else
throw new Exception("Cannot manage object, it is not a JCObject");
}
public String getJCOAssemblyName() {
return assemblyFullName;
}
public String getJCOClassName() {
return className;
}
public String getJCOObjectName() {
return className + ", " + (JCOReflector.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName);
}
public java.lang.Object getJCOInstance() {
return classInstance;
}
public void setJCOInstance(JCObject instance) {
classInstance = instance;
super.setJCOInstance(classInstance);
}
public JCType getJCOType() {
return classType;
}
/**
* Try to cast the {@link IJCOBridgeReflected} instance into {@link PermissionSet}, a cast assert is made to check if types are compatible.
* @param from {@link IJCOBridgeReflected} instance to be casted
* @return {@link PermissionSet} instance
* @throws java.lang.Throwable in case of error during cast operation
*/
public static PermissionSet cast(IJCOBridgeReflected from) throws Throwable {
NetType.AssertCast(classType, from);
return new PermissionSet(from.getJCOInstance());
}
// Constructors section
public PermissionSet() throws Throwable {
}
public PermissionSet(PermissionState state) throws Throwable, system.ArgumentException {
try {
// add reference to assemblyName.dll file
addReference(JCOReflector.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName);
setJCOInstance((JCObject)classType.NewObject(state == null ? null : state.getJCOInstance()));
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public PermissionSet(PermissionSet permSet) throws Throwable {
try {
// add reference to assemblyName.dll file
addReference(JCOReflector.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName);
setJCOInstance((JCObject)classType.NewObject(permSet == null ? null : permSet.getJCOInstance()));
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
// Methods section
public boolean ContainsNonCodeAccessPermissions() throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.NotSupportedException, system.ArgumentNullException, system.ObjectDisposedException, system.InvalidOperationException, system.NullReferenceException, system.FormatException, system.security.SecurityException, system.MissingMethodException, system.reflection.TargetInvocationException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
return (boolean)classInstance.Invoke("ContainsNonCodeAccessPermissions");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public boolean IsEmpty() throws Throwable, system.ArgumentOutOfRangeException, system.ArgumentException, system.NotSupportedException, system.ArgumentNullException, system.ObjectDisposedException, system.InvalidOperationException, system.NullReferenceException, system.FormatException, system.security.SecurityException, system.MissingMethodException, system.reflection.TargetInvocationException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
return (boolean)classInstance.Invoke("IsEmpty");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public boolean IsSubsetOf(PermissionSet target) throws Throwable, system.ArgumentOutOfRangeException, system.NotSupportedException, system.ArgumentNullException, system.NullReferenceException, system.ArgumentException, system.security.SecurityException, system.InvalidOperationException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
return (boolean)classInstance.Invoke("IsSubsetOf", target == null ? null : target.getJCOInstance());
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public boolean IsUnrestricted() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
return (boolean)classInstance.Invoke("IsUnrestricted");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public static byte[] ConvertPermissionSet(java.lang.String inFormat, byte[] inData, java.lang.String outFormat) throws Throwable, system.NotImplementedException {
if (classType == null)
throw new UnsupportedOperationException("classType is null.");
try {
ArrayList resultingArrayList = new ArrayList();
JCObject resultingObjects = (JCObject)classType.Invoke("ConvertPermissionSet", inFormat, inData, outFormat);
for (java.lang.Object resultingObject : resultingObjects) {
resultingArrayList.add(resultingObject);
}
byte[] resultingArray = new byte[resultingArrayList.size()];
for(int indexConvertPermissionSet = 0; indexConvertPermissionSet < resultingArrayList.size(); indexConvertPermissionSet++ ) {
resultingArray[indexConvertPermissionSet] = (byte)resultingArrayList.get(indexConvertPermissionSet);
}
return resultingArray;
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public static byte[] ConvertPermissionSet(java.lang.String dupParam0, JCORefOut dupParam1, java.lang.String dupParam2) throws Throwable, system.NotImplementedException {
if (classType == null)
throw new UnsupportedOperationException("classType is null.");
try {
ArrayList resultingArrayList = new ArrayList();
JCObject resultingObjects = (JCObject)classType.Invoke("ConvertPermissionSet", dupParam0, dupParam1.getJCRefOut(), dupParam2);
for (java.lang.Object resultingObject : resultingObjects) {
resultingArrayList.add(resultingObject);
}
byte[] resultingArray = new byte[resultingArrayList.size()];
for(int indexConvertPermissionSet = 0; indexConvertPermissionSet < resultingArrayList.size(); indexConvertPermissionSet++ ) {
resultingArray[indexConvertPermissionSet] = (byte)resultingArrayList.get(indexConvertPermissionSet);
}
return resultingArray;
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public IPermission AddPermission(IPermission perm) throws Throwable, system.ArgumentException, system.NotSupportedException, system.ArgumentNullException, system.ObjectDisposedException, system.threading.AbandonedMutexException, system.globalization.CultureNotFoundException, system.ArgumentOutOfRangeException, system.InvalidOperationException, system.FormatException, system.security.SecurityException, system.MissingMethodException, system.reflection.TargetInvocationException, system.NullReferenceException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject objAddPermission = (JCObject)classInstance.Invoke("AddPermission", perm == null ? null : perm.getJCOInstance());
return new IPermissionImplementation(objAddPermission);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public IPermission GetPermission(NetType permClass) throws Throwable, system.ArgumentException, system.security.SecurityException, system.ArgumentNullException, system.NotImplementedException, system.NotSupportedException, system.InvalidOperationException, system.MissingMethodException, system.MemberAccessException, system.reflection.TargetException, system.reflection.TargetParameterCountException, system.FormatException, system.ObjectDisposedException, system.threading.AbandonedMutexException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject objGetPermission = (JCObject)classInstance.Invoke("GetPermission", permClass == null ? null : permClass.getJCOInstance());
return new IPermissionImplementation(objGetPermission);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public IPermission RemovePermission(NetType permClass) throws Throwable, system.ArgumentException, system.security.SecurityException, system.ArgumentNullException, system.NotImplementedException, system.NotSupportedException, system.InvalidOperationException, system.MissingMethodException, system.MemberAccessException, system.reflection.TargetException, system.reflection.TargetParameterCountException, system.FormatException, system.ObjectDisposedException, system.threading.AbandonedMutexException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject objRemovePermission = (JCObject)classInstance.Invoke("RemovePermission", permClass == null ? null : permClass.getJCOInstance());
return new IPermissionImplementation(objRemovePermission);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public IPermission SetPermission(IPermission perm) throws Throwable, system.ArgumentException, system.NotSupportedException, system.ArgumentNullException, system.ObjectDisposedException, system.threading.AbandonedMutexException, system.globalization.CultureNotFoundException, system.ArgumentOutOfRangeException, system.NullReferenceException, system.FormatException, system.security.SecurityException, system.InvalidOperationException, system.MissingMethodException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject objSetPermission = (JCObject)classInstance.Invoke("SetPermission", perm == null ? null : perm.getJCOInstance());
return new IPermissionImplementation(objSetPermission);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public PermissionSet Copy() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject objCopy = (JCObject)classInstance.Invoke("Copy");
return new PermissionSet(objCopy);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public PermissionSet Intersect(PermissionSet other) throws Throwable, system.ArgumentNullException, system.TypeLoadException, system.ArgumentException, system.InvalidOperationException, system.MissingMethodException, system.reflection.TargetInvocationException, system.NotSupportedException, system.globalization.CultureNotFoundException, system.ArgumentOutOfRangeException, system.OutOfMemoryException, system.FormatException, system.NullReferenceException, system.security.SecurityException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject objIntersect = (JCObject)classInstance.Invoke("Intersect", other == null ? null : other.getJCOInstance());
return new PermissionSet(objIntersect);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public PermissionSet Union(PermissionSet other) throws Throwable, system.ArgumentNullException, system.TypeLoadException, system.ArgumentException, system.InvalidOperationException, system.MissingMethodException, system.reflection.TargetInvocationException, system.NotSupportedException, system.globalization.CultureNotFoundException, system.ArgumentOutOfRangeException, system.OutOfMemoryException, system.FormatException, system.NullReferenceException, system.security.SecurityException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject objUnion = (JCObject)classInstance.Invoke("Union", other == null ? null : other.getJCOInstance());
return new PermissionSet(objUnion);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public SecurityElement ToXml() throws Throwable, system.ArgumentNullException, system.ArgumentException, system.InvalidOperationException, system.MissingMethodException, system.reflection.TargetInvocationException, system.globalization.CultureNotFoundException, system.ArgumentOutOfRangeException, system.OutOfMemoryException, system.FormatException, system.NotSupportedException, system.NullReferenceException, system.security.SecurityException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject objToXml = (JCObject)classInstance.Invoke("ToXml");
return new SecurityElement(objToXml);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void Assert() throws Throwable, system.security.SecurityException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Invoke("Assert");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void CopyTo(Array array, int index) throws Throwable, system.ArgumentNullException, system.ArgumentException, system.ArgumentOutOfRangeException, system.NotSupportedException, system.ObjectDisposedException, system.InvalidOperationException, system.NullReferenceException, system.FormatException, system.security.SecurityException, system.MissingMethodException, system.reflection.TargetInvocationException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Invoke("CopyTo", array == null ? null : array.getJCOInstance(), index);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void Demand() throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.NotSupportedException, system.ArgumentNullException, system.InvalidOperationException, system.NullReferenceException, system.FormatException, system.security.SecurityException, system.MissingMethodException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Invoke("Demand");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void Deny() throws Throwable, system.InvalidOperationException, system.NotSupportedException, system.security.SecurityException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Invoke("Deny");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void FromXml(SecurityElement et) throws Throwable, system.ArgumentNullException, system.NullReferenceException, system.ArgumentOutOfRangeException, system.OutOfMemoryException, system.FormatException, system.ArgumentException, system.globalization.CultureNotFoundException, system.TypeLoadException, system.InvalidOperationException, system.security.SecurityException, system.NotImplementedException, system.NotSupportedException, system.MemberAccessException, system.reflection.TargetException, system.reflection.TargetParameterCountException, system.MissingMethodException, system.reflection.TargetInvocationException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Invoke("FromXml", et == null ? null : et.getJCOInstance());
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public void PermitOnly() throws Throwable, system.security.SecurityException {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
classInstance.Invoke("PermitOnly");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public static void RevertAssert() throws Throwable, system.InvalidOperationException {
if (classType == null)
throw new UnsupportedOperationException("classType is null.");
try {
classType.Invoke("RevertAssert");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
/**
* @deprecated Not for public use because the method is implemented in .NET with an explicit interface.
* Use the static ToIDeserializationCallback method available in IDeserializationCallback to obtain an object with an invocable method
*/
@Deprecated
public void OnDeserialization(NetObject sender) throws Throwable {
throw new UnsupportedOperationException("Not for public use because the method is implemented with an explicit interface. Use ToIDeserializationCallback to obtain the full interface.");
}
// Properties section
public boolean getIsReadOnly() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
return (boolean)classInstance.Get("IsReadOnly");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public boolean getIsSynchronized() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
return (boolean)classInstance.Get("IsSynchronized");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public int getCount() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
return (int)classInstance.Get("Count");
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public NetObject getSyncRoot() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject val = (JCObject)classInstance.Get("SyncRoot");
return new NetObject(val);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
// Instance Events section
}