Package com.sun.star.registry

Examples of com.sun.star.registry.XRegistryKey


        if (success) {
            try {
                String keyName = "/" + __implName +
                                 "/DATA/SupportedComponents";
                XRegistryKey newKey = regKey.createKey(keyName);

                String[] supportedComponents = { testComponent };
                newKey.setAsciiListValue(supportedComponents);
            } catch (Exception ex) {
                success = false; // prevent startup loop
                System.out.println("can't register component");
            }
        }
View Full Code Here


    * write some info into the registry root key. After all registry
    * is destroyed.<p>
    * Has OK status if some info was written into registry.
    */
    public void _writeRegistryInfo() {
        XRegistryKey key ;
        XSimpleRegistry xReg = null ;

        String tmpDir = util.utils.getOfficeTempDir((XMultiServiceFactory)tParam.getMSF());

        try {
            xReg = RegistryTools.createRegistryService
                ((XMultiServiceFactory)tParam.getMSF()) ;

            xReg.open(tmpDir + "XImpLoader_tmp.rdb", false, true) ;

            key = xReg.getRootKey() ;
        } catch (com.sun.star.uno.Exception e) {
            log.println("Can not create registry for writing") ;
            e.printStackTrace(log) ;
            tRes.tested("writeRegistryInfo()", false) ;
            return ;
        }

        boolean rc ;
        try {
            rc = oObj.writeRegistryInfo(key, implLoader, implUrl) ;
        } catch (CannotRegisterImplementationException e) {
            throw new StatusException("Can not register implementation", e) ;
        }

        if (rc == false)
            log.println("Method returned false value") ;

        String[] keys ;
        try {
            keys = key.getKeyNames() ;
        } catch (com.sun.star.uno.Exception e) {
            log.println("Error retrieving key names from registry") ;
            tRes.tested("writeRegistryInfo()", false) ;
            return ;
        }
View Full Code Here

  public static boolean writeRegistryServiceInfo(
        String impl_name, String supported_services [], XRegistryKey xKey )
    {
        try
        {
          XRegistryKey xNewKey = xKey.createKey( "/" + impl_name + "/UNO/SERVICES" );
            for ( int nPos = 0; nPos < supported_services.length; ++nPos )
            {
                xNewKey.createKey( supported_services[ nPos ] );
            }
          return true;
        }
        catch (com.sun.star.registry.InvalidRegistryException exc)
        {
View Full Code Here

    XSimpleRegistry xSimpleRegistry = null;
    try {
      xSimpleRegistry = (XSimpleRegistry) args[0];
            if (xSimpleRegistry != null)
            {
                XRegistryKey rootkey = xSimpleRegistry.getRootKey();
               
                XRegistryKey implkey_xRegistryKey = rootkey.openKey("Implementations");
                if(implkey_xRegistryKey != null) {
                    XRegistryKey xRegistryKeys[] = implkey_xRegistryKey.openKeys();
                   
                    for(int i = 0; i < xRegistryKeys.length; ++ i) {
                        xaddFactories(new String[]{xRegistryKeys[i].getStringValue()});
                    }
                }
View Full Code Here

   */
  public static boolean writeRegistryServiceInfo(XRegistryKey regKey) {
      boolean result = false;
     
      try {
          XRegistryKey newKey = regKey.createKey("/" + JavaLoader.class.getName() + "/UNO/SERVICE");
        
          for (int i=0; i<supportedServices.length; i++)
              newKey.createKey(supportedServices[i]);
         
          result = true;
      }
      catch (Exception ex) {
          if (DEBUG) System.err.println(">>>JavaLoader.writeRegistryServiceInfo " + ex);
View Full Code Here

   */
  static public boolean writeRegistryServiceInfo(String implName, String serviceName, XRegistryKey regKey) {
      boolean result = false;
     
        try {
          XRegistryKey newKey = regKey.createKey("/" + implName + "/UNO/SERVICES");
        
      newKey.createKey(serviceName);
         
          result = true;
        }
        catch (Exception ex) {
            System.err.println(">>>Connection_Impl.writeRegistryServiceInfo " + ex);
View Full Code Here

  public static boolean writeRegistryServiceInfo(
        String impl_name, String supported_services [], XRegistryKey xKey )
    {
        try
        {
          XRegistryKey xNewKey = xKey.createKey( "/" + impl_name + "/UNO/SERVICES" );
            for ( int nPos = 0; nPos < supported_services.length; ++nPos )
            {
                xNewKey.createKey( supported_services[ nPos ] );
            }
          return true;
        }
        catch (com.sun.star.registry.InvalidRegistryException exc)
        {
View Full Code Here

   
    if (subKeys == null || subKeys.length == 0) return ;
   
    for (int i = 0; i < subKeys.length; i++) {
      printKeyInfo(key, subKeys[i], out, margin) ;
      XRegistryKey subKey = key.openKey
        (getShortKeyName(subKeys[i])) ;
      printTreeInfo(subKey, out, margin + "  ") ;
      subKey.closeKey() ;
    }
  }
View Full Code Here

    String keyName, PrintWriter out, String margin)
    throws com.sun.star.registry.InvalidRegistryException {
   
    out.print(margin) ;
    keyName = getShortKeyName(keyName) ;
    XRegistryKey key = parentKey.openKey(keyName) ;
    if (key != null)
      out.print("/" + getShortKeyName(key.getKeyName()) + " ") ;
    else {
      out.println("(null)") ;
      return ;
    }
   
    if (!key.isValid()) {
      out.println("(not valid)") ;
      return ;
    }
   
    if (key.isReadOnly()) {
      out.print("(read only) ") ;
    }
   
    if (parentKey.getKeyType(keyName) == RegistryKeyType.LINK) {
      out.println("(link to " + parentKey.getLinkTarget(keyName) + ")") ;
      return ;
    }
   
    RegistryValueType type ;
    try {
      type = key.getValueType() ;
   
      if (type.equals(RegistryValueType.ASCII)) {
        out.println("[ASCII] = '" + key.getAsciiValue() + "'") ;
      } else
      if (type.equals(RegistryValueType.STRING)) {
        out.println("[STRING] = '" + key.getStringValue() + "'") ;
      } else
      if (type.equals(RegistryValueType.LONG)) {
        out.println("[LONG] = " + key.getLongValue()) ;
      } else                                                       
      if (type.equals(RegistryValueType.BINARY)) {
        out.print("[BINARY] = {") ;
        byte[] bin = key.getBinaryValue() ;
        for (int i = 0; i < bin.length; i++)
          out.print("" + bin[i] + ",") ;
        out.println("}") ;
      } else
      if (type.equals(RegistryValueType.ASCIILIST)) {
        out.print("[ASCIILIST] = {") ;
        String[] list = key.getAsciiListValue() ;
        for (int i = 0; i < list.length; i++)
          out.print("'" + list[i] + "',") ;
        out.println("}") ;
      } else
      if (type.equals(RegistryValueType.STRINGLIST)) {
        out.print("[STRINGLIST] = {") ;
        String[] list = key.getStringListValue() ;
        for (int i = 0; i < list.length; i++)
          out.print("'" + list[i] + "',") ;
        out.println("}") ;
      } else
      if (type.equals(RegistryValueType.LONGLIST)) {
        out.print("[LONGLIST] = {") ;
        int[] list = key.getLongListValue() ;
        for (int i = 0; i < list.length; i++)
          out.print("" + list[i] + ",") ;
        out.println("}") ;
      } else {
        out.println("") ;
      }
    } catch (com.sun.star.uno.Exception e) {
      out.println("Exception occured : ") ;
      e.printStackTrace(out) ;
    } finally {
      key.closeKey() ;
    }
  }
View Full Code Here

        return false ;
       
      for (int i = 0; i < keyNames1.length; i++) {
     
        String keyName = getShortKeyName(keyNames1[i]) ;
        XRegistryKey key2 = tree2.openKey(keyName) ;
       
        if (key2 == null)
        // key with the same name doesn't exist in the second tree
          return false ;
     
View Full Code Here

TOP

Related Classes of com.sun.star.registry.XRegistryKey

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.