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

JCRCIFS
RepositoryPreconfigured List of Disks (Shared Devices)
WorkspaceDisk (Shared Device)
SessionClient connection (Tree Connection)
Node(nt:file+nt:resource)File
Node(other than nt:file)Folder

List of features

  • 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
Deployment modes

  • Standalone
  • Embedded into the J2EE Application Server
Supported dialects:

  • PC NETWORK PROGRAM 1.0
  • MICROSOFT NETWORKS 1.03
  • MICROSOFT NETWORKS 3.0
  • LANMAN1.0
  • LM1.2X002
  • LANMAN2.1
  • NT LM 0.12
Transport layers

NetBIOS - the JNI implementation for Windows systems, and original Java for Unix, MacOS and other.

Operation Systems

Having been tested using Windows and Linux systems

4 Configuration

The Server runs as a component of eXoContainer, so is configured in the same configuration file. In our case it's /src/main/java/conf/standalone/cifs-configuration.xml for the standalone mode or configure /src/main/java/conf/portal/configuration.xml for portal mode.

<component>
     <key>org.exoplatform.services.cifs.CIFSService</key>
     <type>org.exoplatform.services.cifs.CIFSServiceImpl</type>
	<init-params>
        ...
        </init-params>
</component>

Configuration parameters:

  • 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>

*To enable the server

<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>
If not specified, value "255.255.255.0" is assigned.

  • host_name:
<value-param>
	<name>host_name</name>
	<value>SMBServer</value>
</value-param>

Specifies the server name. It's used for the default server name and may be overloaded with the following configuration.

  • workgroup
<value-param>
	<name>workgroup</name>
	<value>office</value>
</value-param>

Value of the workgroup(domain) name, if not specified, the current workgroup name is used.

  • comment
<value-param>
	<name>comment</name>
	<value>This server is a specific SMB server which works with the JCR
		repository.</value>
</value-param>

Comment for the server.

  • 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>

Enables NetBIOS over TCP/IP transport layer which is implemented using Java.

Values of session and other ports are standard, and already may be used by another cifs server (like samba). So check the assigned values of the ports. If the ports are occupied or the server has no right to use the reserved ports, the bibd exception is thrown.

Host announcer properties are useless. This feature is reserved for future implementation.

  • 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>

Enables NetBIOS - implementation using Win32NetBIOS.dll .

"nativeapi" - specifies the native api for NetBIOS implemented with JNI, may be netbios or winsock (winsock is not tested). If winNetBIOS is not enabled, or the system is not Windows, this parameter has no sense.

"netbiosname" - the netbios name of the server, the server will be shown in Windows Network Neighbourhood having this name.

NOTE

Check that server name ("netbiosname" or "server_name" )is unique in network neighbourhood, otherwise it may cause problems.

LIMITATION There is limit of the file size to be written (700 Mb), it depends on server (hard) and net performance.

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, like
Servername.

>>\\<your server name>

In the same way you can get any available resource on the server

>>\\<your server name> \ <device\service name> \ <file or folder>

*Accessing the server from Windows

If a server has a registered NetBIOS name, look for the network neigbourhood, or type in Exporer

>>\\<your server name>

If the server doesn't have a registered name, type in console:

>>net use <free device name>: \\<server IP> \ <share name>
(for more information, look "net help")

*Accessing the server from Linux

Use smbclient

>>smbclient -I <server ip> -P <port> //<server share>
the port may be not standard (139 - netbios session port, on default).

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.
Tags:
Created by Sergey Karpenko on 06/12/2007
Last modified by Nicolas Filotto on 09/03/2009

Products

generated on Thu Sep 02 15:42:46 UTC 2010

eXo Optional Modules

eXo Core Foundations


Copyright (c) 2000-2010. All Rights Reserved - eXo platform SAS
2.4.30451