11/01/2013

Не запускается 'Центр управления' (db2cc) - Can not open display

На Linux системах при запуске "Центра управления" DB2 не из под учетной записи инстанса (db2inst1) может возникать следующая ошибка:
user@srv: db2cc
No protocol specified
Error: Can not open display
Вероятнее всего вы попытались запустить "Центр управления" из-под учетной записи пользователя, который был вами создан при установке системы Linux, или системной учетной записи root.

10/16/2013

Dynamic query variables in Maximo

Here is a list of variables you can use in Maximo for queries.
:yes – true
:no – false
:&date& – current date
:&datetime& – current date/time
:&user& – logged in user
:&personid& – person ID of the logged in
:&appname& – application name
:&mboname& – name of the current business object
:&ownername& – name of the owner business object
:<relationshipname>.<attrname> – value of an attribute of a related business object of the current business object
:&owner&.<attrname> – value of an attribute of the owner business object
:&owner&.<relationshipname>.<attrname> – value of an attribute of the related business object of the owner business object
:$old_<attrname> – the initial value from the database of the attribute

10/04/2013

Cloning one Maximo 7.5 Administrative Environment to Another Machine

Link: Cloning one Maximo 7.5 Administrative Environment to Another Machine

Question

Can you clone/port a Maximo environment to another machine without doing a full install on the second machine.

Answer

You can attempt to clone/port a Maximo environment to another machine from a machine where Maximo has been installed. On both machines Maximo must reside in the same location. If Maximo was installed on the E drive on machine 1 it needs to be setup on the E drive on machine 2. The operating system on both machines must be identical. If one is Windows 2003 SP2 64-bit, the second machine must be the same. It can not be for example Windows 2003 SP2 32-bit or Windows 2003 64-bit.
This assumes the middleware has been installed and configured.
On the first machine:
1. Zip the ibm\smp folder

2. Backup the database this Maximo connects

On the second machine:

9/16/2013

Принудительное обновление Старт-Центров MAXIMO

Для принудительного обновления старт-центров в MAXIMO необходимо запустить скрипт в СУБД.

Для всех групп:

DELETE FROM MAXIMO.LAYOUT WHERE SCCONFIGID IN ((SELECT MAXIMO.SCCONFIG.SCCONFIGID FROM MAXIMO.SCCONFIG));
DELETE FROM MAXIMO.SCCONFIG;

или для конкретной группы:

DELETE FROM LAYOUT WHERE SCCONFIGID IN (SELECT SCCONFIGID FROM SCCONFIG WHERE GROUPNAME = 'SECURITYGROUPNAME');
DELETE FROM SCCONFIG WHERE GROUPNAME = 'SECURITYGROUPNAME';

8/12/2013

Installing JAD in Eclipse


Link for plugin
Link for JAD for different platforms
p.s.
It's work's in Eclipse 4.2. But not in 4.3.

How to Create Application Restrictions via Presentation.xml

You can use Application Designer to define restrictions on what records can display in an application. You can filter what data a user can see when opening an application by entering a query in the application’s presentation control. You might want to filter what records a specific application displays when it and several other applications use the same data source, but not all of the data records in the set are applicable to all of the applications.
To define an application restriction, complete the following steps:
  1. Open Application Designer by choosing Go To > Configuration > Application Designer.
  2. Type the name of the application you wish to open, or press Enter to display a list of applications.
  3. As an example, open the Assets application in the Workspace tab.
  4. Click Select Action > Toggle Show All Controls.
  5. Click the "presentation..." control.
  6. Click the Control Properties button to open the Presentation Properties dialog box.
  7. In the Where Clause field, enter "inactive=’0’". Application Designer interprets the query as "select * from asset where inactive=’0’".
  8. Click Save.
When you open the Assets application, you will only see records where the inactive attribute has a value of "0".

8/08/2013

Определение переменных окружения в Linux при загрузке системы

1. Создаем файл с удобным именем в папке /etc/profile.d, например amazon.sh. Команда "Создать файл" - touch
2. Наполняем созданный файл переменными, например:
export JAVA_HOME=/usr
export EC2_HOME=/usr/ec2-api-tools-1.6.8.1/
export PATH=$PATH:$EC2_HOME/bin
export AWS_ACCESS_KEY=<AWS_ACCESS_KEY>
export AWS_SECRET_KEY=<AWS_SECRET_KEY>
После перезапуска системы переменные будут существовать в системе.
Проверить можно командой, например: echo $EC2_HOME

8/04/2013

Создание, редактирование и удаление SWAP в Linux


