Class DeployedAssetsConnector

    • Constructor Detail

      • DeployedAssetsConnector

        public DeployedAssetsConnector()
        Constructor which populates the modes supported by the Connector.
    • Method Detail

      • getVersion

        public java.lang.String getVersion()
        Version information.
        Specified by:
        getVersion in interface VersionInfoInterface
        Returns:
        version information
      • getDbUsername

        public java.lang.String getDbUsername()
        Returns the username for connection to the Maximo database.
        Returns:
        the dbUsername.
      • getJdbcDriver

        public java.lang.String getJdbcDriver()
        Returns the JDBC driver for connection to the Maximo database.
        Returns:
        the jdbcDriver.
      • getJdbcUrl

        public java.lang.String getJdbcUrl()
        Returns the JDBC URL for connection to the Maximo database.
        Returns:
        the jdbcUrl.
      • getMode

        public java.lang.String getMode()
        Returns the Connector mode.
        Returns:
        mode.
      • isAddOnlyMode

        public boolean isAddOnlyMode()
        Checks if the Connector is in AddOnly mode.
        Returns:
        whether the Connector is in AddOnly mode.
      • initialize

        public void initialize​(java.lang.Object entry)
                        throws java.lang.Exception
        This standard method initializes the Connector with values present in its Configuration panel. If database related parameters are not present in the Connector's configuration, they are taken from the PROPERTIES_FILE file.
        Specified by:
        initialize in interface ConnectorInterface
        Overrides:
        initialize in class Connector
        Parameters:
        entry - an initial entry provided to the Connector.
        Throws:
        java.lang.Exception - if a problem occurs.
      • querySchema

        public java.lang.Object querySchema​(java.lang.Object arg0)
                                     throws java.lang.Exception
        This method populates Output Map for CallReply mode and Input Map for Iterator\Lookup mode. The attributes for a CI\Relationship are fetched from Maximo database.
        Specified by:
        querySchema in interface ConnectorInterface
        Overrides:
        querySchema in class Connector
        Parameters:
        arg0 - an object parameter not used by this method.
        Returns:
        null, since the Connector handles the schema population on its own.
        Throws:
        java.lang.Exception - if a problem occurs.
        See Also:
        Entry, Vector
      • terminate

        public void terminate()
                       throws java.lang.Exception
        This method will close Connection to the Maximo database. It will also clear the counter for Iterator mode.
        Specified by:
        terminate in interface ConnectorInterface
        Overrides:
        terminate in class Connector
        Throws:
        java.lang.Exception - if a problem occur.
      • checkDbConnection

        public java.lang.String checkDbConnection()
        Checks if with the currently configured properties, a connection to the Maximo database can be established.
        Returns:
        if the connection was established successfully null is returned, otherwise the method returns a String containing the exception's text.
        Throws:
        java.io.IOException - if a problem occurs.
      • selectEntries

        public void selectEntries()
                           throws java.lang.Exception
        This is preparation method for Iterator mode. This will fetch values of deployed assets from the Maximo database.
        Specified by:
        selectEntries in interface ConnectorInterface
        Overrides:
        selectEntries in class Connector
        Throws:
        java.lang.Exception - if a problem occurs.
      • findEntry

        public Entry findEntry​(SearchCriteria criteria)
                        throws java.lang.Exception
        Finds an existing entry. The search criteria specifies which entry to locate

        Here is an example of how to find all people with names starting with 'J' which are from IBM organization in US.

        Example:

         var ctor = input.getConnector();
         var crit = new com.ibm.di.SearchCriteria("$dn",
                        com.ibm.di.SearchCriteria.SUBSTRING, "c=US,o=IBM");
         crit.addCriteria("name", com.ibm.di.SearchCriteria.INITIAL_STRING, "J");
         crit.addCriteria("objectclass", com.ibm.di.SearchCriteria.SUBSTRING, "person");
         
         var res = ctor.findEntry(crit);
         if (res != null) {
                main.logmsg("Found entry:");
                main.dumpEntry(res);
         } else {
          if( getFindEntryCount()> 1 ){
           main.logmsg("Found these entries:");
           while ( (entry = ctor.getNextFindEntry()) != null ) {
             main.dumpEntry(entry);
           }
          }
          else {
                 main.logmsg("Entry not found!");
          }
         }
         
        Specified by:
        findEntry in interface ConnectorInterface
        Overrides:
        findEntry in class Connector
        Parameters:
        criteria - The search criteria used to locate the entry to be modified
        Returns:
        The entry found, or null if no or multiple entries found
        Throws:
        java.lang.Exception - if an error occurs.
      • deleteEntry

        public void deleteEntry​(Entry entry,
                                SearchCriteria search)
                         throws java.lang.Exception
        Deletes an existing entry. The search criteria specifies which entry to modify. Some connectors may silently ignore the search criteria. For example, the LDAP connector will use the distinguished name ($dn) from the entry parameter (if it exists) rather than expanding the search criteria and search for the entry. Each connector's inner semantics governs whether the search parameter is used or not.
        Specified by:
        deleteEntry in interface ConnectorInterface
        Overrides:
        deleteEntry in class Connector
        Parameters:
        entry - The entry data
        search - The search criteria used to locate the entry to be deleted
        Throws:
        java.lang.Exception - if an error occurs.
      • putEntry

        public void putEntry​(Entry entry)
                      throws java.lang.Exception
        Adds a new entry to the data source

        Example:

         var ctor = write.getConnector();
         
         for (i = 0; i < 10; i++) {
                var entry = system.newEntry();
                entry.setAttribute("linenumber", i);
                entry.setAttribute("line", i + " line of text...");
         
                main.logmsg("Writes entry to output...");
                main.dumpEntry(entry);
                ctor.putEntry(entry);
         }
         
        Specified by:
        putEntry in interface ConnectorInterface
        Overrides:
        putEntry in class Connector
        Parameters:
        entry - The entry data to add
        Throws:
        java.lang.Exception - if an error occurs.