"publication"

The publication object is used to create, delete, and list publications

The publication object is used to create, delete and list publications. The publication JSON object can be specified as the main target for the JSON input file or it can be used inside plan or group targets to define a publication during the creation of another target.

Properties summary

Table 1. "publication" object properties summary
Property Description Type
create creates a new publication object
delete deletes the publication specified with the "name" parameter under the engine specified with the "engine" parameter object
list lists the files published by a publication specified with the "name" parameter under the engine specified with the "engine" parameter object

Examples

"create" example with "db" mode

When the mode is "db", a "dbname" parameter is specified. Additional folders will also be published. This feature is used because SQL databases may contain files from different folders.

{
    "memphis": {
     "name": "MEMPHIS",
     "host": "localhost",
     "port": "7597",
     "uid": "admin",
    "pwd": "ADMIN"
    },
    "options": {
      "profile": true,
      "replace": true,
      "ignoredeploy": false,
      "recursivedel": false,
      "recursivesearch": true
    },
    "publication": {
      "actions": [
        "create"
      ],
      "name": "pubdb",
      "engine": "FAIRCOMS@HOST001",
      "mode": "db",
      "dbname": "ctreeSQL",
      "wildcards": ["*dat"],
      "Dbitems":[ 
        {"item":
        "E:\\sw\\eu_database\\dbf\\ML\\data\\c",
        "wildcards":["item????.dat",
            "ordr*"
        ]
    }
  }
 
 

"create" example with "folder" mode

{
    "memphis": {
      "name": "MEMPHIS",
      "host": "localhost",
      "port": "7597",
      "uid": "admin",
      "pwd": "ADMIN"
    },
    "options": {
      "profile": true,
      "replace": true,
      "ignoredeploy": false,
      "recursivedel": false,
      "recursivesearch": true
    },
    "publication": {
      "actions": [
        "create"
        ],
        "name": "pubfolder",
        "engine": "FAIRCOMS@HOST001",
        "mode": "folder",
        "item": "E:\\sw\\eu_database\\dbf\\ML\\data\\d",
        "wildcards": ["cust*dat"],
        "recursive": false
    }
}
 
 

"create" example with "files" mode

{  
  "memphis": {
    "name": "MEMPHIS",
    "host": "localhost",
    "port": "7597",
    "uid": "admin",
    "pwd": "ADMIN"
  },
  "options": {
    "profile": true,
    "replace": true,
    "ignoredeploy": false,
    "recursivedel": false,
    "recursivesearch": true
  },
  "publication": {
    "actions": [
      "create"
    ],
    "name": "pubFiles",
    "engine": "FAIRCOMS@HOST001",
    "mode": "files",
    "items": [
      "E:\\sw\\eu_ldf\\dbf\\ML\\*.*dat",
      "E:\\sw\\usa_ldf\\dbf\\ML\\*.*dat",
    ]
  }
}
 
 

"create" examples of non-publication targets

This is an example to create a "plan" ( the target) with the "create" property value of "false".

In this example, a new "plan" is created as our main target. The publication definition under "subscriptions" has the "create" property value set to "false" because the "pubFiles" publication file already exists on the source server engine and does not need to be created.

{
  "memphis": {
    "name": "MEMPHIS",
    "uid": "admin",
    "pwd": "ADMIN"
  },
  "plan": {
    "actions": [
      "create",
      "deploy",
      "start"
    ],
    "name": "planFiles",
    "sourceEngine": "FAIRCOMS@MAURO-PC",
    "destEngine": "FAIRCOM2@MAURO-PC",
    "subscriptions": [
      {
        "name": "subFiles",
        "bidirectional": false,
        "publication": {
          "name": "pubFiles",
          "create": false
        }
      }
    ]
  }
}

 

This is an example to create a "plan" ( the target) with the "create" property value of "true".

In this example, a new "plan" is created as our main target. The publication definition under "subscriptions" has the "create" property value set to "true" because the "pubFiles" publication file does not exist on the source server engine and needs to be created. The creation specifications, such as mode and items, must be provided.

{
  "memphis": {
    "name": "MEMPHIS",
    "uid": "admin",
    "pwd": "ADMIN"
  },
  "plan": {
    "actions": [
      "create"
    ],
    "name": "planFiles",
    "sourceEngine": "FAIRCOMS@MAURO-PC",
    "destEngine": "FAIRCOM2@MAURO-PC",
    "subscriptions": [
      {
        "name": "subFiles",
        "bidirectional": false,
        "publication": {
          "name": "pubFiles",
          "create": true,
          "mode": "files",
          "items": [
            "E:\\sw\\eu_ldf\\dbf\\ML\\*.*dat"
          ]
        }
      }
    ]
  }
}

Note

Beginning with FairCom DB version 13.0.2 the "create" property is obsolete. The following example creates a "plan" and "publication" if the publication file does not already exist.

 
{
  "memphis": {
    "name": "MEMPHIS",
    "uid": "admin",
    "pwd": "ADMIN"
  },
  "plan": {
    "actions": [
      "create"
    ],
    "name": "planFiles",
    "sourceEngine": "FAIRCOMS@MAURO-PC",
    "destEngine": "FAIRCOM2@MAURO-PC",
    "subscriptions": [
      {
        "name": "subFiles",
        "bidirectional": false,
        "publication": {
          "name": "pubFiles",
          "mode": "files",
          "items": [
            "E:\\sw\\eu_ldf\\dbf\\ML\\*.*dat"
          ]
        }
      }
    ]
  }
}
 
 

"delete" example

{
  "memphis": {
     "name": "MEMPHIS",
     "host": "localhost",
     "port": "7597",
     "uid": "admin",
    "pwd": "ADMIN"
  },
  "options": {
    "profile": true,
    "replace": true,
    "ignoredeploy": false,
    "recursivedel": false,
    "recursivesearch": true
  },
  "publication": {
    "actions": [
      "delete"
    ],
    "name": "pubFiles",
    "engine": "FAIRCOMS@HOST001"
  }
}
 
 

"list" example

{
  "memphis": {
    "name": "MEMPHIS",
    "uid": "admin",
    "pwd": "ADMIN"
  },
  "publication": {
    "actions": [
      "list"
    ],
    "name": "pubFiles",
    "engine": "FAIRCOMS@HOST001"
  }
}
 
 
 
 

“create”

The "create" action creates a new publication, plan, or group.

Note

The "create" action with "plan" targeted always takes a list of subscriptions and each subscription is associated with an existing or new publication. The "create" action with "publication" targeted defines new publications.

 

Properties summary

Table 2. "create" actions summary
Property Description Type Limits (inclusive)
create

When "publication" is not the main target, this property indicates whether to find an existing publication ("false") or create a new one ("true").

Note

Beginning with FairCom DB version 13.0.2, this property is no longer used. If the named publication exists, it is used and other publication properties are ignored.

If the publication does not exist it will be created with the specified properties. If the properties are not sufficient, an error is returned.

 
Boolean
"true"
"false"
dbExcludes specifies wildcards that are used to exclude files in the designated folder, when the mode is "db". Each object is composed of an “item” which is a folder specified in the “items” array, and a mask which specifies the wildcard for the files to exclude. array of JSON objects
dbitems

an array of dbitem objects that specifies the additional database folder to be published together with the main database folder. This option is valid ONLY when the publication mode is “db” (with “files” and “folder” mode this option is ignored). A dbitem object is composed of an “item” string that defines the additional folder to be published, and an array of wildcards items (refer to the wildcards array description below). he main database folder (the folder that usually contains the system tables) is automatically added to the publication and doesn’t need to be specified in the “dbitems” element.Eg:…“dbitems”:[ “item”:”C:\datafolder”, “wildcards”:[“.dta”, “data00?.*”]

Note

The main database folder (the folder that usually contains the system tables) is automatically added to the publication and doesn’t need to be specified in the “dbitems” element. For example:

“dbitems”:[

“item”:”C:\datafolder”,

“wildcards”:[“.dta”,

“data00?.*”

 
array of JSON objects
dbname

contains the name of the database to be published

Note

This is for when the "mode" is "db".

 
string
engine specifies the logical name of the publication string
folderExcludes specifies wildcards that are used to exclude files in the designated folder, when the mode is "folder". array of strings
items

contains a list of the objects to be published. This is valid only when "mode" is "files" or "folder". For the "db" mode, see "dbitems".

Note

When the "mode" is "folder", only the first array element is valid, since "folder" mode only supports folders as published items. When the "mode" is "files", a wildcard can be used as part of the item string to match a certain file pattern.

 

Note

Depending on the "mode" this is a list of databases folders or files.

 
array of strings
mode specifies the mode of the publication string
"db"
"folder"
"files"
name specifies the name of the publication string
recursive

specifies whether the files matching the wildcard are matched recursively in sub-folders or just in the specified root

Note

This is for when the mode is "db" or "folder".

 
Boolean
wildcards

specifies that the specified wildcards are used to match the files in the specified folders.

Note

This works only with “db” and “folder” mode, and has different behaviors for each. For “folder” mode, the wildcard is applied to the files in the published folder. For “db” mode, the wildcards is applied ONLY to the main database folder, which is added automatically to the publication without the need to be specified in the “dbitems” array. Regular filesystem wildcards are accepted. Wildcard elements can be used as children of the “dbitems” element to specify the wildcards to be applied to the additional database folders.

 
array of strings