1. Общая информация


В системе Линукс для размещения виртуальной памяти можно выделить отдельный раздел жесткого диска или использовать обычный файл. Линукс позволяет комбинировать эти два способа. По умолчанию в Unix системах применяется SWAP раздел. Производительность отдельного SWAP раздела жесткого диска выше, чем производительность виртуальной памяти размещенной в файле. Единственным минусом SWAP раздела является сложность его редактирования.

Если Вы до эксплуатации сервера знаете какой емкости нужна SWAP область, то обязательно используйте отдельный раздел жесткого диска. Если нагрузка на SWAP область пока неизвестна, то лучше разместить виртуальную память в файле, после чего определив потребности системы, создать раздел нужного размера.

Система Linux позволяет одновременно использовать несколько SWAP разделов и SWAP файлов. Это позволяет более гибко подойти к вопросу расширения виртуальной памяти в случае нехватке размера SWAP области на сервере. Чаще всего, на работающем сервере с существующим SWAP разделом выясняется, что текущего размера виртуальной памяти уже не хватает. Целесообразнее добавить тестовый файл подкачки для определения нагрузки на SWAP область, а уже после увеличить размер раздела.

SSH, аутентификация по ключам

Сгенерируем пару RSA ключей, это рекомендуемый формат, как наиболее устойчивый к взлому. По-умолчанию, ключи, сохраняются в домашнюю директорию пользователя, в файлы ~/.ssh/id_rsa - приватный ( секретный ) ключ, и ~/.ssh/id_rsa.pub - публичный ключ.
ssh-keygen -t rsa -b 4096
Вот собственно и все, сгенерирована пара ключей RSA, с длиной 4096 бит и сохранены в файлы /root/.ssh/id_rsa и /root/.ssh/id_rsa.pub.

Теперь переименуем id_rsa.pub в authorized_keys
На всякий случай перезапускаем SSHD: /etc/rc.d/sshd restart
Файл id_rsa копируем на компьютер с которого планируем подключаться. Используем в качестве закрытого ключа для подключения.

7/31/2013

IBM Maximo: Rebuilding and Deploying maximo.ear

In this video you can see how to rebuild and deploy maximo.ear for IBM Smart Cloud Control Desk 7.5.1






7/30/2013

Changing configured database, password, server names in Maximo v7

The installation properties are maintained in the Maximo database, and the maximo.properties file. These are required for fixpack installations, and other product installations. Over time passwords may change, hostnames/ip-addresses or database names may change. In order to update these values, follow these instructions:

1. Update the \ibm\SMP\maximo\applications\maximo\properties\maximo.properties file on the Admin Workstation to change the IP-Address/Hostname for either the database server or the webserver. Also to update the password
a. Delete the file named maximo.properties
b. Rename the file named maximo.properties_orig to maximo.properties (this is an unencrypted file)
c. Edit the maximo.properties file and update the hostname/IP-address for the database server.
d. If necessary, update the password for the user to access the database
e. Save the file
Note: The file will be automatically re-encrypted when you install a fixpack or other product. If this is not an immediate activity, you can run encryptproperties.bat file located in C:\ibm\smp\maximo\tools\maximo directory against the file to encrypt it.
2. Update the \ibm\SMP\etc\install.properties file on the Admin Workstation to change the IP-Address/Hostname for either the database server or the webserver.
3. Update the values in the maximo database to change the IP-Address/Hostname for a variety of servers, or to update passwords.
a. Connect to the maximo database using your favorite SQL editor utility.
b. Query the maxpropvalue table, and find the key you need to edit. For example, WAS.DeploymentManagerHostName is the key for the hostname or IP address of the WebSphere machine.
c. Create a query to update that value to the new value, and run the query.
d. Repeat for any passwords, ip addresses etc that need to be updated.
4. Rebuild and redeploy the EAR files.

7/29/2013

Maximo bind variables

We use bind variables a lot in maximo. We are familiar with relationships like “LOCATION=:LOCATION and SITEID=:SITEID”, and conditions like “:CLASS='INCIDENT'”. “:LOCATION”, “:CLASS” are maximo bind variable. They are resolved to the actual value of the specified attribute of the current business object. Current business object means the object that the expression is evaluated against. Depending on the context, it is the parent object that the relationship is defined on, or the object a condition is evaluated against.
Less familiar to us, is that there is an additional set of bind variables that are not resolved to the values of attributes, instead, have their own special meanings and can also be used in maximo expressions.

