Write to i2c Register from java

My setup: Java 1.5, SUSE Linux 10.2
I'm trying to set registers over i2c.
From command line this can be done using "i2cset [options] [bus_address] [chip_address] [register] [value] b".
I'd like to do this without using the command line, directly from java (may be using JNI and some native libraries).
I searched google, tried to find some examples at koders.com - but no luck.
I hope someone can point me in the right direction... Any hint on this subject is highly appreciated!

Yes, as I described, i don't want to use Runtime.exec().
There are many registers which have to be set alternating, so i2cset has to be executed over 4 times a second - which is bad.
I'm currently doing this in my application:
ProcessBuilder pb = new ProcessBuilder(new String[] { I2C_SET_CMD, I2C_OPTION_NOQUESTIONS, I2C_BUS_ADRESS,
          I2C_CHIP_ADRESS, register, value, "b" });
Process p = pb.start();
int exitCode = p.waitFor();The problem is, that there are Filehandles left open (by i2cset?? I think so...) and that crashes linux after some hours of operating (to many open files).
That's the reason, why I'm looking for a solution without Runtime.exec() and especially without using ic2set.
At the moment I don't have native libraries or even native code to do this. Is there a native library which can be used from within java to set i2c Registers?
Or is it somehow possible to do address i2c registers directly from java (whitout using native code)?

