Skip to content

Latest commit

 

History

History
103 lines (63 loc) · 3.34 KB

File metadata and controls

103 lines (63 loc) · 3.34 KB

Open Package

Anything can become a package.

Open Packaging Conventions

The Open Package Conventions are an Open Protocol for Open Packages.

They were first published in 2006, in ECMA-376

Like many file formats, Open Packages are zip files in a trenchcoat.

Any Open Packaging Convention file can be renamed to .zip and extracted as-is.

Unlike many archives, Open Packages have some distinct advantages:

  1. They contain parts and content types
  2. They contain core metadata
  3. They can contain relationships

These advantages are huge!

They allow Open Packages to be an Open Platform built on Open Protocols.

Open Package Parts

Any time we make a web request, we're effectively asking for a file. Open Packages call this a "part"

Any time a server sends a response, it's providing a file's content.

In order for a browser to treat this correctly, a server sets the Content-Type header.

By containing both the file and the content type, Open Packages are a natural choice for describing simple servers.

This makes Open Packages a natural choice for making an Open Platform for applications:

Just create a part in a package and you've got yourself an app.

Package Metadata

Open Packages also contain metadata.

Each Open Package has a small set of "core" metadata that any package may possess:

In .NET, this information is described in the.PackageProperties of an Open Package.

The core package properties are:

  • Category
  • ContentStatus
  • ContentType
  • Created
  • Creator
  • Description
  • Identifier
  • Keywords
  • Language
  • LastModifiedBy
  • LastPrinted
  • Modified
  • Revision
  • Subject
  • Title
  • Version

These properties can make it easier to discover and inspect packages.

It also makes it pretty trivial to make a package store:

All we really need is the identifier and the version (though the Description and Creator are also nice to have)

Packages can also contain as much additional metadata as they want inside of files

File Metadata

Any package can include additional metadata in the package in an easy-to-read file format.

For some examples:

  • Any Nuget package will have a .nuspec which describes this data and more in an XML file.
  • Any PowerShell module will have a .psd1 which describes the module.
  • Any JavaScript package will have a package.json which describes the package contents

Most package creation tools are effectively just verifying some metadata exists and then creating a package.

Having an Open Platform for Open Packages makes this much easier.

Package Relationships

Open Packages can also have any number of relationships.

A relationship has a few components:

  • TargetUri (what this relates to)
  • TargetMode (Internal or External)
  • RelationshipType (what kind of relationship)
  • Identifier (the relationship id)

Relationships can exist on the package and on any part in the package.

Relationships allow package to describe how they relate to themselves and the rest of the world.

This lets a package describe it's relationships with Open Protocols