CIFS
CIFS(SMB) Server for Java Content Repository
Related Documents
1 Introduction
The CIFS(SMB) JCR Server implements the CIFS protocol layer on top of the Java Content Repository (JSR-170). Architecturally the CIFS Server can be divided into three main parts: Network Transport Layer, CIFS Protocol Proccessor and JCR Handler. After the start-up the Server creates Network Transport Handlers (for ex for TCP/IP, NetBIOS) which open server sockets and listen to Client connections. After establishing valid client connection, the Server creates dedicated SMB Session thread to manage client-server interactions. Then, after the protocol dialect negotiation procedure is done , the appropriate JCR Handler is created and starts to work. This JCR Handler is responsible for CIFS/JCR operation mapping and actually JCR operation performing.2 Features
CIFS-JCR artefacts mapping| JCR | CIFS |
|---|---|
| Repository | Preconfigured List of Disks (Shared Devices) |
| Workspace | Disk (Shared Device) |
| Session | Client connection (Tree Connection) |
| Node(nt:file+nt:resource) | File |
| Node(other than nt:file) | Folder |
- JCR Repository browsing. JCR-CIFS artefacts are mapped according to the table above
- Reading files (nt:file and descendants)
- Traversing folders (other than nt:file and descendants)
- Creation of files and folders
- Writing into files (with some limitations related to file size and server productivity)
- Removing files and folders
- Moving files and folders
- Renaming files and folders
- Copying files and folders
3 References and limitations
JCR Repositories- eXo JCR repository that uses the eXo Repository name configuration option
- Any JSR-170 compliant repository that uses the JNDI configuration
- Standalone
- Embedded into the J2EE Application Server
- PC NETWORK PROGRAM 1.0
- MICROSOFT NETWORKS 1.03
- MICROSOFT NETWORKS 3.0
- LANMAN1.0
- LM1.2X002
- LANMAN2.1
- NT LM 0.12
4 Configuration
The Server runs as a component of eXoContainer, so is configured in the same configuration file. In our case it's<component>
<key>org.exoplatform.services.cifs.CIFSService</key>
<type>org.exoplatform.services.cifs.CIFSServiceImpl</type>
<init-params>
...
</init-params>
</component>- repository-name - name of the backed-end Java Content Repository as it is configured in the JCR service (eXo JCR only)
<value-param> <name>repository-name</name> <value>repository</value> </value-param>
- jndi-repository-name - the name of the JNDI bound Java Content Repository (JNDI name) applicable for any JSR-170 compliant repository. In case both repository-name and jndi-repository-name are configured, jndi-repository-name is used.
<value-param> <name>jndi-repository-name</name> <value>jndi-repository</value> </value-param>
- Available workspaces - used if no eXo-repository is used
<value-param> <name>workspaces</name> <value>ws,ws1,ws2</value> </value-param>
<value-param>
<name>enable_smb</name>
<value>true</value>
</value-param>- Broadcast mask
<value-param>
<name>broadcast_mask</name>
<value>255.255.255.255</value>
</value-param>- host_name:
<value-param> <name>host_name</name> <value>SMBServer</value> </value-param>
- workgroup
<value-param> <name>workgroup</name> <value>office</value> </value-param>
- comment
<value-param> <name>comment</name> <value>This server is a specific SMB server which works with the JCR repository.</value> </value-param>
- NetBIOS transport (Java impl) configuration
<properties-param> <name>netbios_java</name> <property name="enabled" value="true"/> <property name="session_port" value="139"/> <property name="datagram_port" value="138"/> <property name="name_port" value="137"/> <!-- NetBIOS host announce config --> <property name="announce_enabled" value="true"/> <property name="announce_interval" value = "5"/> </properties-param>
- NetBIOS SMB transport layer - the JNI implementation only for Windows
<properties-param> <name>winnetbios</name> <property name="enabled" value="true"/> <property name="netbiosname" value="TestCIFS"/> <!--LANA - if not determined or equals -1 will use all available LAN adapters --> <property name="lanas" value="-1"/> <!-- native API for Win NetBIOS : netbios or winsock --> <property name="nativeapi" value="netbios"/> <!-- Win32 NetBIOS host announce config --> <property name="announce_enabled" value ="true"/> <property name="announce_interval" value = "5"/> </properties-param>
5 How to use
There are different ways: Firstly, look for a server using its name for searching and in a workgroup which you specified in the configuration. Secondly, if you can't find your server (it's possible in some cases if the required server is Master Browser), you need to search for it using its name directly, likeServername.
>>\\<your server name>
>>\\<your server name> \ <device\service name> \ <file or folder>
>>\\<your server name>
>>net use <free device name>: \\<server IP> \ <share name>
>>smbclient -I <server ip> -P <port> //<server share>
6 Running
6.1 Windows
- To access the server from Windows client, is the same as for another windows smb-server. Or run
<share name>. - To access the server from Linux, use
smbclient -U <username> //<server ip or name>/<share name>
6.2 Linux
- accessing the server from a Windows client is possible only if the server is bound to standard smb-transport ports (its 139, 138, 137).
- if the server uses non-standart ports (assigned by user in configuration.xml), the access is possible only from clients, who define which port must be used for connection. For example
smbclient -p 60139 //127.0.0.1/ws
- the server is not visible in Network Neighbourhood on default, but if your computer is registered (have netbios name) and the server is bound to standard smb ports, the windows-client can use server resources as usual.