Modified: incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/PollService.java URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/PollService.java?rev=1235400&r1=1235399&r2=1235400&view=diff ============================================================================== --- incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/PollService.java (original) +++ incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/PollService.java Tue Jan 24 18:30:48 2012 @@ -1,3 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.openmeetings.app.remote; import java.util.Collection;
Modified: incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/PrintService.java URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/PrintService.java?rev=1235400&r1=1235399&r2=1235400&view=diff ============================================================================== --- incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/PrintService.java (original) +++ incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/PrintService.java Tue Jan 24 18:30:48 2012 @@ -1,3 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.openmeetings.app.remote; import java.util.Date; Modified: incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/StreamService.java URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/StreamService.java?rev=1235400&r1=1235399&r2=1235400&view=diff ============================================================================== --- incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/StreamService.java (original) +++ incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/StreamService.java Tue Jan 24 18:30:48 2012 @@ -1,3 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.openmeetings.app.remote; import java.util.Collection; Modified: incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/TermineService.java URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/TermineService.java?rev=1235400&r1=1235399&r2=1235400&view=diff ============================================================================== --- incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/TermineService.java (original) +++ incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/TermineService.java Tue Jan 24 18:30:48 2012 @@ -1,3 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.openmeetings.app.remote; Modified: incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/UserService.java URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/UserService.java?rev=1235400&r1=1235399&r2=1235400&view=diff ============================================================================== --- incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/UserService.java (original) +++ incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/UserService.java Tue Jan 24 18:30:48 2012 @@ -1,3 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.openmeetings.app.remote; import java.util.ArrayList; Modified: incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/WhiteBoardService.java URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/WhiteBoardService.java?rev=1235400&r1=1235399&r2=1235400&view=diff ============================================================================== --- incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/WhiteBoardService.java (original) +++ incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/WhiteBoardService.java Tue Jan 24 18:30:48 2012 @@ -1,3 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.openmeetings.app.remote; import java.io.File; Modified: incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/red5/ClientListManager.java URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/red5/ClientListManager.java?rev=1235400&r1=1235399&r2=1235400&view=diff ============================================================================== --- incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/red5/ClientListManager.java (original) +++ incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/red5/ClientListManager.java Tue Jan 24 18:30:48 2012 @@ -1,3 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.openmeetings.app.remote.red5; import java.util.Collection; Modified: incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/red5/EmoticonsManager.java URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/red5/EmoticonsManager.java?rev=1235400&r1=1235399&r2=1235400&view=diff ============================================================================== --- incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/red5/EmoticonsManager.java (original) +++ incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/red5/EmoticonsManager.java Tue Jan 24 18:30:48 2012 @@ -1,3 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.openmeetings.app.remote.red5; import java.io.BufferedReader; Modified: incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/red5/ScopeApplicationAdapter.java URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/red5/ScopeApplicationAdapter.java?rev=1235400&r1=1235399&r2=1235400&view=diff ============================================================================== --- incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/red5/ScopeApplicationAdapter.java (original) +++ incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/red5/ScopeApplicationAdapter.java Tue Jan 24 18:30:48 2012 @@ -1,3 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.openmeetings.app.remote.red5; import java.io.File; Modified: incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/red5/WhiteBoardObjectListManager.java URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/red5/WhiteBoardObjectListManager.java?rev=1235400&r1=1235399&r2=1235400&view=diff ============================================================================== --- incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/red5/WhiteBoardObjectListManager.java (original) +++ incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/red5/WhiteBoardObjectListManager.java Tue Jan 24 18:30:48 2012 @@ -1,3 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.openmeetings.app.remote.red5; import java.util.HashMap; Modified: incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/red5/WhiteBoardObjectListManagerById.java URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/red5/WhiteBoardObjectListManagerById.java?rev=1235400&r1=1235399&r2=1235400&view=diff ============================================================================== --- incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/red5/WhiteBoardObjectListManagerById.java (original) +++ incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/remote/red5/WhiteBoardObjectListManagerById.java Tue Jan 24 18:30:48 2012 @@ -1,154 +1,172 @@ -package org.openmeetings.app.remote.red5; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.slf4j.Logger; -import org.red5.logging.Red5LoggerFactory; -import org.openmeetings.app.conference.whiteboard.WhiteboardObject; -import org.openmeetings.app.conference.whiteboard.WhiteboardObjectList; -import org.openmeetings.app.conference.whiteboard.WhiteboardSyncLockObject; - -public class WhiteBoardObjectListManagerById { - - private static HashMap<Long,WhiteboardObjectList> whiteBoardObjectList = new HashMap<Long,WhiteboardObjectList>(); - - private static Long whiteboardId = 0L; - -// private static HashMap<Long,Map<String,WhiteboardSyncLockObject>> whiteBoardSyncList = new HashMap<Long,Map<String,WhiteboardSyncLockObject>>(); -// -// private static HashMap<Long,Map<String,Map<String,WhiteboardSyncLockObject>>> whiteBoardObjectSyncList = new HashMap<Long,Map<String,Map<String,WhiteboardSyncLockObject>>>(); - - private static final Logger log = Red5LoggerFactory.getLogger(WhiteBoardObjectListManagerById.class, "openmeetings"); - - private static WhiteBoardObjectListManagerById instance = null; - - private WhiteBoardObjectListManagerById() { - } - - public static synchronized WhiteBoardObjectListManagerById getInstance() { - if (instance == null) { - instance = new WhiteBoardObjectListManagerById(); - } - return instance; - } - - public Long getNewWhiteboardId(Long room_id) throws Exception { - whiteboardId++; - - this.setWhiteBoardObjectListRoomObjAndWhiteboardId(room_id, new WhiteboardObject(), whiteboardId); - - return whiteboardId; - } - - /* - * Room items a Whiteboard - */ - public synchronized WhiteboardObjectList getWhiteBoardObjectListByRoomId(Long room_id){ - WhiteboardObjectList whiteboardObjectList = whiteBoardObjectList.get(room_id); - if (whiteboardObjectList == null) { - whiteboardObjectList = new WhiteboardObjectList(); - } - return whiteboardObjectList; - } - - public synchronized WhiteboardObject getWhiteBoardObjectListByRoomIdAndWhiteboard(Long room_id, Long whiteBoardId){ - WhiteboardObjectList whiteboardObjectList = whiteBoardObjectList.get(room_id); - if (whiteboardObjectList == null) { - whiteboardObjectList = new WhiteboardObjectList(); - } - WhiteboardObject whiteboardObjects = whiteboardObjectList.getWhiteboardObjects().get(whiteBoardId); - if (whiteboardObjects == null) { - whiteboardObjects = new WhiteboardObject(); - } - return whiteboardObjects; - } - -// /* -// * Initial Sync Process -// */ -// public synchronized void setWhiteBoardSyncListByRoomid(Long room_id, Map<String,WhiteboardSyncLockObject> mapObject ){ -// whiteBoardSyncList.put(room_id, mapObject); -// } -// public synchronized Map<String,WhiteboardSyncLockObject> getWhiteBoardSyncListByRoomid(Long room_id){ -// Map<String,WhiteboardSyncLockObject> roomList = whiteBoardSyncList.get(room_id); -// if (roomList == null) { -// roomList = new HashMap<String,WhiteboardSyncLockObject>(); -// } -// return roomList; -// } -// -// /* -// * Image Sync Process -// */ -// public synchronized void setWhiteBoardImagesSyncListByRoomid(Long room_id, Map<String,Map<String,WhiteboardSyncLockObject>> mapObject ){ -// whiteBoardObjectSyncList.put(room_id, mapObject); -// } -// public synchronized void setWhiteBoardImagesSyncListByRoomAndObjectId(Long room_id, -// String object_id,Map<String,WhiteboardSyncLockObject> imageSyncList){ -// Map<String,Map<String,WhiteboardSyncLockObject>> roomList = whiteBoardObjectSyncList.get(room_id); -// if (roomList == null) { -// roomList = new HashMap<String,Map<String,WhiteboardSyncLockObject>>(); -// } -// if (imageSyncList.size() == 0) { -// roomList.remove(object_id); -// } else { -// roomList.put(object_id, imageSyncList); -// } -// setWhiteBoardImagesSyncListByRoomid(room_id,roomList); -// } -// public synchronized Map<String,Map<String,WhiteboardSyncLockObject>> getWhiteBoardObjectSyncListByRoomid(Long room_id){ -// Map<String,Map<String,WhiteboardSyncLockObject>> roomList = whiteBoardObjectSyncList.get(room_id); -// if (roomList == null) { -// roomList = new HashMap<String,Map<String,WhiteboardSyncLockObject>>(); -// } -// return roomList; -// } -// public synchronized Map<String,WhiteboardSyncLockObject> getWhiteBoardObjectSyncListByRoomAndObjectId(Long room_id, -// String object_id){ -// log.debug("getWhiteBoardImagesSyncListByRoomAndImageid room_id: "+room_id); -// Map<String,Map<String,WhiteboardSyncLockObject>> roomList = whiteBoardObjectSyncList.get(room_id); -// if (roomList == null) { -// roomList = new HashMap<String,Map<String,WhiteboardSyncLockObject>>(); -// } -// log.debug("getWhiteBoardImagesSyncListByRoomAndImageid roomList: "+roomList); -// log.debug("getWhiteBoardImagesSyncListByRoomAndImageid object_id: "+object_id); -// if (roomList.size() == 1) { -// log.debug("getWhiteBoardImagesSyncListByRoomAndImageid roomList Key image_id: "+roomList.keySet().iterator().next()); -// } -// Map<String,WhiteboardSyncLockObject> imageSyncList = roomList.get(object_id); -// if (imageSyncList == null) { -// imageSyncList = new HashMap<String,WhiteboardSyncLockObject>(); -// } -// return imageSyncList; -// } - - /* - * Whiteboard Object List - * - */ - -// public synchronized HashMap<Long,HashMap<String,List>> getWhiteBoardObjectList(){ -// return whiteBoardObjectList; -// } -// -// public synchronized void setWhiteBoardObjectList(HashMap<Long,HashMap<String,List>> whiteBoardObjectListNew){ -// whiteBoardObjectList = whiteBoardObjectListNew; -// } -// - public synchronized void setWhiteBoardObjectListRoomObj(Long room_id, WhiteboardObjectList whiteboardObjectList){ - whiteBoardObjectList.put(room_id, whiteboardObjectList); - } - - public synchronized void setWhiteBoardObjectListRoomObjAndWhiteboardId(Long room_id, WhiteboardObject whiteboardObjects, Long whiteBoardId){ - WhiteboardObjectList whiteboardObjectList = whiteBoardObjectList.get(room_id); - if (whiteboardObjectList == null) { - whiteboardObjectList = new WhiteboardObjectList(); - whiteboardObjectList.setRoom_id(room_id); - } - whiteboardObjects.setWhiteBoardId(whiteBoardId); - whiteboardObjectList.getWhiteboardObjects().put(whiteBoardId, whiteboardObjects); - whiteBoardObjectList.put(room_id, whiteboardObjectList); - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.openmeetings.app.remote.red5; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.slf4j.Logger; +import org.red5.logging.Red5LoggerFactory; +import org.openmeetings.app.conference.whiteboard.WhiteboardObject; +import org.openmeetings.app.conference.whiteboard.WhiteboardObjectList; +import org.openmeetings.app.conference.whiteboard.WhiteboardSyncLockObject; + +public class WhiteBoardObjectListManagerById { + + private static HashMap<Long,WhiteboardObjectList> whiteBoardObjectList = new HashMap<Long,WhiteboardObjectList>(); + + private static Long whiteboardId = 0L; + +// private static HashMap<Long,Map<String,WhiteboardSyncLockObject>> whiteBoardSyncList = new HashMap<Long,Map<String,WhiteboardSyncLockObject>>(); +// +// private static HashMap<Long,Map<String,Map<String,WhiteboardSyncLockObject>>> whiteBoardObjectSyncList = new HashMap<Long,Map<String,Map<String,WhiteboardSyncLockObject>>>(); + + private static final Logger log = Red5LoggerFactory.getLogger(WhiteBoardObjectListManagerById.class, "openmeetings"); + + private static WhiteBoardObjectListManagerById instance = null; + + private WhiteBoardObjectListManagerById() { + } + + public static synchronized WhiteBoardObjectListManagerById getInstance() { + if (instance == null) { + instance = new WhiteBoardObjectListManagerById(); + } + return instance; + } + + public Long getNewWhiteboardId(Long room_id) throws Exception { + whiteboardId++; + + this.setWhiteBoardObjectListRoomObjAndWhiteboardId(room_id, new WhiteboardObject(), whiteboardId); + + return whiteboardId; + } + + /* + * Room items a Whiteboard + */ + public synchronized WhiteboardObjectList getWhiteBoardObjectListByRoomId(Long room_id){ + WhiteboardObjectList whiteboardObjectList = whiteBoardObjectList.get(room_id); + if (whiteboardObjectList == null) { + whiteboardObjectList = new WhiteboardObjectList(); + } + return whiteboardObjectList; + } + + public synchronized WhiteboardObject getWhiteBoardObjectListByRoomIdAndWhiteboard(Long room_id, Long whiteBoardId){ + WhiteboardObjectList whiteboardObjectList = whiteBoardObjectList.get(room_id); + if (whiteboardObjectList == null) { + whiteboardObjectList = new WhiteboardObjectList(); + } + WhiteboardObject whiteboardObjects = whiteboardObjectList.getWhiteboardObjects().get(whiteBoardId); + if (whiteboardObjects == null) { + whiteboardObjects = new WhiteboardObject(); + } + return whiteboardObjects; + } + +// /* +// * Initial Sync Process +// */ +// public synchronized void setWhiteBoardSyncListByRoomid(Long room_id, Map<String,WhiteboardSyncLockObject> mapObject ){ +// whiteBoardSyncList.put(room_id, mapObject); +// } +// public synchronized Map<String,WhiteboardSyncLockObject> getWhiteBoardSyncListByRoomid(Long room_id){ +// Map<String,WhiteboardSyncLockObject> roomList = whiteBoardSyncList.get(room_id); +// if (roomList == null) { +// roomList = new HashMap<String,WhiteboardSyncLockObject>(); +// } +// return roomList; +// } +// +// /* +// * Image Sync Process +// */ +// public synchronized void setWhiteBoardImagesSyncListByRoomid(Long room_id, Map<String,Map<String,WhiteboardSyncLockObject>> mapObject ){ +// whiteBoardObjectSyncList.put(room_id, mapObject); +// } +// public synchronized void setWhiteBoardImagesSyncListByRoomAndObjectId(Long room_id, +// String object_id,Map<String,WhiteboardSyncLockObject> imageSyncList){ +// Map<String,Map<String,WhiteboardSyncLockObject>> roomList = whiteBoardObjectSyncList.get(room_id); +// if (roomList == null) { +// roomList = new HashMap<String,Map<String,WhiteboardSyncLockObject>>(); +// } +// if (imageSyncList.size() == 0) { +// roomList.remove(object_id); +// } else { +// roomList.put(object_id, imageSyncList); +// } +// setWhiteBoardImagesSyncListByRoomid(room_id,roomList); +// } +// public synchronized Map<String,Map<String,WhiteboardSyncLockObject>> getWhiteBoardObjectSyncListByRoomid(Long room_id){ +// Map<String,Map<String,WhiteboardSyncLockObject>> roomList = whiteBoardObjectSyncList.get(room_id); +// if (roomList == null) { +// roomList = new HashMap<String,Map<String,WhiteboardSyncLockObject>>(); +// } +// return roomList; +// } +// public synchronized Map<String,WhiteboardSyncLockObject> getWhiteBoardObjectSyncListByRoomAndObjectId(Long room_id, +// String object_id){ +// log.debug("getWhiteBoardImagesSyncListByRoomAndImageid room_id: "+room_id); +// Map<String,Map<String,WhiteboardSyncLockObject>> roomList = whiteBoardObjectSyncList.get(room_id); +// if (roomList == null) { +// roomList = new HashMap<String,Map<String,WhiteboardSyncLockObject>>(); +// } +// log.debug("getWhiteBoardImagesSyncListByRoomAndImageid roomList: "+roomList); +// log.debug("getWhiteBoardImagesSyncListByRoomAndImageid object_id: "+object_id); +// if (roomList.size() == 1) { +// log.debug("getWhiteBoardImagesSyncListByRoomAndImageid roomList Key image_id: "+roomList.keySet().iterator().next()); +// } +// Map<String,WhiteboardSyncLockObject> imageSyncList = roomList.get(object_id); +// if (imageSyncList == null) { +// imageSyncList = new HashMap<String,WhiteboardSyncLockObject>(); +// } +// return imageSyncList; +// } + + /* + * Whiteboard Object List + * + */ + +// public synchronized HashMap<Long,HashMap<String,List>> getWhiteBoardObjectList(){ +// return whiteBoardObjectList; +// } +// +// public synchronized void setWhiteBoardObjectList(HashMap<Long,HashMap<String,List>> whiteBoardObjectListNew){ +// whiteBoardObjectList = whiteBoardObjectListNew; +// } +// + public synchronized void setWhiteBoardObjectListRoomObj(Long room_id, WhiteboardObjectList whiteboardObjectList){ + whiteBoardObjectList.put(room_id, whiteboardObjectList); + } + + public synchronized void setWhiteBoardObjectListRoomObjAndWhiteboardId(Long room_id, WhiteboardObject whiteboardObjects, Long whiteBoardId){ + WhiteboardObjectList whiteboardObjectList = whiteBoardObjectList.get(room_id); + if (whiteboardObjectList == null) { + whiteboardObjectList = new WhiteboardObjectList(); + whiteboardObjectList.setRoom_id(room_id); + } + whiteboardObjects.setWhiteBoardId(whiteBoardId); + whiteboardObjectList.getWhiteboardObjects().put(whiteBoardId, whiteboardObjects); + whiteBoardObjectList.put(room_id, whiteboardObjectList); + } +} Modified: incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/rss/LoadAtomRssFeed.java URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/rss/LoadAtomRssFeed.java?rev=1235400&r1=1235399&r2=1235400&view=diff ============================================================================== --- incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/rss/LoadAtomRssFeed.java (original) +++ incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/rss/LoadAtomRssFeed.java Tue Jan 24 18:30:48 2012 @@ -1,3 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.openmeetings.app.rss; import java.net.HttpURLConnection; Modified: incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/rtp/RTPScreenSharingSession.java URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/rtp/RTPScreenSharingSession.java?rev=1235400&r1=1235399&r2=1235400&view=diff ============================================================================== --- incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/rtp/RTPScreenSharingSession.java (original) +++ incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/rtp/RTPScreenSharingSession.java Tue Jan 24 18:30:48 2012 @@ -1,3 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.openmeetings.app.rtp; import java.util.HashMap; Modified: incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/rtp/RTPStreamReceiver.java URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/rtp/RTPStreamReceiver.java?rev=1235400&r1=1235399&r2=1235400&view=diff ============================================================================== --- incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/rtp/RTPStreamReceiver.java (original) +++ incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/rtp/RTPStreamReceiver.java Tue Jan 24 18:30:48 2012 @@ -1,3 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.openmeetings.app.rtp; import java.net.InetAddress; Modified: incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/rtp/RTPStreamingHandler.java URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/rtp/RTPStreamingHandler.java?rev=1235400&r1=1235399&r2=1235400&view=diff ============================================================================== --- incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/rtp/RTPStreamingHandler.java (original) +++ incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/rtp/RTPStreamingHandler.java Tue Jan 24 18:30:48 2012 @@ -1,3 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.openmeetings.app.rtp; import java.util.HashMap; Modified: incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/sip/xmlrpc/EasySSLProtocolSocketFactory.java URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/sip/xmlrpc/EasySSLProtocolSocketFactory.java?rev=1235400&r1=1235399&r2=1235400&view=diff ============================================================================== --- incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/sip/xmlrpc/EasySSLProtocolSocketFactory.java (original) +++ incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/sip/xmlrpc/EasySSLProtocolSocketFactory.java Tue Jan 24 18:30:48 2012 @@ -1,195 +1,213 @@ -package org.openmeetings.app.sip.xmlrpc; - -import java.io.IOException; -import java.net.InetAddress; -import java.net.Socket; -import java.net.UnknownHostException; - -import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManager; - -import org.apache.commons.httpclient.ConnectTimeoutException; -import org.apache.commons.httpclient.HttpClientError; -import org.apache.commons.httpclient.params.HttpConnectionParams; -import org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory; -import org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * <p> - * EasySSLProtocolSocketFactory can be used to creats SSL {@link Socket}s - * that accept self-signed certificates. - * </p> - * <p> - * This socket factory SHOULD NOT be used for productive systems - * due to security reasons, unless it is a concious decision and - * you are perfectly aware of security implications of accepting - * self-signed certificates - * </p> - * - * <p> - * Example of using custom protocol socket factory for a specific host: - * <pre> - * Protocol easyhttps = new Protocol("https", new EasySSLProtocolSocketFactory(), 443); - * - * HttpClient client = new HttpClient(); - * client.getHostConfiguration().setHost("localhost", 443, easyhttps); - * // use relative url only - * GetMethod httpget = new GetMethod("/"); - * client.executeMethod(httpget); - * </pre> - * </p> - * <p> - * Example of using custom protocol socket factory per default instead of the standard one: - * <pre> - * Protocol easyhttps = new Protocol("https", new EasySSLProtocolSocketFactory(), 443); - * Protocol.registerProtocol("https", easyhttps); - * - * HttpClient client = new HttpClient(); - * GetMethod httpget = new GetMethod("https://localhost/"); - * client.executeMethod(httpget); - * </pre> - * </p> - * - * @author <a href="mailto:oleg -at- ural.ru">Oleg Kalnichevski</a> - * - * <p> - * DISCLAIMER: HttpClient developers DO NOT actively support this component. - * The component is provided as a reference material, which may be inappropriate - * for use without additional customization. - * </p> - */ - -public class EasySSLProtocolSocketFactory implements SecureProtocolSocketFactory { - - /** Log object for this class. */ - private static final Log LOG = LogFactory.getLog(EasySSLProtocolSocketFactory.class); - - private SSLContext sslcontext = null; - - /** - * Constructor for EasySSLProtocolSocketFactory. - */ - public EasySSLProtocolSocketFactory() { - super(); - } - - private static SSLContext createEasySSLContext() { - try { - SSLContext context = SSLContext.getInstance("SSL"); - context.init( - null, - new TrustManager[] {new EasyX509TrustManager(null)}, - null); - return context; - } catch (Exception e) { - LOG.error(e.getMessage(), e); - throw new HttpClientError(e.toString()); - } - } - - private SSLContext getSSLContext() { - if (this.sslcontext == null) { - this.sslcontext = createEasySSLContext(); - } - return this.sslcontext; - } - - /** - * @see SecureProtocolSocketFactory#createSocket(java.lang.String,int,java.net.InetAddress,int) - */ - public Socket createSocket( - String host, - int port, - InetAddress clientHost, - int clientPort) - throws IOException, UnknownHostException { - - return getSSLContext().getSocketFactory().createSocket( - host, - port, - clientHost, - clientPort - ); - } - - /** - * Attempts to get a new socket connection to the given host within the given time limit. - * <p> - * To circumvent the limitations of older JREs that do not support connect timeout a - * controller thread is executed. The controller thread attempts to create a new socket - * within the given limit of time. If socket constructor does not return until the - * timeout expires, the controller terminates and throws an {@link ConnectTimeoutException} - * </p> - * - * @param host the host name/IP - * @param port the port on the host - * @param clientHost the local host name/IP to bind the socket to - * @param clientPort the port on the local machine - * @param params {@link HttpConnectionParams Http connection parameters} - * - * @return Socket a new socket - * - * @throws IOException if an I/O error occurs while creating the socket - * @throws UnknownHostException if the IP address of the host cannot be - * determined - */ - public Socket createSocket( - final String host, - final int port, - final InetAddress localAddress, - final int localPort, - final HttpConnectionParams params - ) throws IOException, UnknownHostException, ConnectTimeoutException { - if (params == null) { - throw new IllegalArgumentException("Parameters may not be null"); - } - int timeout = params.getConnectionTimeout(); - if (timeout == 0) { - return createSocket(host, port, localAddress, localPort); - } else { - // To be eventually deprecated when migrated to Java 1.4 or above - return ControllerThreadSocketFactory.createSocket( - this, host, port, localAddress, localPort, timeout); - } - } - - /** - * @see SecureProtocolSocketFactory#createSocket(java.lang.String,int) - */ - public Socket createSocket(String host, int port) - throws IOException, UnknownHostException { - return getSSLContext().getSocketFactory().createSocket( - host, - port - ); - } - - /** - * @see SecureProtocolSocketFactory#createSocket(java.net.Socket,java.lang.String,int,boolean) - */ - public Socket createSocket( - Socket socket, - String host, - int port, - boolean autoClose) - throws IOException, UnknownHostException { - return getSSLContext().getSocketFactory().createSocket( - socket, - host, - port, - autoClose - ); - } - - public boolean equals(Object obj) { - return ((obj != null) && obj.getClass().equals(EasySSLProtocolSocketFactory.class)); - } - - public int hashCode() { - return EasySSLProtocolSocketFactory.class.hashCode(); - } - -} - +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.openmeetings.app.sip.xmlrpc; + +import java.io.IOException; +import java.net.InetAddress; +import java.net.Socket; +import java.net.UnknownHostException; + +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; + +import org.apache.commons.httpclient.ConnectTimeoutException; +import org.apache.commons.httpclient.HttpClientError; +import org.apache.commons.httpclient.params.HttpConnectionParams; +import org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory; +import org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * <p> + * EasySSLProtocolSocketFactory can be used to creats SSL {@link Socket}s + * that accept self-signed certificates. + * </p> + * <p> + * This socket factory SHOULD NOT be used for productive systems + * due to security reasons, unless it is a concious decision and + * you are perfectly aware of security implications of accepting + * self-signed certificates + * </p> + * + * <p> + * Example of using custom protocol socket factory for a specific host: + * <pre> + * Protocol easyhttps = new Protocol("https", new EasySSLProtocolSocketFactory(), 443); + * + * HttpClient client = new HttpClient(); + * client.getHostConfiguration().setHost("localhost", 443, easyhttps); + * // use relative url only + * GetMethod httpget = new GetMethod("/"); + * client.executeMethod(httpget); + * </pre> + * </p> + * <p> + * Example of using custom protocol socket factory per default instead of the standard one: + * <pre> + * Protocol easyhttps = new Protocol("https", new EasySSLProtocolSocketFactory(), 443); + * Protocol.registerProtocol("https", easyhttps); + * + * HttpClient client = new HttpClient(); + * GetMethod httpget = new GetMethod("https://localhost/"); + * client.executeMethod(httpget); + * </pre> + * </p> + * + * @author <a href="mailto:oleg -at- ural.ru">Oleg Kalnichevski</a> + * + * <p> + * DISCLAIMER: HttpClient developers DO NOT actively support this component. + * The component is provided as a reference material, which may be inappropriate + * for use without additional customization. + * </p> + */ + +public class EasySSLProtocolSocketFactory implements SecureProtocolSocketFactory { + + /** Log object for this class. */ + private static final Log LOG = LogFactory.getLog(EasySSLProtocolSocketFactory.class); + + private SSLContext sslcontext = null; + + /** + * Constructor for EasySSLProtocolSocketFactory. + */ + public EasySSLProtocolSocketFactory() { + super(); + } + + private static SSLContext createEasySSLContext() { + try { + SSLContext context = SSLContext.getInstance("SSL"); + context.init( + null, + new TrustManager[] {new EasyX509TrustManager(null)}, + null); + return context; + } catch (Exception e) { + LOG.error(e.getMessage(), e); + throw new HttpClientError(e.toString()); + } + } + + private SSLContext getSSLContext() { + if (this.sslcontext == null) { + this.sslcontext = createEasySSLContext(); + } + return this.sslcontext; + } + + /** + * @see SecureProtocolSocketFactory#createSocket(java.lang.String,int,java.net.InetAddress,int) + */ + public Socket createSocket( + String host, + int port, + InetAddress clientHost, + int clientPort) + throws IOException, UnknownHostException { + + return getSSLContext().getSocketFactory().createSocket( + host, + port, + clientHost, + clientPort + ); + } + + /** + * Attempts to get a new socket connection to the given host within the given time limit. + * <p> + * To circumvent the limitations of older JREs that do not support connect timeout a + * controller thread is executed. The controller thread attempts to create a new socket + * within the given limit of time. If socket constructor does not return until the + * timeout expires, the controller terminates and throws an {@link ConnectTimeoutException} + * </p> + * + * @param host the host name/IP + * @param port the port on the host + * @param clientHost the local host name/IP to bind the socket to + * @param clientPort the port on the local machine + * @param params {@link HttpConnectionParams Http connection parameters} + * + * @return Socket a new socket + * + * @throws IOException if an I/O error occurs while creating the socket + * @throws UnknownHostException if the IP address of the host cannot be + * determined + */ + public Socket createSocket( + final String host, + final int port, + final InetAddress localAddress, + final int localPort, + final HttpConnectionParams params + ) throws IOException, UnknownHostException, ConnectTimeoutException { + if (params == null) { + throw new IllegalArgumentException("Parameters may not be null"); + } + int timeout = params.getConnectionTimeout(); + if (timeout == 0) { + return createSocket(host, port, localAddress, localPort); + } else { + // To be eventually deprecated when migrated to Java 1.4 or above + return ControllerThreadSocketFactory.createSocket( + this, host, port, localAddress, localPort, timeout); + } + } + + /** + * @see SecureProtocolSocketFactory#createSocket(java.lang.String,int) + */ + public Socket createSocket(String host, int port) + throws IOException, UnknownHostException { + return getSSLContext().getSocketFactory().createSocket( + host, + port + ); + } + + /** + * @see SecureProtocolSocketFactory#createSocket(java.net.Socket,java.lang.String,int,boolean) + */ + public Socket createSocket( + Socket socket, + String host, + int port, + boolean autoClose) + throws IOException, UnknownHostException { + return getSSLContext().getSocketFactory().createSocket( + socket, + host, + port, + autoClose + ); + } + + public boolean equals(Object obj) { + return ((obj != null) && obj.getClass().equals(EasySSLProtocolSocketFactory.class)); + } + + public int hashCode() { + return EasySSLProtocolSocketFactory.class.hashCode(); + } + +} + Modified: incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/sip/xmlrpc/EasyX509TrustManager.java URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/sip/xmlrpc/EasyX509TrustManager.java?rev=1235400&r1=1235399&r2=1235400&view=diff ============================================================================== --- incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/sip/xmlrpc/EasyX509TrustManager.java (original) +++ incubator/openmeetings/trunk/singlewebapp/src/app/org/openmeetings/app/sip/xmlrpc/EasyX509TrustManager.java Tue Jan 24 18:30:48 2012 @@ -1,97 +1,115 @@ -package org.openmeetings.app.sip.xmlrpc; - -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; - -import javax.net.ssl.TrustManagerFactory; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * <p> - * EasyX509TrustManager unlike default {@link X509TrustManager} accepts - * self-signed certificates. - * </p> - * <p> - * This trust manager SHOULD NOT be used for productive systems - * due to security reasons, unless it is a concious decision and - * you are perfectly aware of security implications of accepting - * self-signed certificates - * </p> - * - * @author <a href="mailto:[email protected]">Adrian Sutton</a> - * @author <a href="mailto:[email protected]">Oleg Kalnichevski</a> - * - * <p> - * DISCLAIMER: HttpClient developers DO NOT actively support this component. - * The component is provided as a reference material, which may be inappropriate - * for use without additional customization. - * </p> - */ - -public class EasyX509TrustManager implements X509TrustManager -{ - private X509TrustManager standardTrustManager = null; - - /** Log object for this class. */ - private static final Log LOG = LogFactory.getLog(EasyX509TrustManager.class); - - /** - * Constructor for EasyX509TrustManager. - */ - public EasyX509TrustManager(KeyStore keystore) throws NoSuchAlgorithmException, KeyStoreException { - super(); - TrustManagerFactory factory = TrustManagerFactory.getInstance("SunX509"); - factory.init(keystore); - TrustManager[] trustmanagers = factory.getTrustManagers(); - if (trustmanagers.length == 0) { - throw new NoSuchAlgorithmException("SunX509 trust manager not supported"); - } - this.standardTrustManager = (X509TrustManager)trustmanagers[0]; - } - - /** - * @throws CertificateException - * @see com.sun.net.ssl.X509TrustManager#isClientTrusted(X509Certificate[]) - */ - public void checkClientTrusted(X509Certificate[] certificates, String arg) throws CertificateException { - standardTrustManager.checkClientTrusted(certificates, arg); - } - - /** - * @throws CertificateException - * @see com.sun.net.ssl.X509TrustManager#isServerTrusted(X509Certificate[]) - */ - public void checkServerTrusted(X509Certificate[] certificates, String arg) throws CertificateException { - if ((certificates != null) && LOG.isDebugEnabled()) { - LOG.debug("Server certificate chain:"); - for (int i = 0; i < certificates.length; i++) { - LOG.debug("X509Certificate[" + i + "]=" + certificates[i]); - } - } - if ((certificates != null) && (certificates.length == 1)) { - X509Certificate certificate = certificates[0]; - try { - certificate.checkValidity(); - } - catch (CertificateException e) { - LOG.error(e.toString()); - } - } else { - standardTrustManager.checkServerTrusted(certificates, arg); - } - } - - /** - * @see com.sun.net.ssl.X509TrustManager#getAcceptedIssuers() - */ - public X509Certificate[] getAcceptedIssuers() { - return this.standardTrustManager.getAcceptedIssuers(); - } -} - +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.openmeetings.app.sip.xmlrpc; + +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; + +import javax.net.ssl.TrustManagerFactory; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * <p> + * EasyX509TrustManager unlike default {@link X509TrustManager} accepts + * self-signed certificates. + * </p> + * <p> + * This trust manager SHOULD NOT be used for productive systems + * due to security reasons, unless it is a concious decision and + * you are perfectly aware of security implications of accepting + * self-signed certificates + * </p> + * + * @author <a href="mailto:[email protected]">Adrian Sutton</a> + * @author <a href="mailto:[email protected]">Oleg Kalnichevski</a> + * + * <p> + * DISCLAIMER: HttpClient developers DO NOT actively support this component. + * The component is provided as a reference material, which may be inappropriate + * for use without additional customization. + * </p> + */ + +public class EasyX509TrustManager implements X509TrustManager +{ + private X509TrustManager standardTrustManager = null; + + /** Log object for this class. */ + private static final Log LOG = LogFactory.getLog(EasyX509TrustManager.class); + + /** + * Constructor for EasyX509TrustManager. + */ + public EasyX509TrustManager(KeyStore keystore) throws NoSuchAlgorithmException, KeyStoreException { + super(); + TrustManagerFactory factory = TrustManagerFactory.getInstance("SunX509"); + factory.init(keystore); + TrustManager[] trustmanagers = factory.getTrustManagers(); + if (trustmanagers.length == 0) { + throw new NoSuchAlgorithmException("SunX509 trust manager not supported"); + } + this.standardTrustManager = (X509TrustManager)trustmanagers[0]; + } + + /** + * @throws CertificateException + * @see com.sun.net.ssl.X509TrustManager#isClientTrusted(X509Certificate[]) + */ + public void checkClientTrusted(X509Certificate[] certificates, String arg) throws CertificateException { + standardTrustManager.checkClientTrusted(certificates, arg); + } + + /** + * @throws CertificateException + * @see com.sun.net.ssl.X509TrustManager#isServerTrusted(X509Certificate[]) + */ + public void checkServerTrusted(X509Certificate[] certificates, String arg) throws CertificateException { + if ((certificates != null) && LOG.isDebugEnabled()) { + LOG.debug("Server certificate chain:"); + for (int i = 0; i < certificates.length; i++) { + LOG.debug("X509Certificate[" + i + "]=" + certificates[i]); + } + } + if ((certificates != null) && (certificates.length == 1)) { + X509Certificate certificate = certificates[0]; + try { + certificate.checkValidity(); + } + catch (CertificateException e) { + LOG.error(e.toString()); + } + } else { + standardTrustManager.checkServerTrusted(certificates, arg); + } + } + + /** + * @see com.sun.net.ssl.X509TrustManager#getAcceptedIssuers() + */ + public X509Certificate[] getAcceptedIssuers() { + return this.standardTrustManager.getAcceptedIssuers(); + } +} +