Similar Messages

  • Read, Write and create files from java applet.

    Dear All,
    I have created a two files. One is applet and one application file. I am creating a instance of application file in applet. Application file is used for reading, writing and creating files. When I invoke applet from broser it dipslays error wrt file access permission. From the forum search I know that we need to sign the applet / edit the java policy to run the code locally. Final delivery of my code should execute on different system. Its not web. I have created a html page on submitting the form it invokes applet to read the form values from param and needs to update the values in xml file located locally. Please help me on how I can proceed with this fix.
    Thanks in advance.

    Sorry if I have not stated the problem clearly. I need to update content to files hosted in local system using java applets.
    I belive there are two ways to achive that.One with jar signer and one with modifying the java policy file. But this application needs to be installed in different system locally as I have created a application with webpage as useinterface and need to update the content in local files on submission. Not sure on how to modify the java.policy files in each end user system and whats the value we need to update in java policy file. Please help me on the steps to be followed

  • Accessing I2C From Java

    Has anyone had any experience accessing I2C devices using Java. I am currently running a J2ME CVM on arm-linux and I have the device file /dev/i2c-0. I have run a few supplied test programs which scan the bus and show me that the devices are operational. But now I need to be able to write and read using Java.
    Thanks

    Since you need to use a bunch of different IOCTLS with this device, it seems that a JNI adaptor would be in order.

  • Write a file on client from java procedure

    Hello to all, my problem is that i want to write a file from a java procedure using the normal java class. But when i try to write
    File file=new File("C:\\DiscoD\\myFile.txt");
    FileWriter fw=new FileWriter(file);
    fw.write("ciao");
    nothing happens and no file is created. How can i write a file on my pc client from java procedure?
    Thanks to anyone that want helps me.

    I want to write a java procedure loading java class on oracle with utility loadjava and this work for example for classical Hello World. Now i want to write data on a text file on my hard disk using class java calling the procedure for example in this mode:
    begin
    procedure('ciao'); //this procedure have to write on a file located on my pc the word ciao
    end;
    But nothing happens. Why? There is a special reason related to how oracle works(privileges, permission etc)?
    Thanks

  • Write out file from java UDF?

    I have a synchronous RFC->XI->HTTP (no BPM) process and need to write out a log of the call details each time it runs.  At first, I tried having multiple receivers (one for HTTP and one for log file) in IB:Config, but received an error that I "cannot have multiple receivers when synchronous call".
    Should I be able to write out a file using java code in a UDF?  Should I do something with a BPM (and if so, any hints)?
    Thanks in advance!

    It deppends on which kind of log you want and how much time you're willing to spend on this.
    If you want to learn BPM and has available time to learn and implement, go for it. It will provide you more flexibility (since you can use any adapter protocol) and is way better for maintenance purposes.
    Your BPM will basically have 4 steps:
    1. A Receiver step in "Open S/A Bridge" mode;
    2. A Sender step in Asynchronous mode (to send the log message to your target system);
    3. A Sender step in Synchronous mode (to send the request to HTTP and receive the response);
    4. A Sender step in "Close S/A Bridge" mode.
    The mapping can be made in three ways:
    1. mapping between RFC and BPM (so your BPM will have abstract interfaces based on HTTP interface); or
    2. mapping between BPM and HTTP (so your BPM will have abstract interfaces based on RFC interface); or
    3. create 2 transformation steps in the BPM, one to map from RFC.request to HTTP.request and the other to map from HTTP.response to RFC.response (I'd not recomend this).
    Regards,
    Henrique.

  • How register COM object from java?

    Hi!
    In my user home directory I have myCOM.dll. My sign applet use this myCOM.dll. But before use this dll I must register it (by use regsvr32).When myCOM.dll will be success register my applet can work. The problem is that I can not get answer from regsvr3 (is myCOM.dll are successed registered or not, or is user has a grants to register COM object and so on.)
    Again, my java applet can work ONLY when myCOM.dll is registered.
    How I can register myCOM.dll from java applet and if registered is not success exit from java applet?

    I must not have been clear. I am not asking how to access a COM object using Java, we already have tools to do that.
    The question is whether there is a way to define a COM interface using Java. I want to code my COM object in Java. Right now we are using PowerBuilder to code COM objects. I would rather use Java.

  • Error trying to register a Java event listener

    I'm trying to register a java event listener in 11g with the following piece of code:
    DECLARE
    b BOOLEAN := FALSE;
    BEGIN
    b := DBMS_XDB.createFolder('/public/resconfig');
    b := DBMS_XDB.createResource(
    '/public/resconfig/hr_event.xml',
    '<ResConfig xmlns="http://xmlns.oracle.com/xdb/XDBResConfig.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.oracle.com/xdb/XDBResConfig.xsd
    http://xmlns.oracle.com/xdb/XDBResConfig.xsd">
    <event-listeners default-language="Java">
    <listener>
    <description>Category application</description>
    <schema>HR</schema>
    <source>xdbproject.OpenOfficeEventHandler</source>
    <language>Java</language>
    <events>
    <Post-Create/>
    <Post-LinkIn/>
    </events>
    </listener>
    </event-listeners>
    <defaultChildConfig>
    <configuration>
    <path>/public/resconfig/hr_event.xml</path>
    </configuration>
    </defaultChildConfig>
    </ResConfig>');
    END;
    This results in the following error message
    ORA-31146: Ugyldig lytterkilde HR.xdbproject.OpenOfficeEventHandler
    ORA-06512: ved "XDB.DBMS_XDB", line 174
    ORA-06512: ved line 5
    which translates to Invalid listener source.
    My class is loaded in the HR schema, and implements the XDBRepositoryEventListener
    Does anybody have a suggestion to what I'm doing wrong, or how I can find out what makes my class invalid as a listener source?

    Check if it validates against the restrictions set in the XML Schema (Appendix A, Oracle XMLDB Developers Guide):
    XDBResConfig.xsd: XML Schema for Resource Configuration
    This section presents the Oracle XML DB supplied XML schema used to configure repository resources. This is accessible in Oracle XML DB Repository at path /sys/schemas/PUBLIC/xmlns.oracle.com/xdb/XDBResConfig.xsd.
    XDBResConfig.xsd
    <schema xmlns="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://xmlns.oracle.com/xdb/XDBResConfig.xsd"
            xmlns:xdb="http://xmlns.oracle.com/xdb"
            xmlns:rescfg="http://xmlns.oracle.com/xdb/XDBResConfig.xsd"
            elementFormDefault="qualified" xdb:schemaOwner="XDB" version="1.0" >
      <annotation>
        <documentation>
          This XML schema declares the schema of an XDB resource configuration,
          which includes default ACL, event listeners and user configuration.
          It lists all XDB repository events that will be supported.
          Future extension can be added to support user-defined events and
          XML events.
        </documentation>
      </annotation>
      <simpleType name="language">
        <restriction base="string">
          <enumeration value="Java" />
          <enumeration value="C" />
          <enumeration value="PL/SQL" />
        </restriction>
      </simpleType>
      <complexType name = "existsNode">
         <all>
           <element name="XPath" type = "string" minOccurs="1" maxOccurs="1" />
           <element name="namespace" type = "string" minOccurs="0" maxOccurs="1" />
         </all>
      </complexType>
      <!-- listener pre-condition element  -->
      <complexType name = "condition">
         <all>
           <element name="existsNode" type = "rescfg:existsNode" minOccurs="0" maxOccurs="1" />
         </all>
      </complexType>
      <complexType name = "events">
        <all>
          <element name="Render" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Pre-Create" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Post-Create" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Pre-Delete" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Post-Delete" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Pre-Update" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Post-Update" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Pre-Lock" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Post-Lock" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Pre-Unlock" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Post-Unlock" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Pre-LinkIn" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Post-LinkIn" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Pre-LinkTo" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Post-LinkTo" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Pre-UnlinkIn" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Post-UnlinkIn" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Pre-UnlinkFrom" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Post-UnlinkFrom" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Pre-CheckIn" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Post-CheckIn" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Pre-CheckOut" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Post-CheckOut" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Pre-UncheckOut" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Post-UncheckOut" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Pre-VersionControl" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Post-VersionControl" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Pre-Open" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Post-Open" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Pre-InconsistentUpdate" type="string" minOccurs="0" maxOccurs="1"/>
          <element name="Post-InconsistentUpdate" type="string" minOccurs="0" maxOccurs="1"/>
        </all>
      </complexType>
      <!-- event listener element  -->
      <complexType name = "event-listener">
        <all>
          <element name="description" type = "string" minOccurs="0" maxOccurs="1"/>
          <element name="schema" type = "string" minOccurs="0" maxOccurs="1"/>
          <element name="source" type = "string" minOccurs="1" maxOccurs="1"/>
          <element name="language" type = "rescfg:language" minOccurs="0" maxOccurs="1"/>
          <element name="pre-condition" type = "rescfg:condition" minOccurs="0" maxOccurs="1"/>
          <element name="events" type = "rescfg:events" minOccurs="0" maxOccurs="1"/>
        </all>
      </complexType>
      <complexType name="event-listeners">
        <sequence>
          <element name="listener" type = "rescfg:event-listener" minOccurs="1" maxOccurs="unbounded"/>
        </sequence>
        <attribute name = "default-schema" type = "string" xdb:baseProp="true" use="optional"/>
        <attribute name = "default-language" type = "rescfg:language" xdb:baseProp="true"
                   use="optional"/>
        <attribute name = "set-invoker" type = "boolean" xdb:baseProp="true" default="false" />
      </complexType>
      <complexType name="defaultPath">
        <all>
          <element name="pre-condition" type = "rescfg:condition" minOccurs="0" maxOccurs="1"/>
          <element name="path" type="string" minOccurs="0" maxOccurs="1" xdb:transient="generated"/>
          <element name = "resolvedpath" type = "string" minOccurs="1" maxOccurs="1"
                   xdb:baseProp="true" xdb:hidden="true"/>
          <element name = "oid" type = "hexBinary" minOccurs="1" maxOccurs="1" xdb:baseProp="true"
                   xdb:hidden="true"/>
        </all>
      </complexType>
      <complexType name="defaultACL">
        <sequence>
          <element name="ACL" type="rescfg:defaultPath" minOccurs="1" maxOccurs="unbounded"/>
        </sequence>
      </complexType>
      <complexType name = "defaultConfig">
        <sequence>
          <element name="configuration" type="rescfg:defaultPath" minOccurs="1" maxOccurs="unbounded"/>
        </sequence>
      </complexType>
      <simpleType name="link-type">
        <restriction base="string">
          <enumeration value="None"/>
          <enumeration value="Hard"/>
          <enumeration value="Weak"/>
          <enumeration value="Symbolic"/>
        </restriction>
      </simpleType>
      <simpleType name="path-format">
        <restriction base="string">
          <enumeration value="OID"/>
          <enumeration value="Named"/>
        </restriction>
      </simpleType>
      <simpleType name="link-metadata">
        <restriction base="string">
          <enumeration value="None"/>
          <enumeration value="Attributes"/>
          <enumeration value="All"/>
        </restriction>
      </simpleType>
      <simpleType name="unresolved-link">
        <restriction base="string">
          <enumeration value="Error"/>
          <enumeration value="SymLink"/>
          <enumeration value="Skip"/>
        </restriction>
      </simpleType>
      <simpleType name="conflict-rule">
        <restriction base="string">
          <enumeration value="Error"/>
          <enumeration value="Overwrite"/>
          <enumeration value="Syspath"/>
        </restriction>
      </simpleType>
       <simpleType name="section-type">
         <restriction base="string">
           <enumeration value="None"/>
           <enumeration value="Fragment"/>
           <enumeration value="Document"/>
         </restriction>
       </simpleType>
      <!-- XLinkConfig complex type -->
        <complexType name="xlink-config">
         <sequence>
          <element name="LinkType" type = "rescfg:link-type"/>
          <element name="PathFormat" type = "rescfg:path-format" minOccurs="0" default="OID"/>
          <element name="LinkMetadata" type = "rescfg:link-metadata" minOccurs="0" default="None"/>
         </sequence>
         <attribute name="UnresolvedLink" type = "rescfg:unresolved-link" default="Error"/>
        </complexType>
      <!-- XIncludeConfig element -->
        <complexType name="xinclude-config">
         <sequence>
          <element name="LinkType" type = "rescfg:link-type"/>
          <element name="PathFormat" type = "rescfg:path-format" minOccurs="0" default="OID"/>
          <element name="ConflictRule" type = "rescfg:conflict-rule" minOccurs="0" default="Error"/>
         </sequence>
         <attribute name="UnresolvedLink" type = "rescfg:unresolved-link" default="Error"/>
        </complexType>
      <!-- SectionConfig element -->
      <complexType name="section-config">
       <sequence>   
        <element name="Section" maxOccurs="unbounded">
          <complexType>
            <sequence>
             <element name="sectionPath" type="string"/>
             <element name="documentPath" type="string" minOccurs="0"/>
             <element name="namespace" type="string" minOccurs="0"/>
            </sequence>
            <attribute name="type" type="rescfg:section-type" default="None"/>
          </complexType>
        </element>
       </sequence>
      </complexType>
      <!-- ContentFormat element -->
      <simpleType name="content-format" >
        <restriction base="string">
          <enumeration value="text"/>
          <enumeration value="binary"/>
        </restriction>
       </simpleType>
      <!-- resource configuration element  -->
      <complexType name = "ResConfig">
        <all>
          <element name="defaultChildConfig" type="rescfg:defaultConfig" minOccurs="0"  maxOccurs="1"/>
          <element name="defaultChildACL" type="rescfg:defaultACL" minOccurs="0" maxOccurs="1"/>
          <element name="event-listeners" type = "rescfg:event-listeners" minOccurs="0" maxOccurs="1"/>
          <element name="XLinkConfig" type="rescfg:xlink-config" minOccurs="0" maxOccurs="1"/>
          <element name="XIncludeConfig" type="rescfg:xinclude-config" minOccurs="0" maxOccurs="1"/>
          <element name="SectionConfig" type="rescfg:section-config" minOccurs="0" maxOccurs="1"/>
          <element name="ContentFormat" type="rescfg:content-format" minOccurs="0" maxOccurs="1"/>
          <!-- application data -->
          <element name="applicationData" minOccurs="0" maxOccurs="1" >
             <complexType>
               <sequence>
                 <any namespace="##other" maxOccurs="unbounded" processContents="lax"/>
               </sequence>
             </complexType>
         </element>
        </all>
        <attribute name = "enable" type = "boolean" xdb:baseProp="true" default="true" />
        <attribute name = "copy-on-inconsistent-update" type = "boolean" use="optional" />
      </complexType>
      <element name="ResConfig" type="rescfg:ResConfig" xdb:defaultTable = "XDB$RESCONFIG" />
    </schema>
    acl.xsd: XML Schema for ACLs
    This section presents the Oracle Database supplied XML schema used to represent access control lists (ACLs).
    acl.xsd
    <schema xmlns="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://xmlns.oracle.com/xdb/acl.xsd" version="1.0"
            xmlns:xdb="http://xmlns.oracle.com/xdb"
            xmlns:xdbacl="http://xmlns.oracle.com/xdb/acl.xsd"
            elementFormDefault="qualified">
       <annotation>
         <documentation>
            This XML schema describes the structure of XDB ACL documents.
            Note : The "systemPrivileges" element below lists all supported
              system privileges and their aggregations.
              See dav.xsd for description of DAV privileges
            Note : The elements and attributes marked "hidden" are for
              internal use only.
         </documentation>
         <appinfo>
           <xdb:systemPrivileges>
            <xdbacl:all>
              <xdbacl:read-properties/>
              <xdbacl:read-contents/>
              <xdbacl:read-acl/>
              <xdbacl:update/>
              <xdbacl:link/>
              <xdbacl:unlink/>
              <xdbacl:unlink-from/>
              <xdbacl:write-acl-ref/>
              <xdbacl:update-acl/>
              <xdbacl:link-to/>
              <xdbacl:resolve/>
              <xdbacl:write-config/>
            </xdbacl:all>
           </xdb:systemPrivileges>
         </appinfo>
       </annotation>
      <!-- privilegeNameType (this is an emptycontent type) -->
      <complexType name = "privilegeNameType"/>
      <!-- privilegeName element
           All system and user privileges are in the substitutionGroup
           of this element.
        -->
      <element name = "privilegeName" type="xdbacl:privilegeNameType"
               xdb:defaultTable=""/>
      <!-- all system privileges in the XDB ACL namespace -->
      <element name = "read-properties" type="xdbacl:privilegeNameType"
               substitutionGroup="xdbacl:privilegeName" xdb:defaultTable=""/>
      <element name = "read-contents" type="xdbacl:privilegeNameType"
               substitutionGroup="xdbacl:privilegeName" xdb:defaultTable=""/>
      <element name = "read-acl" type="xdbacl:privilegeNameType"
               substitutionGroup="xdbacl:privilegeName" xdb:defaultTable=""/>
      <element name = "update" type="xdbacl:privilegeNameType"
               substitutionGroup="xdbacl:privilegeName" xdb:defaultTable=""/>
      <element name = "link" type="xdbacl:privilegeNameType"
               substitutionGroup="xdbacl:privilegeName" xdb:defaultTable=""/>
      <element name = "unlink" type="xdbacl:privilegeNameType"
               substitutionGroup="xdbacl:privilegeName" xdb:defaultTable=""/>
      <element name = "unlink-from" type="xdbacl:privilegeNameType"
               substitutionGroup="xdbacl:privilegeName" xdb:defaultTable=""/>
      <element name = "write-acl-ref" type="xdbacl:privilegeNameType"
               substitutionGroup="xdbacl:privilegeName" xdb:defaultTable=""/>
      <element name = "update-acl" type="xdbacl:privilegeNameType"
               substitutionGroup="xdbacl:privilegeName" xdb:defaultTable=""/>
      <element name = "link-to" type="xdbacl:privilegeNameType"
               substitutionGroup="xdbacl:privilegeName" xdb:defaultTable=""/>
      <element name = "resolve" type="xdbacl:privilegeNameType"
               substitutionGroup="xdbacl:privilegeName" xdb:defaultTable=""/>
      <element name = "all" type="xdbacl:privilegeNameType"
               substitutionGroup="xdbacl:privilegeName" xdb:defaultTable=""/>
      <!-- privilege element -->
      <element name = "privilege" xdb:defaultTable="">
        <complexType>
          <sequence>
            <any maxOccurs="unbounded" processContents="lax"/>
          </sequence>
        </complexType>
      </element>
      <!-- ace element -->
      <element name = "ace" xdb:defaultTable="">
        <complexType>
          <sequence>
            <element name = "grant" type = "boolean"/>
            <choice>
              <element name="invert" xdb:transient="generated">
                <complexType>
                  <sequence>
                    <element name="principal" type="string"
                             xdb:transient="generated" />
                  </sequence>
                </complexType>
              </element>
              <element name="principal" type="string" xdb:transient="generated"/>
            </choice>
            <element ref="xdbacl:privilege" minOccurs="1"/>
            <!-- "any" contain all app info for an ACE e.g.reason for creation -->
            <any minOccurs="0" maxOccurs="unbounded" namespace="##other"/>
            <!-- HIDDEN ELEMENTS -->
            <choice minOccurs="0">
              <element name = "principalID" type = "hexBinary"
                       xdb:baseProp="true" xdb:hidden="true"/>
              <element name = "principalString" type = "string"
                       xdb:baseProp="true" xdb:hidden="true"/>
            </choice>
            <element name = "flags" type = "unsignedInt" minOccurs="0"
                     xdb:baseProp="true" xdb:hidden="true"/>
          </sequence>
          <attribute name = "collection" type = "boolean"
                     xdb:transient="generated" use="optional"/>
          <attribute name = "principalFormat"
                     xdb:transient="generated" use="optional">
            <simpleType>
              <restriction base="string">
                <enumeration value="ShortName"/>
                <enumeration value="DistinguishedName"/>
                <enumeration value="GUID"/>
                <enumeration value="XSName"/>
              </restriction>   
            </simpleType>
          </attribute>
          <attribute name = "start_date" type = "dateTime" use = "optional"/>
          <attribute name = "end_date" type = "dateTime" use = "optional"/>    
        </complexType>
      </element>
      <!-- acl element -->
      <complexType name="inheritanceType">
        <attribute name="type" type="string" use="required"/>
        <attribute name="href" type="string" use="required"/>
      </complexType>
      <complexType name="aclType">
       <sequence>
        <element name = "schemaURL" type = "string" minOccurs="0"
                 xdb:transient="generated"/>
        <element name = "elementName" type = "string" minOccurs="0"
                 xdb:transient="generated"/>
        <element name = "security-class" type = "QName" minOccurs="0"/>
        <choice minOccurs="0">
          <element name="extends-from" type="xdbacl:inheritanceType"/>
          <element name="constrained-with" type="xdbacl:inheritanceType"/>
        </choice>
        <element ref = "xdbacl:ace" minOccurs="1" maxOccurs = "unbounded"/>
        <!-- this "any" contains all application specific info for an ACL,
             e.g., reason for creation  -->
        <any minOccurs="0" maxOccurs="unbounded" namespace="##other" />
        <!-- HIDDEN ELEMENTS -->
        <element name = "schemaOID" type = "hexBinary" minOccurs="0"
                 xdb:baseProp="true" xdb:hidden="true"/>
        <element name = "elementNum" type = "unsignedInt" minOccurs="0"
                 xdb:baseProp="true" xdb:hidden="true"/>
       </sequence>
       <attribute name = "shared" type = "boolean" default="true"/>
       <attribute name = "description" type = "string"/>
      </complexType>
      <complexType name="rule-based-acl">
        <complexContent>
          <extension base="xdbacl:aclType">
            <sequence>
              <element name = "param" minOccurs="0" maxOccurs="unbounded">
                <complexType>
                  <simpleContent>
                    <extension base="string">
                      <attribute name = "name" type = "string" use = "required"/>
                    </extension>
                  </simpleContent>
                </complexType>
              </element>
            </sequence>
          </extension>
        </complexContent>
      </complexType>
      <element name = "acl" type="xdbacl:aclType" xdb:defaultTable = "XDB$ACL"/>
      <element name = "write-config" type="xdbacl:privilegeNameType"
               substitutionGroup="xdbacl:privilegeName" xdb:defaultTable=""/>
    </schema>Message was edited by:
    Marco Gralike

  • Need to access/connect Remote Unix server from Java

    Please any one give me a direct solution for connecting a remote Unix server through telnet connection from java application. Thanks in advance..

    If I run the below program codes, in the console it is asking to enter username and password in manual but I need to give it automatically.
    The highlighted "root" is entered by the user manually using keyboard.
    Expected:
    I mean the username, password and some action is set to be automatic, so that it should not ask the user to enter the input from keyboard.
    import java.awt.Robot;
    import java.awt.event.KeyEvent;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import org.apache.commons.net.telnet.TelnetClient;
    import org.apache.commons.net.telnet.TelnetNotificationHandler;
    import org.apache.commons.net.telnet.SimpleOptionHandler;
    import org.apache.commons.net.telnet.EchoOptionHandler;
    import org.apache.commons.net.telnet.TerminalTypeOptionHandler;
    import org.apache.commons.net.telnet.SuppressGAOptionHandler;
    import org.apache.commons.net.telnet.InvalidTelnetOptionException;
    import java.util.StringTokenizer;
    * This is a simple example of use of TelnetClient.
    * An external option handler (SimpleTelnetOptionHandler) is used.
    * Initial configuration requested by TelnetClient will be:
    * WILL ECHO, WILL SUPPR
    * ESS-GA, DO SUPPRESS-GA.
    * VT100 terminal type will be subnegotiated.
    * <p>
    * Also, use of the sendAYT(), getLocalOptionState(), getRemoteOptionState()
    * is demonstrated.
    * When connected, type AYT to send an AYT command to the server and see
    * the result.
    * Type OPT to see a report of the state of the first 25 options.
    * <p>
    * @author Bruno D'Avanzo
    public class UnixConnect implements Runnable, TelnetNotificationHandler
        static TelnetClient tc = null;
         * Main for the TelnetClientExample.
        public static void main(String[] args) throws IOException
            FileOutputStream fout = null;
            /*if(args.length < 1)
                System.err.println("Usage: TelnetClientExample1 <remote-ip> [<remote-port>]");
                System.exit(1);
            String remoteip = "192.168.20.11";
            int remoteport;
            if (args.length > 1)
                remoteport = (new Integer(args[1])).intValue();
            else
                remoteport = 23;
            try
                fout = new FileOutputStream ("spy.log", true);
            catch (Exception e)
                System.err.println(
                    "Exception while opening the spy file: "
                    + e.getMessage());
            tc = new TelnetClient();
            TerminalTypeOptionHandler ttopt = new TerminalTypeOptionHandler("VT200", false, false, true, false);
            EchoOptionHandler echoopt = new EchoOptionHandler(true, false, true, false);
            SuppressGAOptionHandler gaopt = new SuppressGAOptionHandler(true, true, true, true);
            try
                tc.addOptionHandler(ttopt);
                tc.addOptionHandler(echoopt);
                tc.addOptionHandler(gaopt);
            catch (InvalidTelnetOptionException e)
                System.err.println("Error registering option handlers: " + e.getMessage());
            while (true)
                boolean end_loop = false;
                try
                    tc.connect(remoteip, remoteport);
                    Thread reader = new Thread (new UnixConnect());
                    tc.registerNotifHandler(new UnixConnect());
                    reader.start();
                    OutputStream outstr = tc.getOutputStream();
                    byte[] buff = new byte[1024];
                    int ret_read = 0;
                    do
                        try
                            ret_read = System.in.read(buff);
                            if(ret_read > 0)
                            outstr.write(buff, 0 , ret_read);
                            outstr.flush();
                        catch (Exception e)
                            System.err.println("Exception while reading keyboard:" + e.getMessage());
                            end_loop = true;
                    while((ret_read > 0) && (end_loop == false));
                    try
                        tc.disconnect();
                    catch (Exception e)
                              System.err.println("Exception while connecting:" + e.getMessage());
                catch (Exception e)
                        System.err.println("Exception while connecting:" + e.getMessage());
                        System.exit(1);
         * Callback method called when TelnetClient receives an option
         * negotiation command.
         * <p>
         * @param negotiation_code - type of negotiation command received
         * (RECEIVED_DO, RECEIVED_DONT, RECEIVED_WILL, RECEIVED_WONT)
         * <p>
         * @param option_code - code of the option negotiated
         * <p>
        public void receivedNegotiation(int negotiation_code, int option_code)
            String command = null;
            if(negotiation_code == TelnetNotificationHandler.RECEIVED_DO)
                command = "DO";
            else if(negotiation_code == TelnetNotificationHandler.RECEIVED_DONT)
                command = "DONT";
            else if(negotiation_code == TelnetNotificationHandler.RECEIVED_WILL)
                command = "WILL";
            else if(negotiation_code == TelnetNotificationHandler.RECEIVED_WONT)
                command = "WONT";
            System.out.println("Received " + command + " for option code " + option_code);
         * Reader thread.
         * Reads lines from the TelnetClient and echoes them
         * on the screen.
        public void run()
            InputStream instr = tc.getInputStream();
            try
                byte[] buff = new byte[1024];
                int ret_read = 0;
                do
                    ret_read = instr.read(buff);
                    if(ret_read > 0)
                       System.out.print(new String(buff, 0, ret_read));
                while (ret_read >= 0);
            catch (Exception e)
                System.err.println("Exception while reading socket:" + e.getMessage());
            try
                tc.disconnect();
            catch (Exception e)
                System.err.println("Exception while closing telnet:" + e.getMessage());

  • "Error while registering the Java 2 Runtime Environment registry keys"

    "Error while registering the Java 2 Runtime Environment registry keys"
    I am getting the above error when trying to install the 1.3 JRE (installed with the 1.3 plug in which I need). As part of my development I have been installing and uninstalling the JRE multiple times. Then, I got the above error when trying to install it, and now it appears to be installed but I cannot uninstall it. When I try to uninstall it, it just remains, and when I try to install it again I get the above error. I have tried cleaning up all javasoft registry entries, but it doesnt seem to have helped. Can anyone help me either completely uninstall the JRE so I can do a clean install or help me get rid of the error above when I install. Is there some registry entries I should be looking at? Anything else? this is quite urgent as I need to test my applet with the plugin installed and not installed - and I currently cant uninstall it. Any ideas?
    Thanks for your help
    Aaron

    I am getting this same error message when trying to upgrade from 1.3.1_03 to 1.3.1_19.
    I have multiple versions of jre's and jdks on my machine.
    Anyone else seen this problem or know how to resolve it.

  • Remote Object - not able to get the returned value from java method

         Hi ,
    I am developing one sample flex aplication that connects to the java code and displays the returned value from the
    java method in flex client. Here I am able to invoke the java method but not able to collect the returned value.
    lastResult is giving null .  I am able to see the sysout messages in server console.
    I am using flex 3.2 and blazeds server  and java 1.5
    Here is the code what I have written.
    <?xml version="1.0" encoding="utf-8"?><mx:WindowedApplication  xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="#FFFFFF" initialize="initApp()">
     <mx:Script><![CDATA[
    import mx.controls.Alert; 
    import mx.binding.utils.ChangeWatcher; 
    import mx.rpc.events.ResultEvent; 
    import mx.messaging.*; 
    import mx.messaging.channels.* 
    public function initApp():void { 
         var cs:ChannelSet = new ChannelSet(); 
         var customChannel:Channel = new AMFChannel("my-amf", "http://localhost:8400/blazeds/messagebroker/amf");     cs.addChannel(customChannel);
         remoteObj.channelSet = cs;
    public function writeToConsole():void {      remoteObj.writeToConsole(
    "hello from Flash client");
          var returnedVal:String = remoteObj.setName().lastResult;     Alert.show(returnedVal);
    //[Bindable] 
    // private var returnedVal:String; 
    ]]>
    </mx:Script>
    <mx:RemoteObject id="remoteObj" destination="sro" /> 
    <mx:Form width="437" height="281">
     <mx:FormItem>  
    </mx:FormItem>  
    <mx:Button label="Write To Server Console" click="writeToConsole()"/>
     </mx:Form>
     </mx:WindowedApplication>
    Java code
    public  
         public SimpleRemoteObject(){  
              super();     }
      class SimpleRemoteObject { 
         public void writeToConsole(String msg) {          System.out.println("SimpleRemoteObject.write: " + msg);     }
         public String setName(){          System.
    out.println("Name changed in Java"); 
              return "Name changed in Java";
    And I have configured destination in  remote-config.xml
    <destination id="sro">
       <properties>    
        <source>SimpleRemoteObject</source>
        <scope>application</scope>
       </properties>
      </destination>
    Please help me .

    You are not able to get the returned value because if you see the Remote object help you will realise you have to use result="resultfn()" and fault = "faultfn()"
    In this you define what you wish to do.
    More importantly in the remote object you need to define which method you wish to call using the method class like this
    <mx:RemoteObject id="remoteObj" destination="sro" result="r1" fault="f1"  >
         <Method name="javaMethodName" result="r2" fault="f2"/>
    <mx:RemoteObject>
    r2 is the function where you get the result back from java and can use it to send the alert.

  • Executing batch file from Java stored procedure hang

    Dears,
    I'm using the following code to execute batch file from Java Stored procedure, which is working fine from Java IDE JDeveloper 10.1.3.4.
    public static String runFile(String drive)
    String result = "";
    String content = "echo off\n" + "vol " + drive + ": | find /i \"Serial Number is\"";
    try {
    File directory = new File(drive + ":");
    File file = File.createTempFile("bb1", ".bat", directory);
    file.deleteOnExit();
    FileWriter fw = new java.io.FileWriter(file);
    fw.write(content);
    fw.close();
    // The next line is the command causing the problem
    Process p = Runtime.getRuntime().exec("cmd.exe /c " + file.getPath());
    BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
    String line;
    while ((line = input.readLine()) != null)
    result += line;
    input.close();
    file.delete();
    result = result.substring( result.lastIndexOf( ' ' )).trim();
    } catch (Exception e) {
    e.printStackTrace();
    result = e.getClass().getName() + " : " + e.getMessage();
    return result;
    The above code is used in getting the volume of a drive on windows, something like "80EC-C230"
    I gave the SYSTEM schema the required privilege to execute the code.
    EXEC DBMS_JAVA.grant_permission('SYSTEM', 'java.io.FilePermission', '&lt;&lt;ALL FILES&gt;&gt;', 'read ,write, execute, delete');
    EXEC DBMS_JAVA.grant_permission('SYSTEM', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '');
    EXEC DBMS_JAVA.grant_permission('SYSTEM', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', '');
    GRANT JAVAUSERPRIV TO SYSTEM;
    I have used the following to load the class in Oracle 9ir2 DB:
    loadjava -u [system/******@orcl|mailto:system/******@orcl] -v -resolve C:\Server\src\net\dev\Util.java
    CREATE FUNCTION A1(drive IN VARCHAR2) RETURN VARCHAR2 AS LANGUAGE JAVA NAME 'net.dev.Util.a1(java.lang.String) return java.lang.String';
    variable serial1 varchar2(1000);
    call A1( 'C' ) into :serial1;
    The problem that it hangs when I execute the call to the function (I have indicated the line causing the problem in a comment in the code).
    I have seen similar problems on other forums, but no solution posted
    [http://oracle.ittoolbox.com/groups/technical-functional/oracle-jdeveloper-l/run-an-exe-file-using-oracle-database-trigger-1567662]
    I have posted this in JDeveloper forum ([t-853821]) but suggested to post for forum in DB.
    Can anyne help?

    Dear Peter,
    You are totally right, I got this as mistake copy paste. I'm just having a Java utility for running external files outside Oracle DB, this is the method runFile()
    I'm passing it the content of script and names of file to be created on the fly and executed then deleted, sorry for the mistake in creating caller function.
    The main point, how I claim that the line in code where creating external process is the problem. I have tried the code with commenting this line and it was working ok, I made this to make sure of the permission required that I need to give to the schema passing security permission problems.
    The function script is running perfect if I'm executing vbs script outside Oracle using something like "cscript //NoLogo aaa1.vbs", but when I use the command line the call just never returns to me "cmd.exe /c bb1.bat".
    where content of bb1.bat as follows:
    echo off
    vol C: | find /i "Serial Number is"
    The above batch file just get the serial number of hard drive assigned when windows formatted HD.
    Same code runs outside Oracle just fine, but inside Oracle doesn't return if I exectued the following:
    variable serial1 varchar2(1000);
    call A1( 'C' ) into :serial1;
    Never returns
    Thanks for tracing teh issue to that details ;) hope you coul help.

  • Passing String Array from Java to PL/SQL

    Hi,
    We are having couple of packages which have been written in PL/SQL . I would like to know how i can send arrays as input parameters from Java to any stored proc in Oracle. I am having Oracle 8i as the DB and am using Websphere RSA for deployment purposes.
    please find below Java , PL/SQL code and exception
    PL/SQL Code :
    PACKAGE PKG_SURCHARGE
    IS
    TYPE commodity_key IS TABLE OF VARCHAR2(500) INDEX BY BINARY_INTEGER;
    PROCEDURE RETRIEVE_CHARGES
    in_Commodity_tab IN commodity_key,
    IS
    BEGIN
    dbms_output.put_line('in_Commodity_tab(' || '0' || ') : ' || in_Commodity_tab(0) );
    Java Code :
    CallableStatement cstmt=null;
    Connection conn=null;
    try{
    conn=getConnection();
    System.out.println("++++++connected");
    String sqlStr = "{call Pkg_Surcharge.RETRIEVE_CHARGES(?) }";
    cstmt = conn.prepareCall(sqlStr );
    //1.
    String[] javaArray={"20081117","20081117"};
    ArrayDescriptor dateDescripter = ArrayDescriptor.createDescriptor( "commodity_key", conn );
    oracle.sql.ARRAY dateArray = new oracle.sql.ARRAY(dateDescripter, conn, javaArray);
    System.out.println("++++++registered-1");
    Catch (Exception e){
    e.printStackTrace();
    Exception Occured:
    java.sql.SQLException: Invalid Pattern Name <Schema Name>.commodity_key
    Appreciate your help in this regard
    Thanks
    Srini
    Edited by: [email protected] on Nov 25, 2008 4:55 AM

    Avi is correct. You must create a varray or nested table instead of using a PL/SQL index-by table.
    SQL> create type commodity_key as varray(#) of varchar2(500);
    or
    SQL> create type commodity_key as table of varchar2(500);
    Use the varray if you know the number of items in the array. Otherwise, use the nested table.

  • Pass value from Java to Perl

    Anyone knows how to pass value from Java to Perl program?

    Did you write the perl program? Can you change it? Or are you trying to interface to something that already exists? This will limit your options, of course.
    Anyway the first option is simple. The java program does this:
    System.out.println("This is a line of input.");The perl program does this:
    while(<>)and in that block, $_ is assigned to each line of input.
    Then you can invoke both like this:
    $ java MyJavaProgram | perl MyPerlProgram.pl

  • Passisng array from Java into PL/SQL procedure

    Hi everybody!
    I have type created with :
    CREATE OR REPLACE TYPE my_type IS TABLE OF number;
    Next I have procedure withinin a package which has parameters:
    PROCEDURE my_proc
    (p_Result OUT NUMBER,
    p_Id table.column%TYPE,
    p_MyType my_type
    I call this procedure from Java :
    import javax.sql.*;
    import java.sql.*;
    import oracle.jdbc.*;
    import oracle.sql.ARRAY;
    import oracle.sql.ArrayDescriptor;
    public class MyClass extends QueryClient {
    private int Id;
    private int type;
    private Integer[] List;
    private int result;
    public MyClass(int Id, eType type,
    Integer[] List) throws SQLException {
    this.Id = Id;
    this.type = (type.equals(eType.TYPE_EXPORT) ? 1 : 0);
    this.List = List;
    this.execute("{call my_package.my_proc(?,?,?,?)}");
    public void body(CallableStatement stmt) throws SQLException {
    ArrayDescriptor descriptor = ArrayDescriptor.createDescriptor("MY_USER.MY_TYPE", getCon());
    ARRAY array_to_pass = new ARRAY(descriptor, getCon(), this.List);
    // register the type.
    stmt.registerOutParameter(1, OracleTypes.NUMBER); // result of procedure calling
    stmt.setInt(2, this.Id );
    stmt.setInt(3, this.type);
    stmt.setArray(4, array_to_pass);
    // execute and retrieve the result set
    stmt.execute();
    this.result = stmt.getInt(1);
    public int getResult() {
    return result;
    EVERYTHING WORKS FINE, BUT when I move type "my_type" into package header
    TYPE my_type IS TABLE OF number;
    I receive error after calling procedure
    java.sql.SQLException: invalid name pattern: MY_USER.MY_TYPE
    I dropped type my_type after moving it into package. So there is only one my_type, in the package.
    User who call procedure is owner of the package.
    So questions are:
    1. Is it possible to have my_type within package without error?
    2. Is it possible to describe my_type without having a connection to database? My aim is eliminate number of connections to database.
    Thanks all.
    Matus.

    You can't use the packaged type for this. You need to use the original collection type (i.e. via the CREATE TYPE syntax) as you have discovered yourself.
    Regards

  • How to compile and register a Java CFX tag with multiple class files?

    All-
    If this is the wrong forum for CFX questions, please let me
    know.
    I need to determine how to compile and register a Java CFX
    tag that contains multiple class files. One class file implements
    the CustomTag interface and the other class files implement various
    supporting classes. All of the documentation that I have found
    talks about using a single class file. I am assuming that a JAR
    file will be involved, but I am not sure of the specifics.
    Thanks in advance for your help.
    -Josh

    Yes, it will involve a jar. Use your java IDE (eclipse,
    etcetera ..) to create a jar containing all of the classes. Check
    your ide's documentation for how to create jar files. After you
    have created the jar, place the jar in the CF class path so CF will
    recognize it. For example the {cf_root}/WEB-INF/lib directory. CF
    must be restarted before it will detect the new jar. After
    restarting CF, register the CFX tag in the ColdFusion Administrator
    using the name of the class that implements the CustomTag
    interface.
    Though it is worth noting you can also instantiate java
    classes directly from ColdFusion (ie without using a CFX
    tag).

Maybe you are looking for

  • Can I use Photoshop cloud on my iMac and MacBook Pro as long as I'm only using one device at a time

    does a subscription allow a user to have the software on two devices as long as it is being used on only one device at a time?

  • Need HELP !! Could not start SunOne Application Server 7

    Installed SunOne application server on Windows-XP professional. Failes to start the appserver. I get the following messages in the log files. Could some one help me? [28/Mar/2003:20:44:42] INFO ( 3664): CORE1116: Sun ONE Application Server 7.0 [28/Ma

  • Installing JDeveloper 10.1.3 on an amd64 machine

    I get the following message when trying to run jdev: Oracle JDeveloper 10g 10.1.3 Copyright 1997, 2005 Oracle. All Rights Reserved Error: hotspot VM not supported Error: JDeveloper can't recognize the JDK version I have used both jdk-1_5_0_05-linux-a

  • I need to reinstall lion but the control-r does not work

    My Macbook is about 3.5 years old and runs with Lion.  The System Preferences froze what in the process of changing the decktop wall paper. So I forced quit and repaired permissions/rebooted.  That did not clear up the problem and I tried Verify Disk

  • Lost in the changeover

    Can anyone help me? My last iMac died and I've got a new one. I've also got the hard drive from the old iMac, but when I try to open things from it, such as the address book, the new version opens and I can't find a way to get at the info that is in