:&OWNER&
It represents the MBO object that is the owner of the current MBO. This is always used with combination to field name or relationship name. Such as :&OWNER&.ATTR1 or:&OWNER&.RELATIONSHIP2.ATTR2. It is used when you need to get to a value of an object on the owner MBO or through one or multiple relationship from the owner MBO. This comes extremely handy if the current record has not been saved to the database and you need to get its value or its related value.

7/28/2013

Maximo Post Install configuration

Login to maximo console http://localhost/maximo/ui using administrator privileges and perform the following steps.
1. Create an organization with Site:
  • Create Currency codes:
  • Goto Financial->Currency codes.
  • Click on New row.
  • Enter a name (ex:- USD).
  • Enter description (ex:- United States Dollar).
  • Save.

7/26/2013

DB2: Восстановление бэкапа базы в существующую базу с другим именем

Предположим мы сняли резервную копию с базы, которая называлась DB2Z, в результате получив файл с таким именем: DB2Z.0.DB2_06.NODE0000.CATN0000.20100930232346.001

Замечаем закономерность, что первая часть имени файла совпдает с алиасом базы данных. На самом деле так и есть. Однако неверно думать, что для того чтобы восстановить резервную копию в существующую базу данных с другим именем, достаточно переименовать файл резервной копии. Имя файла резервной копии следует воспринимать просто как подсказку о том, что она была:
• Получена с базы данных с таким-то алиасом
• Числовое представление типа резервной копии такое-то (0 для полной копии базы, 3 для копии табличного пространства, 4 для копии полученной с помощью LOAD)
• База данных обслуживалась экземпляром (instance) DB2 с таким-то именем
• Копия содержит такой-то узел базы данных (всегда NODE0000 для однораздельных БД)
• Номер каталога узла (всегда CATN0000 для однораздельных баз)
• Время снятия резервной копии
• Номер образа

2/28/2013

Sample Action Class

This entry is part of the Maximo Java Development
Sometimes you have to implement some complex logic in workflows or escalation and you feel limited by the out-of-the-box Maximo actions. In these cases you can unleash the Java power and code your algorithm in a custom action class.
In order to create a custom action class, you must extend the psdi.common.action.ActionCustomClass class.
package cust.actions;

import java.rmi.RemoteException;
import java.rmi.RemoteException;
import psdi.common.action.ActionCustomClass;
import psdi.mbo.MboRemote;
import psdi.util.MXException;

public class SampleAction implements ActionCustomClass
{
   public SampleAction()
   {
        super();
   }

   public void applyCustomAction(MboRemote mbo, Object[] params)
   {
        // Write custom code here
   }
}


2/27/2013

Maximo Developer 101: Lession 4 - Extending MBOs

One of the basic tasks in customizing Maximo is extending the MBOs. Remember, much of the business logic is placed in the MBOs so if you want to add custom business logic, you will need to extend the existing MBOs. 

First, let's talk about the path (package) naming for your custom MBOs.

Standard IBM proceedure is to use the same path, only changing the top level value. For example, the Maximo class path for Asset is: psdi.app.asset.Asset.class. So you would name your customization: myCompany.app.asset.Asset.class

Ok, now when you extend an MBO, you actually have to extend 6 class files. You have to extend the MBO class and the MBO Set class. Then there is a "remote" class for each. Finally the each has a "stub" file. I know this sounds like a lot but in truth, the most of your custom work will be in the MBO class and a maybe a little in the MBO Set file. The two "Remote" files will just be extensions of the base "remote" classes. And as for the two "Stub" files, you will use an XML file that will generate these for you.

At this point, I am going to strongly recommend you download and install the Maximo Developer for Eclipse. This tool will build the four files (MBO, MBO Set, and two remote files) for you. What makes build these files easier is that IBM uses a standing naming system for them. For example say you want to extend the Asset MBO. Well the four files are named as follows: Asset, AssetSet, AssetRemote, AssetSetRemote. (If you are using the Maximo Developer, then you will need to specify the MBO class file name and not the MBO set name.) 

The last step is you need to create an ANT file (this is just a special XML file). This file is a set of instructions that will create the two ";stub" files. The following will compile the stub files for extending the Asset MBO.

Maximo Developer 101: Lesson 3 - Working with Business Objects

