verinec.adaptation
Class DistWMI

java.lang.Object
  extended by verinec.adaptation.DistWMI
All Implemented Interfaces:
IDistributor

public class DistWMI
extends Object
implements IDistributor

Implements the Windows Management Instrumentation (WMI) target using Jawin.

The distributer obtains a result-wmi containing the configuration data to distribute.
Here an example how the result-wmi is structured:

 <result-wmi>
   <wmi class="Win32_NetworkAdapterConfiguration" namespace="root/cimv2" wqlKey="Index" wqlKeyValue="1">
     <method name="EnableStatic">
          <param name="IPAddress" type="ArrayOfString">
            <param-value value="134.21.54.85" />
          </param>
          <param name="SubnetMask" type="ArrayOfString">
                <param-value value="255.255.255.0" />
          </param>
        </method>
   </wmi>
 </result-wmi>
 
The class attribute specifies the name of the wmi class you want access. The namespace corresponds to the wmi namespace where the class is stored. The wqlKey and wqlKeyValue atrributes define the name of the property that forms the basis of the WQL WHERE clause and the appropriate value.
The method element specifies the method to be executed with the corresponding parameters. So far only parameters of the type ArrayOfString are supported.
Each result-wmi has one or more wmi elements. Every wmi element has one ore more method elements. A method element has zero or more param elements. Each param element has one or more param-value elements.
The structure of the result-wmi is defined in the schema configuration.xsd.

Jawin an open source architecture for interoperation between Java and components exposed through Microsoft�s Component Object Model (COM) or through Win32 Dynamic Link Libraries (DLLs).
See jawinproject.sourceforge.net for more information about Jawin.

Version:
$Revision: 824 $
Author:
nadine.zurkinden at unifr.ch

Field Summary
private  String host
           
private  String password
           
private  String username
           
 
Constructor Summary
DistWMI()
           
 
Method Summary
 void distribute(Element config)
          Distributes the data of the result-wmi to the system using WMI.
 String execute(Element command)
          Execute a command of pre- or postprocess.
 void setTarget(Element target)
          Set the target for a connection to WMI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

host

private String host

username

private String username

password

private String password
Constructor Detail

DistWMI

public DistWMI()
Method Detail

setTarget

public void setTarget(Element target)
               throws VerinecException
Set the target for a connection to WMI.

The host attribute is required. If the host is "." it is interpreted as the local host. The user and password attributes are optional and can only be used for a remote connection.

Specified by:
setTarget in interface IDistributor
Parameters:
target - The tr:target element of the service configuration to be distributed.
Throws:
VerinecException - if the target has no wmi child or is missing required attributes.

distribute

public void distribute(Element config)
                throws VerinecException
Distributes the data of the result-wmi to the system using WMI.

Specified by:
distribute in interface IDistributor
Parameters:
config - A result-wmi containing the data to distribute
Throws:
VerinecException - if the config is not a result-wmi or if an error occurs by writing to the WMI.

execute

public String execute(Element command)
               throws VerinecException
Execute a command of pre- or postprocess. Currently no executes are supported.

Specified by:
execute in interface IDistributor
Parameters:
command - Not used.
Returns:
Always fails
Throws:
VerinecException - Always throws exception because no command expected.

Copyright © 2005 Verinec, DIUF