You can subscribe to this list here.
2005 |
Jan
|
Feb
(1) |
Mar
(45) |
Apr
(150) |
May
(145) |
Jun
(150) |
Jul
(79) |
Aug
(313) |
Sep
(160) |
Oct
(309) |
Nov
(115) |
Dec
(60) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(160) |
Feb
(144) |
Mar
(127) |
Apr
(48) |
May
(102) |
Jun
(54) |
Jul
(245) |
Aug
(94) |
Sep
(152) |
Oct
(162) |
Nov
(166) |
Dec
(740) |
2007 |
Jan
(752) |
Feb
(437) |
Mar
(328) |
Apr
(373) |
May
(569) |
Jun
(399) |
Jul
(369) |
Aug
(627) |
Sep
(100) |
Oct
(306) |
Nov
(166) |
Dec
(282) |
2008 |
Jan
(68) |
Feb
(145) |
Mar
(180) |
Apr
(160) |
May
(277) |
Jun
(229) |
Jul
(1188) |
Aug
(51) |
Sep
(97) |
Oct
(99) |
Nov
(95) |
Dec
(170) |
2009 |
Jan
(39) |
Feb
(73) |
Mar
(120) |
Apr
(121) |
May
(104) |
Jun
(262) |
Jul
(57) |
Aug
(171) |
Sep
(131) |
Oct
(88) |
Nov
(64) |
Dec
(83) |
2010 |
Jan
(55) |
Feb
(67) |
Mar
(124) |
Apr
(64) |
May
(130) |
Jun
(75) |
Jul
(164) |
Aug
(64) |
Sep
(44) |
Oct
(17) |
Nov
(43) |
Dec
(31) |
2011 |
Jan
(21) |
Feb
(10) |
Mar
(43) |
Apr
(46) |
May
(52) |
Jun
(71) |
Jul
(7) |
Aug
(16) |
Sep
(51) |
Oct
(14) |
Nov
(33) |
Dec
(15) |
2012 |
Jan
(12) |
Feb
(61) |
Mar
(129) |
Apr
(76) |
May
(70) |
Jun
(52) |
Jul
(29) |
Aug
(41) |
Sep
(32) |
Oct
(23) |
Nov
(38) |
Dec
(26) |
2013 |
Jan
(35) |
Feb
(37) |
Mar
(51) |
Apr
(15) |
May
(52) |
Jun
(15) |
Jul
(23) |
Aug
(21) |
Sep
(46) |
Oct
(69) |
Nov
(57) |
Dec
(26) |
2014 |
Jan
(5) |
Feb
(13) |
Mar
(17) |
Apr
(1) |
May
(5) |
Jun
|
Jul
(2) |
Aug
(2) |
Sep
(1) |
Oct
(16) |
Nov
(8) |
Dec
(4) |
2015 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(1) |
Jun
(4) |
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
From: Viktor M. <mih...@us...> - 2005-05-10 15:50:32
|
Update of /cvsroot/sblim/cmpi-devel/cmpi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11414/cmpi Modified Files: cmpidt.h cmpift.h cmpimacs.h Log Message: Bugs fixed: 1199111. The header files and the C++ wrapper have been brought up to the TOG spec level (1.0). Index: cmpift.h =================================================================== RCS file: /cvsroot/sblim/cmpi-devel/cmpi/cmpift.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- cmpift.h 18 Mar 2005 13:45:40 -0000 1.1.1.1 +++ cmpift.h 10 May 2005 15:50:20 -0000 1.2 @@ -12,7 +12,7 @@ * http://oss.software.ibm.com/developerworks/opensource/license-cpl.html * * Author: Adrian Schuur <sc...@de...> - * Contributors: + * Contributors: Konrad Rzeszutek <da...@us...> * * Description: CMPI Function Table Definions * @@ -54,7 +54,7 @@ @return The newly created Instance. */ [...1306 lines suppressed...] - CMPISelectExp* se, const char *ns, CMPIObjectPath* op, CMPIBoolean first); + (CMPIIndicationMI* mi, const CMPIContext* ctx, + const CMPISelectExp* se, const char *ns, const CMPIObjectPath* op, CMPIBoolean first); CMPIStatus (*deActivateFilter) - (CMPIIndicationMI* mi, CMPIContext* ctx, CMPIResult* rslt, - CMPISelectExp* se, const char *ns, CMPIObjectPath* op, CMPIBoolean last); - #if defined(CMPI_VER_86) + (CMPIIndicationMI* mi, const CMPIContext* ctx, + const CMPISelectExp* se, const char *ns, const CMPIObjectPath* op, CMPIBoolean last); void (*enableIndications) - (CMPIIndicationMI* mi); + (CMPIIndicationMI* mi, const CMPIContext *); void (*disableIndications) - (CMPIIndicationMI* mi); - #endif // CMPI_VER_86 + (CMPIIndicationMI* mi, const CMPIContext *); + }; Index: cmpidt.h =================================================================== RCS file: /cvsroot/sblim/cmpi-devel/cmpi/cmpidt.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- cmpidt.h 18 Mar 2005 13:45:39 -0000 1.1.1.1 +++ cmpidt.h 10 May 2005 15:50:19 -0000 1.2 @@ -12,7 +12,7 @@ * http://oss.software.ibm.com/developerworks/opensource/license-cpl.html * * Author: Adrian Schuur <sc...@de...> - * Contributors: + * Contributors: Konrad Rzeszutek <da...@us...> * * Description: CMPI Data Type Definions * @@ -39,7 +39,7 @@ #define CMPIVersion086 86 // 0.86 #define CMPIVersion087 87 // 0.87 #define CMPIVersion090 90 // 0.90 - + #define CMPIVersion100 100 // 1.00 // CMPI_VERSION compile switch should be used during MI compilation only. // It is used define minimal version support needed from Management Broker. @@ -56,11 +56,13 @@ #define CMPI_VER_87 1 #elif (CMPI_VERSION==90) #define CMPI_VER_90 1 + #elif (CMPI_VERSION==100) + #define CMPI_VER_100 1 #else #error Unsupported CMPI_VERSION defined #endif #else - #define CMPI_VER_80 + #define CMPI_VER_100 #endif @@ -75,8 +77,14 @@ // During MI loading MBs must ensure that // <mi-name>_Create<mi-type>MI.miVersion<=<mi-name>_Create<mi-type>MI.ftVersion // If this is not the case, the MI might require higher version MB support. - -#if defined (CMPI_VER_90) || defined(CMPI_VER_ALL) +#if defined (CMPI_VER_100) || defined(CMPI_VER_ALL) + #define CMPI_VER_90 + #define CMPI_VER_87 + #define CMPI_VER_86 + #define CMPI_VER_85 + #define CMPI_VER_80 + #define CMPICurrentVersion CMPIVersion100 +#elif defined (CMPI_VER_90) || defined(CMPI_VER_ALL) // added Ext function table and getKeyList #define CMPI_VER_87 #define CMPI_VER_86 @@ -368,8 +376,15 @@ #define CMPI_FLAG_IncludeQualifiers 4 #define CMPI_FLAG_IncludeClassOrigin 8 + /* Authenticated ID of the user requesting this MI invocation.*/ #define CMPIPrincipal "CMPIPrincipal" + /* CMPIFlags - invocation flags as specified by the client. */ #define CMPIInvocationFlags "CMPIInvocationFlags" + /* Namespace for which the MI is started. */ + #define CMPIInitNameSpace "CMPIInitNameSpace" + /* The role assumed by the current authenticated user.*/ + #define CMPIRole "CMPIRole" + typedef enum _CMPIrc { CMPI_RC_OK =0, @@ -390,6 +405,13 @@ CMPI_RC_ERR_INVALID_QUERY =15, CMPI_RC_ERR_METHOD_NOT_AVAILABLE =16, CMPI_RC_ERR_METHOD_NOT_FOUND =17, + /* The following return codes are used by cleanup() calls only. */ + CMPI_RC_DO_NOT_UNLOAD =50, + CMPI_RC_NEVER_UNLOAD =51, + /* Internal CMPI return codes. */ + CMPI_RC_ERR_INVALID_HANDLE =60, + CMPI_RC_ERR_INVALID_DATA_TYPE =61, + /* Hosting OS errors. */ CMPI_RC_ERROR_SYSTEM =100, CMPI_RC_ERROR =200 } CMPIrc; @@ -413,6 +435,16 @@ #define CMPI_MB_Supports_Qualifier 0x00001000 #define CMPI_MB_Supports_Schema 0x00003000 +#define CMPI_MB_BasicRead 0x00000001 +#define CMPI_MB_BasicWrite 0x00000003 +#define CMPI_MB_InstanceManipulation 0x00000007 +#define CMPI_MB_AssociationTraversal 0x00000009 +#define CMPI_MB_QueryExecution 0x00000011 +#define CMPI_MB_QueryNormalization 0x00000031 +#define CMPI_MB_BasicQualifierSupport 0x00000047 +#define CMPI_MB_OSEncapsulationSupport 0x00000100 + + /* Query Predicate operations */ typedef enum _CMPIPredOp { Index: cmpimacs.h =================================================================== RCS file: /cvsroot/sblim/cmpi-devel/cmpi/cmpimacs.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- cmpimacs.h 18 Mar 2005 13:45:39 -0000 1.1.1.1 +++ cmpimacs.h 10 May 2005 15:50:21 -0000 1.2 @@ -12,7 +12,7 @@ * http://oss.software.ibm.com/developerworks/opensource/license-cpl.html * * Author: Adrian Schuur <sc...@de...> - * Contributors: + * Contributors: Konrad Rzeszutek <da...@us...> * * Description: CMPI Convenience Definions * @@ -65,7 +65,7 @@ @param msg the message as character string @return This macro contains a return statement and leaves the function. [...1117 lines suppressed...] CMPICurrentVersion, \ CMPICurrentVersion, \ @@ -2145,7 +2231,7 @@ #else #define CMPropertyMIFactory(cn,pn) \ CMPI_EXTERN_C \ - CMPIMethodMI* pn##_Create_PropertyMI(CMPIBroker* broker, CMPIContext *ctxp) { \ + CMPIMethodMI* pn##_Create_PropertyMI(const CMPIBroker* broker, const CMPIContext *ctxp, CMPIStatus *rc) { \ static CMPIPropertyMIFT propMIFT={ \ CMPICurrentVersion, \ CMPICurrentVersion, \ @@ -2196,7 +2282,7 @@ #define CMIndicationMIFactory(cn,pn) \ CMPI_EXTERN_C \ - CMPIIndicationMI* pn##_Create_IndicationMI(CMPIBroker* broker, CMPIContext *ctxp) { \ + CMPIIndicationMI* pn##_Create_IndicationMI(const CMPIBroker* broker, const CMPIContext *ctxp, CMPIStatus *rc) { \ static CMPIIndicationMIFT indMIFT={ \ CMPICurrentVersion, \ CMPICurrentVersion, \ |
From: Benjamin B. <bg...@us...> - 2005-05-10 09:12:33
|
Update of /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/utils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12154/Plugin/com/ibm/ecute/utils Modified Files: Utils.java Constants.java Log Message: Version 2.1 alpha 6d Edit qualifiers dialog with main functionality added to RSA Index: Utils.java =================================================================== RCS file: /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/utils/Utils.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Utils.java 6 Jul 2004 13:16:03 -0000 1.1 +++ Utils.java 10 May 2005 09:11:53 -0000 1.2 @@ -79,13 +79,20 @@ try { //Create directory - (new File("jacob")).mkdir(); - ZipFile zipFile = new ZipFile("jacobBin_17.zip"); + String zipFileName = null; + File zipfile = new File("jacob/jacob_18.zip"); + if(zipfile.exists()){ + zipFileName = "jacob/jacob_18.zip"; + } else { + zipFileName = "jacob/jacobBin_17.zip"; + } + + ZipFile zipFile = new ZipFile(zipFileName); + //Recover jar file - ZipEntry entry = zipFile.getEntry("jacob.jar"); InputStream in = zipFile.getInputStream(entry); @@ -103,7 +110,6 @@ out.close(); //Recover DLL - entry = zipFile.getEntry("jacob.dll"); in = zipFile.getInputStream(entry); @@ -118,7 +124,6 @@ out.close(); //Recover license.txt - entry = zipFile.getEntry("LICENSE.TXT"); in = zipFile.getInputStream(entry); @@ -132,14 +137,18 @@ in.close(); out.close(); - return "New version of Jacob detected: the necessary files were extracted\r\nPlease, close restart the tooling"; + // the '$' at the beginning of the return string is used to determine the type + // of the show dialog + return "$New version of Jacob detected: the necessary files were extracted\r\n" + + "Please, restart this eCUTE tool now"; } catch (Exception e) { e.printStackTrace(); - return "Error: Some of the files associated to the JACOB proyect are missing\n" + return "Error: Some files associated to the JACOB project are missing\n" + "\n" - + "Please get the file at http://danadler.com/jacob/jacobBin_17.zip " - + "and place it in the install directory" + + "Please get the file at\n" + + "http://easynews.dl.sourceforge.net/sourceforge/jacob-project/jacob_18.zip \n" + + "and place it in the install directory\n" + "\n" + "Use the URL shortcut saved in the install directory\n"; } Index: Constants.java =================================================================== RCS file: /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/utils/Constants.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- Constants.java 8 Apr 2005 09:11:19 -0000 1.8 +++ Constants.java 10 May 2005 09:11:53 -0000 1.9 @@ -22,8 +22,8 @@ public class Constants { - public static final String pluginVersion="2.1 alpha 6"; - public static final String toolName="ECUTE"; + public static final String pluginVersion="2.1 alpha 6d"; + public static final String toolName="eCUTE"; public static final String qualifiersFileName="QualifiersList.txt"; public static final String cimMOFInputPackageName = "CIMMOFInput"; |
From: Benjamin B. <bg...@us...> - 2005-05-10 09:12:32
|
Update of /cvsroot/sblim/ecute/Plugin/com/ibm/ecute In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12154/Plugin/com/ibm/ecute Modified Files: EditQualifiers.java EcuteEclipsePlugin.java EntryPoint.java Log Message: Version 2.1 alpha 6d Edit qualifiers dialog with main functionality added to RSA Index: EntryPoint.java =================================================================== RCS file: /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/EntryPoint.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- EntryPoint.java 29 Dec 2004 10:33:38 -0000 1.15 +++ EntryPoint.java 10 May 2005 09:11:53 -0000 1.16 @@ -39,6 +39,7 @@ import com.ibm.ecute.plugins.Dialogs.SelectProjectDialog; import com.ibm.ecute.utils.Constants; import com.ibm.ecute.utils.PropertyList; +import com.ibm.ecute.utils.Utils; public class EntryPoint { //private static final String defaultConfiguration = @@ -165,6 +166,21 @@ } catch (Exception e) { } frame = new DefaultPluginFrame(dialogTittle); + + if(inputPluginArgumment.equalsIgnoreCase("RoseREI")||outputPluginArgumment.equalsIgnoreCase("RoseREI")){ + String error = Utils.isJacobInstalled(); + if (error != null) { + System.out.println("ERROR: "+error); + if(error.startsWith("$")){ + error = error.substring(1); + frame.displayInformation("Jacob has been installed", error); + } else { + frame.displayError("Problem accessing Rose", error); + } + System.exit(1); + } + } + int operation = 0; boolean returned = true; do { Index: EditQualifiers.java =================================================================== RCS file: /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/EditQualifiers.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- EditQualifiers.java 18 Mar 2005 08:02:36 -0000 1.3 +++ EditQualifiers.java 10 May 2005 09:11:53 -0000 1.4 @@ -20,6 +20,7 @@ */ package com.ibm.ecute; import java.awt.Dimension; +import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; @@ -35,6 +36,7 @@ import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; +import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTabbedPane; import javax.swing.UIManager; @@ -44,6 +46,7 @@ import com.ibm.ecute.Dialogs.DefinitionsTab; import com.ibm.ecute.Dialogs.ValuesTab; import com.ibm.ecute.utils.License; +import com.ibm.ecute.utils.Utils; import com.jacob.com.ComThread; public class EditQualifiers extends JFrame implements ActionListener, @@ -80,9 +83,37 @@ GridBagLayout mainPanelL = new GridBagLayout(); GridBagConstraints mainPanelC = new GridBagConstraints(); mainPane.setLayout( mainPanelL ); - - + JTabbedPane tabs = new JTabbedPane(); + + String error = Utils.isJacobInstalled(); + if (error != null) { + System.out.println("ERROR: "+error); + Frame frame = new Frame(); + + // Center the frame on the screen + Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize(); + Point thePoint=new Point(screenSize.width/2,screenSize.height/2); + thePoint.translate(-getWidth()/2,-getHeight()/2); + frame.setLocation(thePoint); + frame.show(); + + + if(error.startsWith("$")){ + frame.setTitle("New Jacob version installed"); + error = error.substring(1); + JOptionPane.showMessageDialog(frame, + error,"New Jacob version installed", + JOptionPane.INFORMATION_MESSAGE); + + } else { + frame.setTitle("Jacob not installed"); + JOptionPane.showMessageDialog(frame, + error,"Jacob not installed", + JOptionPane.ERROR_MESSAGE); + } + System.exit(1); + } valuesTab = new ValuesTab(this); tabs.addTab("Qualifier Values",valuesTab); @@ -244,7 +275,7 @@ thePoint.translate(-getWidth()/2,-getHeight()/2); setLocation(thePoint); - show(); + show(); } public static void main( String args[] ) { Index: EcuteEclipsePlugin.java =================================================================== RCS file: /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/EcuteEclipsePlugin.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- EcuteEclipsePlugin.java 14 Feb 2005 17:38:06 -0000 1.6 +++ EcuteEclipsePlugin.java 10 May 2005 09:11:53 -0000 1.7 @@ -11,6 +11,8 @@ import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Platform; import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.eclipse.uml2.Model; +import org.eclipse.uml2.OpaqueExpression; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; @@ -152,13 +154,22 @@ } public QualifiersList getQualifiersList() throws Exception{ - if(qualifiersList == null){ - qualifiersList = new QualifiersList(); - qualifiersList.Load(getQualifierListDestination()); - } + if(qualifiersList == null){ + qualifiersList = new QualifiersList(); + qualifiersList.Load(getQualifierListDestination()); + } return qualifiersList; } + public QualifiersList getQualifiersList(Model model, String name) throws Exception{ + + qualifiersList = new QualifiersList(); + String modelQualifiers = ((OpaqueExpression)model.getOwnedRule(name).getSpecification()).getBody(); + qualifiersList.Load("MODEL_CONSTRAINT*" + modelQualifiers); + + return qualifiersList; + } + public static String getPluginId() { return "com.ibm.ecute"; |
From: Benjamin B. <bg...@us...> - 2005-05-10 09:12:20
|
Update of /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/plugins/Dialogs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12154/Plugin/com/ibm/ecute/plugins/Dialogs Modified Files: DefaultPluginFrame.java Log Message: Version 2.1 alpha 6d Edit qualifiers dialog with main functionality added to RSA Index: DefaultPluginFrame.java =================================================================== RCS file: /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/plugins/Dialogs/DefaultPluginFrame.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- DefaultPluginFrame.java 11 Jul 2004 16:40:33 -0000 1.3 +++ DefaultPluginFrame.java 10 May 2005 09:11:56 -0000 1.4 @@ -155,6 +155,17 @@ JOptionPane.ERROR_MESSAGE); setVisible(wasVisible); } + + public void displayInformation(String errorTittle, String error) { + boolean wasVisible=isVisible(); + setVisible(true); + JOptionPane.showMessageDialog( + this, + error, + errorTittle, + JOptionPane.INFORMATION_MESSAGE); + setVisible(wasVisible); + } //return true if the answer was YES public boolean displayYesNoQuestion(String errorTittle, String error) { |
From: Benjamin B. <bg...@us...> - 2005-05-10 09:12:20
|
Update of /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/plugins/output In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12154/Plugin/com/ibm/ecute/plugins/output Modified Files: RoseREIPlugin.java Log Message: Version 2.1 alpha 6d Edit qualifiers dialog with main functionality added to RSA Index: RoseREIPlugin.java =================================================================== RCS file: /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/plugins/output/RoseREIPlugin.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- RoseREIPlugin.java 9 Dec 2004 15:03:33 -0000 1.7 +++ RoseREIPlugin.java 10 May 2005 09:11:55 -0000 1.8 @@ -115,8 +115,7 @@ if (error != null) { System.out.println("ERROR: "+error); container.displayError("Problem accessing Rose", error); - - return PluginFrame.BACK_PRESSED; + System.exit(1); } int result; |
From: Benjamin B. <bg...@us...> - 2005-05-10 09:12:19
|
Update of /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/rsa/core/internal/properties In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12154/Plugin/com/ibm/ecute/rsa/core/internal/properties Modified Files: QualifiersPropertySection.java Log Message: Version 2.1 alpha 6d Edit qualifiers dialog with main functionality added to RSA Index: QualifiersPropertySection.java =================================================================== RCS file: /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/rsa/core/internal/properties/QualifiersPropertySection.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- QualifiersPropertySection.java 8 Apr 2005 09:11:18 -0000 1.11 +++ QualifiersPropertySection.java 10 May 2005 09:11:54 -0000 1.12 @@ -3,6 +3,9 @@ */ package com.ibm.ecute.rsa.core.internal.properties; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Iterator; @@ -14,37 +17,43 @@ import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; -import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CLabel; +import org.eclipse.swt.events.MouseAdapter; +import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableColumn; import org.eclipse.swt.widgets.TableItem; +import org.eclipse.ui.PlatformUI; import org.eclipse.uml2.AggregationKind; import org.eclipse.uml2.AssociationClass; import org.eclipse.uml2.Class; import org.eclipse.uml2.Comment; +import org.eclipse.uml2.Constraint; import org.eclipse.uml2.Element; +import org.eclipse.uml2.Model; import org.eclipse.uml2.MultiplicityElement; import org.eclipse.uml2.NamedElement; +import org.eclipse.uml2.OpaqueExpression; import org.eclipse.uml2.Operation; +import org.eclipse.uml2.Package; import org.eclipse.uml2.Parameter; import org.eclipse.uml2.ParameterDirectionKind; import org.eclipse.uml2.Property; import org.eclipse.uml2.Stereotype; import org.eclipse.uml2.Type; +import org.eclipse.uml2.UML2Package; import com.ibm.ecute.EcuteEclipsePlugin; import com.ibm.ecute.Qualifiers.Qualifier; import com.ibm.ecute.Qualifiers.QualifiersList; -import com.ibm.ecute.rsa.ui.internal.wizards.command.QualifierValueValidator; +import com.ibm.ecute.rsa.core.internal.dialogs.EditQualifiersDialog; import com.ibm.ecute.utils.License; import com.ibm.xtools.common.ui.properties.TabbedPropertySheetPage; import com.ibm.xtools.emf.msl.EditingDomain; @@ -64,16 +73,17 @@ * You can obtain a current copy of the Common Public License from * http://oss.software.ibm.com/developerworks/opensource/license-cpl.html * - * @author Susanne Katz <ka...@de...> + * @author Susanne Katz <ka...@de...> + * Benjamin Bender <be...@de...> */ -public class QualifiersPropertySection extends AbstractModelerPropertySection { +public class QualifiersPropertySection extends AbstractModelerPropertySection{ // Copyright private static final String COPYRIGHT = License.COPYRIGHT; + + private static String QUALIFIERS_CONSTRAINT_NAME = "QualifiersList"; private Button editValueButton; - private Button defaultValueButton; - private Button removeButton; - private Button showAllButton; + public Button showAllButton; private TableColumn nameColumn; private TableColumn valueColumn; private TableColumn definedInColumn; @@ -82,7 +92,9 @@ private TableColumn flavorColumn; private Table qualifiersTable; private ArrayList defaultValueQualifiers; - //private Font boldFont; + + private static QualifiersList qualifiersList = null; + private boolean qualifiersListChanged = false; public QualifiersPropertySection() @@ -94,84 +106,41 @@ super.createControls(composite, tabbedpropertysheetpage); Composite composite1 = getWidgetFactory().createFlatFormComposite(composite); defaultValueQualifiers = new ArrayList(); - //formdata label - FormData formdata = new FormData(); - formdata.left = new FormAttachment(0, 0); - formdata.top = new FormAttachment(0, 0); - CLabel clabel = getWidgetFactory().createCLabel(composite1, "Qualifiers:"); - clabel.setLayoutData(formdata); - //formdata checkButton - formdata = new FormData(); - formdata.left = new FormAttachment(0, 0); - formdata.top = new FormAttachment(clabel, 4); - showAllButton = getWidgetFactory().createButton(composite1, "Show qualifiers with default value", SWT.CHECK); - showAllButton.setSelection(true); - showAllButton.setLayoutData(formdata); - showAllButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent selectionevent) - { - showAll(); - } - - }); //formdata editValueButton - formdata = new FormData(); - formdata.left = new FormAttachment(0,0); - formdata.top = new FormAttachment(showAllButton, 4); - editValueButton = getWidgetFactory().createButton(composite1, "Edit value", 8); + FormData formdata = new FormData(); + formdata.left = new FormAttachment(0,5); + formdata.top = new FormAttachment(0,0); + editValueButton = getWidgetFactory().createButton(composite1, "Edit qualifiers", 8); editValueButton.setLayoutData(formdata); editValueButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent selectionevent) { int ai = qualifiersTable.getSelectionIndex(); - if(ai != -1) - { - editValue(ai, false); - } - } - - }); - //formdata removeButton - formdata = new FormData(); - formdata.left = new FormAttachment(editValueButton, 4); - formdata.top = new FormAttachment(showAllButton, 4); - removeButton = getWidgetFactory().createButton(composite1, "Remove Qualifier", 8); - removeButton.setLayoutData(formdata); - removeButton.addSelectionListener(new SelectionAdapter() { - - public void widgetSelected(SelectionEvent selectionevent) - { - int ai = qualifiersTable.getSelectionIndex(); - if(ai != -1) - { - removeQualifier(ai); - } + editValue(ai, false); } }); - //formdata defaultValueButton + + //formdata checkButton formdata = new FormData(); - formdata.left = new FormAttachment(removeButton, 4); - formdata.top = new FormAttachment(showAllButton, 4); - defaultValueButton = getWidgetFactory().createButton(composite1, "Default value", 8); - defaultValueButton.setLayoutData(formdata); - defaultValueButton.addSelectionListener(new SelectionAdapter() { + formdata.left = new FormAttachment(editValueButton, 30); + formdata.top = new FormAttachment(0,4); + showAllButton = getWidgetFactory().createButton(composite1, "Show qualifiers with default value", SWT.CHECK); + showAllButton.setSelection(true); + showAllButton.setLayoutData(formdata); + showAllButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent selectionevent) { - int ai = qualifiersTable.getSelectionIndex(); - if(ai != -1) - { - editValue(ai, true); - } + showAll(); } }); //Table - qualifiersTable = getWidgetFactory().createTable(composite1, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.SINGLE); + qualifiersTable = getWidgetFactory().createTable(composite1, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.SINGLE| SWT.MouseDoubleClick); qualifiersTable.setHeaderVisible(true); qualifiersTable.setLinesVisible(true); nameColumn = new TableColumn(qualifiersTable, 0); @@ -186,15 +155,15 @@ flavorColumn.setText("Flavor"); scopeColumn = new TableColumn(qualifiersTable, 0); scopeColumn.setText("Scope"); - qualifiersTable.addSelectionListener(new SelectionAdapter() { - - public void widgetSelected(SelectionEvent selectionevent) - { - removeButton.setEnabled(isRemoveAllowed()); - editValueButton.setEnabled(isEditValueAllowed()); - defaultValueButton.setEnabled(isEditValueAllowed()); - } + qualifiersTable.addMouseListener(new MouseAdapter() { + public void mouseDoubleClick(MouseEvent e){ + int ai = qualifiersTable.getSelectionIndex(); + if(ai != -1) + { + editValue(ai, false); + } + } }); //formdata table @@ -203,22 +172,23 @@ formdata.right = new FormAttachment(100, 0); formdata.top = new FormAttachment(editValueButton, 4); formdata.bottom = new FormAttachment(100, -4); - //formdata.width = 600; formdata.height = 800; qualifiersTable.setLayoutData(formdata); - - //boldFont = new Font(Display.getDefault(), "TableItemFont_BOLD", 8, SWT.BOLD); + editValueButton.setEnabled(true); } public void refresh() { + if(!existsQualifierListConstraint()){ + + createQualifiersListConstraint(); + } + qualifiersTable.removeAll(); defaultValueQualifiers.clear(); - defaultValueButton.setEnabled(false); - removeButton.setEnabled(false); - editValueButton.setEnabled(false); + editValueButton.setEnabled(true); if(!(getEObject() instanceof NamedElement)) { packColumns(); @@ -235,13 +205,79 @@ if(((Parameter)element).getDirection().getValue() == ParameterDirectionKind.RETURN) return null; } - QualifiersList qualifiersList=null; - try { - qualifiersList = EcuteEclipsePlugin.getDefault().getQualifiersList(); - } catch (Exception e) { - //TODO Show ErrorDialog! - e.printStackTrace(); - } + + // tried to change the OCL qualifier of a class automatically + // when a class constraint body is changed --> failed +/* + if(element instanceof Class){ + List elementList = ((Class)element).getPackage().getOwnedElements(); + ArrayList constraintList = new ArrayList(); + for (int i = 0; i < elementList.size(); i++){ + if (elementList.get(i) instanceof Constraint) + constraintList.add(elementList.get(i)); + } + if (constraintList != null){ + for(int j = 0; j < constraintList.size(); j++){ + Constraint constraint = (Constraint)constraintList.get(j); + List constrainedElements = constraint.getConstrainedElements(); + for(int k = 0; k < constrainedElements.size(); k++){ + if(constrainedElements.get(k) instanceof Class){ + if(((Class)constrainedElements.get(k)).getName().equalsIgnoreCase(((Class)element).getName())){ + String body = ((OpaqueExpression)constraint.getSpecification()).getBody(); + int index = body.indexOf("\n"); + String qualifierValue = "{\""; + if (index != -1){ + qualifierValue = qualifierValue.concat(body.substring(0, index)); + } else { + qualifierValue = qualifierValue.concat(body.substring(0)); + } + qualifierValue = qualifierValue.concat("\""); + body = body.substring(index +1); + index = body.indexOf("\n"); + while (index != -1){ + qualifierValue = qualifierValue.concat(",\""); + qualifierValue = qualifierValue.concat(body.substring(0, index)); + qualifierValue = qualifierValue.concat("\""); + body = body.substring(index +1); + index = body.indexOf("\n"); + if(index == -1){ + qualifierValue = qualifierValue.concat(",\""); + qualifierValue = qualifierValue.concat(body.substring(0)); + qualifierValue = qualifierValue.concat("\""); + } + } + qualifierValue = qualifierValue.concat("}"); + System.out.println("OCL qualifier: " + qualifierValue); + Class thisClass = (Class)constrainedElements.get(k); + + Stereotype cimStereotype = thisClass.getAppliedStereotype("CIM::Qualifiers"); + List qualifierNameList = (List) thisClass.getValue(cimStereotype, "QualifierName"); + int stereotypeOCLIndex = -1; + for(int i = 0; i < qualifierNameList.size(); i++){ + if(qualifierNameList.get(i).toString().equalsIgnoreCase("OCL")){ + stereotypeOCLIndex = i; + } + } + thisClass.setValue(cimStereotype, "QualifierValue["+stereotypeOCLIndex+"]", qualifierValue); + } + } + } + } + } + } +*/ + if (qualifiersList == null || qualifiersListChanged == true){ + try { + qualifiersListChanged = false; + qualifiersList = EcuteEclipsePlugin.getDefault().getQualifiersList(getModel(), QUALIFIERS_CONSTRAINT_NAME); + if (qualifiersList == null){ + qualifiersList = EcuteEclipsePlugin.getDefault().getQualifiersList(); + } + } catch (Exception e) { + //TODO Show ErrorDialog! + e.printStackTrace(); + } + } Vector vector = qualifiersList.GetElements(); //make a copy of the qualifiers list to remove the qualifiers already displayed ArrayList allAvailableQualifers = new ArrayList(); @@ -649,107 +685,18 @@ protected void editValue(int ai, boolean setDefaultValue) { - //new EditQualifiers(); + if(!(getEObject() instanceof NamedElement)){ + return; + } + final NamedElement element = (NamedElement) getEObject(); - final QualifierValueObject qualifier = (QualifierValueObject)qualifiersTable.getItem(ai).getData(); - if(qualifier == null) - { - return; - } - - if(!(getEObject() instanceof Element)){ - return; - } - final Element element = (Element) getEObject(); - - if(!setDefaultValue){ - - InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), "Value Editor", - "Set new value for "+qualifier.name, qualifier.value, new QualifierValueValidator()); - - if (dialog.open() == 0) { - final String newValue = dialog.getValue(); - if (!qualifier.value.equalsIgnoreCase(newValue)) { - - EditingDomain editingDomain = UMLModeler.getEditingDomain(); - try { - if (qualifier.index == -1) { - //add Qualifier to Stereotype-Properties - - editingDomain.run(new ResourceSetModifyOperation("EditQualifier") { - - protected void execute(IProgressMonitor monitor) throws InvocationTargetException, - InterruptedException { - - Stereotype cimStereotype = element.getAppliedStereotype("CIM::Qualifiers"); - int stereotypePropertyIndex = ((List) element.getValue(cimStereotype, "QualifierName")) - .size(); - element.setValue(cimStereotype, "QualifierName[" + stereotypePropertyIndex + "]", qualifier.name); - element.setValue(cimStereotype, "QualifierValue[" + stereotypePropertyIndex + "]", newValue); - } - - }, new NullProgressMonitor()); - - } else { - - editingDomain.run(new ResourceSetModifyOperation("EditQualifier") { - - protected void execute(IProgressMonitor monitor) throws InvocationTargetException, - InterruptedException { - Stereotype cimStereotype = element.getAppliedStereotype("CIM::Qualifiers"); - element.setValue(cimStereotype, "QualifierValue[" + qualifier.index + "]", newValue); - } - - }, new NullProgressMonitor()); - - } - } catch (InvocationTargetException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - refresh(); - } - } - }else{ - - EditingDomain editingDomain = UMLModeler.getEditingDomain(); - try { - if(qualifier.index == -1){ - editingDomain.run( new ResourceSetModifyOperation("SetDefaultValue") { - - protected void execute(IProgressMonitor monitor) - throws InvocationTargetException, InterruptedException { - - Stereotype cimStereotype = element.getAppliedStereotype("CIM::Qualifiers"); - int stereotypePropertyIndex = ((List) element.getValue(cimStereotype, "QualifierName")).size(); - element.setValue(cimStereotype, "QualifierName["+stereotypePropertyIndex+"]", qualifier.name); - element.setValue(cimStereotype, "QualifierValue["+stereotypePropertyIndex+"]", qualifier.defaultValue); - } - }, new NullProgressMonitor()); - } else{ - editingDomain.run( new ResourceSetModifyOperation("SetDefaultValue") { - - protected void execute(IProgressMonitor monitor) - throws InvocationTargetException, InterruptedException { - - Stereotype cimStereotype = element.getAppliedStereotype("CIM::Qualifiers"); - element.setValue(cimStereotype, "QualifierValue["+qualifier.index+"]", qualifier.defaultValue); } - }, new NullProgressMonitor()); - } - } catch (InvocationTargetException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - refresh(); - } + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); + + EditQualifiersDialog editPage = new EditQualifiersDialog(shell, element, ai, this); + if(editPage.open() == 0){ + refresh(); + } + return; } private int addQualiferToTable(String qualifierName, String qualifierValue, String definedIn, Qualifier qualifier, int index, boolean isDefaultQualifier) @@ -778,8 +725,6 @@ if(definedIn==null) definedIn = ""; - - String scope = ""; String flavor = ""; String defaultValue = "null"; @@ -805,14 +750,12 @@ }; tableitem.setText(as); tableitem.setData(new QualifierValueObject(name, qualifierValue, defaultValue, index)); -// if(showAllButton.getSelection()){ -// if(!isDefaultQualifier){ -// tableitem.setFont(boldFont); -// } -// } + return i; } + + protected boolean isRemoveAllowed() { if(isReadOnly()) @@ -831,8 +774,7 @@ return false; } } - - //TODO return true; + return true; } @@ -850,8 +792,7 @@ return false; } } - - //TODO return true; + return true; } @@ -895,7 +836,385 @@ update(notification, eobject); } - private class QualifierValueObject{ + public void mapQualifierToModel(Element element, String qualifierName, String newValue){ + if (element instanceof Class){ + if(qualifierName.equalsIgnoreCase("Description")){ + Comment descr = element.createOwnedComment(UML2Package.eINSTANCE.getComment()); + descr.setBody(newValue); + Stereotype stereo = descr.getApplicableStereotype("Default::Documentation"); + descr.apply(stereo); + } + if(qualifierName.equalsIgnoreCase("OCL")){ + List elementList = ((Class)element).getPackage().getOwnedElements(); + ArrayList constraintList = new ArrayList(); + for (int i = 0; i < elementList.size(); i++){ + if (elementList.get(i) instanceof Constraint) + constraintList.add(elementList.get(i)); + } + if (constraintList != null){ + for(int j = 0; j < constraintList.size(); j++){ + Constraint constraint = (Constraint)constraintList.get(j); + List constrainedElements = constraint.getConstrainedElements(); + for(int k = 0; k < constrainedElements.size(); k++){ + if(constrainedElements.get(k) instanceof Class){ + if(((Class)constrainedElements.get(k)).getName().equalsIgnoreCase(((Class)element).getName())){ + String tempBody, body = ""; + // prepare constraint body content + if(newValue.startsWith("{")){ + int length = newValue.length(); + tempBody = newValue.substring(2, length - 2); + } else { + tempBody = newValue; + } + int index = tempBody.indexOf(","); + boolean multiple = false; + if (index != -1) + multiple = true; + while (index != -1){ + int length = tempBody.length(); + body = body.concat(tempBody.substring(0, index - 1)); + body = body.concat("\n"); + tempBody = tempBody.substring(index + 2); + index = tempBody.indexOf(","); + } + if (multiple){ + body = body.concat(tempBody.substring(index + 1)); + } + if (!multiple) + body = tempBody; + + //set constraint body and language + ((OpaqueExpression)constraint.getSpecification()).setBody(body); + + + } + } + } + } + } + } + } + } + + public boolean getShowAll(){ + return showAllButton.getSelection(); + } + + public void setShowAll(boolean setValue){ + showAllButton.setSelection(setValue); + } + + public Model getModel(){ + + Model thisModel = null; + + NamedElement element = (NamedElement)getEObject(); + while(element.getOwner() != null){ + element = (NamedElement)element.getOwner(); + } + thisModel = (Model)element; + + return thisModel; + } + + private boolean existsQualifierListConstraint(){ + + Model model = getModel(); + Constraint qualifiersConstraint = model.getOwnedRule(QUALIFIERS_CONSTRAINT_NAME); + if(qualifiersConstraint == null){ + return false; + } else { + return true; + } + } + + private void createQualifiersListConstraint() { + EditingDomain editingDomain = UMLModeler.getEditingDomain(); + try { + + editingDomain.run(new ResourceSetModifyOperation("EditQualifier") { + + protected void execute(IProgressMonitor monitor) throws InvocationTargetException, + InterruptedException { + + Model model = getModel(); + Constraint qualifiersListConstraint = model.createOwnedRule(UML2Package.eINSTANCE.getConstraint()); + qualifiersListConstraint.setName(QUALIFIERS_CONSTRAINT_NAME); + qualifiersListConstraint.getConstrainedElements().add(model); + // create specification + qualifiersListConstraint.createSpecification(UML2Package.eINSTANCE.getOpaqueExpression()); + // set constraint body + String qualifierListTXTcontent = null; + try { + + String filename = EcuteEclipsePlugin.getDefault().getQualifierListDestination(); + + File f = new File(filename); + byte buffer[] = new byte[(int)f.length()]; + FileInputStream in = null; + String str = null; + + try + { + in = new FileInputStream(f); + + int len = in.read( buffer, 0, (int)f.length() ); + str = new String( buffer, 0, len ); + + } + catch ( IOException e ) { + e.printStackTrace(); + } + finally + { + try { + if ( in != null ) in.close(); + } catch (IOException e) {} + } + + if(str != null){ + while(str.startsWith("#")){ + int index = str.indexOf("\n"); + str = str.substring(index + 1); + } + } + qualifierListTXTcontent = str; + + } catch (Exception e) { + e.printStackTrace(); + } + + if(qualifierListTXTcontent != null){ + ((OpaqueExpression)qualifiersListConstraint.getSpecification()).setBody(qualifierListTXTcontent); + } + } + }, new NullProgressMonitor()); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + public void updateQualifiersListConstraint(final QualifiersList qualifiersList) { + EditingDomain editingDomain = UMLModeler.getEditingDomain(); + try { + + editingDomain.run(new ResourceSetModifyOperation("updateQualifiersListConstraint") { + + protected void execute(IProgressMonitor monitor) throws InvocationTargetException, + InterruptedException { + + Model model = getModel(); + Constraint qualifiersListConstraint = model.getOwnedRule(QUALIFIERS_CONSTRAINT_NAME); + // get constraint specification + OpaqueExpression constraintSpec = (OpaqueExpression)qualifiersListConstraint.getSpecification(); + // convert qualifiers list + String qualifierListString = convertQualifierListToString(qualifiersList); + // add new list to constraint + constraintSpec.setBody(qualifierListString); + } + }, new NullProgressMonitor()); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + public void removeQualifierStereotypesFromModel(final String qualifierName, final boolean classScope, + final boolean associationScope, final boolean propertyScope, final boolean methodScope, + final boolean parameterScope, final boolean referenceScope) { + + EditingDomain editingDomain = UMLModeler.getEditingDomain(); + try { + + editingDomain.run(new ResourceSetModifyOperation("removeQualifierStereotypesFromModel") { + + protected void execute(IProgressMonitor monitor) throws InvocationTargetException, + InterruptedException { + + Model model = getModel(); + List packages = model.getOwnedMembers(); + for(int i = 0; i < packages.size(); i++){ + List packageMembers = ((Package)packages.get(i)).getOwnedMembers(); + for(int j = 0; j < packageMembers.size(); j++){ + if(associationScope || referenceScope){ + if(packageMembers.get(j) instanceof AssociationClass){ + AssociationClass aClass = (AssociationClass)packageMembers.get(j); + if(associationScope){ + removeStereotypeFromUMLElement(qualifierName, aClass); + } + if(referenceScope){ + List ownedEnds = aClass.getOwnedEnds(); + for(int m = 0; m < ownedEnds.size(); m++){ + Property property = (Property)ownedEnds.get(m); + removeStereotypeFromUMLElement(qualifierName, property); + } + } + } + } + + if(classScope||propertyScope||methodScope||parameterScope) { + + if(packageMembers.get(j) instanceof Class && !(packageMembers.get(j) instanceof AssociationClass)){ + Class cClass = (Class)packageMembers.get(j); + + if(classScope){ + removeStereotypeFromUMLElement(qualifierName, cClass); + } + if(propertyScope){ + List attributes = cClass.getOwnedAttributes(); + for(int m = 0; m < attributes.size(); m++){ + Property property = (Property)attributes.get(m); + removeStereotypeFromUMLElement(qualifierName, property); + } + } + if(methodScope || parameterScope){ + List methods = cClass.getOwnedOperations(); + for(int n = 0; n < methods.size(); n++){ + Operation operation = (Operation)methods.get(n); + if(methodScope){ + removeStereotypeFromUMLElement(qualifierName, operation); + } + if (parameterScope){ + List parameters = operation.getOwnedParameters(); + for(int p = 0; p < parameters.size(); p++){ + Parameter parameter = (Parameter)parameters.get(p); + removeStereotypeFromUMLElement(qualifierName, parameter); + } + } + } + } + } + } + } + } + } + }, new NullProgressMonitor()); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + public QualifiersList getQualifiersList(){ + return qualifiersList; + } + + public void setQualifiersList(QualifiersList newList){ + + qualifiersList = newList; + } + + public boolean getQualifiersListChanged(){ + return qualifiersListChanged; + } + + public void setQualifiersListChanged(boolean newValue){ + qualifiersListChanged = newValue; + } + + public String convertQualifierListToString(QualifiersList qualifiersList){ + + String qualifiersListString = ""; + + Vector listElements = qualifiersList.GetElements(); + int size = listElements.size(); + + for(int i = 0; i < size; i++){ + String item = ""; + Qualifier currentQualifier = (Qualifier)listElements.get(i); + String type = ""; + if(currentQualifier.type2String() != null){ + type = (currentQualifier.type2String()).toLowerCase(); + } + item = item.concat(currentQualifier.name + "=" + type + ","); + String defaultValue = ""; + if(currentQualifier.defaultValue == null){ + defaultValue = "nnuullll"; + } else { + defaultValue = currentQualifier.defaultValue; + } + item = item.concat(defaultValue +","); + if(currentQualifier.classScope) + item = item.concat(" class"); + if(currentQualifier.associationScope) + item = item.concat(" association"); + if(currentQualifier.indicationScope) + item = item.concat(" indication"); + if(currentQualifier.propertyScope) + item = item.concat(" property"); + if(currentQualifier.methodScope) + item = item.concat(" method"); + if(currentQualifier.parameterScope) + item = item.concat(" parameter"); + if(currentQualifier.referenceScope) + item = item.concat(" reference"); + item = item.concat(","); + + if(currentQualifier.DissableOverrideFlavor) + item = item.concat(" DissableOverride"); + if(currentQualifier.RestrictedFlavor) + item = item.concat(" Restricted"); + if(currentQualifier.TranslatableFlavor) + item = item.concat(" TranslatableFlavor"); + item = item.concat("\r\n"); + + qualifiersListString = qualifiersListString.concat(item); + } + + return qualifiersListString; + } + + private void removeStereotypeFromUMLElement(final String qualifierName, Element element) { + + boolean containsQualifier = false; + + Stereotype cimStereotype = element.getAppliedStereotype("CIM::Qualifiers"); + List qualifierNames = (List) element.getValue(cimStereotype, "QualifierName"); + + for(int j = 0; j < qualifierNames.size(); j++){ + + String name = (String)qualifierNames.get(j); + if(name.equalsIgnoreCase(qualifierName)){ + containsQualifier = true; + j = qualifierNames.size(); + } + } + + if(containsQualifier){ + // new Stereotype + Stereotype newCimStereotype = element.getAppliedStereotype("CIM::Qualifiers"); + List newQualifierNames = (List) element.getValue(newCimStereotype, "QualifierName"); + List newQualifierValues = (List) element.getValue(newCimStereotype, "QualifierValue"); + + List names = new ArrayList(); + List values = new ArrayList(); + names.addAll(newQualifierNames); + values.addAll(newQualifierValues); + newQualifierNames.clear(); + newQualifierValues.clear(); + + for(int i = 0; i < names.size(); i++){ + String name = (String)names.get(i); + String value = (String)values.get(i); + + if(!qualifierName.equalsIgnoreCase(name)){ + newQualifierNames.add(name); + newQualifierValues.add(value); + } + } + + for(int j = 0; j < newQualifierNames.size(); j++){ + element.setValue(newCimStereotype, "QualifierName[" + j + "]", newQualifierNames.get(j)); + element.setValue(newCimStereotype, "QualifierValue[" + j + "]", newQualifierValues.get(j)); + } + } + } + + private class QualifierValueObject{ private String name; private String value; private String defaultValue; |
From: Benjamin B. <bg...@us...> - 2005-05-10 09:12:04
|
Update of /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/plugins/output/funcionality In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12154/Plugin/com/ibm/ecute/plugins/output/funcionality Modified Files: RSAModelCreator.java Log Message: Version 2.1 alpha 6d Edit qualifiers dialog with main functionality added to RSA Index: RSAModelCreator.java =================================================================== RCS file: /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/plugins/output/funcionality/RSAModelCreator.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- RSAModelCreator.java 8 Apr 2005 09:11:16 -0000 1.10 +++ RSAModelCreator.java 10 May 2005 09:11:54 -0000 1.11 @@ -17,12 +17,12 @@ import org.eclipse.uml2.Class; import org.eclipse.uml2.Classifier; import org.eclipse.uml2.Comment; -//import org.eclipse.uml2.Constraint; +import org.eclipse.uml2.Constraint; import org.eclipse.uml2.Element; import org.eclipse.uml2.Generalization; import org.eclipse.uml2.Model; import org.eclipse.uml2.MultiplicityElement; -//import org.eclipse.uml2.OpaqueExpression; +import org.eclipse.uml2.OpaqueExpression; import org.eclipse.uml2.Operation; import org.eclipse.uml2.Package; import org.eclipse.uml2.PackageableElement; @@ -122,7 +122,6 @@ public int AddAssociation(String className1, String roleName1, String className2, String roleName2, Object diagram) { //metamorphose lastClass to AssociationClass - //System.out.println("metamorphose: " + lastClass.getName() + " to an AssociationClass"); Element element = lastClass; String s = EObjectUtil.getID(element); Element element1 = (Element) EObjectUtil.metamorphose(element, UML2Package.eINSTANCE.getAssociationClass()); @@ -168,8 +167,6 @@ rootClassName2 = className1; lastAssocPropUpperBound2 = rootAssocPropUpperBound1; lastAssocPropLowerBound2 = rootAssocPropLowerBound1; -// link1Tab = tab + " Role B"; -// link2Tab = tab + " Role A"; } else if (rootAssocPropName1.equalsIgnoreCase(roleName2)) { @@ -183,16 +180,12 @@ lastAssocPropUpperBound1 = rootAssocPropUpperBound2; lastAssocPropLowerBound1 = rootAssocPropLowerBound2; -// link1Tab = tab + " Role B"; -// link2Tab = tab + " Role A"; } else if (rootAssocPropName2.equalsIgnoreCase(roleName2)) { if (rootAssocPropName1.equalsIgnoreCase(roleName1)) { rootClassName1 = className1; lastAssocPropUpperBound1 = rootAssocPropUpperBound1; lastAssocPropLowerBound1 = rootAssocPropLowerBound1; -// link1Tab = tab + " Role B"; -// link2Tab = tab + " Role A"; } rootClassName2 = className2; lastAssocPropUpperBound2 = rootAssocPropUpperBound2; @@ -237,7 +230,6 @@ return NOLINKS; //Create Association - Type type1 = getClass(className1, lastCategory, true); if (type1 == null) return NOLINK1; @@ -314,7 +306,6 @@ } public void AddAttribute(String dataType, String name, String defaultValue){ - //System.out.println("AddAttribute: " + name); if (defaultValue == null) defaultValue = ""; @@ -342,7 +333,6 @@ } public void AddParameter(String dataType, String name, String defaultValue) { - //System.out.println("AddParameter: " + name); org.eclipse.uml2.Parameter parameter; parameter = lastMethod.createOwnedParameter(UML2Package.eINSTANCE.getParameter()); @@ -374,20 +364,14 @@ String dataType = (String) leftDataTypes.get(typedElement); if(!setType(dataType, typedElement, false)){ log.addLine2Log("\nWarning: Datatype \""+dataType+"\" used in "+ typedElement.getQualifiedName() +" can not be found."); - // A dummy class named \""+dataType+"\" was created."); log.updateImage(log.getWarningImage()); -// Class dummy = (Class) typedElement.getNearestPackage().createOwnedMember(UML2Package.eINSTANCE.getClass_()); -// dummy.setName(dataType); -// typedElement.setType(dummy); } } - //System.out.println("Close: "); - //TODO helper.openDiagramEditor(diagram); + //TODO helper.openDiagramEditor(diagram); } public Object CreateCategory(String name, Object rootCategory, Object diagram, String uid) { - //System.out.println("CreateCategory: " + name); org.eclipse.uml2.Package package_; org.eclipse.uml2.Package rootPackage = (org.eclipse.uml2.Package) rootCategory; @@ -433,7 +417,6 @@ public int CreateClass(String name, String rootClass, Object category, boolean replace) { - System.out.println("CreateClass: " + name); org.eclipse.uml2.Package package_ = (org.eclipse.uml2.Package) category; org.eclipse.uml2.Class theRoot = null; int result = OK; @@ -472,7 +455,6 @@ class_ = (org.eclipse.uml2.Class) package_.createOwnedMember(UML2Package.eINSTANCE.getClass_()); class_.setName(name); - System.out.println("CreateClass: " + name + " CREATED"); } lastClassComposition = false; lastCategory = package_; @@ -501,29 +483,14 @@ } public void CreateMethod(String dataType, String name) { - //System.out.println("CreateMethod: " + name); org.eclipse.uml2.Operation method; method = lastClass.createOwnedOperation(UML2Package.eINSTANCE.getOperation()); method.setName(name); -// Type returnType = null; - -// PackageableElement element; -// -// element = uml2Model.getImportedMember(dataType); -// if (element != null) { -// if (element instanceof PrimitiveType) -// returnType = ((PrimitiveType) element); -// } else { -// element = uml2Model.getOwnedMember(dataType); -// if (element instanceof Class) -// returnType = ((Class) element); -// } - //method.setType(returnType); does not work Parameter returnResult = method.createOwnedParameter(UML2Package.eINSTANCE.getParameter()); returnResult.setDirection(ParameterDirectionKind.RETURN_LITERAL); - //returnResult.setType(returnType); + setType(dataType, returnResult, true); returnResult.setName("ReturnType"); @@ -534,7 +501,7 @@ } public void DeleteLastClass() { - //System.out.println("DeleteLastClass: "); + lastClass.destroy(); } @@ -545,7 +512,6 @@ if (package_ == rootCategory) return; - //System.out.println("finishCategory: " + package_.getName()); List list = diagramHelper.getDiagrams(package_, UMLDiagramKind.CLASS_LITERAL); Iterator it = list.iterator(); while (it.hasNext()){ @@ -562,7 +528,6 @@ } public void FinishClass(Object diagram) { - //System.out.println("FinishClass: "); boolean isAssociationClass = false; ArrayList list = new ArrayList(); if (lastClass instanceof AssociationClass) { @@ -573,10 +538,6 @@ diagramHelper.createViews((Diagram) diagram, list); } -// if (lastClass instanceof AssociationClass) { -// isAssociationClass = true; -// } - if (lastRootClass != null) { boolean isRootAssociationClass = false; if (lastRootClass instanceof AssociationClass) { @@ -601,20 +562,10 @@ Generalization generalization = specificClassifier.createGeneralization(generalClassifier); generalization.setIsSubstitutable(true); - //System.out.println("Generalization " + specificClassifier.getQualifiedName() + " ->> " - // + generalClassifier.getQualifiedName() + " created."); -/* - if(!isAssociationClass) { - //add class to the diagram - list.add(lastClass); - diagramHelper.createViews((Diagram) diagram, list); - } -*/ } } public Object GetRootCategory() { - //System.out.println("GetRootCategory: "); lastElement = rootCategory; lastCategory = rootCategory; return rootCategory; @@ -629,18 +580,18 @@ Element theElement = lastElement; Element otherElement = null; Stereotype cimStereotype = theElement.getAppliedStereotype("CIM::Qualifiers"); - + if(type == TCLASS){ if(name.equalsIgnoreCase("Composition")&& !value.equalsIgnoreCase("false")){ lastClassComposition = true; } - /* + // create OCL class constraint if(name.equalsIgnoreCase("OCL")&& !value.equalsIgnoreCase("null")){ Package package_ = lastCategory; Constraint constraint = (Constraint)package_.createOwnedMember(UML2Package.eINSTANCE.getConstraint()); - // constraint.setName(name); + constraint.setName("OCL " + lastClass.getName()); // create specification constraint.createSpecification(UML2Package.eINSTANCE.getOpaqueExpression()); @@ -658,7 +609,7 @@ multiple = true; while (index != -1){ int length = tempBody.length(); - body = body.concat(tempBody.substring(0, index - 2)); + body = body.concat(tempBody.substring(0, index - 1)); body = body.concat("\n"); tempBody = tempBody.substring(index + 2); index = tempBody.indexOf(","); @@ -690,61 +641,23 @@ if (thisDiagram != null){ diagramHelper.createViews(thisDiagram, list); } - }*/ + } } -/* + if(type == TMETHOD){ - - if(name.equalsIgnoreCase("OCL")&& !value.equalsIgnoreCase("null")){ + + // create pre/post conditions of a method + // not implemented yet + if(name.equalsIgnoreCase("OCL")&& !value.equalsIgnoreCase("null")){ System.out.println("class: " + lastClass.getName()); System.out.println("name: " + name + " value: "+ value); - Package package_ = lastCategory; - Constraint constraint = (Constraint)package_.createOwnedMember(UML2Package.eINSTANCE.getConstraint()); - constraint.setName(name); - constraint.createSpecification(UML2Package.eINSTANCE.getOpaqueExpression()); - String tempBody, body = ""; - if(value.startsWith("{")){ - int length = value.length(); - tempBody = value.substring(2, length - 2); - } else { - tempBody = value; - } - int index = tempBody.indexOf(","); - boolean multiple = false; - if (index != -1) - multiple = true; - while (index != -1){ - int length = tempBody.length(); - body = body.concat(tempBody.substring(0, index - 2)); - body = body.concat("\n"); - tempBody = tempBody.substring(index + 2); - index = tempBody.indexOf(","); - } - if (multiple){ - body = body.concat(tempBody.substring(index + 1)); - } - if (!multiple) - body = tempBody; - ((OpaqueExpression)constraint.getSpecification()).setBody(body); - ((OpaqueExpression)constraint.getSpecification()).setLanguage("OCL"); - // TODO add connection line between constraint and class - ArrayList list = new ArrayList(); - list.add(constraint); - List diagrams = diagramHelper.getDiagrams(package_, UMLDiagramKind.CLASS_LITERAL); - Iterator it = diagrams.iterator(); - Diagram thisDiagram = null; - while(it.hasNext()){ - Diagram diagram = (Diagram)it.next(); - if(diagram.getName().equalsIgnoreCase("Main")) - thisDiagram = diagram; - } - if (thisDiagram != null){ - diagramHelper.createViews(thisDiagram, list); - } - } + + // lastMethod.getPreconditions().add(); + // lastMethod.getPostconditions().add(); + } } - */ + // because of the different role order in RSA theElement is // lastAssocProp2 if type TLINK1 if (type == TLINK1) { @@ -973,17 +886,6 @@ return theClass; } - // Class getAssociationClass(String name, Package package_, boolean - // otherPackages) { - // - // AssociationClass assocClass = null; - // PackageableElement element = package_.getOwnedMember(name); - // if(element instanceof AssociationClass) - // assocClass = (AssociationClass) element; - // - // return assocClass; - // } - private boolean setType(String dataType, TypedElement element, boolean retry){ //Search for imported DataTypes. @@ -1009,6 +911,5 @@ return false; } } - } } \ No newline at end of file |
From: Benjamin B. <bg...@us...> - 2005-05-10 09:12:03
|
Update of /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/Dialogs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12154/Plugin/com/ibm/ecute/Dialogs Modified Files: DefinitionsTab.java Log Message: Version 2.1 alpha 6d Edit qualifiers dialog with main functionality added to RSA Index: DefinitionsTab.java =================================================================== RCS file: /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/Dialogs/DefinitionsTab.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- DefinitionsTab.java 18 Mar 2005 08:02:49 -0000 1.3 +++ DefinitionsTab.java 10 May 2005 09:11:55 -0000 1.4 @@ -26,6 +26,8 @@ import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; +import java.awt.Point; +import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; @@ -210,14 +212,27 @@ mainPanelL.setConstraints( saveButton, mainPanelC ); add( saveButton ); - if(QualifiersTable.qualifiersList.size==0) - JOptionPane.showMessageDialog(this, - "Your qualifier definitions file is empty.\nYou can add "+ - "qualifier definitions importing a MOF file with qualifier "+ - "definitions like \nCore27_Qualifiers.MOF (recomended) or using "+ + if(QualifiersTable.qualifiersList.size==0){ + Frame frame = new Frame(); + frame.setTitle("Qualifier Definitions empty"); + // Center the frame on the screen + Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize(); + Point thePoint=new Point(screenSize.width/2,screenSize.height/2); + thePoint.translate(-getWidth()/2,-getHeight()/2); + frame.setLocation(thePoint); + frame.show(); + + JOptionPane.showMessageDialog(frame, + "Your qualifier definitions file is empty.\n" + + "You can add qualifier definitions importing a MOF file with\n "+ + "qualifier definitions like \n"+ + "Core27_Qualifiers.MOF (recomended) or using "+ "the following dialog (definitions tab)", - "No Qualifier Definitions", - JOptionPane.ERROR_MESSAGE); + "Qualifier Definitions empty", + JOptionPane.WARNING_MESSAGE); + + frame.dispose(); + } } public void acceptAction(){ |
From: Benjamin B. <bg...@us...> - 2005-05-10 09:12:03
|
Update of /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/Qualifiers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12154/Plugin/com/ibm/ecute/Qualifiers Modified Files: Qualifier.java QualifiersList.java Log Message: Version 2.1 alpha 6d Edit qualifiers dialog with main functionality added to RSA Index: Qualifier.java =================================================================== RCS file: /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/Qualifiers/Qualifier.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Qualifier.java 26 Nov 2004 13:03:06 -0000 1.3 +++ Qualifier.java 10 May 2005 09:11:54 -0000 1.4 @@ -67,21 +67,29 @@ case STRING: return "String"; case UNINT8: - return "Unsigned Integer8"; + return "uint8"; + //return "Unsigned Integer8"; case SINT8: - return "Integer8"; + return "sint8"; + //return "Integer8"; case UNINT16: - return "Unsigned Integer16"; + return "uint16"; + //return "Unsigned Integer16"; case SINT16: - return "Integer16"; + return "sint16"; + //return "Integer16"; case UNINT32: - return "Unsigned Integer32"; + return "uint32"; + //return "Unsigned Integer32"; case SINT32: - return "Integer32"; + return "sint32"; + //return "Integer32"; case UNINT64: - return "Unsigned Integer64"; + return "uint64"; + //return "Unsigned Integer64"; case SINT64: - return "Integer64"; + return "sint64"; + //return "Integer64"; } return "Unknown"; } Index: QualifiersList.java =================================================================== RCS file: /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/Qualifiers/QualifiersList.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- QualifiersList.java 14 Feb 2005 17:38:07 -0000 1.7 +++ QualifiersList.java 10 May 2005 09:11:54 -0000 1.8 @@ -19,6 +19,11 @@ package com.ibm.ecute.Qualifiers; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Point; +import java.awt.Toolkit; +import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -28,6 +33,8 @@ import java.util.Properties; import java.util.Vector; +import javax.swing.JOptionPane; + import com.ibm.ecute.EcuteEclipsePlugin; import com.ibm.ecute.EntryPoint; import com.ibm.ecute.utils.License; @@ -45,24 +52,65 @@ public int size = 0; public void Load(String fileName) { - qualifiersList = new Properties(); - if (EntryPoint.isRunningFromEclipse()){ - try{ - String qualifListDest = EcuteEclipsePlugin.getDefault().getQualifierListDestination(); - file=new File(qualifListDest); - FileInputStream flujo=new FileInputStream(file); - qualifiersList.load(flujo); - }catch (Exception e){ - //TODO write ErrorMessage to LogDialog! - } - + qualifiersList = new Properties(); + // RSA import + if (EntryPoint.isRunningFromEclipse()){ + + // if import was performed in RSA + try{ + if(fileName.startsWith("MODEL_CONSTRAINT*")){ + // load from model constraint + int index = fileName.indexOf("*"); + String qualifierList = fileName.substring(index+1); + ByteArrayInputStream inputStream = new ByteArrayInputStream(qualifierList.getBytes()); + qualifiersList.load(inputStream); + } else { + // load from QualifierList.txt + String qualifListDest = EcuteEclipsePlugin.getDefault().getQualifierListDestination(); + file=new File(qualifListDest); + FileInputStream flujo=new FileInputStream(file); + qualifiersList.load(flujo); + } + }catch (Exception e){ + //TODO write ErrorMessage to LogDialog! + } + + // Rose and RSA (if import was not performed) } else { try { - file = new File(fileName); - FileInputStream flujo = new FileInputStream(file); - qualifiersList.load(flujo); + if(fileName.startsWith("MODEL_CONSTRAINT*")){ + // load from model constraint + int index = fileName.indexOf("*"); + String qualifierList = fileName.substring(index+1); + ByteArrayInputStream inputStream = new ByteArrayInputStream(qualifierList.getBytes()); + qualifiersList.load(inputStream); + } else { + // load from txt file + file = new File(fileName); + FileInputStream flujo = new FileInputStream(file); + qualifiersList.load(flujo); + } } catch (Exception e) { e.printStackTrace(); + Frame frame = new Frame(); + frame.setTitle("No Qualifier Definitions"); + // Center the frame on the screen + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + Point thePoint = new Point(screenSize.width/2,screenSize.height/2); + thePoint.translate(-frame.getWidth()/2,-frame.getHeight()/2); + frame.setLocation(thePoint); + frame.show(); + + JOptionPane.showMessageDialog(frame, + "Your qualifier definitions file QualifierList.txt\n" + + "does not exist.\n\n" + + "Please copy this file from an other location to the\n "+ + "eCUTE directory or reinstall eCUTE. \n", + "QualifierList.txt does not exist", + JOptionPane.ERROR_MESSAGE); + + frame.dispose(); + System.exit(1); } } @@ -92,7 +140,12 @@ definitions.put(qualifier.name.toLowerCase(), qualifier); - String definition = Qualifier.TYPES[qualifier.type]; + String definition = ""; + if(qualifier.type == -1){ + definition += "Unknown"; + } else { + definition += Qualifier.TYPES[qualifier.type]; + } if (qualifier.isArray) definition += " []"; if (qualifier.defaultValue == null) |
From: Benjamin B. <bg...@us...> - 2005-05-10 09:12:02
|
Update of /cvsroot/sblim/ecute/Plugin/com/ibm/ecute/rsa/core/internal/dialogs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12154/Plugin/com/ibm/ecute/rsa/core/internal/dialogs Added Files: EditQualifiersDialog.java Log Message: Version 2.1 alpha 6d Edit qualifiers dialog with main functionality added to RSA --- NEW FILE: EditQualifiersDialog.java --- /* * Created on 12.04.2005 */ package com.ibm.ecute.rsa.core.internal.dialogs; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Set; import java.util.Vector; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.emf.common.util.EList; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; [...3616 lines suppressed...] disableOverrideButton.setLayoutData(formdata); formdata = new FormData(); formdata.left = new FormAttachment(0,5); formdata.top = new FormAttachment(disableOverrideButton,10); formdata.bottom = new FormAttachment(100,-5); translatableButton.setLayoutData(formdata); // second column formdata = new FormData(); formdata.left = new FormAttachment(50,5); formdata.top = new FormAttachment(0,5); toSubclassButton.setLayoutData(formdata); formdata = new FormData(); formdata.left = new FormAttachment(50,5); formdata.top = new FormAttachment(toSubclassButton,10); restrictedButton.setLayoutData(formdata); } } } |
From: Gareth S B. <bes...@us...> - 2005-05-09 16:48:01
|
Update of /cvsroot/sblim/testsuite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22431 Modified Files: Makefile.am Log Message: http://sourceforge.net/tracker/index.php?func=detail&aid=1187586&group_id=128809&atid=712784 Index: Makefile.am =================================================================== RCS file: /cvsroot/sblim/testsuite/Makefile.am,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile.am 14 Apr 2005 10:38:49 -0000 1.1 +++ Makefile.am 9 May 2005 16:47:37 -0000 1.2 @@ -45,4 +45,4 @@ install-data-local: test -d $(DESTDIR)$(pkgstatedir)/stat || $(mkdir_p) $(DESTDIR)$(pkgstatedir)/stat - $(LN_S) $(pkgstatedir)/stat $(DESTDIR)$(pkgdatadir) + $(LN_S) -f $(pkgstatedir)/stat $(DESTDIR)$(pkgdatadir) |
From: Gareth S B. <bes...@us...> - 2005-05-09 16:44:51
|
Update of /cvsroot/sblim/sfcb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21711 Modified Files: wbemcat Log Message: http://sourceforge.net/tracker/index.php?func=detail&aid=1193589&group_id=128809&atid=712784 Index: wbemcat =================================================================== RCS file: /cvsroot/sblim/sfcb/wbemcat,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- wbemcat 25 Apr 2005 23:19:34 -0000 1.1 +++ wbemcat 9 May 2005 16:44:43 -0000 1.2 @@ -36,14 +36,14 @@ print "\nOptions:\n"; print " -h, --host=HOSTNAME\tName of host running the CIMOM. Default=$host\n"; print " -p, --port=PORT\tPort that the CIMOM is listening on. Default=$port\n"; - print "\t-?, --help\tDisplay this help and exit\n"; + print " -?, --help\t\tDisplay this help and exit\n"; die "\n"; } # Process command line options, if any GetOptions("host|h=s" => \$host, "port|p=i" => \$port, - "help|?" => sub{usage}) || usage; + "help|?" => usage) || usage; my $file = @ARGV[0]; # Read all the XML data from the input file |
From: Adrian S. <a3s...@us...> - 2005-05-09 16:24:27
|
Update of /cvsroot/sblim/sfcb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16789 Modified Files: httpAdapter.c Log Message: Fixed [ 1193800 ] sfcb doesn't honor the HTTP expect header sfcb now closes request with a 417 return code. Index: httpAdapter.c =================================================================== RCS file: /cvsroot/sblim/sfcb/httpAdapter.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- httpAdapter.c 26 Apr 2005 21:58:47 -0000 1.7 +++ httpAdapter.c 9 May 2005 16:24:18 -0000 1.8 @@ -643,12 +643,15 @@ cp += strspn(cp, " \t"); inBuf.useragent = cp; } - else if (strncasecmp(hdr, "TE:", 18) == 0) { - char *cp = &hdr[18]; + else if (strncasecmp(hdr, "TE:", 3) == 0) { + char *cp = &hdr[3]; cp += strspn(cp, " \t"); if (strncasecmp(cp,"trailers",8)==0) inBuf.trailers=1; } + else if (strncasecmp(hdr, "Expect:", 7) == 0) { + genError(conn_fd, &inBuf, 417, "Expectation Failed", NULL); //more); + } } if (doBa) { |
From: Adrian S. <a3s...@us...> - 2005-05-06 02:12:08
|
Update of /cvsroot/sblim/sfcb/regressionTests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23621/regressionTests Modified Files: build.sh Log Message: Closed [ 1193559 ] CMGetArg/CMGetArgAt return datum w/ type 0 The problem is a paramvalue without a type as part of the method call. <PARAMVALUE NAME="operation"> <VALUE>"Set"</VALUE> </PARAMVALUE> This is a wbemcli problem. sfcbd now defaults to string if no type is found. Index: build.sh =================================================================== RCS file: /cvsroot/sblim/sfcb/regressionTests/build.sh,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- build.sh 8 Apr 2005 10:29:59 -0000 1.7 +++ build.sh 6 May 2005 02:11:58 -0000 1.8 @@ -46,8 +46,10 @@ for x in $dirs do - echo make -C $x install - make -C $x install +# echo make -C $x install +# make -C $x install + echo sh $x/build.sh $x + sh $x/build.sh $x done echo sfcbmof -I $CIMDIR -i CIM_Schema.mof -o repository/root/interop/classSchemas schema/interop.mof |
From: Adrian S. <a3s...@us...> - 2005-05-06 02:12:07
|
Update of /cvsroot/sblim/sfcb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23621 Modified Files: cimXmlRequest.c Log Message: Closed [ 1193559 ] CMGetArg/CMGetArgAt return datum w/ type 0 The problem is a paramvalue without a type as part of the method call. <PARAMVALUE NAME="operation"> <VALUE>"Set"</VALUE> </PARAMVALUE> This is a wbemcli problem. sfcbd now defaults to string if no type is found. Index: cimXmlRequest.c =================================================================== RCS file: /cvsroot/sblim/sfcb/cimXmlRequest.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- cimXmlRequest.c 27 Apr 2005 11:10:41 -0000 1.9 +++ cimXmlRequest.c 6 May 2005 02:11:58 -0000 1.10 @@ -1644,6 +1644,8 @@ sreq.principal = setCharsMsgSegment(ctx->principal); for (p = req->paramValues.first; p; p = p->next) { + // this is a problem: - paramvalue without type + if (p->type==NULL) p->type=CMPI_string; CMPIValue val = str2CMPIValue(p->type, p->value.value, &p->valueRef); CMAddArg(in, p->name, &val, p->type); } |
From: Adrian S. <a3s...@us...> - 2005-05-05 22:12:47
|
Update of /cvsroot/sblim/sfcb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32678 Modified Files: objectImpl.c Log Message: Fixed [ 1191278 ] wbemcli segv's on ec [ 1194280 ] GetClass on CIM_StatisticalData fails Incomplete coding sequence in ClClassGetPropertyAt() of objectImpl.c Index: objectImpl.c =================================================================== RCS file: /cvsroot/sblim/sfcb/objectImpl.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- objectImpl.c 26 Apr 2005 14:11:20 -0000 1.4 +++ objectImpl.c 5 May 2005 22:12:34 -0000 1.5 @@ -1543,6 +1543,25 @@ if (data) *data = (p + id)->data; if (name) *name = strdup(ClObjectGetClString(&cls->hdr, &(p + id)->id)); if (quals) *quals = (p + id)->quals; + + if (data->state & CMPI_nullValue) { + data->value.uint64=0; + } + else if (data->type == CMPI_chars) { + const char *str = + ClObjectGetClString(&cls->hdr, (ClString *) & data->value.chars); + data->value.string = native_new_CMPIString(str, NULL); + data->type = CMPI_string; + } + else if (data->type == CMPI_dateTime) { + const char *str = + ClObjectGetClString(&cls->hdr, (ClString *) & data->value.chars); + data->value.dateTime = native_new_CMPIDateTime_fromChars(str, NULL); + } + else if (data->type & CMPI_ARRAY) { + data->value.dataPtr.ptr = (void *) ClObjectGetClArray(&cls->hdr, + (ClArray *) & data->value.array); + } return 0; } @@ -1781,12 +1800,9 @@ p = (ClProperty *) ClObjectGetClSection(&inst->hdr, &inst->properties); if (id < 0 || id > inst->properties.used) _SFCB_RETURN(1); - if (data) - *data = (p + id)->data; - if (name) - *name = strdup(ClObjectGetClString(&inst->hdr, &(p + id)->id)); - if (quals) - *quals = (p + id)->quals; + if (data) *data = (p + id)->data; + if (name) *name = strdup(ClObjectGetClString(&inst->hdr, &(p + id)->id)); + if (quals) *quals = (p + id)->quals; if (data->type == CMPI_chars) { const char *str = ClObjectGetClString(&inst->hdr, (ClString *) & data->value.chars); |
Update of /cvsroot/sblim/sfcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4777 Added Files: Makefile args.c array.c broker.c cimXmlParser.c cimXmlParser.h cimXmlResp.c cimXmlResp.h cimXmlResp.y cmcimacs.h datetime.c enumeration.c genericlist.c genericlist.h instance.c native.h objectpath.c property.c rules setEnv setting.cmpi string.c test.c tool.h utilList.h utilStringBuffer.c utilStringBuffer.h value.c ylwrap Log Message: added new files for sfcc --- NEW FILE: genericlist.h --- /* * genericList.h * * (C) Copyright IBM Corp. 2005 * * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. * * You can obtain a current copy of the Common Public License from * http://oss.software.ibm.com/developerworks/opensource/license-cpl.html * * Author: Keith Pomakis <po...@po...> * Contributions: Adrian Schuur <sc...@de...> * * Description: * * list implementation. * */ /************************************************************************ ************************************************************************* ** ** ** Generic List Library ** ** ** ** by Keith Pomakis ** ** kpp...@je... ** ** ** ** Spring, 1994 ** ** ** ************************************************************************* ************************************************************************/ #ifndef GENERIC_LIST_DEFINED #define GENERIC_LIST_DEFINED #include "utilList.h" typedef struct GLE_struct { void *pointer; struct GLE_struct *previous; struct GLE_struct *next; } Generic_list_element; typedef struct { Generic_list_element *current; Generic_list_element pre_element, post_element, deleted_element; int (*lt) (void *a, void *b); unsigned int num_of_elements; } Generic_list_info; typedef struct { Generic_list_info *info; } Generic_list; #define Generic_stack Generic_list #define Generic_queue Generic_list /****************************************************************************/ /* Stack operations */ #define initialize_stack initialize_list #define destroy_stack destroy_list #define push add_to_beginning #define pop remove_from_beginning #define peek_at_top peek_at_beginning #define copy_stack copy_list /* Queue operations */ #define initialize_queue initialize_list #define destroy_queue destroy_list #define enqueue add_to_end #define dequeue remove_from_beginning #define dequeue_all remove_all #define peek_at_head peek_at_beginning #define peek_at_tail peek_at_end #define copy_queue copy_list #endif /* GENERIC_LIST_DEFINED */ --- NEW FILE: objectpath.c --- /*! \file objectpath.c \brief Native CMPIObjectPath implementation. This is the native CMPIObjectPath implementation as used for remote providers. It reflects the well-defined interface of a regular CMPIObjectPath, however, it works independently from the management broker. It is part of a native broker implementation that simulates CMPI data types rather than interacting with the entities in a full-grown CIMOM. (C) Copyright IBM Corp. 2003 THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. You can obtain a current copy of the Common Public License from http://oss.software.ibm.com/developerworks/opensource/license-cpl.html \author Frank Scheffler $Revision: 1.1 $ */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "cmcidt.h" #include "cmcift.h" #include "cmcimacs.h" #include "tool.h" #include "native.h" #include "utilStringBuffer.h" extern char *keytype2Chars(CMPIType type); struct native_cop { CMPIObjectPath cop; int mem_state; char * namespace; char * classname; struct native_property * keys; }; static struct native_cop * __new_empty_cop ( int, const char *, const char *, CMPIStatus * ); /****************************************************************************/ static CMPIStatus __oft_release ( CMPIObjectPath * cop ) { struct native_cop * o = (struct native_cop *) cop; if ( o->mem_state == TOOL_MM_NO_ADD ) { o->mem_state = TOOL_MM_ADD; tool_mm_add ( o ); tool_mm_add ( o->classname ); tool_mm_add ( o->namespace ); propertyFT.release ( o->keys ); CMReturn ( CMPI_RC_OK ); } CMReturn ( CMPI_RC_ERR_FAILED ); } static CMPIObjectPath * __oft_clone ( CMPIObjectPath * cop, CMPIStatus * rc ) { CMPIStatus tmp; struct native_cop * o = (struct native_cop *) cop; struct native_cop * new = __new_empty_cop ( TOOL_MM_NO_ADD, o->namespace, o->classname, &tmp ); if ( tmp.rc == CMPI_RC_OK ) { new->keys = propertyFT.clone ( o->keys, rc ); } else if ( rc ) CMSetStatus ( rc, tmp.rc ); return (CMPIObjectPath *) new; } static CMPIStatus __oft_setNameSpace ( CMPIObjectPath * cop, const char * namespace ) { struct native_cop * o = (struct native_cop *) cop; char * ns = ( namespace )? strdup ( namespace ): NULL; if ( o->mem_state == TOOL_MM_NO_ADD ) { free ( o->namespace ); } else { tool_mm_add ( ns ); } o->namespace = ns; CMReturn ( CMPI_RC_OK ); } static CMPIString * __oft_getNameSpace ( CMPIObjectPath * cop, CMPIStatus * rc ) { struct native_cop * o = (struct native_cop *) cop; return native_new_CMPIString ( o->namespace, rc ); } static CMPIStatus __oft_setHostName ( CMPIObjectPath * cop, const char * hn ) { CMReturn ( CMPI_RC_ERR_NOT_SUPPORTED ); } static CMPIString * __oft_getHostName ( CMPIObjectPath * cop, CMPIStatus * rc ) { if ( rc ) CMSetStatus ( rc, CMPI_RC_ERR_NOT_SUPPORTED ); return NULL; } static CMPIStatus __oft_setClassName ( CMPIObjectPath * cop, const char * classname ) { struct native_cop * o = (struct native_cop *) cop; char * cn = ( classname )? strdup ( classname ): NULL; if ( o->mem_state == TOOL_MM_NO_ADD ) { free ( o->classname ); } else { tool_mm_add ( cn ); } o->classname = cn; CMReturn ( CMPI_RC_OK ); } static CMPIString * __oft_getClassName ( CMPIObjectPath * cop, CMPIStatus * rc ) { struct native_cop * o = (struct native_cop *) cop; return native_new_CMPIString ( o->classname, rc ); } static CMPIStatus __oft_addKey ( CMPIObjectPath * cop, const char * name, CMPIValue * value, CMPIType type ) { struct native_cop * o = (struct native_cop *) cop; CMReturn ( ( propertyFT.addProperty ( &o->keys, o->mem_state, name, type, CMPI_keyValue, value ) )? CMPI_RC_ERR_ALREADY_EXISTS: CMPI_RC_OK ); } static CMPIData __oft_getKey ( CMPIObjectPath * cop, const char * name, CMPIStatus * rc ) { struct native_cop * o = (struct native_cop *) cop; return propertyFT.getDataProperty ( o->keys, name, rc ); } static CMPIData __oft_getKeyAt ( CMPIObjectPath * cop, unsigned int index, CMPIString ** name, CMPIStatus * rc ) { struct native_cop * o = (struct native_cop *) cop; return propertyFT.getDataPropertyAt ( o->keys, index, name, rc ); } static unsigned int __oft_getKeyCount ( CMPIObjectPath * cop, CMPIStatus * rc ) { struct native_cop * o = (struct native_cop *) cop; return propertyFT.getPropertyCount ( o->keys, rc ); } static CMPIStatus __oft_setNameSpaceFromObjectPath ( CMPIObjectPath * cop, CMPIObjectPath * src ) { struct native_cop * s = (struct native_cop *) src; return __oft_setNameSpace ( cop, s->namespace ); } static CMPIString *__oft_toString(CMPIObjectPath * cop, CMPIStatus * rc); static struct native_cop * __new_empty_cop ( int mm_add, const char * namespace, const char * classname, CMPIStatus * rc ) { static CMPIObjectPathFT oft = { NATIVE_FT_VERSION, __oft_release, __oft_clone, __oft_setNameSpace, __oft_getNameSpace, __oft_setHostName, __oft_getHostName, __oft_setClassName, __oft_getClassName, __oft_addKey, __oft_getKey, __oft_getKeyAt, __oft_getKeyCount, __oft_setNameSpaceFromObjectPath, NULL, NULL, NULL, NULL, NULL, __oft_toString }; static CMPIObjectPath o = { "CMPIObjectPath", &oft }; struct native_cop * cop = (struct native_cop *) tool_mm_alloc ( mm_add, sizeof ( struct native_cop ) ); cop->cop = o; cop->mem_state = mm_add; cop->classname = ( classname )? strdup ( classname ): NULL; cop->namespace = ( namespace )? strdup ( namespace ): NULL; if ( mm_add == TOOL_MM_ADD ) { tool_mm_add ( cop->classname ); tool_mm_add ( cop->namespace ); } if ( rc ) CMSetStatus ( rc, CMPI_RC_OK ); return cop; } CMPIObjectPath * newCMPIObjectPath ( const char * namespace, const char * classname, CMPIStatus * rc ) { return (CMPIObjectPath *) __new_empty_cop ( TOOL_MM_ADD, namespace, classname, rc ); } extern char *value2Chars(CMPIType type, CMPIValue * value); char *pathToChars(CMPIObjectPath * cop, CMPIStatus * rc, char *str, int uri) { // "//atp:9999/root/cimv25:TennisPlayer.first="Patrick",last="Rafter"; CMPIString *ns; CMPIString *cn; CMPIString *name; CMPIData data; unsigned int i, m, s; char *v; char *colon=":"; *str = 0; if (uri) colon="%3A"; ns = cop->ft->getNameSpace(cop, rc); cn = cop->ft->getClassName(cop, rc); if (ns && ns->hdl && *(char*)ns->hdl) { if (uri==0) strcpy(str,(char*)ns->hdl); else { char *cns=(char*)ns->hdl; for (s=i=0, m=strlen(cns); i<m; i++,s++) { if (cns[i]=='/') { str[s++]='%'; str[s++]='2'; str[s]='F'; } else str[s]=cns[i]; } str[s]=0; } CMRelease(ns); strcat(str,colon); } strcat(str, (char *) cn->hdl); CMRelease(cn); for (i = 0, m = cop->ft->getKeyCount(cop, rc); i < m; i++) { data = cop->ft->getKeyAt(cop, i, &name, rc); if (i) strcat(str, ","); else strcat(str, "."); strcat(str, (char *) name->hdl); strcat(str, "="); v = value2Chars(data.type, &data.value); strcat(str, v); free(v); CMRelease(name); }; return str; } static CMPIString *__oft_toString(CMPIObjectPath * cop, CMPIStatus * rc) { char str[4096] = { 0 }; pathToChars(cop, rc, str,0); return native_new_CMPIString(str, rc); } const char *getNameSpaceChars(CMPIObjectPath * cop) { struct native_cop * o = (struct native_cop *) cop; return o->namespace; } UtilList *getNameSpaceComponents(CMPIObjectPath * cop) { UtilList *ul=newList(); CMPIString *nss=__oft_getNameSpace(cop, NULL); int s=0,i,m; char nsc[256],*ns; if (nss && nss->hdl) { ns=(char*)nss->hdl; if (ns) for (s=i=0, m=strlen(ns); i<m; i++,s++) { if (ns[i]=='/') { nsc[s]=0; ul->ft->append(ul,strdup(nsc)); s=-1; } else nsc[s]=ns[i]; } nsc[s]=0; } if (s) ul->ft->append(ul,strdup(nsc)); CMRelease(nss); return ul; } void pathToXml(UtilStringBuffer *sb, CMPIObjectPath *cop) { int i,s,m,state=0; CMPIData data; CMPIString *name; for (i=0,s=__oft_getKeyCount(cop,NULL); i<s; i++) { data=__oft_getKeyAt(cop,i,&name,NULL); switch (state) { case 0: sb->ft->append3Chars(sb,"<KEYBINDING NAME=\"",(char*)name->hdl,"\">"); if (data.type==CMPI_ref) { CMPIObjectPath *ref=data.value.ref; sb->ft->appendChars(sb, "<VALUE.REFERENCE><INSTANCEPATH>"); CMPIString *hn=__oft_getHostName(ref, NULL);; sb->ft->append3Chars(sb,"<NAMESPACEPATH><HOST>",(char*)hn->hdl,"</HOST>"); CMRelease(hn); sb->ft->appendChars(sb, "<VALUE.REFERENCE><INSTANCEPATH><LOCALNAMESPACEPATH>"); CMPIString *nss=__oft_getNameSpace(ref, NULL); if (nss && nss->hdl) { char nsc[256]; char *ns=(char*)nss->hdl; if (ns) for (s=i=0, m=strlen(ns); i<m; i++,s++) { if (ns[i]=='/') { nsc[s]=0; sb->ft->append3Chars(sb,"<NAMESPACE NAME=\"",nsc,"\"></NAMESPACE>"); s=0; } else nsc[s]=ns[i]; } nsc[s]=0; if (s) sb->ft->append3Chars(sb,"<NAMESPACE NAME=\"",nsc,"\"></NAMESPACE>"); CMRelease(nss); } sb->ft->appendChars(sb,"</LOCALNAMESPACEPATH></NAMESPACEPATH>"); CMPIString *cn=__oft_getClassName(ref, NULL); sb->ft->append3Chars(sb,"<INSTANCENAME CLASSNAME=\"",(char*)cn->hdl,"\">"); state=1; continue; } else { sb->ft->append5Chars(sb,"<KEYVALUE VALUETYPE=\"",keytype2Chars(data.type),"\">", value2Chars(data.type,&data.value),"</KEYVALUE>"); state=0; } break; case 1: if (data.type==CMPI_ref) { sb->ft->appendChars(sb,"</INSTANCENAME></INSTANCEPATH></VALUE.REFERENCE>"); i--; state=0; } else { sb->ft->append3Chars(sb,"<KEYBINDING NAME=\"",(char*)name->hdl,"\">"); sb->ft->append5Chars(sb,"<KEYVALUE VALUETYPE=\"",keytype2Chars(data.type),"\">", value2Chars(data.type,&data.value),"</KEYVALUE>"); } break; } sb->ft->appendChars(sb,"</KEYBINDING>\n"); } if (state==1) sb->ft->appendChars(sb,"</INSTANCENAME></INSTANCEPATH></VALUE.REFERENCE></KEYBINDING>"); } /****************************************************************************/ /*** Local Variables: ***/ /*** mode: C ***/ /*** c-basic-offset: 8 ***/ /*** End: ***/ --- NEW FILE: broker.c --- /*! \file broker.c \brief Native CMPI broker encapsulated functionality. This module implements a complete CMPI broker encapsulated function table (CMPIBrokerEncFT) natively. Thus, CMPI data types may be created remotely without the need to connect to the CIMOM. (C) Copyright IBM Corp. 2003 THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. You can obtain a current copy of the Common Public License from http://oss.software.ibm.com/developerworks/opensource/license-cpl.html \author Frank Scheffler $Revision: 1.1 $ */ #include "cmpidt.h" #include "cmpift.h" #include "cmpimacs.h" #include "tool.h" #include "native.h" #include "debug.h" static CMPIInstance * __beft_newInstance ( CMPIBroker * broker, CMPIObjectPath * cop, CMPIStatus * rc ) { TRACE_NORMAL(("Creating new native CMPIInstance.")); return native_new_CMPIInstance ( cop, rc ); } static CMPIObjectPath * __beft_newObjectPath ( CMPIBroker * broker, char * namespace, char * classname, CMPIStatus * rc ) { TRACE_NORMAL(("Creating new native CMPIObjectPath.")); return native_new_CMPIObjectPath ( namespace, classname, rc ); } static CMPIArgs * __beft_newArgs ( CMPIBroker * broker, CMPIStatus * rc ) { TRACE_NORMAL(("Creating new native CMPIArgs.")); return native_new_CMPIArgs ( rc ); } static CMPIString * __beft_newString ( CMPIBroker * broker, char * str, CMPIStatus * rc ) { TRACE_NORMAL(("Creating new native CMPIString.")); TRACE_INFO(("String: %s", str )); return native_new_CMPIString ( str, rc ); } static CMPIArray * __beft_newArray ( CMPIBroker * broker, CMPICount size, CMPIType type, CMPIStatus * rc ) { TRACE_NORMAL(("Creating new native CMPIArray.")); TRACE_INFO(("type: 0x%x\nsize: %d", type, size )); return native_new_CMPIArray ( size, type, rc ); } static CMPIDateTime * __beft_newDateTime ( CMPIBroker * broker, CMPIStatus * rc ) { TRACE_NORMAL(("Creating new native CMPIDateTime.")); return native_new_CMPIDateTime ( rc ); } static CMPIDateTime * __beft_newDateTimeFromBinary ( CMPIBroker * broker, CMPIUint64 time, CMPIBoolean interval, CMPIStatus * rc ) { TRACE_NORMAL(("Creating new native CMPIDateTime.")); TRACE_INFO(("time: %lld\ninterval: %d", time, interval )); return native_new_CMPIDateTime_fromBinary ( time, interval, rc ); } static CMPIDateTime * __beft_newDateTimeFromChars ( CMPIBroker * broker, char * string, CMPIStatus * rc ) { TRACE_NORMAL(("Creating new native CMPIDateTime.")); TRACE_INFO(("time: %s", string )); return native_new_CMPIDateTime_fromChars ( string, rc ); } static CMPISelectExp * __beft_newSelectExp ( CMPIBroker * broker, char * queryString, char * language, CMPIArray ** projection, CMPIStatus * rc ) { TRACE_NORMAL(("Creating new native CMPISelectExp.")); return native_new_CMPISelectExp ( queryString, language, projection, rc ); } static CMPIBoolean __beft_classPathIsA ( CMPIBroker * broker, CMPIObjectPath * cop, char * type, CMPIStatus * rc ) { TRACE_CRITICAL(("This operation is not yet supported.")); if ( rc ) CMSetStatus ( rc, CMPI_RC_ERR_NOT_SUPPORTED ); return 0; } static CMPIString * __beft_toString ( CMPIBroker * broker, void * object, CMPIStatus * rc ) { TRACE_CRITICAL(("This operation is not yet supported.")); if ( rc ) CMSetStatus ( rc, CMPI_RC_ERR_NOT_SUPPORTED ); return NULL; } static CMPIBoolean __beft_isOfType ( CMPIBroker * broker, void * object, char * type, CMPIStatus * rc ) { char * t = * ( (char **) object ); TRACE_NORMAL(("Verifying encapsulated object type.")); if ( rc ) CMSetStatus ( rc, CMPI_RC_OK ); return ( strcmp ( t, type ) == 0 ); } static CMPIString * __beft_getType ( CMPIBroker * broker, void * object, CMPIStatus * rc ) { TRACE_NORMAL(("Returning encapsulated object type.")); return __beft_newString ( broker, *( (char **) object ), rc ); } /****************************************************************************/ CMPIBrokerEncFT native_brokerEncFT = { NATIVE_FT_VERSION, __beft_newInstance, __beft_newObjectPath, __beft_newArgs, __beft_newString, __beft_newArray, __beft_newDateTime, __beft_newDateTimeFromBinary, __beft_newDateTimeFromChars, __beft_newSelectExp, __beft_classPathIsA, __beft_toString, __beft_isOfType, __beft_getType }; /****************************************************************************/ /*** Local Variables: ***/ /*** mode: C ***/ /*** c-basic-offset: 8 ***/ /*** End: ***/ --- NEW FILE: rules --- %.dep: %.c $(CC) -MM $(CPPFLAGS) $< | sed 's!\($*\)\.o[ :]*!\1.o $@ : !g' > $@ LINK_LIB = $(LINK.c) -shared $^ $(LOADLIBES) $(LDLIBS) -o $@ LINK_BIN = $(LINK.c) $^ $(LOADLIBES) $(LDLIBS) -o $@ --- NEW FILE: utilList.h --- /* * utilList.h * * (C) Copyright IBM Corp. 2005 * * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. * * You can obtain a current copy of the Common Public License from * http://oss.software.ibm.com/developerworks/opensource/license-cpl.html * * Author: Adrian Schuur <sc...@de...> * * Description: * * */ #ifndef UTILList_H #define UTILList_H struct _Util_List_FT; typedef struct _Util_List_FT Util_List_FT; struct _UtilList { void *hdl; Util_List_FT *ft; int mem_state; }; typedef struct _UtilList UtilList; struct _Util_List_FT { int version; void (*release) (UtilList * ul); UtilList *(*clone) (UtilList * ul); void (*clear) (UtilList * ul); unsigned long (*size) (UtilList * ul); int (*isEmpty) (UtilList * ul); int (*contains) (UtilList * ul, const void *elm); void (*append) (UtilList * ul, const void *elm); void (*prepend) (UtilList * ul, const void *elm); void (*add) (UtilList * ul, const void *elm); void *(*getFirst) (UtilList * ul); void *(*getLast) (UtilList * ul); void *(*getNext) (UtilList * ul); void *(*getPrevious) (UtilList * ul); void *(*getCurrent) (UtilList * ul); void *(*removeFirst) (UtilList * ul); void *(*removeLast) (UtilList * ul); void *(*removeCurrent) (UtilList * ul); void *(*removeThis) (UtilList * ul, void *elm); }; UtilList *newList(); #endif --- NEW FILE: genericlist.c --- /* * genericList.c * * (C) Copyright IBM Corp. 2005 * * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. * * You can obtain a current copy of the Common Public License from * http://oss.software.ibm.com/developerworks/opensource/license-cpl.html * * Author: Keith Pomakis <po...@po...> * Contributions: Adrian Schuur <sc...@de...> * * Description: * * list implementation. * */ /************************************************************************ ************************************************************************* ** ** ** Generic List Library ** ** ** ** by Keith Pomakis ** ** kpp...@je... ** ** ** ** Spring, 1994 ** ** ** ************************************************************************* ************************************************************************/ #include <stdio.h> #include <stdlib.h> #include "genericlist.h" #include "tool.h" //#include "mlog.h" #ifdef THINK_C #define malloc NewPtr #endif #define NEW(x) ((x *) emalloc(sizeof(x))) static void initialize_list(Generic_list * list); static void initialize_sorted_list(Generic_list * list, int (*lt) (void *a, void *b)); static void destroy_list(Generic_list * list); static void add_to_beginning(Generic_list list, void *pointer); static void add_to_end(Generic_list list, void *pointer); //static void add_to_list(Generic_list list, void *pointer); static void *remove_from_beginning(Generic_list list); static void *remove_from_end(Generic_list list); static void *remove_from_list(Generic_list list, void *pointer); static void remove_all(Generic_list list); //static void *peek_at_beginning(Generic_list list); //static void *peek_at_end(Generic_list list); static void *first_in_list(Generic_list list); static void *next_in_list(Generic_list list); static void *current_in_list(Generic_list list); static void *remove_current(Generic_list list); static void *previous_in_list(Generic_list list); static void *last_in_list(Generic_list list); static void reset_to_beginning(Generic_list list); //static void reset_to_end(Generic_list list); static int num_of_objects(const Generic_list list); static int is_empty(const Generic_list list); static int is_in_list(const Generic_list list, const void *pointer); static Generic_list copy_list(Generic_list list); /* static void perform_on_list(Generic_list list, void (*fn) (void *pointer, void *args),void *args); static void *first_that(Generic_list list, int (*fn) (const void *pointer, const void *args), const void *args); static void *next_that(Generic_list list, int (*fn) (const void *pointer, const void *args), const void *args); static void *previous_that(Generic_list list, int (*fn) (const void *pointer, const void *args), const void *args); static void *last_that(Generic_list list, int (*fn) (const void *pointer, const void *args), const void *args); static Generic_list all_such_that(Generic_list list, int (*fn) (const void *pointer, const void *args), const void *args); static void remove_all_such_that(Generic_list list, int (*fn) (const void *pointer, const void *args), const void *args); */ static char *module = "generic_list"; static void *emalloc(unsigned int n); /****************************************************************************/ static void initialize_list(Generic_list * list) { list->info = NEW(Generic_list_info); list->info->pre_element.pointer = NULL; list->info->pre_element.previous = &list->info->pre_element; list->info->pre_element.next = &list->info->post_element; list->info->post_element.pointer = NULL; list->info->post_element.previous = &list->info->pre_element; list->info->post_element.next = &list->info->post_element; list->info->current = &list->info->pre_element; list->info->deleted_element.pointer = NULL; list->info->lt = NULL; list->info->num_of_elements = 0; } /****************************************************************************/ static void initialize_sorted_list(Generic_list * list, int (*lt) (void *a, void *b)) { initialize_list(list); list->info->lt = lt; } /****************************************************************************/ static void destroy_list(Generic_list * list) { remove_all(*list); free((void *) list->info); } /****************************************************************************/ static void add_to_beginning(Generic_list list, void *pointer) { Generic_list_element *element; if (!pointer) { // mlogf(M_ERROR,M_SHOW, "%s: NULL pointer passed 1\n", module); fprintf(stderr, "%s: NULL pointer passed 1\n", module); return; exit(EXIT_FAILURE); } element = NEW(Generic_list_element); element->next = list.info->pre_element.next; element->previous = &list.info->pre_element; element->pointer = pointer; list.info->pre_element.next->previous = element; list.info->pre_element.next = element; list.info->num_of_elements++; } /****************************************************************************/ static void add_to_end(Generic_list list, void *pointer) { Generic_list_element *element; if (!pointer) { // mlogf(M_ERROR,M_SHOW, "%s: NULL pointer passed 2\n", module); fprintf(stderr,"%s: NULL pointer passed 2\n", module); // abort(); return; exit(EXIT_FAILURE); } element = NEW(Generic_list_element); element->next = &list.info->post_element; element->previous = list.info->post_element.previous; element->pointer = pointer; list.info->post_element.previous->next = element; list.info->post_element.previous = element; list.info->num_of_elements++; } /****************************************************************************/ /* static void add_to_list(Generic_list list, void *pointer) { Generic_list_element *element, *new_element; if (list.info->lt) { if (!pointer) { mlogf(M_ERROR,M_SHOW, "%s: NULL pointer passed\n", module); exit(EXIT_FAILURE); } element = list.info->pre_element.next; while (element != &list.info->post_element && (*list.info->lt) (element->pointer, pointer)) element = element->next; new_element = NEW(Generic_list_element); new_element->next = element; new_element->previous = element->previous; new_element->pointer = pointer; element->previous->next = new_element; element->previous = new_element; list.info->num_of_elements++; } else add_to_end(list, pointer); } */ /****************************************************************************/ static void *remove_from_list(Generic_list list, void *pointer) { Generic_list_element *element; element = list.info->post_element.previous; while (element != &list.info->pre_element && element->pointer != pointer) element = element->previous; if (element == &list.info->pre_element) /* No such element was found. */ return NULL; if (element == list.info->current) { list.info->deleted_element.previous = element->previous; list.info->deleted_element.next = element->next; list.info->current = &list.info->deleted_element; } element->previous->next = element->next; element->next->previous = element->previous; free(element); list.info->num_of_elements--; return pointer; } /****************************************************************************/ static void *remove_from_beginning(Generic_list list) { Generic_list_element *element; void *pointer; if (list.info->num_of_elements == 0) return NULL; element = list.info->pre_element.next; if (element == list.info->current) list.info->current = &list.info->pre_element; pointer = element->pointer; list.info->pre_element.next = element->next; element->next->previous = &list.info->pre_element; free(element); list.info->num_of_elements--; return pointer; } /****************************************************************************/ static void *remove_from_end(Generic_list list) { Generic_list_element *element; void *pointer; if (list.info->num_of_elements == 0) return NULL; element = list.info->post_element.previous; if (element == list.info->current) list.info->current = &list.info->post_element; pointer = element->pointer; list.info->post_element.previous = element->previous; element->previous->next = &list.info->post_element; free(element); list.info->num_of_elements--; return pointer; } /****************************************************************************/ static void *remove_current(Generic_list list) { Generic_list_element *element; void *pointer; element = list.info->current; if (element->pointer == NULL) return NULL; list.info->deleted_element.previous = element->previous; list.info->deleted_element.next = element->next; list.info->current = &list.info->deleted_element; pointer = element->pointer; element->next->previous = element->previous; element->previous->next = element->next; free(element); list.info->num_of_elements--; return pointer; } /****************************************************************************/ static void remove_all(Generic_list list) { Generic_list_element *element; element = list.info->pre_element.next; while (element && element != &list.info->post_element) { element = element->next; if (element) free(element->previous); } list.info->pre_element.next = &list.info->post_element; list.info->post_element.previous = &list.info->pre_element; list.info->num_of_elements = 0; } /****************************************************************************/ /* static void *peek_at_beginning(Generic_list list) { return list.info->pre_element.next->pointer; } */ /****************************************************************************/ /* static void *peek_at_end(Generic_list list) { return list.info->post_element.previous->pointer; } */ /****************************************************************************/ static void *first_in_list(Generic_list list) { list.info->current = list.info->pre_element.next->next->previous; return list.info->current->pointer; } /****************************************************************************/ static void *current_in_list(Generic_list list) { return list.info->current->pointer; } /****************************************************************************/ static void *last_in_list(Generic_list list) { list.info->current = list.info->post_element.previous->previous->next; return list.info->current->pointer; } /****************************************************************************/ static void *next_in_list(Generic_list list) { list.info->current = list.info->current->next; return list.info->current->pointer; } /****************************************************************************/ static void *previous_in_list(Generic_list list) { list.info->current = list.info->current->previous; return list.info->current->pointer; } /****************************************************************************/ static void reset_to_beginning(Generic_list list) { list.info->current = &list.info->pre_element; } /****************************************************************************/ /* static void reset_to_end(Generic_list list) { list.info->current = &list.info->post_element; } */ /****************************************************************************/ static int num_of_objects(const Generic_list list) { return list.info->num_of_elements; } /****************************************************************************/ static int is_empty(const Generic_list list) { return (list.info->num_of_elements == 0); } /****************************************************************************/ static int is_in_list(const Generic_list list, const void *pointer) { Generic_list_element *element; element = list.info->pre_element.next; while (element != &list.info->post_element && element->pointer != pointer) element = element->next; return (element != &list.info->post_element); } /****************************************************************************/ static Generic_list copy_list(Generic_list list) { Generic_list list_copy; Generic_list_element *element; initialize_sorted_list(&list_copy, list.info->lt); element = list.info->pre_element.next; while (element != &list.info->post_element) { add_to_end(list_copy, element->pointer); element = element->next; } return list_copy; } /****************************************************************************/ /* static void perform_on_list(Generic_list list, void (*fn) (void *pointer, void *args), void *args) { Generic_list_element *element; element = list.info->pre_element.next; while (element != &list.info->post_element) { (*fn) (element->pointer, args); element = element->next; } } */ /****************************************************************************/ /* static void *first_that(Generic_list list, int (*fn) (const void *pointer, const void *args), const void *args) { Generic_list_element *element; element = list.info->pre_element.next; while (element != &list.info->post_element && !(*fn) (element->pointer, args)) { element = element->next; } if (element->pointer) list.info->current = element; return element->pointer; } */ /****************************************************************************/ /* static void *next_that(Generic_list list, int (*fn) (const void *pointer, const void *args), const void *args) { Generic_list_element *element; element = list.info->current->next; while (element != &list.info->post_element && !(*fn) (element->pointer, args)) { element = element->next; } if (element->pointer) list.info->current = element; return element->pointer; } */ /****************************************************************************/ /* static void *previous_that(Generic_list list, int (*fn) (const void *pointer, const void *args), const void *args) { Generic_list_element *element; element = list.info->current->previous; while (element != &list.info->pre_element && !(*fn) (element->pointer, args)) { element = element->previous; } if (element->pointer) list.info->current = element; return element->pointer; } */ /****************************************************************************/ /* static void *last_that(Generic_list list, int (*fn) (const void *pointer, const void *args), const void *args) { Generic_list_element *element; element = list.info->post_element.previous; while (element != &list.info->pre_element && !(*fn) (element->pointer, args)) { element = element->previous; } if (element->pointer) list.info->current = element; return element->pointer; } */ /****************************************************************************/ /* static Generic_list all_such_that(Generic_list list, int (*fn) (const void *pointer, const void *args), const void *args) { Generic_list list_copy; Generic_list_element *element; initialize_sorted_list(&list_copy, list.info->lt); element = list.info->pre_element.next; while (element != &list.info->post_element) { if ((*fn) (element->pointer, args)) add_to_end(list_copy, element->pointer); element = element->next; } return list_copy; } */ /****************************************************************************/ /* static void remove_all_such_that(Generic_list list, int (*fn) (const void *pointer, const void *args), const void *args) { void *obj; reset_to_beginning(list); while ((obj = next_in_list(list))) if ((*fn) (obj, args)) remove_current(list); } */ /****************************************************************************/ /****************************************************************************/ /** **/ /** Internal functions **/ /** **/ /****************************************************************************/ /****************************************************************************/ static void *emalloc(unsigned int n) { void *ptr; ptr = (void *) malloc(n); if (ptr == NULL) { // mlogf(M_ERROR,M_SHOW, "%s: error allocating memory\n", module); fprintf(stderr, "%s: error allocating memory\n", module); exit(EXIT_FAILURE); } return ptr; } static void listRelease(UtilList * ul) { Generic_list l = *(Generic_list *) & ul->hdl; destroy_list(&l); //memUnlinkEncObj(ul->mem_state); free(ul); } static UtilList *listClone(UtilList * ul) { Generic_list l = *(Generic_list *) & ul->hdl; UtilList *nul = NEW(UtilList); *nul = *ul; nul->hdl = copy_list(l).info; return nul; } static void listClear(UtilList * ul) { Generic_list l = *(Generic_list *) & ul->hdl; remove_all(l); } static unsigned long listSize(UtilList * ul) { Generic_list l = *(Generic_list *) & ul->hdl; return num_of_objects(l); } static int listIsEmpty(UtilList * ul) { Generic_list l = *(Generic_list *) & ul->hdl; return is_empty(l); } static int listContains(UtilList * ul, const void *elm) { Generic_list l = *(Generic_list *) & ul->hdl; return is_in_list(l, elm); } static void listAppend(UtilList * ul, const void *elm) { Generic_list l = *(Generic_list *) & ul->hdl; add_to_end(l, (void *) elm); } static void listPrepend(UtilList * ul, const void *elm) { Generic_list l = *(Generic_list *) & ul->hdl; add_to_beginning(l, (void *) elm); } static void listAdd(UtilList * ul, const void *elm) { Generic_list l = *(Generic_list *) & ul->hdl; add_to_beginning(l, (void *) elm); } static void *listGetFirst(UtilList * ul) { Generic_list l = *(Generic_list *) & ul->hdl; reset_to_beginning(l); return first_in_list(l); } static void *listGetLast(UtilList * ul) { Generic_list l = *(Generic_list *) & ul->hdl; return last_in_list(l); } static void *listGetNext(UtilList * ul) { Generic_list l = *(Generic_list *) & ul->hdl; return next_in_list(l); } static void *listGetPrevious(UtilList * ul) { Generic_list l = *(Generic_list *) & ul->hdl; return previous_in_list(l); } static void *listGetCurrent(UtilList * ul) { Generic_list l = *(Generic_list *) & ul->hdl; return current_in_list(l); } static void *listRemoveFirst(UtilList * ul) { Generic_list l = *(Generic_list *) & ul->hdl; return remove_from_beginning(l); } static void *listRemoveLast(UtilList * ul) { Generic_list l = *(Generic_list *) & ul->hdl; return remove_from_end(l); } static void *listRemoveCurrent(UtilList * ul) { Generic_list l = *(Generic_list *) & ul->hdl; return remove_current(l); } static void *listRemoveThis(UtilList * ul, void *elm) { Generic_list l = *(Generic_list *) & ul->hdl; return remove_from_list(l, elm); } Util_List_FT UtilList_ft = { 1, listRelease, listClone, listClear, listSize, listIsEmpty, listContains, listAppend, listPrepend, listAdd, listGetFirst, listGetLast, listGetNext, listGetPrevious, listGetCurrent, listRemoveFirst, listRemoveLast, listRemoveCurrent, listRemoveThis }; Util_List_FT *UtilListFT = &UtilList_ft; UtilList *newList() { UtilList ul,*tUl; int state; ul.ft = UtilListFT; initialize_list((Generic_list *) & ul.hdl); tUl=(UtilList*)(memAddEncObj(MEM_NOT_TRACKED, &ul, sizeof(ul),&state)); tUl->mem_state=state; return tUl; } --- NEW FILE: property.c --- /*! \file property.c \brief Native property implementation. This module implements a native property, which is not public to any provider programmer. It is used to implement various other data types natively, such as instances, object-paths and args. It provides means to maintain linked lists of named properties including functionality to add, remove, clone and release them. (C) Copyright IBM Corp. 2003 THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. You can obtain a current copy of the Common Public License from http://oss.software.ibm.com/developerworks/opensource/license-cpl.html \author Frank Scheffler $Revision: 1.1 $ */ #include <stdio.h> #include <string.h> #include "cmcidt.h" #include "cmcift.h" #include "cmcimacs.h" #include "tool.h" #include "native.h" //! Storage container for commonly needed data within native CMPI data types. /*! This structure is used to build linked lists of data containers as needed for various native data types. */ struct native_property { char * name; //!< Property identifier. CMPIType type; //!< Associated CMPIType. CMPIValueState state; //!< Current value state. CMPIValue value; //!< Current value. struct native_property * next; //!< Pointer to next property. }; /****************************************************************************/ static CMPIData __convert2CMPIData ( struct native_property * prop, CMPIString ** propname ) { CMPIData result; if ( prop != NULL ) { result.type = prop->type; result.state = prop->state; result.value = prop->value; if ( propname ) { *propname = native_new_CMPIString ( prop->name, NULL ); } } else { result.state = CMPI_nullValue; } return result; } /** * returns non-zero if already existant */ static int __addProperty ( struct native_property ** prop, int mm_add, const char * name, CMPIType type, CMPIValueState state, CMPIValue * value ) { CMPIValue v; if ( *prop == NULL ) { struct native_property * tmp = *prop = (struct native_property *) tool_mm_alloc ( mm_add, sizeof ( struct native_property ) ); tmp->name = strdup ( name ); if ( mm_add == TOOL_MM_ADD ) tool_mm_add ( tmp->name ); if ( type == CMPI_chars ) { type = CMPI_string; v.string = native_new_CMPIString ( (char *) value, NULL ); value = &v; } tmp->type = type; if ( type != CMPI_null ) { tmp->state = state; if ( mm_add == TOOL_MM_ADD ) { tmp->value = *value; } else { CMPIStatus rc; tmp->value = native_clone_CMPIValue ( type, value, &rc ); // what if clone() fails??? } } else tmp->state = CMPI_nullValue; return 0; } return ( strcmp ( (*prop)->name, name ) == 0 || __addProperty ( &( (*prop)->next ), mm_add, name, type, state, value ) ); } /** * returns -1 if non-existant */ static int __setProperty ( struct native_property * prop, int mm_add, const char * name, CMPIType type, CMPIValue * value ) { CMPIValue v; if ( prop == NULL ) { return -1; } if ( strcmp ( prop->name, name ) == 0 ) { CMPIStatus rc; if ( ! ( prop->state & CMPI_nullValue ) ) native_release_CMPIValue ( prop->type, &prop->value ); if ( type == CMPI_chars ) { type = CMPI_string; v.string = native_new_CMPIString ( (char *) value, NULL ); value = &v; } prop->type = type; if ( type != CMPI_null ) { prop->value = ( mm_add == TOOL_MM_ADD )? *value: native_clone_CMPIValue ( type, value, &rc ); // what if clone() fails ??? } else prop->state = CMPI_nullValue; return 0; } return __setProperty ( prop->next, mm_add, name, type, value); } static struct native_property * __getProperty ( struct native_property * prop, const char * name ) { if ( ! prop || ! name ) { return NULL; } return ( strcmp ( prop->name, name ) == 0 )? prop: __getProperty ( prop->next, name ); } static CMPIData __getDataProperty ( struct native_property * prop, const char * name, CMPIStatus * rc ) { struct native_property * p = __getProperty ( prop, name ); if ( rc ) CMSetStatus ( rc, ( p )? CMPI_RC_OK: CMPI_RC_ERR_NO_SUCH_PROPERTY ); return __convert2CMPIData ( p, NULL ); } static struct native_property * __getPropertyAt ( struct native_property * prop, unsigned int pos ) { if ( ! prop ) { return NULL; } return ( pos == 0 )? prop: __getPropertyAt ( prop->next, --pos ); } static CMPIData __getDataPropertyAt ( struct native_property * prop, unsigned int pos, CMPIString ** propname, CMPIStatus * rc ) { struct native_property * p = __getPropertyAt ( prop, pos ); if ( rc ) CMSetStatus ( rc, ( p )? CMPI_RC_OK: CMPI_RC_ERR_NO_SUCH_PROPERTY ); return __convert2CMPIData ( p, propname ); } static CMPICount __getPropertyCount ( struct native_property * prop, CMPIStatus * rc ) { CMPICount c = 0; if ( rc ) CMSetStatus ( rc, CMPI_RC_OK ); while ( prop != NULL ) { c++; prop = prop->next; } return c; } static void __release ( struct native_property * prop ) { for ( ; prop; prop = prop->next ) { tool_mm_add ( prop ); tool_mm_add ( prop->name ); native_release_CMPIValue ( prop->type, &prop->value ); } } static struct native_property * __clone ( struct native_property * prop, CMPIStatus * rc ) { struct native_property * result; CMPIStatus tmp; if ( prop == NULL ) { if ( rc ) CMSetStatus ( rc, CMPI_RC_OK ); return NULL; } result = (struct native_property * ) tool_mm_alloc ( TOOL_MM_NO_ADD, sizeof ( struct native_property ) ); result->name = strdup ( prop->name ); result->type = prop->type; result->state = prop->state; result->value = native_clone_CMPIValue ( prop->type, &prop->value, &tmp ); if ( tmp.rc != CMPI_RC_OK ) { result->state = CMPI_nullValue; } result->next = __clone ( prop->next, rc ); return result; } /** * Global function table to access native_property helper functions. */ struct native_propertyFT propertyFT = { __addProperty, __setProperty, __getDataProperty, __getDataPropertyAt, __getPropertyCount, __release, __clone }; /****************************************************************************/ /*** Local Variables: ***/ /*** mode: C ***/ /*** c-basic-offset: 8 ***/ /*** End: ***/ --- NEW FILE: native.h --- /*! \file native.h \brief Header file for the native encapsulated CMPI data type implementation. This file defines all the data types and functions necessary to use native encapsulated CMPI data objects. These are clones of the regular CMPI data types like CMPIObjectPath, CMPIInstance etc., however, they can be instantiated and manipulated without a full blown CIMOM. Instead, they use an autononmous CIMOM clone that provides all the functions to create these objects as defined by the CMPIBrokerEncFT. (C) Copyright IBM Corp. 2003 THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. You can obtain a current copy of the Common Public License from http://oss.software.ibm.com/developerworks/opensource/license-cpl.html \author Frank Scheffler $Revision: 1.1 $ */ #ifndef _REMOTE_CMPI_NATIVE_DATA_H #define _REMOTE_CMPI_NATIVE_DATA_H #define NATIVE_FT_VERSION 1 #include "cmcidt.h" #include "cmcift.h" #include "cmci.h" #include "cimXmlParser.h" struct native_instance { CMPIInstance instance; int mem_state; char * classname; char * namespace; int filtered; char ** property_list; char ** key_list; struct native_property * props; }; //! Forward declaration for anonymous struct. struct native_property; //! Function table for native_property handling functions. /*! This structure holds all the function pointers necessary to handle linked lists of native_property structs. \sa propertyFT in native.h */ struct native_propertyFT { //! Adds a new native_property to a list. int (* addProperty) ( struct native_property **, int, const char *, CMPIType, CMPIValueState, CMPIValue * ); //! Resets the values of an existing native_property, if existant. int (* setProperty) ( struct native_property *, int, const char *, CMPIType, CMPIValue * ); //! Looks up a specifix native_property in CMPIData format. CMPIData (* getDataProperty) ( struct native_property *, const char *, CMPIStatus * ); //! Extract an indexed native_property in CMPIData format. CMPIData (* getDataPropertyAt) ( struct native_property *, unsigned int, CMPIString **, CMPIStatus * ); //! Yields the number of native_property items in a list. CMPICount (* getPropertyCount) ( struct native_property *, CMPIStatus * ); //! Releases a complete list of native_property items. void (* release) ( struct native_property * ); //! Clones a complete list of native_property items. struct native_property * (* clone) ( struct native_property *, CMPIStatus * ); }; /****************************************************************************/ void native_release_CMPIValue ( CMPIType, CMPIValue * val ); CMPIValue native_clone_CMPIValue ( CMPIType, CMPIValue * val, CMPIStatus * ); CMPIString * native_new_CMPIString ( const char *, CMPIStatus * ); CMPIArray * native_new_CMPIArray ( CMPICount size, CMPIType type, CMPIStatus * ); void native_array_increase_size ( CMPIArray *, CMPICount ); CMPIEnumeration * native_new_CMPIEnumeration ( CMPIArray *, CMPIStatus * ); CMPIInstance * native_new_CMPIInstance ( CMPIObjectPath *, CMPIStatus * ); CMPIObjectPath * native_new_CMPIObjectPath ( const char *, const char *, CMPIStatus * ); CMPIArgs * native_new_CMPIArgs ( CMPIStatus * ); CMPIDateTime * native_new_CMPIDateTime ( CMPIStatus * ); CMPIDateTime * native_new_CMPIDateTime_fromBinary ( CMPIUint64, CMPIBoolean, CMPIStatus * ); CMPIDateTime * native_new_CMPIDateTime_fromChars ( const char *, CMPIStatus * ); struct xtokValueReference; CMPIValue str2CMPIValue(CMPIType type, char *val, struct xtokValueReference *ref); void setInstNsAndCn(CMPIInstance *ci, char *ns, char *cn); CMPIStatus simpleArrayAdd(CMPIArray * array, CMPIValue * val, CMPIType type); const char *getNameSpaceChars(CMPIObjectPath * cop); CMPIValue *getKeyValueTypePtr(char *type, char *value, struct xtokValueReference *ref, CMPIValue * val, CMPIType * typ); #define newCMPIString native_new_CMPIString #define newCMPIObjectPath native_new_CMPIObjectPath #define newCMPIInstance native_new_CMPIInstance #define newCMPIArray native_new_CMPIArray #define newCMPIEnumeration native_new_CMPIEnumeration /****************************************************************************/ struct native_propertyFT propertyFT; #endif /*** Local Variables: ***/ /*** mode: C ***/ /*** c-basic-offset: 8 ***/ /*** End: ***/ --- NEW FILE: cimXmlParser.h --- /* * cimXmlParser.h * * (C) Copyright IBM Corp. 2005 * * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. * * You can obtain a current copy of the Common Public License from * http://oss.software.ibm.com/developerworks/opensource/license-cpl.html * * Author: Adrian Schuur <sc...@de...> * * Description: * * CIM XML lexer for sfcb to be used in connection with cimXmlOps.y. * */ #ifndef XMLSCAN_H #define XMLSCAN_H #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include "cmcidt.h" #include "cmcift.h" #include "cmcimacs.h" #include "native.h" typedef enum typeValRef { typeValRef_InstanceName, typeValRef_InstancePath, typevalRef_LocalInstancePath } TypeValRef; typedef enum typeProperty { typeProperty_Value, typeProperty_Reference, typeProperty_Array } TypeProperty; typedef struct xmlBuffer { char *base; char *last; char *cur; char eTagFound; int etag; char nulledChar; } XmlBuffer; typedef struct xmlElement { char *attr; } XmlElement; typedef struct xmlAttr { char *attr; } XmlAttr; typedef struct xtokNameSpace { char *ns; char *cns; // must be free'd } XtokNameSpace; typedef struct xtokMessage { char *id; } XtokMessage; typedef struct xtokValue { char *value; } XtokValue; typedef struct xtokValueArray { int max,next; char **values; } XtokValueArray; typedef struct xtokHost { char *host; } XtokHost; typedef struct xtokNameSpacePath { XtokHost host; char *nameSpacePath; } XtokNameSpacePath; struct xtokKeyBinding; struct xtokValueReference; typedef struct xtokKeyValue { char *valueType, *value; } XtokKeyValue; typedef struct xtokKeyBindings { int max, next; struct xtokKeyBinding *keyBindings; // must be free'd } XtokKeyBindings; typedef struct xtokInstanceName { char *className; XtokKeyBindings bindings; } XtokInstanceName; typedef struct xtokInstancePath { XtokNameSpacePath path; XtokInstanceName instanceName; int type; } XtokInstancePath; typedef struct xtokLocalInstancePath { char *path; XtokInstanceName instanceName; int type; } XtokLocalInstancePath; typedef struct xtokLocalClassPath { char *path; char *className; int type; } XtokLocalClassPath; typedef struct xtokValueReference { union { XtokInstancePath instancePath; XtokLocalInstancePath localInstancePath; XtokInstanceName instanceName; }; TypeValRef type; } XtokValueReference; typedef struct xtokKeyBinding { char *name, *value, *type; XtokValueReference ref; } XtokKeyBinding; typedef struct xtokQualifier { struct xtokQualifier *next; char *name; CMPIType type; char *value; char propagated, overridable, tosubclass, toinstance, translatable; } XtokQualifier; typedef struct xtokQualifiers { XtokQualifier *last, *first; // must be free'd } XtokQualifiers; typedef struct xtokPropertyData { union { char *value; XtokValueReference ref; XtokValueArray array; }; XtokQualifiers qualifiers; int null; } XtokPropertyData; typedef struct xtokProperty { struct xtokProperty *next; char *name; char *classOrigin; char propagated; char *referenceClass; CMPIType valueType; XtokPropertyData val; TypeProperty propType; } XtokProperty; typedef struct xtokProperties { XtokProperty *last, *first; // must be free'd } XtokProperties; typedef struct xtokInstance { char *className; XtokProperties properties; XtokQualifiers qualifiers; } XtokInstance; typedef struct xtokInstanceData { XtokProperties properties; XtokQualifiers qualifiers; } XtokInstanceData; typedef struct xtokNamedInstance { XtokInstanceName path; XtokInstance instance; } XtokNamedInstance; typedef struct xtokPropertyList { XtokValueArray list; } XtokPropertyList; typedef struct xtokParamValue { struct xtokParamValue *next; char *name; CMPIType type; union { XtokValue value; XtokValueReference valueRef; XtokValueArray valueArray; }; } XtokParamValue; typedef struct xtokParamValues { XtokParamValue *last, *first; // must be free'd } XtokParamValues; typedef struct xtokParam { struct xtokParam *next; XtokQualifiers qualifiers; XtokQualifier qualifier; int qPart; int pType; char *name; char *refClass; char *arraySize; CMPIType type; } XtokParam; typedef struct xtokParams { XtokParam *last, *first; // must be free'd } XtokParams; typedef struct xtokMethod { struct xtokMethod *next; XtokQualifiers qualifiers; XtokParams params; char *name; char *classOrigin; int propagated; CMPIType type; } XtokMethod; typedef struct xtokMethodData { XtokQualifiers qualifiers; XtokParams params; } XtokMethodData; typedef struct xtokMethods { XtokMethod *last, *first; // must be free'd } XtokMethods; typedef struct xtokClass { char *className; char *superClass; XtokProperties properties; XtokQualifiers qualifiers; XtokMethods methods; } XtokClass; typedef struct xtokErrorResp { char *code; char *description; } XtokErrorResp; #include <setjmp.h> typedef struct responseHdr { XmlBuffer *xmlBuffer; int rc; int opType; int simple; char *id; char *iMethod; int methodCall; void *cimRequest; unsigned long cimRequestLength; int errCode; char *description; CMPIArray *rvArray; } ResponseHdr; typedef struct parser_control { XmlBuffer *xmb; ResponseHdr respHdr; char *nameSpace; CMPIInstance *curInstance; CMPIObjectPath *curPath; } ParserControl; extern ResponseHdr scanCimXmlResponse(const char *xmlData, CMPIObjectPath *cop); extern void freeCimXmlResponse(ResponseHdr * hdr); #endif --- NEW FILE: setEnv --- export LD_LIBRARY_PATH=. ulimit -c unlimited --- NEW FILE: utilStringBuffer.c --- /* * utilStringBuffer.c * * (C) Copyright IBM Corp. 2005 * * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENS... [truncated message content] |
From: Gareth S B. <bes...@us...> - 2005-05-04 18:18:38
|
Update of /cvsroot/sblim/sfcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4484 Modified Files: cmci.h Log Message: Index: cmci.h =================================================================== RCS file: /cvsroot/sblim/sfcc/cmci.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- cmci.h 2 May 2005 15:31:49 -0000 1.1.1.1 +++ cmci.h 4 May 2005 18:18:28 -0000 1.2 @@ -22,9 +22,9 @@ #ifndef _CMPIC_H_ #define _CMPIC_H_ -#include "cmpidt.h" -#include "cmpift.h" -#include "cmpimacs.h" +#include "cmcidt.h" +#include "cmcift.h" +#include "cmcimacs.h" #include "utilList.h" #ifdef __cplusplus @@ -173,7 +173,7 @@ @return Enumeration of Instances. */ CMPIEnumeration* (*associators) - (CMCIClient* cl,CMPIContext* ctx, + (CMCIClient* cl, CMPIObjectPath* op, const char *assocClass, const char *resultClass, const char *role, const char *resultRole, char** properties, CMPIStatus* rc); @@ -291,7 +291,7 @@ @return Property value. */ CMPIData (*getProperty) - (CMCIClient *cl, CMPIContext *ctx, + (CMCIClient *cl, CMPIObjectPath *op, const char *name, CMPIStatus *rc); } CMCIClientFT; @@ -299,7 +299,6 @@ typedef struct clientData { char *hostName; char *port; - UtilList *nameSpace; char *user; char *pwd; char *scheme; @@ -311,7 +310,7 @@ CMCIClientFT *ft; }; -CMCIClient *cmciConnect(const char *hn, const char *port, const char *ns, +CMCIClient *cmciConnect(const char *hn, const char *port, const char *user, const char *pwd, CMPIStatus *rc); #ifdef __cplusplus |
From: Gareth S B. <bes...@us...> - 2005-05-04 18:18:18
|
Update of /cvsroot/sblim/sfcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4418 Modified Files: cmcift.h Log Message: Index: cmcift.h =================================================================== RCS file: /cvsroot/sblim/sfcc/cmcift.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- cmcift.h 2 May 2005 15:31:49 -0000 1.1.1.1 +++ cmcift.h 4 May 2005 18:18:10 -0000 1.2 @@ -22,7 +22,7 @@ #ifndef _CMCIFT_H_ #define _CMCIFT_H_ -#include "cmpidt.h" +#include "cmcidt.h" #ifdef __cplusplus extern "C" { |
From: Gareth S B. <bes...@us...> - 2005-05-04 18:18:04
|
Update of /cvsroot/sblim/sfcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4328 Modified Files: cmcidt.h Log Message: Index: cmcidt.h =================================================================== RCS file: /cvsroot/sblim/sfcc/cmcidt.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- cmcidt.h 2 May 2005 15:31:49 -0000 1.1.1.1 +++ cmcidt.h 4 May 2005 18:17:47 -0000 1.2 @@ -19,8 +19,8 @@ * */ -#ifndef _CMPIDT_H_ -#define _CMPIDT_H_ +#ifndef _CMCIDT_H_ +#define _CMCIDT_H_ #include <stdio.h> @@ -188,7 +188,6 @@ CMPIInstance* inst; CMPIObjectPath* ref; CMPIArgs* args; - CMPISelectExp* filter; CMPIEnumeration* Enum; CMPIArray* array; CMPIString* string; @@ -388,7 +387,7 @@ }; #endif -#endif // _CMPIDT_H_ +#endif // _CMCIDT_H_ |
From: Gareth S B. <bes...@us...> - 2005-05-04 18:17:30
|
Update of /cvsroot/sblim/sfcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4161 Modified Files: client.c Log Message: Index: client.c =================================================================== RCS file: /cvsroot/sblim/sfcc/client.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- client.c 3 May 2005 22:51:29 -0000 1.1.1.1 +++ client.c 4 May 2005 18:17:22 -0000 1.2 @@ -1,17 +1,429 @@ + +/* + * cmpic.h + * + * (C) Copyright IBM Corp. 2005 + * + * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE + * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE + * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. + * + * You can obtain a current copy of the Common Public License from + * http://oss.software.ibm.com/developerworks/opensource/license-cpl.html + * + * Author: Adrian Schuur <sc...@de...> + * + * Description: + * + * CMPI Client function tables. + * +*/ + #include "cmci.h" +#include "utilStringBuffer.h" +#include "utilList.h" +#include "native.h" -int main(int argc, char *argv[]) +#include <stdlib.h> +#include <string.h> +#include <curl/curl.h> +#include "cimXmlParser.h" + +typedef struct _CMCIConnectionFT { + char *(*genRequest)(ClientEnc *cle, char *op, CMPIObjectPath *cop, int cls, int keys); + char *(*addPayload)(CMCIConnection *, UtilStringBuffer *pl); + char *(*getResponse)(CMCIConnection *con, CMPIObjectPath *cop); + void (*initializeHeaders)(CMCIConnection *con); + void (*reset)(CMCIConnection *); +} CMCIConnectionFT; + +struct _ClientEnc { + CMCIClient enc; + CMCIClientData data; + CMCIConnection *connection; +}; + +struct _CMCIConnection { + CMCIConnectionFT *ft; // The handle to the curl object + CURL *mHandle; // The list of headers sent with each request + struct curl_slist *mHeaders; // The body of the request + UtilStringBuffer *mBody; // The uri of the request + UtilStringBuffer *mUri; // The username/password used in authentication + UtilStringBuffer *mUserPass; // Used to store the HTTP response + UtilStringBuffer *mResponse; +}; + +static const char *headers[] = { + "Content-type: application/xml; charset=\"utf-8\"", + "Connection: Keep-Alive, TE", + "CIMProtocolVersion: 1.0", + "CIMOperation: MethodCall" +}; +#define NUM_HEADERS ((sizeof(headers))/(sizeof(headers[0]))) + +static const char xmlHeader[]={ + "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" + "<CIM CIMVERSION=\"2.0\" DTDVERSION=\"2.0\">\n" + "<MESSAGE ID=\"4711\" PROTOCOLVERSION=\"1.0\">" + "<SIMPLEREQ>\n" +}; + +static char *getErrorMessage(CURLcode err) { - CMCIClient *cc; - CMPIObjectPath *cop; - CMPIInstance *ci; + static char error[128]; +#if LIBCURL_VERSION_NUM >= 0x071200 + return curl_easy_strerror(rv); +#else + sprintf(error,"CURL error: %d",err); + return error; +#endif +} - cc=cmciConnect("localhost","root/cimv2",NULL,NULL,NULL); - cop=newCMPIObjectPath("root/cimv2","class",NULL); - CMAddKey(cop,"key1","keyvalue",CMPI_chars); +void list2StringBuffer(UtilStringBuffer *sb, UtilList *ul, char *sep) +{ + void *e; + for (e=ul->ft->getFirst(ul); e; e=ul->ft->getNext(ul)) { + sb->ft->appendChars(sb,(char*)e); + sb->ft->appendChars(sb,sep); + } +} - ci=cc->ft->getInstance(cc,cop,NULL,NULL); +static size_t writeCb(void *ptr, size_t size, size_t nmemb, void *stream) +{ + UtilStringBuffer *sb=(UtilStringBuffer*)stream; + unsigned int length = size * nmemb; + sb->ft->appendBlock(sb, ptr, length); + return length; +} - return 0; +static char *addPayload(CMCIConnection *con, UtilStringBuffer *pl) +{ +// con->mBody = pl; +// if (dumpXml) +// cerr << "To server: " << pl << endl; + + CURLcode rv; + + rv = curl_easy_setopt(con->mHandle, CURLOPT_POSTFIELDS, pl->ft->getCharPtr(pl)); + if (rv) return getErrorMessage(rv); + rv = curl_easy_setopt(con->mHandle, CURLOPT_POSTFIELDSIZE, pl->ft->getSize(pl)); + if (rv) return getErrorMessage(rv); + else return NULL; +} + +static char* genRequest(ClientEnc *cle, char *op, CMPIObjectPath *cop, int cls, int keys) +{ + CMCIConnection *con=cle->connection; + CMCIClientData *cld=&cle->data; + CURLcode rv; + UtilStringBuffer *sb=newStringBuffer(1024); + char userPwd[256]; + char method[256]="CIMMethod: "; + + + if (!con->mHandle) return "Unable to initialize curl interface."; + +// if (!supportsSSL() && url.scheme == "https") +// throw HttpException("this curl library does not support https urls."); + + con->mResponse->ft->reset(con->mResponse); + + con->mUri->ft->reset(con->mUri); + con->mUri->ft->append6Chars(con->mUri,cld->scheme,"://",cld->hostName,":",cld->port,"/cimom"); + + sb->ft->appendChars(sb,"CIMObject: "); + //url.ns.toStringBuffer(sb,"%2F"); + + /* Initialize curl with the url */ + rv = curl_easy_setopt(con->mHandle, CURLOPT_URL, con->mUri->ft->getCharPtr(con->mUri)); + + /* Disable progress output */ + rv = curl_easy_setopt(con->mHandle, CURLOPT_NOPROGRESS, 1); + + /* This will be a HTTP post */ + rv = curl_easy_setopt(con->mHandle, CURLOPT_POST, 1); + + /* Disable SSL verification */ + rv = curl_easy_setopt(con->mHandle, CURLOPT_SSL_VERIFYHOST, 0); + rv = curl_easy_setopt(con->mHandle, CURLOPT_SSL_VERIFYPEER, 0); + + /* Set username and password */ + if (cld->user) { + strcpy(userPwd,cld->user); + if (cld->pwd) { + strcat(userPwd,":"); + rv = curl_easy_setopt(con->mHandle, CURLOPT_USERPWD, userPwd); + } + } + + // Initialize default headers + con->ft->initializeHeaders(con); + + // Add CIMMethod header + strcat(method,op); + con->mHeaders = curl_slist_append(con->mHeaders, method); + + // Add CIMObject header + con->mHeaders = curl_slist_append(con->mHeaders, sb->ft->getCharPtr(sb)); + + + // Set all of the headers for the request + rv = curl_easy_setopt(con->mHandle, CURLOPT_HTTPHEADER, con->mHeaders); + + // Set up the callbacks to store the response + rv = curl_easy_setopt(con->mHandle, CURLOPT_WRITEFUNCTION, writeCb); + + // Use CURLOPT_FILE instead of CURLOPT_WRITEDATA - more portable + rv = curl_easy_setopt(con->mHandle, CURLOPT_FILE, con->mResponse); + + // Fail if we receive an error (HTTP response code >= 300) + rv = curl_easy_setopt(con->mHandle, CURLOPT_FAILONERROR, 1); + + // Turn this on to enable debugging + // rv = curl_easy_setopt(mHandle, CURLOPT_VERBOSE, 1); + + return NULL; +} + +char *getResponse(CMCIConnection *con, CMPIObjectPath *cop) +{ + CURLcode rv; + + rv = curl_easy_perform(con->mHandle); + if (rv) { + long responseCode = -1; + char *error; + // Use CURLINFO_HTTP_CODE instead of CURLINFO_RESPONSE_CODE + // (more portable to older versions of curl) + curl_easy_getinfo(con->mHandle, CURLINFO_HTTP_CODE, &responseCode); + if (responseCode == 401) { + error = (con->mUserPass->ft->getSize(con->mUserPass) > 0) ? "Invalid username/password." : + "Username/password required."; + } + else error = getErrorMessage(rv); + return error; + } + + if (con->mResponse->ft->getSize(con->mResponse) == 0) + return "No data received from server."; + + return NULL; +} + +static void initializeHeaders(CMCIConnection *con) +{ + unsigned int i; + + if (con->mHeaders) { + curl_slist_free_all(con->mHeaders); + con->mHeaders = NULL; + } + for (i = 0; i < NUM_HEADERS; i++) + con->mHeaders = curl_slist_append(con->mHeaders, headers[i]); +} + +CMCIConnectionFT conFt={ + genRequest, + addPayload, + getResponse, + initializeHeaders +}; + +CMCIConnection *initConnection(CMCIClientData *cld) +{ + CMCIConnection *c=(CMCIConnection*)calloc(1,sizeof(CMCIConnection)); + c->ft=&conFt; + c->mHandle = curl_easy_init(); + c->mHeaders = NULL; + c->mBody = newStringBuffer(256); + c->mUri = newStringBuffer(256); + c->mResponse = newStringBuffer(2048); + + return c; +} + + +extern UtilList *getNameSpaceComponents(CMPIObjectPath * cop); +extern char *keytype2Chars(CMPIType type); +extern void pathToXml(UtilStringBuffer *sb, CMPIObjectPath *cop); + +static void emitlocal(UtilStringBuffer *sb, int f) +{ + if (f) + sb->ft->appendChars(sb,"<IPARAMVALUE NAME=\"LocalOnly\"><VALUE>TRUE</VALUE></IPARAMVALUE>\n"); + else + sb->ft->appendChars(sb,"<IPARAMVALUE NAME=\"LocalOnly\"><VALUE>FALSE</VALUE></IPARAMVALUE>\n"); +} + +static void emitqual(UtilStringBuffer *sb, int f) +{ + if (f) + sb->ft->appendChars(sb,"<IPARAMVALUE NAME=\"IncludeQualifiers\"><VALUE>TRUE</VALUE></IPARAMVALUE>\n"); + else + sb->ft->appendChars(sb,"<IPARAMVALUE NAME=\"IncludeQualifiers\"><VALUE>FALSE</VALUE></IPARAMVALUE>\n"); +} + +static void emitorigin(UtilStringBuffer *sb, int f) +{ + if (f) + sb->ft->appendChars(sb,"<IPARAMVALUE NAME=\"IncludeClassOrigin\"><VALUE>TRUE</VALUE></IPARAMVALUE>\n"); + else + sb->ft->appendChars(sb,"<IPARAMVALUE NAME=\"IncludeClassOrigin\"><VALUE>FALSE</VALUE></IPARAMVALUE>\n"); +} + +static void emitdeep(UtilStringBuffer *sb, int f) +{ + if (f) + sb->ft->appendChars(sb,"<IPARAMVALUE NAME=\"DeepInheritance\"><VALUE>TRUE</VALUE></IPARAMVALUE>\n"); + else + sb->ft->appendChars(sb,"<IPARAMVALUE NAME=\"DeepInheritance\"><VALUE>FALSE</VALUE></IPARAMVALUE>\n"); } +static CMPIEnumeration *enumInstanceNames(CMCIClient* mb, + CMPIObjectPath* cop, CMPIStatus* rc) +{ + ClientEnc *cl=(ClientEnc*)mb; + CMCIConnection *con=cl->connection; + UtilStringBuffer *sb=newStringBuffer(2048); + UtilList *nsc; + CMPIString *cn; + char *ns,*error; + + cn=cop->ft->getClassName(cop,NULL); + con->ft->genRequest(cl,"EnumerateInstanceNames",cop,0,0); + sb->ft->appendChars(sb,xmlHeader); + + nsc=getNameSpaceComponents(cop); + sb->ft->appendChars(sb,"<IMETHODCALL NAME=\"EnumerateInstanceNames\">" + "<LOCALNAMESPACEPATH>"); + for (ns=nsc->ft->getFirst(nsc); ns; ns=nsc->ft->getNext(nsc)) + sb->ft->append3Chars(sb,"<NAMESPACE NAME=\"",ns,"\"></NAMESPACE>"); + sb->ft->appendChars(sb,"</LOCALNAMESPACEPATH>\n"); + + sb->ft->append3Chars(sb,"<IPARAMVALUE NAME=\"ClassName\"><CLASSNAME NAME=\"",(char*)cn->hdl, + "\"/></IPARAMVALUE>\n"); + + sb->ft->appendChars(sb,"</IMETHODCALL></SIMPLEREQ>\n</MESSAGE></CIM>"); + +// fprintf(stderr,"%s\n",sb->ft->getCharPtr(sb)); + con->ft->addPayload(con,sb); + + if ((error=con->ft->getResponse(con,cop))) { + CMSetStatusWithChars(rc,CMPI_RC_ERR_FAILED,error); + return NULL; + } +// fprintf(stderr,"%s\n",con->mResponse->ft->getCharPtr(con->mResponse)); + + ResponseHdr rh=scanCimXmlResponse(con->mResponse->ft->getCharPtr(con->mResponse),cop); + + if (rh.errCode!=0) { + CMSetStatusWithChars(rc,rh.errCode,rh.description); + return NULL; + } + + if (rh.rvArray->ft->getSimpleType(rh.rvArray,NULL)==CMPI_ref) { + CMPIEnumeration *enm=newCMPIEnumeration(rh.rvArray,NULL); + CMSetStatus(rc,CMPI_RC_OK); + return enm; + } + + CMSetStatusWithChars(rc,CMPI_RC_ERR_FAILED,"Unexpected return value"); + return NULL; +} + +static CMPIInstance* getInstance(CMCIClient* mb, + CMPIObjectPath* cop, char** properties, CMPIStatus* rc) +{ + ClientEnc *cl=(ClientEnc*)mb; + CMCIConnection *con=cl->connection; + UtilStringBuffer *sb=newStringBuffer(2048); + UtilList *nsc; + CMPIString *cn; + char *ns,*error; + + cn=cop->ft->getClassName(cop,NULL); + con->ft->genRequest(cl,"GetInstance",cop,0,0); + sb->ft->appendChars(sb,xmlHeader); + + nsc=getNameSpaceComponents(cop); + sb->ft->appendChars(sb,"<IMETHODCALL NAME=\"GetInstance\">\n" + "<LOCALNAMESPACEPATH>"); + for (ns=nsc->ft->getFirst(nsc); ns; ns=nsc->ft->getNext(nsc)) + sb->ft->append3Chars(sb,"<NAMESPACE NAME=\"",ns,"\"></NAMESPACE>"); + sb->ft->appendChars(sb,"</LOCALNAMESPACEPATH>\n"); + + emitlocal(sb,0); + emitorigin(sb,0); + emitqual(sb,0); + + if (properties) { + sb->ft->appendChars(sb,"<IPARAMVALUE NAME=\"PropertyList\"><VALUE.ARRAY>"); + while (*properties) { + sb->ft->append3Chars(sb,"<VALUE>",*properties,"</VALUE>"); + properties++; + } + sb->ft->appendChars(sb,"</VALUE.ARRAY></IPARAMVALUE>\n"); + } + + sb->ft->append3Chars(sb,"<IPARAMVALUE NAME=\"InstanceName\">\n" + "<INSTANCENAME CLASSNAME=\"",(char*)cn->hdl,"\">\n"); + + pathToXml(sb, cop); + + sb->ft->appendChars(sb,"</INSTANCENAME>\n</IPARAMVALUE>\n"); + + sb->ft->appendChars(sb,"</IMETHODCALL></SIMPLEREQ>\n</MESSAGE></CIM>"); + +// fprintf(stderr,"%s\n",sb->ft->getCharPtr(sb)); + con->ft->addPayload(con,sb); + + if ((error=con->ft->getResponse(con,cop))) { + CMSetStatusWithChars(rc,CMPI_RC_ERR_FAILED,error); + return NULL; + } +// fprintf(stderr,"%s\n",con->mResponse->ft->getCharPtr(con->mResponse)); + + ResponseHdr rh=scanCimXmlResponse(con->mResponse->ft->getCharPtr(con->mResponse),cop); + + if (rh.errCode!=0) { + CMSetStatusWithChars(rc,rh.errCode,rh.description); + return NULL; + } + + if (rh.rvArray->ft->getSimpleType(rh.rvArray,NULL)==CMPI_instance) { + CMSetStatus(rc,CMPI_RC_OK); + return rh.rvArray->ft->getElementAt(rh.rvArray,0,NULL).value.inst; + } + + CMSetStatusWithChars(rc,CMPI_RC_ERR_FAILED,"Unexpected return value"); + return NULL; +} + + +static CMCIClientFT clientFt = { + enumInstanceNames, + getInstance +}; + +CMCIClient *cmciConnect(const char *hn, const char *port, + const char *user, const char *pwd, CMPIStatus *rc) +{ + + ClientEnc *cc=(ClientEnc*)calloc(1,sizeof(ClientEnc)); + + cc->enc.hdl=&cc->data; + cc->enc.ft=&clientFt; + + cc->data.hostName= hn ? strdup(hn) : "localhost"; + cc->data.port= port ? strdup(port) : "5988"; + cc->data.user= user ? strdup(user) : NULL; + cc->data.pwd= pwd ? strdup(pwd) : NULL; + cc->data.scheme= "http"; + + cc->connection=initConnection(&cc->data); + + return (CMCIClient*)cc; + +} + + |
From: Viktor M. <mih...@us...> - 2005-05-04 14:43:57
|
Update of /cvsroot/sblim/cmpi-network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13502 Modified Files: ChangeLog Makefile.am NEWS cmpiOSBase_IPProtocolEndpoint.c configure.ac provider-register.sh sblim-cmpi-network.spec.in Log Message: Bug 1195244: Added Status property to Linux_IPProtocolEndpoint class. Further, modified the build files for the new provider-register.sh interface. Index: sblim-cmpi-network.spec.in =================================================================== RCS file: /cvsroot/sblim/cmpi-network/sblim-cmpi-network.spec.in,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- sblim-cmpi-network.spec.in 18 Apr 2005 12:06:56 -0000 1.1 +++ sblim-cmpi-network.spec.in 4 May 2005 14:43:48 -0000 1.2 @@ -9,7 +9,7 @@ Summary: SBLIM Network Instrumentation Name: @PACKAGE_TARNAME@ Version: @PACKAGE_VERSION@ -Release: @CIMSERVER@ +Release: 1 Group: Systems Management/Base License: Common Public License 1.0 @@ -79,17 +79,17 @@ # Register Schema and Provider - this is higly provider specific %define SCHEMA %{_datadir}/%{name}/Linux_Network.mof -%define REGISTRATION_pegasus %{_datadir}/%{name}/Linux_NetworkRegister.mof -%define REGISTRATION_sfcb %{_datadir}/%{name}/Linux_Network.sfcb.reg +%define REGISTRATION %{_datadir}/%{name}/Linux_Network.registration +%{_datadir}/%{name}/provider-register.sh \ + -r %{REGISTRATION} -m %{SCHEMA} > /dev/null -%{_datadir}/%{name}/provider-register.sh -t @CIMSERVER@ \ - -s %{SCHEMA} > /dev/null +/sbin/ldconfig -%{_datadir}/%{name}/provider-register.sh -t @CIMSERVER@ \ - -r %{REGISTRATION_@CIMSERVER@} > /dev/null +%preun -/sbin/ldconfig +%{_datadir}/%{name}/provider-register.sh -d \ + -r %{REGISTRATION} -m %{SCHEMA} > /dev/null %postun /sbin/ldconfig Index: configure.ac =================================================================== RCS file: /cvsroot/sblim/cmpi-network/configure.ac,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- configure.ac 18 Apr 2005 12:06:56 -0000 1.1 +++ configure.ac 4 May 2005 14:43:48 -0000 1.2 @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) -AC_INIT(SBLIM BaseOS Network Providers, 1.3.3am, sbl...@li...,sblim-cmpi-network) +AC_INIT(SBLIM BaseOS Network Providers, 1.3.4, sbl...@li...,sblim-cmpi-network) AC_CONFIG_SRCDIR([OSBase_CommonNetwork.c]) AC_CONFIG_HEADER([config.h]) AM_INIT_AUTOMAKE Index: Makefile.am =================================================================== RCS file: /cvsroot/sblim/cmpi-network/Makefile.am,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile.am 18 Apr 2005 12:06:55 -0000 1.1 +++ Makefile.am 4 May 2005 14:43:48 -0000 1.2 @@ -114,15 +114,7 @@ # Automake instructions for ./mof subdir # SCHEMAS=mof/Linux_Network.mof -REGISTRATIONS.pegasus=mof/Linux_NetworkRegister.mof -REGISTRATIONS.sfcb=mof/Linux_Network.sfcb.reg -REGISTRATIONS.openwbem= -REGISTRATIONS.sniacimom= - -REGISTRATIONS=$(REGISTRATIONS.pegasus) \ - $(REGISTRATIONS.sfcb) \ - $(REGISTRATIONS.openwbem) \ - $(REGISTRATIONS.sniacimom) +REGISTRATIONS=mof/Linux_Network.registration # We must explicity add all the schema files to the distribution package pkgdata_DATA=$(SCHEMAS) $(REGISTRATIONS) @@ -131,10 +123,10 @@ # Register the provider(s) and class definition(s) to the current CIM server/CIMOM postinstall: - test x"$(SCHEMAS)" != x && \ - sh provider-register.sh -t @CIMSERVER@ -s $(SCHEMAS) - test x"$(REGISTRATIONS.@CIMSERVER@)" != x && \ - sh provider-register.sh -t @CIMSERVER@ -r $(REGISTRATIONS.@CIMSERVER@) + sh provider-register.sh -t @CIMSERVER@ -r $(REGISTRATIONS) -m $(SCHEMAS) + +preuninstall: + sh provider-register.sh -d -t @CIMSERVER@ -r $(REGISTRATIONS) -m $(SCHEMAS) dist-hook: test -d "$(distdir)" && rm -rf `find $(distdir) -type d -name CVS` Index: ChangeLog =================================================================== RCS file: /cvsroot/sblim/cmpi-network/ChangeLog,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ChangeLog 18 Apr 2005 12:06:55 -0000 1.1 +++ ChangeLog 4 May 2005 14:43:48 -0000 1.2 @@ -1,4 +1,16 @@ +2005-05-04 <mih...@dy...> + + * test/system/linux/Linux_IPProtocolEndpoint.system: + Bug 1195244: set expected Status to OK. + + * cmpiOSBase_IPProtocolEndpoint.c: + Bug 1195244: set Status poperty in create_instance. + + * sblim-cmpi-network.spec.in: Added deregistration support. + * Makefile.am: Changes to use new provider-register.sh. + + * configure.ac: Bumped version number to 1.3.4 // =================================================================== // new in version 1.2.4 : Index: NEWS =================================================================== RCS file: /cvsroot/sblim/cmpi-network/NEWS,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- NEWS 18 Apr 2005 12:06:55 -0000 1.1 +++ NEWS 4 May 2005 14:43:48 -0000 1.2 @@ -0,0 +1,8 @@ +Changes in 1.3.4 +================ + +Bugs: +- 1195244 Linux_IPProtocolEndpoint class now features the Status property. + +Other: +- New provider-register.sh interface. Index: cmpiOSBase_IPProtocolEndpoint.c =================================================================== RCS file: /cvsroot/sblim/cmpi-network/cmpiOSBase_IPProtocolEndpoint.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- cmpiOSBase_IPProtocolEndpoint.c 20 Sep 2004 12:16:07 -0000 1.8 +++ cmpiOSBase_IPProtocolEndpoint.c 4 May 2005 14:43:48 -0000 1.9 @@ -163,6 +163,7 @@ CMSetProperty( ci, "Caption", "Protocol Endpoint for IP (Internet Protocol) ", CMPI_chars); CMSetProperty( ci, "Description", "A communication point to send and receive data. This class is dedicated to link IP intefaces to Logical Networks.", CMPI_chars); + CMSetProperty( ci, "Status", "OK", CMPI_chars); /* 2.7 */ #ifndef CIM26COMPAT Index: provider-register.sh =================================================================== RCS file: /cvsroot/sblim/cmpi-network/provider-register.sh,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- provider-register.sh 18 Apr 2005 12:06:56 -0000 1.1 +++ provider-register.sh 4 May 2005 14:43:48 -0000 1.2 @@ -12,68 +12,481 @@ # # Author: Viktor Mihajlovski <mih...@de...> # Contributors: -# Description: Script to install class definitions (MOFs) and registration data -# for a variety of supported CIMOMs +# Description: Script to install class definitions (MOFs) and +# registration data for a variety of supported CIMOMs # ================================================================== + +function pegasus_path() +{ + for p in /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin \ + /opt/tog-pegasus/bin /opt/tog-pegasus/sbin $PEGASUS_HOME/bin + do + if test -x $p/$1 + then + echo $p/$1 + return 0 + fi + done + return 1 +} + +function pegasus_transform() +{ + OUTFILE=$1 + shift + regfiles=$* + PROVIDERMODULES=`cat $regfiles 2> /dev/null | grep -v '^[[:space:]]*#.*' | cut -d ' ' -f 4 | sort | uniq` + if test x"$PROVIDERMODULES" == x + then + echo Failed to read registration files >&2 + return 1 + fi + PROVIDERS=`cat $regfiles 2> /dev/null | grep -v '^[[:space:]]*#.*' | cut -d ' ' -f 3-4 | sort | uniq` + +# produce ProviderModules + echo > $OUTFILE + chatter "Processing provider modules:" $PROVIDERMODULES + for pm in $PROVIDERMODULES + do + cat >> $OUTFILE <<EOFPM +instance of PG_ProviderModule +{ + Name = "$pm"; + Location = "$pm"; + Vendor = "SBLIM"; + Version = "2.0.0"; + InterfaceType = "CMPI"; + InterfaceVersion = "2.0.0"; +}; + +EOFPM + done + +# produce Providers + set -- $PROVIDERS + while test x$1 != x + do + cat >> $OUTFILE <<EOFP +instance of PG_Provider +{ + Name = "$1"; + ProviderModuleName = "$2"; +}; + +EOFP + shift 2 + done + +#produce Capabilities + for rf in $regfiles + do + cat $rf | grep -v '^[[:space:]]*#.*' | while read CLASSNAME NAMESPACE PROVIDERNAME PROVIDERMODULE CAPS + do + numcap= + for cap in $CAPS + do + case $cap in + instance) + if test x$numcap == x + then numcap=2 + else numcap="$numcap, 2" + fi;; + association) + if test x$numcap == x + then numcap=3 + else numcap="$numcap, 3" + fi;; + indication) + if test x$numcap == x + then numcap=4 + else numcap="$numcap, 4" + fi;; + method) + if test x$numcap == x + then numcap=5 + else numcap="$numcap, 5" + fi;; + **) echo unknown provider type $cap >&2 + return 1;; + esac + done + cat >> $OUTFILE <<EOFC +instance of PG_ProviderCapabilities +{ + ProviderModuleName = "$PROVIDERMODULE"; + ProviderName = "$PROVIDERNAME"; + ClassName = "$CLASSNAME"; + ProviderType = { $numcap }; + Namespaces = {"$NAMESPACE"}; + SupportedProperties = NULL; + SupportedMethods = NULL; + CapabilityID = "1"; +}; + +EOFC + done + done +} + function pegasus_install() { if ps -C cimserver > /dev/null 2>&1 then - CIMMOF=cimmof + CIMMOF=`pegasus_path cimmof` + if test $? != 0 + then + echo "Error: cimmof not found" >&2 + return 1 + fi state=active else - CIMMOF=cimmofl + CIMMOF=`pegasus_path cimmofl` + if test $? != 0 + then + echo "Error: cimmof not found" >&2 + return 1 + fi state=inactive fi + + mymofs= + mregs= + mofmode=1 + while test x$1 != x + do + if test $1 == ":" + then + mofmode=0 + shift + continue + fi + if test $mofmode == 1 + then + mymofs="$mymofs $1" + else + myregs="$myregs $1" + fi + shift + done + + for _TEMPDIR in /var/tmp /tmp + do + if test -w $_TEMPDIR + then + _REGFILENAME=$_TEMPDIR/$$.mof + break + fi + done + - if test $1 == mofs - then - NAMESPACE=root/cimv2 - action="Installing Schemas" - else if test $1 == regs + trap "rm -f $_REGFILENAME" EXIT + + if pegasus_transform $_REGFILENAME $myregs then - NAMESPACE=root/PG_Interop - action="Registering Providers" + chatter Registering providers with $state cimserver + $CIMMOF -n root/cimv2 $mymofs && + $CIMMOF -n root/PG_Interop $_REGFILENAME else - echo "Invalid install mode " $1 + echo "Failed to build pegasus registration MOF." >&2 return 1 fi +} + +function pegasus_uninstall() +{ + mymofs= + mregs= + mofmode=1 + while test x$1 != x + do + if test $1 == ":" + then + mofmode=0 + shift + continue + fi + if test $mofmode == 1 + then + mymofs="$mymofs $1" + else + myregs="$myregs $1" + fi + shift + done + + if ps -C cimserver > /dev/null 2>&1 + then + PROVIDERMODULES=`cat $myregs 2> /dev/null | grep -v '^[[:space:]]*#.*' | cut -d ' ' -f 4 | sort | uniq` + if test x"$PROVIDERMODULES" == x + then + echo Failed to read registration files >&2 + return 1 + fi + CIMPROVIDER=`pegasus_path cimprovider` + if test $? != 0 + then + echo "Error: cimprovider not found" >&2 + return 1 + fi + for pm in $PROVIDERMODULES + do + chatter "Remove provider module" $pm + $CIMPROVIDER -d -m $pm > /dev/null && + $CIMPROVIDER -r -m $pm > /dev/null + done + WBEMEXEC=`pegasus_path wbemexec` + if test $? != 0 + then + echo "Error: wbemexec not found" >&2 + return 1 + fi + CLASSES=`cat $myregs 2> /dev/null | grep -v '^[[:space:]]*#.*' | cut -d ' ' -f 1` + for cls in $CLASSES + do + chatter Delete CIM Class $cls + $WBEMEXEC > /dev/null <<EOFWX +<?xml version="1.0" encoding="utf-8" ?> +<CIM CIMVERSION="2.0" DTDVERSION="2.0"> + <MESSAGE ID="4711" PROTOCOLVERSION="1.0"> + <SIMPLEREQ> + <IMETHODCALL NAME="DeleteClass"> + <LOCALNAMESPACEPATH> + <NAMESPACE NAME="root"></NAMESPACE> + <NAMESPACE NAME="cimv2"></NAMESPACE> + </LOCALNAMESPACEPATH> + <IPARAMVALUE NAME="ClassName"> + <CLASSNAME NAME="$cls"/> + </IPARAMVALUE> + </IMETHODCALL> + </SIMPLEREQ> + </MESSAGE> +</CIM> +EOFWX + done + else + echo "Sorry, cimserver must be running to deregister the providers." >&2 + return 1 fi +} +function sfcb_transform() +{ + OUTFILE=$1 shift - echo $action with $state cimserver - $CIMMOF -n $NAMESPACE $* + regfiles=$* + +#produce sfcb registraion + for rf in $regfiles + do + cat $rf | grep -v '^[[:space:]]*#.*' | while read CLASSNAME NAMESPACE PROVIDERNAME PROVIDERMODULE CAPS + do + chatter "Registering class" $CLASSNAME + cat >> $OUTFILE <<EOFC +[$CLASSNAME] + provider: $PROVIDERNAME + location: $PROVIDERMODULE + type: $CAPS + namespace: $NAMESPACE +# +EOFC + done + done } -function sfcb_install() +function sfcb_rebuild() { - if test $1 == mofs + if ps -C sfcbd > /dev/null 2>&1 then - action="Staging Schemas" - shift - params="$*" - else if test $1 == regs + # sfcb is running -- need to restart + for INITSCRIPT in /etc/init.d/sfcb /usr/local/etc/init.d/sfcb none + do + if test -x $INITSCRIPT + then + break; + fi + done + chatter "Shutting down sfcb." + if test $INITSCRIPT == none + then + killall sfcbd + else + $INITSCRIPT stop + fi + t=0 + while ps -C sfcbd > /dev/null 2>&1 + do + sleep 1 + t=`expr $t + 1` + if test $t > 10 + then + echo "Timed out waiting for sfcb shutdown..." >&2 + echo "Please stop sfcb manually and rebuild the repository using sfcbrepos." >&2 + return 1 + fi + done + chatter "Rebuilding repository." + sfcbrepos -f + if test $? != 0 + then + echo "Repository rebuild failed." >&2 + return 1 + fi + + if test $INITSCRIPT == none + then + echo "No init script found - you need to start sfcbd manually." >&2 + return 1 + else + chatter "Restarting sfcb." + $INITSCRIPT start + fi + else + # Not running - rebuild repository + chatter "Rebuilding repository." + sfcbrepos -f + fi +} + +function sfcb_install() +{ + mymofs= + mregs= + mofmode=1 + while test x$1 != x + do + if test $1 == ":" + then + mofmode=0 + shift + baseregname=`basename -$1 .registration` + continue + fi + if test $mofmode == 1 + then + mymofs="$mymofs $1" + else + myregs="$myregs $1" + fi + shift + done + + for _TEMPDIR in /var/tmp /tmp + do + if test -w $_TEMPDIR + then + _REGFILENAME=$_TEMPDIR/$baseregname.reg + break + fi + done + + trap "rm -f $_REGFILENAME" EXIT + + if sfcb_transform $_REGFILENAME $myregs then - action="Staging Provider Registration -- rebuild repository and restart sfcb!" - shift - params="-r $*" + chatter "Staging provider registration." + sfcbstage -r $_REGFILENAME $mymofs + if test $? != 0 + then + echo "Failed to stage provider registration." >&2 + return 1 + fi + sfcb_rebuild else - echo "Invalid install mode " $1 + echo "Failed to build sfcb registration file." >&2 return 1 fi - fi +} + +function sfcb_uninstall() +{ + mymofs= + while test x$1 != x + do + if test $1 == ":" + then + shift + baseregname=`basename -$1 .registration` + break + fi + mymofs="$mymofs `basename $1`" + shift + done - echo $action - sfcbstage $params + # "Unstage" MOFs and the registration file + chatter "Unstaging provider regsiatrations." + sfcbunstage -r $baseregname.reg $mymofs + + # Rebuild repository + sfcb_rebuild +} + +function cim_server() +{ + for exname in sfcbd cimserver owcimomd + do + if pegasus_path $exname > /dev/null + then + case $exname in + sfcbd) echo sfcb; return 0;; + cimserver) echo pegasus; return 0;; + owcimomd) echo openwbem; return 0;; + esac + break; + fi + done + echo unknown + return 1 } function usage() { - echo "usage: $0 [-h] -t <cimserver> [ -s mof ... | -r regfile ... ]" + echo "usage: $0 [-h] [-v] [-d] [-t <cimserver>] -r regfile ... -m mof ..." +} + +function chatter() +{ + if test x$verbose != x + then + echo $* + fi +} + +function gb_getopt() +{ + rmode=0 + mmode=0 + options= + moffiles= + registrations= + while [ -n "$1" ] + do + case $1 in + -r) mmode=0; + rmode=1; + shift;; + -m) mmode=1; + rmode=0; + shift;; + -*) mmode=0; + rmode=0; + options="$options $1"; + shift;; + **) if [ $mmode == 1 ] + then moffiles="$moffiles $1" + elif [ $rmode == 1 ] + then registrations="$registrations -r $1" + else options="$options $1"; + fi; + shift;; + esac + done + echo $options $registrations $moffiles } -args=`getopt ht:r:s: $*` + +prepargs=`gb_getopt $*` +args=`getopt dvht:r: $prepargs` if [ $? != 0 ] then @@ -89,11 +502,13 @@ -h) help=1; shift; break;; + -v) verbose=1; + shift;; + -d) deregister=1; + shift;; -t) cimserver=$2; shift 2;; - -s) mofs=$2; - shift 2;; - -r) regs=$2; + -r) regs="$regs $2"; shift 2;; --) shift; break;; @@ -101,53 +516,56 @@ esac done +mofs=$* + if [ "$help" == "1" ] then usage echo -e "\t-h display help message" + echo -e "\t-v verbose mode" + echo -e "\t-d deregister provider and uninstall schema" echo -e "\t-t specify cimserver type (pegasus|sfcb|openwbem|sniacimom)" - echo -e "\t-s specify schema mofs" echo -e "\t-r specify registration files" + echo -e "\t-m specify schema mof files" echo - echo Use this command install schema mofs or register provider - echo CIM Server Type is required, schema and registration files are - echo mutually exclusive. + echo Use this command to install schema mofs and register providers. + echo CIM Server Type is required as well as at least one registration file and one mof. exit 0 fi -if test x$cimserver == x -then - usage $0 - exit 1 -fi - -if test x"$mofs" == x && test x"$regs" == x +if test x"$mofs" == x || test x"$regs" == x then usage $0 exit 1 fi -if test x"$mofs" != x && test x"$regs" != x +if test x$cimserver == x then - usage $0 - exit 1 + cimserver=`cim_server` + if test $? == 0 + then + chatter "Autoselected CIM server type:" $cimserver + else + echo "CIM server type could not be determined, specify with -t." >&2 + exit 1 + fi fi -if test x"$mofs" != x -then - mode=mofs - mofs="$mofs $*" -else if test x"$regs" != x +if test x$deregister == x then - mode=regs - regs="$regs $*" -fi -fi - -case $cimserver in - pegasus) pegasus_install $mode $mofs $regs;; - sfcb) sfcb_install $mode $mofs $regs;; - openwbem) echo openwbem not yet supported && exit 1 ;; - sniacimom) echo sniacimom not yet supported && exit 1 ;; - **) echo "Invalid CIM Server Type " $cimserver && exit 1;; -esac + case $cimserver in + pegasus) pegasus_install $mofs ":" $regs;; + sfcb) sfcb_install $mofs ":" $regs;; + openwbem) echo openwbem not yet supported && exit 1 ;; + sniacimom) echo sniacimom not yet supported && exit 1 ;; + **) echo "Invalid CIM Server Type " $cimserver && exit 1;; + esac +else + case $cimserver in + pegasus) pegasus_uninstall $mofs ":" $regs;; + sfcb) sfcb_uninstall $mofs ":" $regs;; + openwbem) echo openwbem not yet supported && exit 1 ;; + sniacimom) echo sniacimom not yet supported && exit 1 ;; + **) echo "Invalid CIM Server Type " $cimserver && exit 1;; + esac +fi |
From: Viktor M. <mih...@us...> - 2005-05-04 14:43:57
|
Update of /cvsroot/sblim/cmpi-network/test/system/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13502/test/system/linux Modified Files: Linux_IPProtocolEndpoint.system Log Message: Bug 1195244: Added Status property to Linux_IPProtocolEndpoint class. Further, modified the build files for the new provider-register.sh interface. Index: Linux_IPProtocolEndpoint.system =================================================================== RCS file: /cvsroot/sblim/cmpi-network/test/system/linux/Linux_IPProtocolEndpoint.system,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Linux_IPProtocolEndpoint.system 20 Apr 2004 08:43:29 -0000 1.3 +++ Linux_IPProtocolEndpoint.system 4 May 2005 14:43:48 -0000 1.4 @@ -16,7 +16,7 @@ Description : -set OtherEnabledState : -empty -Status : -empty +Status : -eq OK -------------------------------------------------------------------------------- Instance Level : Linux_IPProtocolEndpoint.pl |
From: Viktor M. <mih...@us...> - 2005-05-04 14:43:56
|
Update of /cvsroot/sblim/cmpi-network/mof In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13502/mof Added Files: Linux_Network.registration Removed Files: Linux_Network.sfcb.reg Linux_NetworkRegister.mof Log Message: Bug 1195244: Added Status property to Linux_IPProtocolEndpoint class. Further, modified the build files for the new provider-register.sh interface. --- Linux_Network.sfcb.reg DELETED --- --- NEW FILE: Linux_Network.registration --- # Classname Namespace Providername Libraryname Capabilities ... Linux_NetworkPortImplementsIPEndpoint root/cimv2 OSBase_NetworkPortImplementsIPEndpointProvider cmpiOSBase_NetworkPortImplementsIPEndpointProvider instance association Linux_LocalLoopbackPort root/cimv2 OSBase_LocalLoopbackPortProvider cmpiOSBase_LocalLoopbackPortProvider instance method Linux_EthernetPort root/cimv2 OSBase_EthernetPortProvider cmpiOSBase_EthernetPortProvider instance method Linux_CSNetworkPort root/cimv2 OSBase_CSNetworkPortProvider cmpiOSBase_CSNetworkPortProvider instance association Linux_TokenRingPort root/cimv2 OSBase_TokenRingPortProvider cmpiOSBase_TokenRingPortProvider instance method Linux_IPProtocolEndpoint root/cimv2 OSBase_IPProtocolEndpointProvider cmpiOSBase_IPProtocolEndpointProvider instance --- Linux_NetworkRegister.mof DELETED --- |
From: Viktor M. <mih...@us...> - 2005-05-03 17:41:35
|
Update of /cvsroot/sblim/cmpi-samples/autotools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1083 Added Files: pegregconv.pl Log Message: Added script to help in the conversion from Pegasus to generic registration format. --- NEW FILE: pegregconv.pl --- #!/usr/bin/perl # $Id: pegregconv.pl,v 1.1 2005/05/03 17:41:19 mihajlov Exp $ # ================================================================== # (C) Copyright IBM Corp. 2005 # # THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE # ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE # CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. # # You can obtain a current copy of the Common Public License from # http://www.opensource.org/licenses/cpl1.0.php # # Author: Viktor Mihajlovski <mih...@de...> # Contributors: # Description: Converter for Pegasus Registration Files # ================================================================== # ------------------------------------------------------------------ # This is a small helper script to convert Pegasus Registration MOFs # to the generic registration file format of SBLIM's # provider-register.sh . # Please verify the result of the conversion! # This script is still very rudimentary and probably full of errors. # ------------------------------------------------------------------ use strict; use warnings; use Text::Balanced qw (extract_delimited extract_bracketed extract_tagged); my $oneline = ""; my $before; my $extracted; my $after; my $insttype; my $ign; my $ign1; my $pmod; my $ploc; my $prov; my $cls; my $ns; my $ptype; my $i; my $j; my $tempstr; my %pmods = (); my %pclass = (); while (<>) { s#//.*$##; s#\t+# #g; s#^\s+##g; s#\s+$##g; s#\s*=\s*#=#g; s#\s+# #g; s/^#.*$//; chomp(); $oneline = $oneline . $_ if length > 0; } do { ($extracted, $after, $before) = extract_bracketed($oneline,"{}","instance of [a-zA-Z0-9_]+ ?"); ($ign,$ign1,$insttype) = split(/ /,$before); if ($insttype eq "PG_ProviderModule") { $i = index($extracted,"Name="); if ($i >= 0) { $tempstr = substr($extracted,$i); ($pmod,$ign,$ign1) = extract_delimited($tempstr,'"',"Name="); } $i = index($extracted,"Location="); if ($i >= 0) { $tempstr = substr($extracted,$i); ($ploc,$ign,$ign1) = extract_delimited($tempstr,'"',"Location="); } $pmod =~ s/"//g; $ploc =~ s/"//g; # Add hashtable entry $pmods{$pmod}=$ploc; } elsif ($insttype eq "PG_Provider") { $i = index($extracted,"ProviderModuleName="); if ($i >= 0) { $tempstr = substr($extracted,$i); ($pmod,$ign,$ign) = extract_delimited($tempstr,'"',"ProviderModuleName="); } $j = index($extracted,"Name="); if ($j - length("ProviderModule") == $i) { $j = index($extracted,"Name=",$j+1); } if ($j >= 0) { $tempstr = substr($extracted,$j); ($prov,$ign,$ign) = extract_delimited($tempstr,'"',"Name="); } } elsif ($insttype eq "PG_ProviderCapabilities") { $i = index($extracted,"ProviderModuleName="); if ($i >= 0) { $tempstr = substr($extracted,$i); ($pmod,$ign,$ign) = extract_delimited($tempstr,'"',"ProviderModuleName="); } $i = index($extracted,"ProviderName="); if ($i >= 0) { $tempstr = substr($extracted,$i); ($prov,$ign,$ign) = extract_delimited($tempstr,'"',"ProviderName="); } $i = index($extracted,"ClassName="); if ($i >= 0) { $tempstr = substr($extracted,$i); ($cls,$ign,$ign) = extract_delimited($tempstr,'"',"ClassName="); } $i = index($extracted,"Namespaces="); if ($i >= 0) { $tempstr = substr($extracted,$i); ($ns,$ign,$ign) = extract_delimited($tempstr,'"',"Namespaces={"); } $i = index($extracted,"ProviderType="); if ($i >= 0) { $tempstr = substr($extracted,$i); ($ptype,$ign,$ign) = extract_bracketed($tempstr,'{}',"ProviderType="); } $cls =~ s/"//g; $pmod =~ s/"//g; $prov=~ s/"//g; $ns =~ s/"//g; $ptype =~ tr/{}/ /; # Add hashtable entry $pclass{$cls} = { "module" => $pmod, "provider" => $prov, "namespace" => $ns, "type" => $ptype}; } $after =~ s/^;//; $oneline = $after; } while (length($oneline)); print "# Classname Namespace Providername Libraryname Capabilities ...\n"; for my $key (keys %pclass) { my $mod = $pclass{$key}{"module"}; my $provider = $pclass{$key}{"provider"}; my $namesp = $pclass{$key}{"namespace"}; my $type = $pclass{$key}{"type"}; my $loc = $pmods{$mod}; print "$key $namesp $provider $loc"; my @types = split(/,/,$type); for my $ttt (@types) { if ($ttt == 2) { print " instance"; } elsif ($ttt == 3) { print " association"; } elsif ($ttt == 4) { print " indication"; } elsif ($ttt == 5) { print " method"; } } print "\n"; } |