Skip to content

Commit 06626f7

Browse files
committed
Some more javadoc warning fixes
1 parent 3e86e80 commit 06626f7

File tree

4 files changed

+265
-47
lines changed

4 files changed

+265
-47
lines changed

core/src/main/java/org/apache/ftpserver/impl/FtpIoSession.java

Lines changed: 148 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,10 @@ public WriteFuture write(Object message, SocketAddress destination) {
570570
}
571571

572572
/* End wrapped IoSession methods */
573+
/**
574+
* Reset the session state. It will remove the 'rename-from' and 'file-offset'
575+
* attributes from the session
576+
*/
573577
public void resetState() {
574578
removeAttribute(ATTRIBUTE_RENAME_FROM);
575579
removeAttribute(ATTRIBUTE_FILE_OFFSET);
@@ -588,10 +592,20 @@ public synchronized ServerDataConnectionFactory getDataConnection() {
588592
}
589593
}
590594

595+
/**
596+
* Get the 'file-system' attribute
597+
*
598+
* @return The 'file-system' attribute value
599+
*/
591600
public FileSystemView getFileSystemView() {
592601
return (FileSystemView) getAttribute(ATTRIBUTE_FILE_SYSTEM);
593602
}
594603

604+
/**
605+
* Get the 'user' attribute
606+
*
607+
* @return The 'user' attribute value
608+
*/
595609
public User getUser() {
596610
return (User) getAttribute(ATTRIBUTE_USER);
597611
}
@@ -605,45 +619,95 @@ public boolean isLoggedIn() {
605619
return containsAttribute(ATTRIBUTE_USER);
606620
}
607621

622+
/**
623+
* Get the session listener
624+
*
625+
* @return The session listener
626+
*/
608627
public Listener getListener() {
609628
return (Listener) getAttribute(ATTRIBUTE_LISTENER);
610629
}
611630

631+
/**
632+
* Set the listener attribute
633+
*
634+
* @param listener The listener to set
635+
*/
612636
public void setListener(Listener listener) {
613637
setAttribute(ATTRIBUTE_LISTENER, listener);
614638
}
615639

640+
/**
641+
* Get a Ftp session
642+
*
643+
* @return a new Ftp session instance
644+
*/
616645
public FtpSession getFtpletSession() {
617646
return new DefaultFtpSession(this);
618647
}
619648

649+
/**
650+
* Get the session's language
651+
*-
652+
* @return The session language
653+
*/
620654
public String getLanguage() {
621655
return (String) getAttribute(ATTRIBUTE_LANGUAGE);
622656
}
623657

658+
/**
659+
* Set the session language
660+
*
661+
* @param language The language to set
662+
*/
624663
public void setLanguage(String language) {
625664
setAttribute(ATTRIBUTE_LANGUAGE, language);
626665

627666
}
628667

629-
public String getUserArgument() {
630-
return (String) getAttribute(ATTRIBUTE_USER_ARGUMENT);
631-
}
632-
668+
/**
669+
* Set the 'user' attribute
670+
*
671+
* @param user The user for this session
672+
*/
633673
public void setUser(User user) {
634674
setAttribute(ATTRIBUTE_USER, user);
635675

636676
}
637677

678+
/**
679+
* Get the user argument
680+
*
681+
* @return The user argument to set
682+
*/
683+
public String getUserArgument() {
684+
return (String) getAttribute(ATTRIBUTE_USER_ARGUMENT);
685+
}
686+
687+
/**
688+
* Set the user argument
689+
*
690+
* @param userArgument The user argument to set
691+
*/
638692
public void setUserArgument(String userArgument) {
639693
setAttribute(ATTRIBUTE_USER_ARGUMENT, userArgument);
640694

641695
}
642696

697+
/**
698+
* Get the max idle time
699+
*
700+
* @return The configured max idle time
701+
*/
643702
public int getMaxIdleTime() {
644703
return (Integer) getAttribute(ATTRIBUTE_MAX_IDLE_TIME, 0);
645704
}
646705

706+
/**
707+
* Set the max idle time for a session
708+
*
709+
* @param maxIdleTime Maximum time a session can idle
710+
*/
647711
public void setMaxIdleTime(int maxIdleTime) {
648712
setAttribute(ATTRIBUTE_MAX_IDLE_TIME, maxIdleTime);
649713

@@ -659,21 +723,40 @@ public void setMaxIdleTime(int maxIdleTime) {
659723
}
660724
}
661725

726+
/**
727+
* Increment the number of failed logins
728+
*/
662729
public synchronized void increaseFailedLogins() {
663730
int failedLogins = (Integer) getAttribute(ATTRIBUTE_FAILED_LOGINS, 0);
664731
failedLogins++;
665732
setAttribute(ATTRIBUTE_FAILED_LOGINS, failedLogins);
666733
}
667734

735+
/**
736+
* Get the 'failed-logins' attribute. It contains the number
737+
* of failed logins during this session
738+
*
739+
* @return The number of failed logins
740+
*/
668741
public int getFailedLogins() {
669742
return (Integer) getAttribute(ATTRIBUTE_FAILED_LOGINS, 0);
670743
}
671744