The first step in programming Maximo is working with the Maximo Business Objects (MBOs). In this lesson, we will cover the basics of working with this class files
Although there are class files for different MBO in Maximo (one for Asset, WorkOrder, etc.), these all extend the same base object. This means you can use this based object to do 90% of what you need to do. When access an MBO, you first use what is called and MBO Set object. The main class you will use is called “MboSetRemote”. You get an MBO set object by using the MXServer object.
psdi.mbo.MboSetRemote myAssetSet = psdi.server.MXServer.getMXServer().getMboSet(“ASSET”, getUserInfo())
The above line of code creates an MBO Set object of the ASSET MBO. Of course at this point you have all of the records in the Asset table. You will most like want to narrow this down. To do this you use the .setWhere method on the MboSetRemote object. For example if we wanted just one asset, we could use something like this:
myAssetSet.setWhere(“ASSETNUM = ’12345′ and SITEID = ‘EAGLEA’”);
In the above line of code, our MboSet object would return just one record (assuming that asset/siteid existed). Now one note about the setWhere method. You can use it over and over on the same MboSet object (like in a loop), but you must call the .reset() method after each setWhere or the subsequent calls to setWhere will do nothing.
Now that we have our collection of records we want to work with, we now need to get each record. We do this by using the getMbo() method. Of course you need make sure you have any records to process and we can do that with the .count() method. This will return how many records match your “setWhere”.
Just like how all MBO Set objects extend the same object, so do each of the record objects. They extend the MboRemote object. Again, you can do 90% of what you need to do.
if (myAssetSet.count() > 0)
{
   for (int i=0; i < myAssetSet.count(); i++) {
      psdi.mbo.MboRemote currentAsset = myAssetSet.getMbo(i);
   }
}

Maximo Developer 101: Lesson 2- Maximo Fundamentals

Before you being working with Maximo, there are a couple of important concepts you need to know. These will affect your design options in creating solutions.
First thing to know is that when programming Maximo is that it is database agnostic. What I mean by this is that Maximo does know what database it is using. What does this mean to you? Well if you are trying to develop something in Maximo and hope to sell it, then you need to make sure that your enhancement is also database agnostic. If you are developing something in-house and will never change database platforms, then this is not that big of a programming concern, but it is a good practice to do it anyway.
Next thing to know is that Maximo is an Object Oriented database. Now you might be wondering how this can be since the physical database is a standard relational database (DB2, Oracle or SQL Server). Maximo does it the same way that the Java tool Hibernate does it, through a set of class files that manage all physical read/writes to the database. As a developer, you just would use the class files for accessing the database. IBM however did not use Hibernate for the Object Oriented interface. Instead, they created their own set of classes call Maximo Business Objects (MBOs) (pronounced M.B.Os or Maybows). Since Maximo is database agnostic, there is no guaranteed way to place business rules and all data integrity requirements in the database. As such, Maximo places almost all of this in the MBOs. In the database, the only data integrity you will find are unique indexes and required fields. None of the tables have primary keys, Foreign Keys or default values. This makes updating/adding data directly to the database tricky at best. It is entirely possible to enter data into the database and have it not show up in the front end because it does not meet Maximo’s data requirements. You are safe to query the database directly but all updated/inserts/deletes should be done in Java using the MBO objects. Another benefit of using the MBOs is that your code then becomes database agnostic too.

Maximo Developer 101 – Getting Started

So you want to be a Maximo developer. Well the first step is to setup your development environment. First you will need a Maximo development environment. This guide does not cover how to set that up. Although you can technically use any Java IDE, IBM recommends Eclipse IDE. All documentation from IBM is for Eclipse as well as an add-on or two are available for it. So the next question is always “What version?” Any version of 3.1 or above. You can download Eclipse here: http://www.eclipse.org/.

Next you will want to download the setup guides from IBM:

Maximo Eclipse Developer Setup Guide

Maximo Developer Remote Access Guide

Now these guides were created for Maximo 6 but they still work for Maximo 7 with the following changes

  1. The guide says Eclipse 3.1 but any newer version will work
  2. Step 1 of the Maximo Eclipse Developer Setup Guide says “Make sure that you have follow all the steps in the document MXES-Initial Eclipse 3.1.1 Setup”, this just means to make sure Eclipse is installed.
  3. Maximo 7 uses Java 1.5 while Maximo 6 uses Java 1.4

The setup guide talks about how to setup for doing MBO extension. This will also work for field classes and integration development. If you want to do screen development, then you will also need to add to your library the class folder %maximo%/maximouiweb/webmodule/WEB-INF/classes as this is where app beans and data beans are stored.

A couple of other useful tools are:

  • Maximo Developer : This is an Eclipse plug-in that helps automate the creation of Mbo Class extensions.
  • Maximo View Log : This is a web based tool for quickly viewing the Maximo Log

At this point, you should have a development environment for doing your Maximo work. So, what next? Here are some other resources available to you: