17 junio 2011

Creación de un portal virtual a través del Configuration Task (aka ConfigEngine)

Para crear un portal virtual haciendo uso del ConfigEngine, necesitamos editar el archivo /ConfigEngine/config/helpers/virtual_portal.properties y debemos completar los siguientes parámetros (resaltados):

# VirtualPortalTitle: Title of the Virtual Portal
VirtualPortalTitle=PortalPrueba1

# VirtualPortalRealm: Realm of the Virtual Portal
VirtualPortalRealm=defaultWIMFileBasedRealm

# VirtualPortalHost: Hostname of the Virtual Portal
VirtualPortalHostName=

# VirtualPortalContext: Context of the Virtual Portal
VirtualPortalContext=prueba1

# VirtualPortalNlsFile: File which contains language specific information for the Virtual Portal
VirtualPortalNlsFile=

# VirtualPortalObjectId: ObjectId of the Virtual Portal
# The ObjectId is needed to modify, delete Virtual Portals and
# can be obtained by running task list-all-virtual-portals
# Note: Do not delete the default Virtual Portal (ObjectId ends with _0)
VirtualPortalObjectId=

Para este ejemplo voy a crear un portal con el contexto "prueba1". 

Una vez que hemos ingresado los datos correspondientes ejecutamos la siguiente sentencia:

./ConfigEngine.sh -DparentProperties=/ConfigEngine/config/helpers/virtual_portal.properties create-virtual-portal

++++ Actualización ++++
En algunas situaciones podría aparecerles el siguiente mensaje de error:


  [wsadmin] WASX7209I: Connected to process "WebSphere_Portal" on node node01 using SOAP connector;  The type of process is: UnManagedProcess
  [wsadmin] WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[/opt/IBM/WebSphere/wp_profile/ConfigEngine]"
  [wsadmin] false
  [wsadmin] VirtualPortalTitle:    PortalPrueba1
  [wsadmin] VirtualPortalRealm:    defaultWIMFileBasedRealm
  [wsadmin] VirtualPortalContext:  prueba1
  [wsadmin] VirtualPortalHostName:
  [wsadmin] VirtualPortalNlsFile:
  [wsadmin] logged in as "uid=wpsadminaux,o=defaultWIMFileBasedRealm"
  [wsadmin] [06/17/11 17:09:21.148 PET] EJPXD0001I
  [wsadmin] [06/17/11 17:09:21.169 PET] EJPCA3001I: "VirtualPortalRealm in wkplc.properties with defaultWIMFileBasedRealm" already there. No action taken
  [wsadmin] [06/17/11 17:09:24.581 PET] EJPXD0002E
  [wsadmin] [06/17/11 17:09:24.583 PET] EJPCA3002E: ERROR: "VirtualPortal with context prueba1" already there
  [wsadmin] It appears that a Virtual Portal already exist with context prueba1.
  [wsadmin] java.rmi.RemoteException: com.ibm.wps.command.CreateVPFailedBecauseDuplicateKeyException: EJPEB0806E: Creating a virutal portal failed because a unique key constraint in the data backend was violated. Likely a virutal portal with the same context was deleted but still exists in the database. It is recommended to run the cleanup task for deleting resources by running the XML script Task.xml using the XML configuration interface.


Cuando suceda esto, debemos correr la siguiente sentencia desde la ruta "/bin":

./xmlaccess.sh -in ../doc/xml-samples/Task.xml -out result-Task.xml -url http://:10039/wps/config -user -password

Eliminando un Portal Virtual con el Configuration Task (aka ConfigEngine)

Para eliminar un portal virtual, lo primero que debemos hacer es obtener el listado de portales virtuales existentes. Para realizar esto ejecutamos la siguiente sentencia:

./ConfigEngine.sh list-all-virtual-portals

Al ejecutarla, se mostrará un listado como aparece en la siguiente figura.


Finalmente, con el valor que figura en el atributo "Object ID" del portal que deseamos eliminar ejecutamos la siguiente sentencia:

./ConfigEngine.sh delete-virtual-portal -DVirtualPortalObjectId=Z18_DNG2OKG10GV880I1P7FOOQ3GU6


No está de más señalar que "Z18_DNG2OKG10GV880I1P7FOOQ3GU6" es el Object ID antes mencionado.