How to revoke and grant permission in java using Security Manager  ??

I like to revoke and grant permission through java code..can anybody give me a sample code.

Discussion is here:
http://forum.java.sun.com/thread.jspa?threadID=731363

Similar Messages

  • How to audio and video Broadcasting in Java using Java Media Framework

    Hi to all members of this forum
    well these days i m working on my final year project in this i have to implement audio video broadcasting over the network so if any one of u have done it can any one kindly help me out n let me know how i can implement it m email is [email protected] do reply me

    Discussion is here:
    http://forum.java.sun.com/thread.jspa?threadID=731363

  • How to download and upload files in Java?

    Hi, everyone
    How to download and upload files in Java? Do you have some references about this issue or some valuable web link�? Thanks!
    Best Regards,
    Hai.Ren

    This is too vague a question, please be more specific. What protocol would you like to use? HTTP? FTP? Something else?

  • I updated java yesterday and I get a java.lang.security.exception. how do I fix it?

    I updated java yesterday and I get a java.lang.security.exception. how do i fix this?

    Hello russhend,
    i think this one should help you to understand your problem and then solve it.
    https://forums.oracle.com/thread/2179273.
    Thank you.

  • How to read and XSD file in java prospective in NWDS

    Hi !!
    anybody can help me that
    how to read and XSD file in java prospective in Netweaver developer Studio
    Regards
    Abhishek Agrahari

    I guess you can make it more clear...

  • How to update and insert the records without using Table_comparison and Map_operation?

    How to update and insert the records without using Table_comparison and Map_operation?

    Use either join or MERGE see this Inserting, Updating, and Deleting Data by Using MERGE

  • How long should and Iphone 4S battery last using wifi continuously and having all notofocations and locations services ON and Off???

    1. Hi, How long should and Iphone 4S battery last using wifi continuously and having all notofocations and locations services ON and Off???
    2. What battery percentage should use if I do not make calls all day and wifi is on?
    3. What battery percentage should use if I do not make calls all day and wifi is off?
    4. If I do not have a Sim Card inside my Iphone 4S will the phone use more battery life?
    5. In what time should the iphone normally discharge?
    6. Basically how would i know if my battery is not defective as some people say?

    all your questions are relative to individual use, therefore nobody could give you any definitive answer to any of them.

  • Java -Djava.security.manager -Djava.security.policy=myPolicy classfile

    Hi everybody and Sun's member,
    From the command line we can install security manager as follows :
    java -Djava.security.manager - Djava.security.policy=myPolicy
    is it possible to install security manager and policy file by our program. Sugestion pliz.
    Regards
    Gt

    Thanks for your sugesstion. With this command "java -Djava.security.manager - Djava.security.policy=myPolicy" we are installing Security Manager and Policy file. What will be the minimum code for the above command, as I want to install dynamically (I mean how to spacify and install Security manager and policy files by programatically). Appreatiating anybodies sugesstion.
    Regards
    Gt

  • How add grant permission in java.policy

    hi master
    sir serch in my system
    C:\Program Files\j2sdk_nb\j2sdk1.4.2\jre\lib\security
    C:\Program Files\j2sdk_nb\_jvm\lib\security
    C:\Program Files\Java\j2re1.4.1_03\lib\security
    C:\Program Files\Java\jre1.5.0_10\lib\security
    sir i have many java.policy file which one is default java.policy file
    how i add the code
    permission java.util.PropertyPermission "java.version", "read";
    permission java.util.PropertyPermission "java.vendor", "read";
    permission java.util.PropertyPermission "java.vendor.url", "read";
    permission java.util.PropertyPermission "java.class.version", "read";
    permission java.util.PropertyPermission "os.name", "read";
    permission java.util.PropertyPermission "os.version", "read";
    permission java.util.PropertyPermission "os.arch", "read";
    permission java.util.PropertyPermission "file.separator", "read";
    permission java.util.PropertyPermission "path.separator", "read";
    permission java.util.PropertyPermission "line.separator", "read";
    permission java.util.PropertyPermission "java.specification.version", "read";
    permission java.util.PropertyPermission "java.specification.vendor", "read";
    permission java.util.PropertyPermission "java.specification.name", "read";
    permission java.util.PropertyPermission "java.vm.specification.version", "read";
    permission java.util.PropertyPermission "java.vm.specification.vendor", "read";
    permission java.util.PropertyPermission "java.vm.specification.name", "read";
    permission java.util.PropertyPermission "java.vm.version", "read";
    permission java.util.PropertyPermission "java.vm.vendor", "read";
    permission java.util.PropertyPermission "java.vm.name", "read";
    and this code
    grant codeBase "C:\Program Files\j2sdk_nb\j2sdk1.4.2\jre\lib\security
    permission java.security.AllPermission;
    give me idea how i add my code in java.policy file of using the oracle database in applete
    thank
    aamir

    in the control panel see what runtime is used by ur applet, mostly the lastest one u installed.
    C:\Program Files\Java\jre1.5.0_10\lib\security
    in this folder grant permission for the codebase where ur database is located.

  • How to set the granted permission in RMI SERVER site

    Hi everyone,
    I have developin some simple RMi program but the error message is keep on prompting out and I cant really test out what is the result. I understand I got to GRANT the permission for the RMI but I I dun really know where should I start first. I know there are code that can be implement in the sErver site, just hope some one can guide me out.
    Thank lot...
    here is the code for server:
    import java.rmi.*;
    import java.rmi.server.UnicastRemoteObject;
    public class myRMIServer
    public static void main(String[] argv)
    System.setSecurityManager(new RMISecurityManager());
    try
    myRMIImpl implementation = new myRMIImpl("myRMIImplInstance");
    catch (Exception e)
    System.out.println("Exception occurred: " + e);
    Where should i code the getProperties and setProperties code...

    so, what u mean is the problem occur doesnt related to coding part ?? do you think it is because I did not start the rmiRegistry, but somehow when i started the rmiRegistry, the console window is blank an it is nothing in the window. pls pls help me to solve this problem... sound easy initially but end up it is not...
    by the way, here is the code
    Interface
    public interface myRMIInterface extends java.rmi.Remote
    public java.util.Date getDate() throws java.rmi.RemoteException;
    Interface Implementation
    import java.rmi.*;
    import java.rmi.server.UnicastRemoteObject;
    public class myRMIImpl extends UnicastRemoteObject implements myRMIInterface
    public myRMIImpl(String name) throws RemoteException
    super();
    try
    Naming.rebind(name, this);
    catch(Exception e)
    System.out.println("Exception occurred: " + e);
    public java.util.Date getDate()
    return new java.util.Date();
    server
    import java.rmi.*;
    import java.rmi.Naming;
    import java.rmi.RMISecurityManager;
    import java.rmi.server.UnicastRemoteObject;
    import java.rmi.registry.LocateRegistry;
    import java.util.Properties;
    public class myRMIServer
    public static void main(String[] argv)
    //System.setProperty("java.security.policy","C:\\workspace\\MyRMI\\java.policy");           
    //System.getProperty("java.security.policy","C:\\workspace\\MyRMI\\java.policy");
         //myRMIServer m = System.getProperties();
         //m.setProperty("java.security.policy","C:\\workspace\\MyRMI\\java.policy");
         //System.setSecurityManager(new RMISecurityManager());
    //Properties p = System.getProperties();
    //p.setProperty("java.security.policy","C:\\workspace\\MyRMI\\java.policy");
    try
    myRMIImpl implementation = new myRMIImpl("myRMIImplInstance");
    Properties p = System.getProperties();
         System.setProperty("java.security.policy","C:\\workspace\\MyRMI\\java.policy.txt");
         System.setProperty("java.rmi.server.codebase","file:///P:\\Projects\\RMIServer\\bin");
         if (System.getSecurityManager() == null) {
         System.setSecurityManager(new RMISecurityManager());
         System.out.println("Security manager registered");
         //System.out.println("Service registered");
    catch (Exception e)
    System.out.println("Exception occurred: " + e);
    here is the code, to run, I got a client one as well, but is just for displat purpose..
    thank you, guys....really appreciate ur help

  • How to read  and write XML in java

    I have a code that reads a large XML file, splits it into smaller files, filters and then writes it into a new XML file. My problem is that I had coded the input file name into the code, so that only the specified file can be read. How can I rewrite my code to be able to take any input xml and perform the same operation? Here's a portion of my code below:
                            File file = new File("c:\\APAdjustmentJVDoc_FINAL.xml");
                        output = new BufferedWriter(new FileWriter(file));
                        for (int i = 1; i < 79; i++) {
                             fIStream = new FileInputStream("c:\\APAdjustmentJVDoc_new" + i + ".xml");
                             loRead = new InputStreamReader(fIStream);
                             doc = XMLUtil.transformToNode(loRead, false);
                             System.out.println("Reading from file " + "c:\\APAdjustmentJVDoc_new" + i + ".xml");
                             writeFile(doc, docIdList, output);
                             fIStream.close();
                             loRead.close();
                        System.out.println("Output file complete");
                   } catch (Exception e) {
                        e.printStackTrace();
                   } finally {
                        if (output != null) {
                             output.close();
                        if (fIStream != null) {
                             fIStream.close();
              } catch (Exception e) {
                   e.printStackTrace();
                 

    You need to pass your filename String as a parameter to your functionality. It depends how you're currently set up though. We can't really see the top of your call so it's difficult to determine what you are calling and we don't really know from where you're calling either.
    If you're running standalone, then on launch of the application, you can feed in a file name as an argument that you can read in in String args[] in the main function and pass down to your XML splitter.
    If you're a method in a class that's part of a bigger pile, you can feed the file name as a String to the method from wherever you call from if it makes sense architecturally.
    You might also want to pass down a File object if that makes sense in your current code (i.e. if you're using your file for other purposes prior to the split, to avoid recreating closing/opening for no reason).
    Depends what you're trying to do. If I put together a piece like this, I would probably create an <yourcurrentrootpackage>.xml.splitter package.
    Also, on a side note, you're problem isn't really reading and writing XML in java, but seems more to be making your functionality generic so that any XML file can be split with your code.
    Regards
    JFM

  • How to create and edit a .ini file using java

    Hi All...
    Pls help me in creating and editing an .ini file using java...
    thanks in advance
    Regards,
    sathya

    Let's assume the ini file is a mapping type storage (key=value) so lets use Properties object. (works with java 1.4 & up)
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.util.Properties;
    public class Test {
         private static Properties props;
         public static void main(String[] args) throws IOException {
              File file = new File("test.ini");//This is out ini file
              props = new Properties();//Create the properties object
              read(file);//Read the ini file
              //Once we've populated the Properties object. set/add a property using the setProperty() method.
              props.setProperty("testing", "value");
              write(file);//Write to ini file
         public static void read(File file) throws IOException {
              FileInputStream fis = new FileInputStream(file);//Create a FileInputStream
              props.load(fis);//load the ini to the Properties file
              fis.close();//close
         public static void write(File file) throws IOException {
              FileOutputStream fos = new FileOutputStream(file);//Create a FileOutputStream
              props.store(fos, "");//write the Properties object values to our ini file
              fos.close();//close
    }

  • How to revoke all grants given to a role

    Hi,
    I need a single sql query to revoke all grants given to a role. Dropping a role is not a option before me .
    Can someone help me with the query:
    Regds,
    Kunwar

    Hi Pawan,
    I used this query to find out the grants given to a role.
    But i dont know PL/SQL. Can you help me with the pl/sql code ? :)
    ++++++++++++++++++++
    select 'ROLE' typ,
    grantee grantee,
    granted_role priv,
    admin_option ad,
    '--' tabnm,
    '--' colnm,
    '--' owner
    from dba_role_privs
    where grantee='KUNDBO91_ALL'
    union
    select 'SYSTEM' typ,
    grantee grantee,
    privilege priv,
    admin_option ad,
    '--' tabnm,
    '--' colnm,
    '--' owner
    from dba_sys_privs
    where grantee='KUNDBO91_ALL'
    union
    select 'TABLE' typ,
    grantee grantee,
    privilege priv,
    grantable ad,
    table_name tabnm,
    '--' colnm,
    owner owner
    from dba_tab_privs
    where grantee='KUNDBO91_ALL'
    union
    select 'COLUMN' typ,
    grantee grantee,
    privilege priv,
    grantable ad,
    table_name tabnm,
    column_name colnm,
    owner owner
    from dba_col_privs
    where grantee='KUNDBO91_ALL'
    order by 1;
    ++++++++++++++++++++

  • How to fetch and display arbitrary log files from a managed host?

    We are creating a small management portal for a custom application and need a way to display, in a browser, the contents of an arbitrary log file located on an EM managed host. The effect we are looking for is similar to what you get when you show the contents of a database alert log using EM.
    I want to extend the EM agent to get the log and display the contents, but see two problems: (1) it seems like we would have to schedule the fetch of the log contents to happen on a regular basis and would not be able to do it on demand and (2) storing the results in the EM repository seems like it could consume a pile of storage, even if it only stores the logs for 24 hours.
    I am pretty sure we can bypass the repository somehow because I think the "show database alert log" EM process does so. Of course, I can't really be sure how this code is getting the alert log, but it seems reasonable to assume it is using the management agent.
    Is there some API for the EM Agent that I am missing?
    Any ideas would be appreciated.

    From within OEM it doesnt look possible. User defined metrics (UDM) can only return number or a string. The alertlog fetch is done via alertlogViewer.pl while being passed a couple of parameters.
    OEM does have a preliminary/rough api available at http://www.oracle.com/technology/products/oem/emx/index.html but I havent seen anyone make use of it yet.
    If you use just a web connection then you will probably run into security issues as a web server can usually only view/access stuff under their htmldoc dir.
    Seems like some non-OEM very custom code is what you seek..

  • How to save and download json to make use of a app in offline mode

    how to download and save a json file from url to make use of a app in offline mode and if internet is available it should take data from url only and display it in tableview..but  for the second time it should make use of the saved json data to display the table view data in app.

    Hi,
    Using F calls a routine and not BAdI.
    If record will directly be created then there is no need to write Z program and calling it using F indicator. However, in case there is some logic which can not be written directly in the Dynamic Action then you need to write that logic in a routine and call it using F indicator.
    VK

Maybe you are looking for