11 Replies Latest reply on Nov 17, 2011 3:29 PM by 859601

    Create Customization File in OSB 10g with WLST script

    655092
      Is it possible to create a customization file the same as created from the OSB console with a WLST script?

      Can someone show me the syntax to do this? I need to turn this request around quickly and don't have time for a lot of trial and error.

      Edited by: DoubleT on Sep 29, 2009 6:44 PM
        • 1. Re: Create Customization File in OSB 10g with WLST script
          675595
          Did not understand what you meant by 'file created from the OSB console with a WLST script'?

          The customization schema (Customization.xsd) which describes the customization types is available at the following location in your Oracle Service Bus installation:
          BEA_HOME\modules\com.bea.common.configfwk_[version].jar, where BEA_HOME represents the directory in which you installed Oracle Service Bus

          I guess good starting point for this is to export a customization file for the simple resources from OSB and start customizing.
          http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/consolehelp/customization.html#wp1113361

          Thanks
          Manoj
          • 2. Re: Create Customization File in OSB 10g with WLST script
            mwh
            Hi..

            It's fairly straightforward...

            Although I do it in Java, it's fairly simple to convert into wlst..

            Here's the steps to create an Env Value Customization for a specific project..

            Get the Ref object for the project..

            Create an EnvValueQuery.. (e.g. EnvValueQuery projQuery = new EnvValueQuery(null, null, Collections.singleton(ref), false, null, false) )

            Use the ALSBConfigurationMBean to get a collection of Qualified env values.. (e.g. Collection<QualifiedEnvValue> projectEnvVals = alsbJmx.lookupEsbReadOnlyConfigMBean().findEnvValues(projQuery);)

            put the env values into an array list..
            e.g. for (QualifiedEnvValue qEnvValue : projectEnvVals){
                           alCustomRefs.add(qEnvValue);
                      }

            Create an EnvValueCustomization.. (e.g. EnvValueCustomization projectEnvValsCustomization = new EnvValueCustomization("Customizations File for - " + ref.getFullName(), alCustomRefs );)

            Create an array list and put the customizations into it.. (e.g. ArrayList<Customization> alCustomizations = new ArrayList<Customization>(); alCustomizations.add(projectEnvValsCustomization);)

            Create a File Output Stream and use the Customization class to write the customizations to the file.. e,g. Customization.toXML(alCustomizations, fileOutputStream)

            ..Mark.
            • 3. Re: Create Customization File in OSB 10g with WLST script
              655092
              Thank you both for your responses. I've coded the wlst script with specific EnvValueQuery's as suggested by Mark before, but what I am really hoping for is a way to create a customization file with WLST that looks the same as the file that is created when you click the "Create Customization File" in the OSB console. When you create the file in the console, it has all the values, and you can do a search and replace in the file. When you create the file the way Mark suggests, it creates a file that only has those specific things you want to search and replace.

              I'd prefer to have the full file like it is created when you use the console as we already have a process in place to deal with this file format that works very well for us. If I have to use the method Mark mentioned, we have to recode a chunk of our automated process, which is what I am trying to avoid. That's not to say Mark's suggestion is incorrect... I'm just hoping there's another option that fits better into the process we already have in place.
              • 4. Re: Create Customization File in OSB 10g with WLST script
                mwh
                Hi..

                There's a simple way to do what you want.. but not too sure within WLST.. but there's an MBean that the console uses "com.bea:Name=Config.XBus Kernel,Type=com.bea.wli.config.mbeans.ConfigMBean", if you can get hold of that then the following does exactly the same as the console...
                         ConfigMBean alsbConfigMB = alsbJmx.getCoreConfigReadOnlyMBean();
                
                         Set<Ref> domainRefs = alsbCoreRO.getRefs(Ref.getDomainRef());     //..instance of ALSBConfigurationMBean    
                         
                         byte[] contentsProj = alsbConfigMB.createCustomizationFile(domainRefs, EnvValueTypes.ENV_VALUE_TYPES);
                         FileOutputStream fosConfig = new FileOutputStream("testCustomization.xml");
                         fosConfig.write(contentsProj);
                         fosConfig.close();
                ..Mark..
                • 6. Re: Create Customization File in OSB 10g with WLST script
                  525476
                  Mark -

                  I'm trying to accomplish this and I'm not able to derive the code needed to accomplish this line from your example. Can you please help with this? I havent been able to find anything else online that talks about this. Thanks!

                  ConfigMBean alsbConfigMB = alsbJmx.getCoreConfigReadOnlyMBean();

                  Edited by: JeffWest on Feb 9, 2010 5:53 PM
                  • 7. Re: Create Customization File in OSB 10g with WLST script
                    679367
                    I am NOT able to access the ConfigMBean either. Can someone help to mimic the same functionality of exporting the customization file done in OSB admin console using WLST?
                    • 8. Re: Create Customization File in OSB 10g with WLST script
                      user10290371
                      Hello mwh

                      I have also tried to repeat your steps using JMX. This is exactly what I need to do. I managed to find the mbean and the method you mentioned (createCustomizationFile(...)).

                      2 Questions:
                      - You have provided us with some very useful software hints. UNfortunately this is not enough to write a fully functional programm as this uses Oracle proprietary transport objects and MBeans.
                      It would be very very helpful, if you could send us the full source code of an example client so that we can see all the necessary imports and the way how you did get all those objects.
                      You would do me a very big favour if you could tell me how to export ALL projects in one step into the customizing.xml file.

                      - I also do need the reverse function -> important an customization.xml into an ESB which is called execute in the sbconsole. I cannot find a corresponding MBean-Operation for "execute". Do you have any hints for us how to do this ?


                      Thanks a lot in advance
                      Martin
                      • 9. Re: Create Customization File in OSB 10g with WLST script
                        Ulisses-Chieppe
                        How I get a instance of alsbConfigMB?
                        • 10. Re: Create Customization File in OSB 10g with WLST script
                          Ulisses-Chieppe
                          I resolved my problem. The solution is follow (Java language):

                          Set<Ref> domainRefs = alsbConfMB.getRefs(businessServiceQuery);

                               EnvValueQuery evquery = new EnvValueQuery(null, // search across all
                                         // resource types
                                         envValueTypesToSearch, domainRefs, // search only in found refs.
                                         false, // Search all resources
                                         null, // the string we want to replace
                                         false // not a complete match of URI.
                               );

                          Collection<QualifiedEnvValue> founds = alsbConfMB.findEnvValues(evquery);

                               List<QualifiedEnvValue> qualifiedEnvValueList = new ArrayList<QualifiedEnvValue>();
                               for (QualifiedEnvValue qev : founds) {
                                    if (qev.getEnvValueType().equals(EnvValueTypes.SERVICE_URI)) {
                                         qualifiedEnvValueList.add(qev);
                                    }
                               }


                               EnvValueCustomization projectEnvValsCustomization = new EnvValueCustomization("Customizations File for businss services ", qualifiedEnvValueList);
                               List<Customization> customizationList = new ArrayList<Customization>();
                               customizationList.add(projectEnvValsCustomization);
                               OutputStream fileOutputStream = new FileOutputStream("testCustomization.xml");
                               Customization.toXML(customizationList, fileOutputStream);
                               fileOutputStream.close();
                          • 11. Re: Create Customization File in OSB 10g with WLST script
                            859601
                            Hi Ulisses,

                            Could I ask you something?
                            How did you do to connect your script java to weblogic server?

                            Helps me a lot if you tell me the java's class invocation

                            thank you