745+
/**
746+
* Set the login attributes: 'login-time' and 'file-system'
747+
*
748+
* @param fsview The file system view
749+
*/
672750
public void setLogin(FileSystemView fsview) {
673751
setAttribute(ATTRIBUTE_LOGIN_TIME, new Date());
674752
setAttribute(ATTRIBUTE_FILE_SYSTEM, fsview);
675753
}
676754

755+
/**
756+
* Reinitialize the session. It will disconnect the user,
757+
* and clear the 'user', 'user-argument', 'login-time', 'file-system',
758+
* 'rename-from' and 'file-offset' session attributes
759+
*/
677760
public void reinitialize() {
678761
logoutUser();
679762
removeAttribute(ATTRIBUTE_USER);
@@ -684,6 +767,9 @@ public void reinitialize() {
684767
removeAttribute(ATTRIBUTE_FILE_OFFSET);
685768
}
686769

770+
/**
771+
* Logout the connected user
772+
*/
687773
public void logoutUser() {
688774
ServerFtpStatistics stats = ((ServerFtpStatistics) context.getFtpStatistics());
689775
if (stats != null) {
@@ -695,63 +781,96 @@ public void logoutUser() {
695781
}
696782
}
697783

784+
/**
785+
* Get the 'file-offset' attribute value. Default to 0 if none is set
786+
*
787+
* @return The 'file-offset' attribute value
788+
*/
789+
public long getFileOffset() {
790+
return (Long) getAttribute(ATTRIBUTE_FILE_OFFSET, 0L);
791+
}
792+
793+
/**
794+
* Set the 'file-offset' attribute value.
795+
*
796+
* @param fileOffset The 'file-offset' attribute value
797+
*/
698798
public void setFileOffset(long fileOffset) {
699799
setAttribute(ATTRIBUTE_FILE_OFFSET, fileOffset);
700800

701801
}
702802

803+
/**
804+
* Get the 'rename-from' attribute
805+
*
806+
* @return The 'rename-from' attribute value
807+
*/
808+
public FtpFile getRenameFrom() {
809+
return (FtpFile) getAttribute(ATTRIBUTE_RENAME_FROM);
810+
}
811+
812+
/**
813+
* Set the 'rename-from' attribute
814+
*
815+
* @param renFr The 'rename-from' attribute value
816+
*/
703817
public void setRenameFrom(FtpFile renFr) {
704818
setAttribute(ATTRIBUTE_RENAME_FROM, renFr);
705819

706820
}
707821

708-
public FtpFile getRenameFrom() {
709-
return (FtpFile) getAttribute(ATTRIBUTE_RENAME_FROM);
710-
}
711-
712-
public long getFileOffset() {
713-
return (Long) getAttribute(ATTRIBUTE_FILE_OFFSET, 0L);
822+
/**
823+
* Get the structure attribute. We support only <code>FILE</code>
824+
*
825+
* @return The structure attribute
826+
*/
827+
public Structure getStructure() {
828+
return (Structure) getAttribute(ATTRIBUTE_STRUCTURE, Structure.FILE);
714829
}
715830

831+
/**
832+
* Set the transfert structure
833+
*
834+
* @param structure The structure (only FILE is currently supported)
835+
*/
716836
public void setStructure(Structure structure) {
717837
setAttribute(ATTRIBUTE_STRUCTURE, structure);
718838
}
719839

840+
/**
841+
* Get the data type (ascii or binary)
842+
*
843+
* @return The data type
844+
*/
845+
public DataType getDataType() {
846+
return (DataType) getAttribute(ATTRIBUTE_DATA_TYPE, DataType.ASCII);
847+
}
848+
849+
/**
850+
* Set the data type
851+
*
852+
* @param dataType The data type to use (ASCII or BINARY)
853+
*/
720854
public void setDataType(DataType dataType) {
721855
setAttribute(ATTRIBUTE_DATA_TYPE, dataType);
722856

723857
}
724858

725859
/**
726-
* {@inheritDoc}
860+
* Get the 'session-id' attribute. If none is set, and RandomUUID is created.
861+
*
862+
* @return The 'session-id' attribute value
727863
*/
728864
public UUID getSessionId() {
729865
synchronized (wrappedSession) {
730866
if (!wrappedSession.containsAttribute(ATTRIBUTE_SESSION_ID)) {
731867
wrappedSession.setAttribute(ATTRIBUTE_SESSION_ID, UUID.randomUUID());
732868
}
869+
733870
return (UUID) wrappedSession.getAttribute(ATTRIBUTE_SESSION_ID);
734871
}
735872
}
736873

737-
/**
738-
* Get the structure attribute. We support only <code>FILE</code>
739-
*
740-
* @return The structure attribute
741-
*/
742-
public Structure getStructure() {
743-
return (Structure) getAttribute(ATTRIBUTE_STRUCTURE, Structure.FILE);
744-
}
745-
746-
/**
747-
* Get the data type (ascii or binary)
748-
*
749-
* @return The data type
750-
*/
751-
public DataType getDataType() {
752-
return (DataType) getAttribute(ATTRIBUTE_DATA_TYPE, DataType.ASCII);
753-
}
754-
755874
/**
756875
* Get the login time
757876
*

0 commit comments

Comments
 (0)