You
can create resources in a given location in the repository. The
natural file size is subject to database limitations and session
time-out. For the default configuration, files are limited to 25
MB. To raise or lower the maximum file size, you must change the
database configuration.
Writing resources is equivalent to storing data in the repository.
Once you write a resource to the repository, it becomes accessible
to all clients in the repository ecosystem. When you write resources,
such as XML schemas, XDP files, and XSD files, to the repository,
the contents are parsed based on the MIME type. If the MIME type
is supported, the parser determines whether there is an implied relationship
to other content. For example, if a cascading style sheet (CSS)
has a relative URL that references a common CSS, it is expected
that you will submit the common CSS into the repository as well.
The relationship between the two resources is stored as a pending
relationship for a non-adjustable period of 30 days. When you submit
the common CSS to the repository within the 30-day period, the relationship
is formed.
When you create a resource, the access control list (ACL) is
inherited from the parent folder. The root folder has system-level
permissions until an initial resource or folder is created, at which
point the resource or folder is given default ACL permissions.
You can programmatically
write resources by using the Repository service Java API or web
service API.
Summary of steps
To write a resource, follow these steps:
-
Include project files.
-
Create a Repository service client.
-
Specify
the URI of the resource to be read.
-
Read the resource.
Include project files
Include the necessary files in your development
project. If you are creating a client application using Java, include
the necessary JAR files. If you are using web services, include
the proxy files.
Create the service client
Before you can programmatically read
a resource, you must establish a connection and provide credentials.
This is accomplished by creating a service client.
Specify the URI of the target folder for the resource
Create a
string containing the URI of the resource to be read. The syntax
includes forward slashes, as in this example: "/
path
/
folder
".
Create the resource
Invoke the Repository service method to create
the resource, and populate the resource with identifying information,
including its UUID, resource name, and description.
Specify the resource content
Invoke the Repository service method
to create resource content, and store that content in the resource.
Write the resource to the target folder
Invoke the Repository
service method to write the resource, specifying the target folder’s
URI.
Write resources using the Java API
Write a resource by using the Repository service API (Java):
-
Include project files
Include client JAR files
in your Java project’s class path.
-
Create the service client
Create a
ResourceRepositoryClient
object
by using its constructor and passing a
ServiceClientFactory
object
that contains connection properties.
-
Specify the URI of the target folder for the resource
Specify
the URI of the target folder for the resource. In this case, because
the resource named
testResource
will be stored
in the folder named
testFolder
, the folder’s URI
is
"/testFolder"
. The URI is stored as a
java.lang.String
object.
-
Create the resource
To create a resource, you must
first create a
com.adobe.repository.infomodel.bean.RepositoryInfomodelFactoryBean
object.
Invoke
the
RepositoryInfomodelFactoryBean
object’s
newResource
method,
which creates a
com.adobe.repository.infomodel.bean.Resource
object.
In this example, the following parameters are provided:
-
A
com.adobe.repository.infomodel.Id
object,
which is created by invoking the default constructor for the
Id
class.
-
A
com.adobe.repository.infomodel.Lid
object,
which is created by invoking the default constructor for the
Lid
class.
-
A
java.lang.String
containing the file name
of the resource.
To specify the resource’s description,
invoke the
Resource
object’s
setDescription
method
and pass a string containing the description. In this example, the
description is
"test resource"
.
-
Specify
the resource content
To create content for the resource,
invoke the
RepositoryInfomodelFactoryBean
object’s
newResourceContent
method,
which returns a
com.adobe.repository.infomodel.bean.ResourceContent
object.
Add content to the
ResourceContent
object. In this
example, this is accomplished by doing the following tasks:
-
Invoking the
ResourceContent
object’s
setDataDocument
method and
passing in a
com.adobe.idp.Document
object
-
Invoking the
ResourceContent
object’s
setSize
method
and passing in the size in bytes of the
Document
object
Add
the content to the resource by invoking the
Resource
object’s
setContent
method
and passing in the
ResourceContent
object. For more
information, see
LiveCycle API Reference
.
-
Write
the resource to the target folder
Invoke the
ResourceRepositoryClient
object’s
writeResource
method
and pass in the URI of the folder, as well as the
Resource
object.
Write resources using the web service API
Write a resource by using the Repository service API (web
service):
-
Include project files
-
Create the service client
Using the Microsoft .NET
client assembly, create a
RepositoryServiceService
object
by invoking its default constructor. Set its
Credentials
property
using a
System.Net.NetworkCredential
object containing
the user name and password.
-
Specify the URI of the target folder for the resource
Specify
the URI of the target folder for the resource. In this case, because
the resource named
testResource
will be stored
in the folder named
testFolder
, the folder’s URI
is
"/testFolder"
. When using a language compliant
with the Microsoft .NET Framework (for example, C#), store the URI in
a
System.String
object.
-
Create the resource
To create a resource, invoke the
default constructor for the
Resource
class. In
this example, the following information is stored in the
Resource
object:
-
A
com.adobe.repository.infomodel.Id
object,
which is created by invoking the default constructor for the
Id
class
and assigned to the
Resource
object’s
id
field.
-
A
com.adobe.repository.infomodel.Lid
object,
which is created by invoking the default constructor for the
Lid
class
and assigned to the
Resource
object’s
lid
field.
-
A string containing the file name of the resource, which
is assigned to the
Resource
object’s
name
field.
The name used in this example is
"testResource"
.
-
A string containing the description of the resource, which
is assigned to the
Resource
object’s
description
field.
The description used in this example is
"test resource"
.
-
Specify
the resource content
To create content for the resource,
invoke the default constructor for the
ResourceContent
class.
Then add content to the
ResourceContent
object.
In this example, this is accomplished by doing the following tasks:
Add
the content to the resource by assigning the
ResourceContent
object to
the
Resource
object’s
content
field.
-
Write
the resource to the target folder
Invoke the
RepositoryServiceService
object’s
writeResource
method
and pass in the URI of the folder, as well as the
Resource
object.
Pass
null
for the other two parameters.
|
|
|