|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--oracle.ifs.adk.filesystem.IfsFileSystem
import oracle.ifs.beans.*;
import oracle.ifs.adk.filesystem.IfsFileSystem;
public class listFolder {
static public void main(String argv[]) throws IfsException {
IfsFileSystem fsAPI = new IfsFileSystem("admin", "welcome", "Local");
String dir = argv[0]; //get the path of the Folder
whose contents we wish to display
PublicObject po = fsAPI.findPublicObjectByPath(dir);
PublicObject[] contents = fsAPI.listFolder((Folder)po);
System.out.println("Here are the names of the items
in folder " + dir);
for (int i=0; i < contents.length; i++)
System.out.println(contents[i].getName());
}
Field Summary | |
static char |
MATCH_ALL
The character used as the wildcard to match any (0 or more) characters. |
static char |
MATCH_ONE
The character used as the wildcard to match any single character. |
Constructor Summary | |
IfsFileSystem(LibrarySession session)
Construct an IfsFileSystem object given an already established session. |
|
IfsFileSystem(java.lang.String username,
java.lang.String password,
java.lang.String server,
java.lang.String serverPassword)
Construct an IfsFileSystem object. |
Method Summary | |
void |
addFolderRelationship(Folder folder,
PublicObject po)
Create a reference between a Folder and a PublicObject; placing the PublicObject inside the Folder. |
void |
cancelCheckout(PublicObject po)
Cancel a checkout. |
DirectoryUser |
checkedOutBy(PublicObject po)
Return the DirectoryUser who currently has PublicObject po checked out, or null if po is not checked out. |
void |
checkIn(PublicObject po,
java.lang.String comment)
If po is unversioned: the session lock will be released on the object. |
PublicObject |
checkOut(PublicObject po,
boolean makeVersioned)
If po is unversioned, and makeVersioned is True: po will become versioned. |
Folder |
copy(Folder fromFolder,
Folder toFolder,
boolean recursive,
AccessControlList acl)
Copy a Folder into another Folder. |
PublicObject |
copy(PublicObject po,
Folder folder,
AccessControlList acl,
boolean overwrite)
Copy the PublicObject po into the specified folder. |
Document |
createDocument(java.lang.String name,
java.io.InputStream content,
java.lang.String folderPath,
AccessControlList acl,
boolean doParse,
ParserCallback callback)
Create a Document in iFS. |
Folder |
createFolder(java.lang.String name,
Folder destfolder,
boolean createParents,
AccessControlList acl)
Create a Folder in iFS. |
void |
delete(Folder folder,
boolean recursive)
Delete a Folder. |
void |
delete(PublicObject po)
Delete a PublicObject. |
PublicObject |
findPublicObjectById(java.lang.Long id)
Returns the PublicObject having the specified id . |
PublicObject |
findPublicObjectByPath(java.lang.String path)
Returns the PublicObject pointed to by path . |
AttributeValue |
getAttribute(PublicObject po,
java.lang.String attrName)
Return a specified attribute of a PublicObject. |
AttributeValue[] |
getAttributes(PublicObject po,
java.lang.String[] attrNames)
Return the specified attributes of a PublicObject. |
DirectoryUser |
getCurrentUser()
Display the current user in the session. |
java.io.InputStream |
getDocumentContent(Document doc)
Retrieve the content of a Document as a stream. |
VersionDescription[] |
getHistory(PublicObject po)
Retrieve the revision history of the specified PublicObject. |
LibrarySession |
getLibrarySession()
Return the LibrarySession object being used to communicate with iFS. |
Folder[] |
getParents(PublicObject po)
Return a list of parent Folders that reference the specified PublicObject. |
boolean |
isCheckedOut(PublicObject po)
Check to see if a PublicObject is currently checked out. |
boolean |
isVersioned(PublicObject po)
Check to see if a PublicObject is versioned. |
PublicObject[] |
listFolder(Folder folder,
java.lang.String pattern)
Return the items of the specified folder whose names
match pattern . |
PublicObject |
makeVersioned(PublicObject po)
Convert an unversioned PublicObject into versioned PublicObject. |
PublicObject |
move(Folder fromFolder,
Folder toFolder,
PublicObject po,
java.lang.String newName,
AccessControlList acl,
boolean overwrite)
Move a PublicObject from fromFolder to
toFolder with the new name newName and
new access control list acl , if specified. |
Document |
putDocument(java.lang.String name,
java.io.InputStream content,
java.lang.String folderPath,
AccessControlList acl,
boolean doParse,
ParserCallback callback)
Create an iFS Document named name in Folder
folder with content as the body. |
void |
removeFolderRelationship(Folder folder,
PublicObject po,
boolean rmNoRef)
Removes the relationship between a Folder and a PublicObject. |
void |
rename(PublicObject po,
java.lang.String newName)
Rename a PublicObject. |
java.io.InputStream |
renderAsStream(PublicObject po,
java.lang.String rendererType,
java.lang.String rendererName)
Render the object out as a stream. |
PublicObject[] |
searchByContent(java.lang.String[] keywords,
Folder folder,
int maxDepth)
Perform a recursive search based on document content starting in Folder folder . |
PublicObject[] |
searchByContent(java.lang.String keyword,
Folder folder,
int maxDepth)
Perform a recursive search based on document content starting in Folder folder . |
PublicObject[] |
searchByName(java.lang.String pattern,
Folder folder,
int maxDepth)
Perform a recursive search based on filename starting in Folder
folder . |
void |
setAttribute(PublicObject po,
java.lang.String name,
AttributeValue value)
Set an attribute for a PublicObject in iFS. |
void |
setAttributes(PublicObject po,
java.lang.String[] names,
AttributeValue[] values)
Set attributes for a PublicObject in iFS. |
void |
setLibrarySession(LibrarySession session)
Set a new LibrarySession to communicate with iFS. |
Document |
updateDocument(java.lang.String name,
java.io.InputStream content,
java.lang.String folderPath,
AccessControlList acl,
boolean doParse,
ParserCallback callback)
Update a document in iFS. |
Field Detail |
public static final char MATCH_ALL
public static final char MATCH_ONE
Constructor Detail |
public IfsFileSystem(LibrarySession session) throws IfsException
session
- Session objectpublic IfsFileSystem(java.lang.String username, java.lang.String password, java.lang.String server, java.lang.String serverPassword) throws IfsException
username
, password
, and
server
must be specified. serverPassword
is optional.username
- Usernamepassword
- Passwordserver
- Server to connect toserverPassword
- Server passwordMethod Detail |
public void addFolderRelationship(Folder folder, PublicObject po) throws IfsException
addFolderRelationship
in interface FileSystem
folder
- Folder object that will contain po
po
- PublicObject objectIfsException(68010)
- - if a po by that name already exists
in folder.public void cancelCheckout(PublicObject po) throws IfsException
cancelCheckout
in interface FileSystem
po
- PublicObject object to be cancelledIfsException(68011)
- - if po is not checked out.IfsException(68012)
- - if po is not versioned.IfsException(68022)
- - if po is a Folder.public void checkIn(PublicObject po, java.lang.String comment) throws IfsException
checkIn
in interface FileSystem
po
- PublicObject to be checked incomments
- CheckIn commentsIfsException(68011)
- - if po is not checked out.IfsException(68012)
- - if po is not versioned.IfsException(68022)
- - if po is a Folder.public PublicObject checkOut(PublicObject po, boolean makeVersioned) throws IfsException
checkOut
in interface FileSystem
po
- PublicObject to be checked outmakeVersioned
- Flag to request creation of VersionSeries for poIfsException(68012)
- - if po is not versioned, and
makeVersioned is false.IfsException(68014)
- - if po is already checked out.IfsException(68022)
- - if po is a Folder.public DirectoryUser checkedOutBy(PublicObject po) throws IfsException
checkedOutBy
in interface FileSystem
po
- PublicObjectIfsException(68012)
- - if po is not versionedIfsException(68022)
- - if po is a Folder.public PublicObject copy(PublicObject po, Folder folder, AccessControlList acl, boolean overwrite) throws IfsException
po
is a non-Folder object:
overwrite
is True, existing PublicObject in
folder
will be overwritten.
overwrite
is False, a new copy will be created
with the naming convention "Copy of .." for the first copy, and
"Copy (#) of .." for all other copies.
po
is a Folder object:
overwrite
is True, the content of po
will be copied over to the existing PublicObject in
folder
with versioning semantics.
overwrite
is False, a new copy will be created
with the naming convention "Copy of .." for the first copy, and
"Copy (#) of .." for all other copies.
copy
in interface FileSystem
po
- PublicObject to copy fromfolder
- Folder object to copy toacl
- ACL to be applied to the newly created copy; if null,
session user's default ACL is usedoverwrite
- If true, overwrite existing PublicObject in folder .
Note: overwrite behaves differently if po is a Folder.
See above for details.IfsException(68021)
- - if name conflict exists while trying to
copy between a Folder and a non-Folder
objects.copy(Folder, Folder, boolean, AccessControlList)
public Folder copy(Folder fromFolder, Folder toFolder, boolean recursive, AccessControlList acl) throws IfsException
recursive
flag
is True, subfolders will be copied as well. If there exists a
Folder object in toFolder
with same name as
fromFolder
, the contents of fromFolder
will be copied over to the existing Folder object in
toFolder
with versioning semantics.copy
in interface FileSystem
fromFolder
- Folder to copy fromtoFolder
- Folder to copy torecursive
- If True, subfolders will be copiedacl
- ACL to be applied to the newly created copy of
fromFolder (but not its items); if null, session
user's default ACL will be usedIfsException(68021)
- - if name conflict exists while trying to
copy between a Folder and a non-Folder
objects.public Document createDocument(java.lang.String name, java.io.InputStream content, java.lang.String folderPath, AccessControlList acl, boolean doParse, ParserCallback callback) throws IfsException, java.io.IOException
name
, an exception is thrown.
If doParse
is true and the object created from parsing
the input stream is a Document or a subclass, then it will be returned.
If the object created from parsing the input stream is not a Document
or a subclass, null is returned (but the object is still created).createDocument
in interface FileSystem
name
- Name of the document to be createdcontent
- InputStream to read contents from; if null,
empty document is createdfolderPath
- Absolute path of folder in which to create
the documentacl
- ACL to be assigned to the new document; if null,
sess user's default ACL will be useddoParse
- If true, input stream will be parsed using a parser
which is determined based on the file extensioncallback
- Parser callback to be specified if doParse is trueIfsException(68003)
- - if folderPath
is not a
FolderIfsException(68004)
- - if folderPath
is not foundIfsException(68010)
- - if a document by that name already existspublic Folder createFolder(java.lang.String name, Folder destfolder, boolean createParents, AccessControlList acl) throws IfsException
createFolder
in interface FileSystem
name
- Name of the Folder to be created; name can also be
in the format of a path (relative to destFolder) if
createParents is true (eg. "a/b/c")destfolder
- Folder in which to create the new foldercreateParents
- If true, non-existing parent folders will be createdacl
- ACL to be assigned to new folder(s) created;
if null, session user's default ACL will be usedIfsException
- - if operation failed.public void delete(PublicObject po) throws IfsException
po
is a Folder, then
recursive delete will be performed.delete
in interface FileSystem
po
- PublicObject to be deleted.IfsException
- - if operation failed.delete(Folder, boolean)
public void delete(Folder folder, boolean recursive) throws IfsException
delete
in interface FileSystem
folder
- Folder object to be deletedrecursive
- If true, subfolders will be deletedIfsException(68020)
- - if folder
is non-empty,
and recursive
is False.public PublicObject findPublicObjectById(java.lang.Long id) throws IfsException
id
.findPublicObjectById
in interface FileSystem
id
- Id of the PublicObjectIfsException
- - if operation failed.public PublicObject findPublicObjectByPath(java.lang.String path) throws IfsException
path
.findPublicObjectByPath
in interface FileSystem
path
- Path to the PublicObjectIfsException
- - if operation failed.public AttributeValue getAttribute(PublicObject po, java.lang.String attrName) throws IfsException
getAttribute
in interface FileSystem
po
- PublicObject from which to get the attributeattrName
- Name of the attributeIfsException
- - if operation failed.public AttributeValue[] getAttributes(PublicObject po, java.lang.String[] attrNames) throws IfsException
getAttributes
in interface FileSystem
po
- PublicObject from which to get the attributesattrNames
- A list of attributes to return; if null, all
attributes will be returnedIfsException
- - if operation failed.public DirectoryUser getCurrentUser() throws IfsException
getCurrentUser
in interface FileSystem
IfsException
- - if operation failed.public java.io.InputStream getDocumentContent(Document doc) throws IfsException, java.io.IOException
getDocumentContent
in interface FileSystem
doc
- Document from which to retrieve contentIfsException
- - if operation failed.renderAsStream(PublicObject, String, String)
public VersionDescription[] getHistory(PublicObject po) throws IfsException
po
is
unversioned, return null.getHistory
in interface FileSystem
po
- PublicObject from which to get historypo
is unversionedIfsException(68022)
- - if po is a Folder.public LibrarySession getLibrarySession()
getLibrarySession
in interface FileSystem
public Folder[] getParents(PublicObject po) throws IfsException
getParents
in interface FileSystem
po
- PublicObject from which to retrieve parentsIfsException
- - if operation failed.public boolean isCheckedOut(PublicObject po) throws IfsException
isCheckedOut
in interface FileSystem
po
- PublicObjectIfsException(68012)
- - if po is not versioned.IfsException(68022)
- - if po is a Folder.checkedOutBy(PublicObject)
public boolean isVersioned(PublicObject po) throws IfsException
isVersioned
in interface FileSystem
po
- PublicObjectIfsException(68022)
- - if po is a Folder..public PublicObject[] listFolder(Folder folder, java.lang.String pattern) throws IfsException
folder
whose names
match pattern
. (Subfolders are not expanded --
see searchByName()). pattern
may contain wildcards.
If pattern
is null, then all items will be returned.
The returned array is in alphabetical order.listFolder
in interface FileSystem
folder
- Folder to list contents ofpattern
- Filename pattern to be matched; if null, return allIfsException
- - if operation failed.searchByName(String, Folder, int)
public PublicObject makeVersioned(PublicObject po) throws IfsException
po
will have their references changed
to point to the newly created Family object.makeVersioned
in interface FileSystem
doc
- Unversioned document to convertIfsException(68014)
- - if po is already checked out.IfsException(68022)
- - if po is a Folder.public PublicObject move(Folder fromFolder, Folder toFolder, PublicObject po, java.lang.String newName, AccessControlList acl, boolean overwrite) throws IfsException
fromFolder
to
toFolder
with the new name newName
and
new access control list acl
, if specified.
If fromFolder
and toFolder
are the same:
newName
is not null:
acl
..
acl
is not null:
toFolder
as
po
:
overwrite
is false:
overwrite
is true and po
is a Folder:
po
will be copied to the existing
folder in toFolder
with versioning semantics.
overwrite
is true and po
is not a Folder:
toFolder
with
po
with versioning semantics.
newName
is specified:
po
to toFolder
.
po
's name to newName
.
newName
is not specified:
po
to toFolder
.
po
's ACL will be left unchanged.move
in interface FileSystem
fromFolder
- Folder in which the PO belongstoFolder
- Folder to which to move POpo
- PublicObject to movenewName
- New name to be assigned to the moved POacl
- ACL to be used on the moved object; if null,
acl will not be changedoverwrite
- If true, overwrite existing PublicObject in folderIfsException(68018)
- - if po is checked out.IfsException(68019)
- - if po is an unfoldered version document.IfsException(68021)
- - if name conflict exists while trying to
move between a Folder and a non-Folder
objects.public Document putDocument(java.lang.String name, java.io.InputStream content, java.lang.String folderPath, AccessControlList acl, boolean doParse, ParserCallback callback) throws IfsException, java.io.IOException
name
in Folder
folder
with content
as the body. If
there is an existing Document with same name as name
,
this call is equivalent to updateDocument().
If document does not exist:
doParse
is true:
acl
is null:
doParse
is true and the object created from parsing
the input stream is a Document or a subclass, then it will be returned.
If the object created from parsing the input stream is not a Document
or a subclass, null is returned (but the object is still created).name
- Name of the documentcontent
- InputStream from which to read document contentsfolderPath
- Absolute path of Folder in which to create
the documentacl
- ACL to be assigned to the document; if null,
session user's default ACL will be useddoParse
- If true, input stream will be parsed using a parser
which is determined based on the file extensioncallback
- Parser callback to be specified if doParse
is trueIfsException
- - if operation failed.public void removeFolderRelationship(Folder folder, PublicObject po, boolean rmNoRef) throws IfsException
rmNoRef
is 'True', po
will be deleted
if there are no other relationships existing for po
.removeFolderRelationship
in interface FileSystem
folder
- Folder from which contains a reference to
po
po
- PublicObject from which to remove referencermNoRef
- If 'True', po
will be removed when
there are no more existing relationshipsIfsException
- - if operation failed.delete(PublicObject)
public void rename(PublicObject po, java.lang.String newName) throws IfsException
po
's parent Folders
contains an existing PO with the same name as newName
,
the PO will not be renamed, and an exception will be thrown.rename
in interface FileSystem
po
- PublicObject to be renamednewName
- New name to be assignedIfsException(68005)
- - if newName already exists.public java.io.InputStream renderAsStream(PublicObject po, java.lang.String rendererType, java.lang.String rendererName) throws IfsException
renderAsStream
in interface FileSystem
po
- PublicObjectrendererType
- StringrendererName
- Stringpublic PublicObject[] searchByContent(java.lang.String keyword, Folder folder, int maxDepth) throws IfsException
folder
. The maximum depth of recursive search
to be performed starting at folder
can be specified
in the maxDepth
argument. If maxDepth
is < 1, it is ignored and the default is a search with unlimited depth.
Only foldered items containing keyword
will be returned.
Only unversioned documents' content can be searched. Versioned
documents will not be handled. This will be fixed in the next
release.
For example:
searchByContent("happy", thisFolder, 2)
thisFolder
and/or its subfolders 2 levels deep.
keyword
- A keyword on which to searchfolder
- Folder from which to start the search; if null,
the search will start from the root foldermaxDepth
- Maximum depth for search; if < 1, unlimited depthpublic PublicObject[] searchByContent(java.lang.String[] keywords, Folder folder, int maxDepth) throws IfsException
folder
. The maximum depth of recursive search
to be performed starting at folder
can be specified
in the maxDepth
argument. If maxDepth
is < 1, it is ignored and the default is a search with unlimited depth.
Only foldered items containing keyword
will be returned.
Only unversioned documents' content can be searched. Versioned
documents will not be handled. This will be fixed in the next
release.
For example:
searchByContent(new String[] {"abc", "smile"}, null, 0)
keywords
- A set of keywords on which to searchfolder
- Folder from which to start the search; if null,
the search will start from the root foldermaxDepth
- Maximum depth for search; if < 1, unlimited depthpublic PublicObject[] searchByName(java.lang.String pattern, Folder folder, int maxDepth) throws IfsException
folder
.
Only foldered items whose filenames match pattern
will be returned. "*" matches any string of zero or more characters,
and "?" matches any single character.
For versioned documents, only the Family's name will be searched.
Each individual version's name will not be searched. This will be
fixed in the next release.
For example:
searchByName(MATCH_ALL + "txt", thisFolder, 0)
pattern
- Name patternfolder
- Folder from which to start the search; if null,
the search will start from the root foldermaxDepth
- Maximum depth for search; if < 1, it is ignoredpublic void setAttribute(PublicObject po, java.lang.String name, AttributeValue value) throws IfsException
setAttribute
in interface FileSystem
po
- PublicObject for which to set the attributename
- Name of the attributevalue
- Attribute value to be setIfsException
- if operation failed.public void setAttributes(PublicObject po, java.lang.String[] names, AttributeValue[] values) throws IfsException
setAttributes
in interface FileSystem
po
- PublicObject for which to set attributesnames
- Names of the attributesvalues
- Attribute values to be setIfsException
- - if operation failed.public void setLibrarySession(LibrarySession session) throws IfsException
setLibrarySession
in interface FileSystem
session
- LibrarySession objectpublic Document updateDocument(java.lang.String name, java.io.InputStream content, java.lang.String folderPath, AccessControlList acl, boolean doParse, ParserCallback callback) throws IfsException, java.io.IOException
doParse
is true and the object created from parsing
the input stream is a Document or a subclass, then it will be returned.
If the object created from parsing the input stream is not a Document
or a subclass, null is returned (but the object is still created).updateDocument
in interface FileSystem
name
- Name of the documentcontent
- InputStream from which to read the document contentsfolderPath
- Absolute path of folder in which to update
the documentacl
- ACL to be assigned to the document; if null,
session user's default ACL will be useddoParse
- If 'True', input stream will be parsed using a parser
which is determined based on the file extensioncallback
- Parser callback to be specified if doParse is trueIfsException(68003)
- if folderPath is not a Folder.IfsException(68004)
- if folderPath is not found.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |