repo_name
stringlengths
7
104
file_path
stringlengths
13
198
context
stringlengths
67
7.15k
import_statement
stringlengths
16
4.43k
code
stringlengths
40
6.98k
prompt
stringlengths
227
8.27k
next_line
stringlengths
8
795
Slyce-Inc/SlyceMessaging
slyce-messaging/src/test/java/it/slyce/messaging/MessageUtilsTest.java
// Path: slyce-messaging/src/main/java/it/slyce/messaging/message/MediaMessage.java // public class MediaMessage extends Message { // private String url; // // public String getUrl() { // return url; // } // // public void setUrl(String url) { // this.url = url; // } // // @Override // public MessageItem toMessageItem(Context context){ // if (this.source == MessageSource.EXTERNAL_USER) // return new MessageExternalUserMediaItem(this, context); // else // return new MessageInternalUserMediaItem(this, context); // } // } // // Path: slyce-messaging/src/main/java/it/slyce/messaging/message/MessageSource.java // public enum MessageSource { // LOCAL_USER, // EXTERNAL_USER, // GENERAL // } // // Path: slyce-messaging/src/main/java/it/slyce/messaging/message/TextMessage.java // public class TextMessage extends Message { // private String text; // // public String getText() { // return text; // } // // public void setText(String text) { // this.text = text; // } // // @Override // public MessageItem toMessageItem(Context context){ // if (this.source == MessageSource.EXTERNAL_USER) // return new MessageExternalUserTextItem(this, context); // else // return new MessageInternalUserTextItem(this, context); // } // } // // Path: slyce-messaging/src/main/java/it/slyce/messaging/utils/MessageUtils.java // public class MessageUtils { // // public static void markMessageItemAtIndexIfFirstOrLastFromSource(int i, List<MessageItem> messageItems) { // if (i < 0 || i >= messageItems.size()) { // return; // } // // MessageItem messageItem = messageItems.get(i); // messageItem.setIsFirstConsecutiveMessageFromSource(false); // messageItem.setIsLastConsecutiveMessageFromSource(false); // // if (previousMessageIsNotFromSameSource(i, messageItems)) { // messageItem.setIsFirstConsecutiveMessageFromSource(true); // } // // if (isTheLastConsecutiveMessageFromSource(i, messageItems)) { // messageItem.setIsLastConsecutiveMessageFromSource(true); // } // } // // private static boolean previousMessageIsNotFromSameSource(int i, List<MessageItem> messageItems) { // return i == 0 || // previousMessageIsSpinner(i, messageItems) || // previousMessageIsFromAnotherSender(i, messageItems); // } // // private static boolean previousMessageIsFromAnotherSender(int i, List<MessageItem> messageItems) { // return messageItems.get(i - 1).getMessageSource() != messageItems.get(i).getMessageSource(); // } // // private static boolean previousMessageIsSpinner(int i, List<MessageItem> messageItems) { // return isSpinnerMessage(i - 1, messageItems); // } // // private static boolean isTheLastConsecutiveMessageFromSource(int i, List<MessageItem> messageItems) { // if (isSpinnerMessage(i, messageItems)) { // return false; // } // // return i == messageItems.size() - 1 || // nextMessageHasDifferentSource(i, messageItems) || // messageItems.get(i).getMessage() == null || // messageItems.get(i + 1).getMessage() == null || // nextMessageWasAtLeastAnHourAfterThisOne(i, messageItems); // } // // private static boolean nextMessageWasAtLeastAnHourAfterThisOne(int i, List<MessageItem> messageItems) { // return messageItems.get(i + 1).getMessage().getDate() - messageItems.get(i).getMessage().getDate() > 1000 * 60 * 60; // one hour // } // // private static boolean nextMessageHasDifferentSource(int i, List<MessageItem> messageItems) { // return messageItems.get(i).getMessageSource() != messageItems.get(i + 1).getMessageSource(); // } // // private static boolean isSpinnerMessage(int i, List<MessageItem> messageItems) { // return messageItems.get(i).getMessageItemType() == MessageItemType.SPINNER; // } // }
import org.junit.Before; import org.junit.Test; import java.util.ArrayList; import java.util.List; import it.slyce.messaging.message.MediaMessage; import it.slyce.messaging.message.MessageSource; import it.slyce.messaging.message.TextMessage; import it.slyce.messaging.message.messageItem.MessageItem; import it.slyce.messaging.utils.MessageUtils; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue;
package it.slyce.messaging; /** * Created by audrey on 7/14/16. */ public class MessageUtilsTest { List<MessageItem> messageItems; @Before public void before() { messageItems = new ArrayList<>(); // incoming text TextMessage firstIncoming = new TextMessage(); firstIncoming.setSource(MessageSource.EXTERNAL_USER); firstIncoming.setText("hi"); messageItems.add(firstIncoming.toMessageItem(null)); // incoming text TextMessage secondIncoming = new TextMessage(); secondIncoming.setSource(MessageSource.EXTERNAL_USER); secondIncoming.setText("second message"); messageItems.add(secondIncoming.toMessageItem(null)); // incoming image
// Path: slyce-messaging/src/main/java/it/slyce/messaging/message/MediaMessage.java // public class MediaMessage extends Message { // private String url; // // public String getUrl() { // return url; // } // // public void setUrl(String url) { // this.url = url; // } // // @Override // public MessageItem toMessageItem(Context context){ // if (this.source == MessageSource.EXTERNAL_USER) // return new MessageExternalUserMediaItem(this, context); // else // return new MessageInternalUserMediaItem(this, context); // } // } // // Path: slyce-messaging/src/main/java/it/slyce/messaging/message/MessageSource.java // public enum MessageSource { // LOCAL_USER, // EXTERNAL_USER, // GENERAL // } // // Path: slyce-messaging/src/main/java/it/slyce/messaging/message/TextMessage.java // public class TextMessage extends Message { // private String text; // // public String getText() { // return text; // } // // public void setText(String text) { // this.text = text; // } // // @Override // public MessageItem toMessageItem(Context context){ // if (this.source == MessageSource.EXTERNAL_USER) // return new MessageExternalUserTextItem(this, context); // else // return new MessageInternalUserTextItem(this, context); // } // } // // Path: slyce-messaging/src/main/java/it/slyce/messaging/utils/MessageUtils.java // public class MessageUtils { // // public static void markMessageItemAtIndexIfFirstOrLastFromSource(int i, List<MessageItem> messageItems) { // if (i < 0 || i >= messageItems.size()) { // return; // } // // MessageItem messageItem = messageItems.get(i); // messageItem.setIsFirstConsecutiveMessageFromSource(false); // messageItem.setIsLastConsecutiveMessageFromSource(false); // // if (previousMessageIsNotFromSameSource(i, messageItems)) { // messageItem.setIsFirstConsecutiveMessageFromSource(true); // } // // if (isTheLastConsecutiveMessageFromSource(i, messageItems)) { // messageItem.setIsLastConsecutiveMessageFromSource(true); // } // } // // private static boolean previousMessageIsNotFromSameSource(int i, List<MessageItem> messageItems) { // return i == 0 || // previousMessageIsSpinner(i, messageItems) || // previousMessageIsFromAnotherSender(i, messageItems); // } // // private static boolean previousMessageIsFromAnotherSender(int i, List<MessageItem> messageItems) { // return messageItems.get(i - 1).getMessageSource() != messageItems.get(i).getMessageSource(); // } // // private static boolean previousMessageIsSpinner(int i, List<MessageItem> messageItems) { // return isSpinnerMessage(i - 1, messageItems); // } // // private static boolean isTheLastConsecutiveMessageFromSource(int i, List<MessageItem> messageItems) { // if (isSpinnerMessage(i, messageItems)) { // return false; // } // // return i == messageItems.size() - 1 || // nextMessageHasDifferentSource(i, messageItems) || // messageItems.get(i).getMessage() == null || // messageItems.get(i + 1).getMessage() == null || // nextMessageWasAtLeastAnHourAfterThisOne(i, messageItems); // } // // private static boolean nextMessageWasAtLeastAnHourAfterThisOne(int i, List<MessageItem> messageItems) { // return messageItems.get(i + 1).getMessage().getDate() - messageItems.get(i).getMessage().getDate() > 1000 * 60 * 60; // one hour // } // // private static boolean nextMessageHasDifferentSource(int i, List<MessageItem> messageItems) { // return messageItems.get(i).getMessageSource() != messageItems.get(i + 1).getMessageSource(); // } // // private static boolean isSpinnerMessage(int i, List<MessageItem> messageItems) { // return messageItems.get(i).getMessageItemType() == MessageItemType.SPINNER; // } // } // Path: slyce-messaging/src/test/java/it/slyce/messaging/MessageUtilsTest.java import org.junit.Before; import org.junit.Test; import java.util.ArrayList; import java.util.List; import it.slyce.messaging.message.MediaMessage; import it.slyce.messaging.message.MessageSource; import it.slyce.messaging.message.TextMessage; import it.slyce.messaging.message.messageItem.MessageItem; import it.slyce.messaging.utils.MessageUtils; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; package it.slyce.messaging; /** * Created by audrey on 7/14/16. */ public class MessageUtilsTest { List<MessageItem> messageItems; @Before public void before() { messageItems = new ArrayList<>(); // incoming text TextMessage firstIncoming = new TextMessage(); firstIncoming.setSource(MessageSource.EXTERNAL_USER); firstIncoming.setText("hi"); messageItems.add(firstIncoming.toMessageItem(null)); // incoming text TextMessage secondIncoming = new TextMessage(); secondIncoming.setSource(MessageSource.EXTERNAL_USER); secondIncoming.setText("second message"); messageItems.add(secondIncoming.toMessageItem(null)); // incoming image
MediaMessage incomingImage = new MediaMessage();
Slyce-Inc/SlyceMessaging
slyce-messaging/src/test/java/it/slyce/messaging/MessageUtilsTest.java
// Path: slyce-messaging/src/main/java/it/slyce/messaging/message/MediaMessage.java // public class MediaMessage extends Message { // private String url; // // public String getUrl() { // return url; // } // // public void setUrl(String url) { // this.url = url; // } // // @Override // public MessageItem toMessageItem(Context context){ // if (this.source == MessageSource.EXTERNAL_USER) // return new MessageExternalUserMediaItem(this, context); // else // return new MessageInternalUserMediaItem(this, context); // } // } // // Path: slyce-messaging/src/main/java/it/slyce/messaging/message/MessageSource.java // public enum MessageSource { // LOCAL_USER, // EXTERNAL_USER, // GENERAL // } // // Path: slyce-messaging/src/main/java/it/slyce/messaging/message/TextMessage.java // public class TextMessage extends Message { // private String text; // // public String getText() { // return text; // } // // public void setText(String text) { // this.text = text; // } // // @Override // public MessageItem toMessageItem(Context context){ // if (this.source == MessageSource.EXTERNAL_USER) // return new MessageExternalUserTextItem(this, context); // else // return new MessageInternalUserTextItem(this, context); // } // } // // Path: slyce-messaging/src/main/java/it/slyce/messaging/utils/MessageUtils.java // public class MessageUtils { // // public static void markMessageItemAtIndexIfFirstOrLastFromSource(int i, List<MessageItem> messageItems) { // if (i < 0 || i >= messageItems.size()) { // return; // } // // MessageItem messageItem = messageItems.get(i); // messageItem.setIsFirstConsecutiveMessageFromSource(false); // messageItem.setIsLastConsecutiveMessageFromSource(false); // // if (previousMessageIsNotFromSameSource(i, messageItems)) { // messageItem.setIsFirstConsecutiveMessageFromSource(true); // } // // if (isTheLastConsecutiveMessageFromSource(i, messageItems)) { // messageItem.setIsLastConsecutiveMessageFromSource(true); // } // } // // private static boolean previousMessageIsNotFromSameSource(int i, List<MessageItem> messageItems) { // return i == 0 || // previousMessageIsSpinner(i, messageItems) || // previousMessageIsFromAnotherSender(i, messageItems); // } // // private static boolean previousMessageIsFromAnotherSender(int i, List<MessageItem> messageItems) { // return messageItems.get(i - 1).getMessageSource() != messageItems.get(i).getMessageSource(); // } // // private static boolean previousMessageIsSpinner(int i, List<MessageItem> messageItems) { // return isSpinnerMessage(i - 1, messageItems); // } // // private static boolean isTheLastConsecutiveMessageFromSource(int i, List<MessageItem> messageItems) { // if (isSpinnerMessage(i, messageItems)) { // return false; // } // // return i == messageItems.size() - 1 || // nextMessageHasDifferentSource(i, messageItems) || // messageItems.get(i).getMessage() == null || // messageItems.get(i + 1).getMessage() == null || // nextMessageWasAtLeastAnHourAfterThisOne(i, messageItems); // } // // private static boolean nextMessageWasAtLeastAnHourAfterThisOne(int i, List<MessageItem> messageItems) { // return messageItems.get(i + 1).getMessage().getDate() - messageItems.get(i).getMessage().getDate() > 1000 * 60 * 60; // one hour // } // // private static boolean nextMessageHasDifferentSource(int i, List<MessageItem> messageItems) { // return messageItems.get(i).getMessageSource() != messageItems.get(i + 1).getMessageSource(); // } // // private static boolean isSpinnerMessage(int i, List<MessageItem> messageItems) { // return messageItems.get(i).getMessageItemType() == MessageItemType.SPINNER; // } // }
import org.junit.Before; import org.junit.Test; import java.util.ArrayList; import java.util.List; import it.slyce.messaging.message.MediaMessage; import it.slyce.messaging.message.MessageSource; import it.slyce.messaging.message.TextMessage; import it.slyce.messaging.message.messageItem.MessageItem; import it.slyce.messaging.utils.MessageUtils; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue;
messageItems.add(firstIncoming.toMessageItem(null)); // incoming text TextMessage secondIncoming = new TextMessage(); secondIncoming.setSource(MessageSource.EXTERNAL_USER); secondIncoming.setText("second message"); messageItems.add(secondIncoming.toMessageItem(null)); // incoming image MediaMessage incomingImage = new MediaMessage(); incomingImage.setSource(MessageSource.EXTERNAL_USER); incomingImage.setUrl("http://snipsnap.it/fakeimage.png"); messageItems.add(incomingImage.toMessageItem(null)); // outgoing text TextMessage firstOutgoing = new TextMessage(); firstOutgoing.setSource(MessageSource.LOCAL_USER); firstOutgoing.setText("hi"); messageItems.add(firstOutgoing.toMessageItem(null)); // outgoing image TextMessage secondOutgoing = new TextMessage(); secondOutgoing.setSource(MessageSource.LOCAL_USER); secondOutgoing.setText("hi"); messageItems.add(secondOutgoing.toMessageItem(null)); // incoming text TextMessage finalIncoming = new TextMessage(); finalIncoming.setSource(MessageSource.EXTERNAL_USER); finalIncoming.setText("final message"); messageItems.add(finalIncoming.toMessageItem(null)); } @Test public void firstConsecutiveMessageIsMarkedAsFirst() throws Exception {
// Path: slyce-messaging/src/main/java/it/slyce/messaging/message/MediaMessage.java // public class MediaMessage extends Message { // private String url; // // public String getUrl() { // return url; // } // // public void setUrl(String url) { // this.url = url; // } // // @Override // public MessageItem toMessageItem(Context context){ // if (this.source == MessageSource.EXTERNAL_USER) // return new MessageExternalUserMediaItem(this, context); // else // return new MessageInternalUserMediaItem(this, context); // } // } // // Path: slyce-messaging/src/main/java/it/slyce/messaging/message/MessageSource.java // public enum MessageSource { // LOCAL_USER, // EXTERNAL_USER, // GENERAL // } // // Path: slyce-messaging/src/main/java/it/slyce/messaging/message/TextMessage.java // public class TextMessage extends Message { // private String text; // // public String getText() { // return text; // } // // public void setText(String text) { // this.text = text; // } // // @Override // public MessageItem toMessageItem(Context context){ // if (this.source == MessageSource.EXTERNAL_USER) // return new MessageExternalUserTextItem(this, context); // else // return new MessageInternalUserTextItem(this, context); // } // } // // Path: slyce-messaging/src/main/java/it/slyce/messaging/utils/MessageUtils.java // public class MessageUtils { // // public static void markMessageItemAtIndexIfFirstOrLastFromSource(int i, List<MessageItem> messageItems) { // if (i < 0 || i >= messageItems.size()) { // return; // } // // MessageItem messageItem = messageItems.get(i); // messageItem.setIsFirstConsecutiveMessageFromSource(false); // messageItem.setIsLastConsecutiveMessageFromSource(false); // // if (previousMessageIsNotFromSameSource(i, messageItems)) { // messageItem.setIsFirstConsecutiveMessageFromSource(true); // } // // if (isTheLastConsecutiveMessageFromSource(i, messageItems)) { // messageItem.setIsLastConsecutiveMessageFromSource(true); // } // } // // private static boolean previousMessageIsNotFromSameSource(int i, List<MessageItem> messageItems) { // return i == 0 || // previousMessageIsSpinner(i, messageItems) || // previousMessageIsFromAnotherSender(i, messageItems); // } // // private static boolean previousMessageIsFromAnotherSender(int i, List<MessageItem> messageItems) { // return messageItems.get(i - 1).getMessageSource() != messageItems.get(i).getMessageSource(); // } // // private static boolean previousMessageIsSpinner(int i, List<MessageItem> messageItems) { // return isSpinnerMessage(i - 1, messageItems); // } // // private static boolean isTheLastConsecutiveMessageFromSource(int i, List<MessageItem> messageItems) { // if (isSpinnerMessage(i, messageItems)) { // return false; // } // // return i == messageItems.size() - 1 || // nextMessageHasDifferentSource(i, messageItems) || // messageItems.get(i).getMessage() == null || // messageItems.get(i + 1).getMessage() == null || // nextMessageWasAtLeastAnHourAfterThisOne(i, messageItems); // } // // private static boolean nextMessageWasAtLeastAnHourAfterThisOne(int i, List<MessageItem> messageItems) { // return messageItems.get(i + 1).getMessage().getDate() - messageItems.get(i).getMessage().getDate() > 1000 * 60 * 60; // one hour // } // // private static boolean nextMessageHasDifferentSource(int i, List<MessageItem> messageItems) { // return messageItems.get(i).getMessageSource() != messageItems.get(i + 1).getMessageSource(); // } // // private static boolean isSpinnerMessage(int i, List<MessageItem> messageItems) { // return messageItems.get(i).getMessageItemType() == MessageItemType.SPINNER; // } // } // Path: slyce-messaging/src/test/java/it/slyce/messaging/MessageUtilsTest.java import org.junit.Before; import org.junit.Test; import java.util.ArrayList; import java.util.List; import it.slyce.messaging.message.MediaMessage; import it.slyce.messaging.message.MessageSource; import it.slyce.messaging.message.TextMessage; import it.slyce.messaging.message.messageItem.MessageItem; import it.slyce.messaging.utils.MessageUtils; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; messageItems.add(firstIncoming.toMessageItem(null)); // incoming text TextMessage secondIncoming = new TextMessage(); secondIncoming.setSource(MessageSource.EXTERNAL_USER); secondIncoming.setText("second message"); messageItems.add(secondIncoming.toMessageItem(null)); // incoming image MediaMessage incomingImage = new MediaMessage(); incomingImage.setSource(MessageSource.EXTERNAL_USER); incomingImage.setUrl("http://snipsnap.it/fakeimage.png"); messageItems.add(incomingImage.toMessageItem(null)); // outgoing text TextMessage firstOutgoing = new TextMessage(); firstOutgoing.setSource(MessageSource.LOCAL_USER); firstOutgoing.setText("hi"); messageItems.add(firstOutgoing.toMessageItem(null)); // outgoing image TextMessage secondOutgoing = new TextMessage(); secondOutgoing.setSource(MessageSource.LOCAL_USER); secondOutgoing.setText("hi"); messageItems.add(secondOutgoing.toMessageItem(null)); // incoming text TextMessage finalIncoming = new TextMessage(); finalIncoming.setSource(MessageSource.EXTERNAL_USER); finalIncoming.setText("final message"); messageItems.add(finalIncoming.toMessageItem(null)); } @Test public void firstConsecutiveMessageIsMarkedAsFirst() throws Exception {
MessageUtils.markMessageItemAtIndexIfFirstOrLastFromSource(0, messageItems);
Slyce-Inc/SlyceMessaging
slyce-messaging/src/main/java/it/slyce/messaging/message/SpinnerMessage.java
// Path: slyce-messaging/src/main/java/it/slyce/messaging/message/messageItem/spinner/SpinnerItem.java // public class SpinnerItem extends MessageItem { // public SpinnerItem() { // super(null); // } // // @Override // public void buildMessageItem(MessageViewHolder messageViewHolder) { // // } // // @Override // public MessageItemType getMessageItemType() { // return MessageItemType.SPINNER; // } // // @Override // public MessageSource getMessageSource() { // return MessageSource.EXTERNAL_USER; // } // }
import android.content.Context; import it.slyce.messaging.message.messageItem.MessageItem; import it.slyce.messaging.message.messageItem.spinner.SpinnerItem;
package it.slyce.messaging.message; /** * Created by matthewpage on 7/5/16. */ public class SpinnerMessage extends Message { @Override public MessageItem toMessageItem(Context context) {
// Path: slyce-messaging/src/main/java/it/slyce/messaging/message/messageItem/spinner/SpinnerItem.java // public class SpinnerItem extends MessageItem { // public SpinnerItem() { // super(null); // } // // @Override // public void buildMessageItem(MessageViewHolder messageViewHolder) { // // } // // @Override // public MessageItemType getMessageItemType() { // return MessageItemType.SPINNER; // } // // @Override // public MessageSource getMessageSource() { // return MessageSource.EXTERNAL_USER; // } // } // Path: slyce-messaging/src/main/java/it/slyce/messaging/message/SpinnerMessage.java import android.content.Context; import it.slyce.messaging.message.messageItem.MessageItem; import it.slyce.messaging.message.messageItem.spinner.SpinnerItem; package it.slyce.messaging.message; /** * Created by matthewpage on 7/5/16. */ public class SpinnerMessage extends Message { @Override public MessageItem toMessageItem(Context context) {
return new SpinnerItem();
Slyce-Inc/SlyceMessaging
example/src/androidTest/java/it/snipsnap/slyce_messaging_example/SlyceMessagingUITests.java
// Path: slyce-messaging/src/main/java/it/slyce/messaging/message/MessageSource.java // public enum MessageSource { // LOCAL_USER, // EXTERNAL_USER, // GENERAL // } // // Path: slyce-messaging/src/main/java/it/slyce/messaging/message/TextMessage.java // public class TextMessage extends Message { // private String text; // // public String getText() { // return text; // } // // public void setText(String text) { // this.text = text; // } // // @Override // public MessageItem toMessageItem(Context context){ // if (this.source == MessageSource.EXTERNAL_USER) // return new MessageExternalUserTextItem(this, context); // else // return new MessageInternalUserTextItem(this, context); // } // } // // Path: slyce-messaging/src/main/java/it/slyce/messaging/message/messageItem/MessageRecyclerAdapter.java // public class MessageRecyclerAdapter extends RecyclerView.Adapter<MessageViewHolder> { // // private static final String TAG = MessageRecyclerAdapter.class.getName(); // // private List<MessageItem> mMessageItems; // // private CustomSettings customSettings; // // public MessageRecyclerAdapter(List<MessageItem> messageItems, CustomSettings customSettings) { // mMessageItems = messageItems; // this.customSettings = customSettings; // } // // @Override // public MessageViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { // LayoutInflater inflater = LayoutInflater.from(parent.getContext()); // MessageViewHolder viewHolder = null; // // MessageItemType messageItemType = MessageItemType.values()[viewType]; // switch (messageItemType) { // // // case INCOMING_MEDIA: // View scoutMediaView = inflater.inflate(R.layout.item_message_external_media, parent, false); // viewHolder = new MessageExternalUserMediaViewHolder(scoutMediaView, customSettings); // break; // // case INCOMING_TEXT: // View scoutTextView = inflater.inflate(R.layout.item_message_external_text, parent, false); // viewHolder = new MessageExternalUserTextViewHolder(scoutTextView, customSettings); // break; // // case OUTGOING_MEDIA: // View userMediaView = inflater.inflate(R.layout.item_message_user_media, parent, false); // viewHolder = new MessageInternalUserViewHolder(userMediaView, customSettings); // break; // // case OUTGOING_TEXT: // View userTextView = inflater.inflate(R.layout.item_message_user_text, parent, false); // viewHolder = new MessageInternalUserTextViewHolder(userTextView, customSettings); // break; // // case SPINNER: // View spinnerView = inflater.inflate(R.layout.item_spinner, parent, false); // viewHolder = new SpinnerViewHolder(spinnerView, customSettings); // break; // // case GENERAL_TEXT: // View generalTextView = inflater.inflate(R.layout.item_message_general_text, parent, false); // viewHolder = new MessageGeneralTextViewHolder(generalTextView, customSettings); // break; // // case GENERAL_OPTIONS: // View generalOptionsView = inflater.inflate(R.layout.item_message_general_options, parent, false); // viewHolder = new MessageGeneralOptionsViewHolder(generalOptionsView, customSettings); // break; // } // // return viewHolder; // } // // @Override // public void onBindViewHolder(MessageViewHolder messageViewHolder, int position) { // if (messageViewHolder == null) { // return; // } // // // Build the item // MessageItem messageItem = getMessageItemByPosition(position); // if (messageItem != null) { // messageItem.buildMessageItem(messageViewHolder); // } // } // // @Override // public int getItemCount() { // return mMessageItems != null ? mMessageItems.size() : 0; // } // // @Override // public int getItemViewType(int position) { // // // Get the item type // Integer itemType = getMessageItemType(position); // if (itemType != null) { // return itemType; // } // // return super.getItemViewType(position); // } // // private MessageItem getMessageItemByPosition(int position) { // if (mMessageItems != null && !mMessageItems.isEmpty()) { // if (position >= 0 && position < mMessageItems.size()) { // MessageItem messageItem = mMessageItems.get(position); // if (messageItem != null) { // return messageItem; // } // } // } // // return null; // } // // private Integer getMessageItemType(int position) { // MessageItem messageItem = getMessageItemByPosition(position); // if (messageItem != null) { // return messageItem.getMessageItemTypeOrdinal(); // } // // return null; // } // // public void updateMessageItemDataList(List<MessageItem> messageItems) { // mMessageItems = messageItems; // notifyDataSetChanged(); // } // }
import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import android.support.v7.widget.RecyclerView; import android.test.ActivityInstrumentationTestCase2; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import java.util.Date; import it.slyce.messaging.SlyceMessagingFragment; import it.slyce.messaging.message.MessageSource; import it.slyce.messaging.message.TextMessage; import it.slyce.messaging.message.messageItem.MessageRecyclerAdapter;
package it.snipsnap.slyce_messaging_example; /** * @Author Matthew Page * @Date 7/18/16 */ @RunWith(AndroidJUnit4.class) public class SlyceMessagingUITests extends ActivityInstrumentationTestCase2<MainActivity> { private MainActivity mActivity; private SlyceMessagingFragment mFragment; private RecyclerView mRecyclerView;
// Path: slyce-messaging/src/main/java/it/slyce/messaging/message/MessageSource.java // public enum MessageSource { // LOCAL_USER, // EXTERNAL_USER, // GENERAL // } // // Path: slyce-messaging/src/main/java/it/slyce/messaging/message/TextMessage.java // public class TextMessage extends Message { // private String text; // // public String getText() { // return text; // } // // public void setText(String text) { // this.text = text; // } // // @Override // public MessageItem toMessageItem(Context context){ // if (this.source == MessageSource.EXTERNAL_USER) // return new MessageExternalUserTextItem(this, context); // else // return new MessageInternalUserTextItem(this, context); // } // } // // Path: slyce-messaging/src/main/java/it/slyce/messaging/message/messageItem/MessageRecyclerAdapter.java // public class MessageRecyclerAdapter extends RecyclerView.Adapter<MessageViewHolder> { // // private static final String TAG = MessageRecyclerAdapter.class.getName(); // // private List<MessageItem> mMessageItems; // // private CustomSettings customSettings; // // public MessageRecyclerAdapter(List<MessageItem> messageItems, CustomSettings customSettings) { // mMessageItems = messageItems; // this.customSettings = customSettings; // } // // @Override // public MessageViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { // LayoutInflater inflater = LayoutInflater.from(parent.getContext()); // MessageViewHolder viewHolder = null; // // MessageItemType messageItemType = MessageItemType.values()[viewType]; // switch (messageItemType) { // // // case INCOMING_MEDIA: // View scoutMediaView = inflater.inflate(R.layout.item_message_external_media, parent, false); // viewHolder = new MessageExternalUserMediaViewHolder(scoutMediaView, customSettings); // break; // // case INCOMING_TEXT: // View scoutTextView = inflater.inflate(R.layout.item_message_external_text, parent, false); // viewHolder = new MessageExternalUserTextViewHolder(scoutTextView, customSettings); // break; // // case OUTGOING_MEDIA: // View userMediaView = inflater.inflate(R.layout.item_message_user_media, parent, false); // viewHolder = new MessageInternalUserViewHolder(userMediaView, customSettings); // break; // // case OUTGOING_TEXT: // View userTextView = inflater.inflate(R.layout.item_message_user_text, parent, false); // viewHolder = new MessageInternalUserTextViewHolder(userTextView, customSettings); // break; // // case SPINNER: // View spinnerView = inflater.inflate(R.layout.item_spinner, parent, false); // viewHolder = new SpinnerViewHolder(spinnerView, customSettings); // break; // // case GENERAL_TEXT: // View generalTextView = inflater.inflate(R.layout.item_message_general_text, parent, false); // viewHolder = new MessageGeneralTextViewHolder(generalTextView, customSettings); // break; // // case GENERAL_OPTIONS: // View generalOptionsView = inflater.inflate(R.layout.item_message_general_options, parent, false); // viewHolder = new MessageGeneralOptionsViewHolder(generalOptionsView, customSettings); // break; // } // // return viewHolder; // } // // @Override // public void onBindViewHolder(MessageViewHolder messageViewHolder, int position) { // if (messageViewHolder == null) { // return; // } // // // Build the item // MessageItem messageItem = getMessageItemByPosition(position); // if (messageItem != null) { // messageItem.buildMessageItem(messageViewHolder); // } // } // // @Override // public int getItemCount() { // return mMessageItems != null ? mMessageItems.size() : 0; // } // // @Override // public int getItemViewType(int position) { // // // Get the item type // Integer itemType = getMessageItemType(position); // if (itemType != null) { // return itemType; // } // // return super.getItemViewType(position); // } // // private MessageItem getMessageItemByPosition(int position) { // if (mMessageItems != null && !mMessageItems.isEmpty()) { // if (position >= 0 && position < mMessageItems.size()) { // MessageItem messageItem = mMessageItems.get(position); // if (messageItem != null) { // return messageItem; // } // } // } // // return null; // } // // private Integer getMessageItemType(int position) { // MessageItem messageItem = getMessageItemByPosition(position); // if (messageItem != null) { // return messageItem.getMessageItemTypeOrdinal(); // } // // return null; // } // // public void updateMessageItemDataList(List<MessageItem> messageItems) { // mMessageItems = messageItems; // notifyDataSetChanged(); // } // } // Path: example/src/androidTest/java/it/snipsnap/slyce_messaging_example/SlyceMessagingUITests.java import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import android.support.v7.widget.RecyclerView; import android.test.ActivityInstrumentationTestCase2; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import java.util.Date; import it.slyce.messaging.SlyceMessagingFragment; import it.slyce.messaging.message.MessageSource; import it.slyce.messaging.message.TextMessage; import it.slyce.messaging.message.messageItem.MessageRecyclerAdapter; package it.snipsnap.slyce_messaging_example; /** * @Author Matthew Page * @Date 7/18/16 */ @RunWith(AndroidJUnit4.class) public class SlyceMessagingUITests extends ActivityInstrumentationTestCase2<MainActivity> { private MainActivity mActivity; private SlyceMessagingFragment mFragment; private RecyclerView mRecyclerView;
private MessageRecyclerAdapter mAdapter;
Slyce-Inc/SlyceMessaging
slyce-messaging/src/main/java/it/slyce/messaging/message/messageItem/general/generalText/MessageGeneralTextViewHolder.java
// Path: slyce-messaging/src/main/java/it/slyce/messaging/message/messageItem/MessageViewHolder.java // public class MessageViewHolder extends RecyclerView.ViewHolder { // public ImageView avatar; // public TextView initials; // public TextView timestamp; // public ViewGroup avatarContainer; // public CustomSettings customSettings; // // public MessageViewHolder(View itemView, CustomSettings customSettings) { // super(itemView); // this.customSettings = customSettings; // } // } // // Path: slyce-messaging/src/main/java/it/slyce/messaging/utils/CustomSettings.java // public class CustomSettings { // public int backgroudColor; // public int timestampColor; // public int localBubbleBackgroundColor; // public int localBubbleTextColor; // public int externalBubbleBackgroundColor; // public int externalBubbleTextColor; // public int snackbarBackground; // public int snackbarTitleColor; // public int snackbarButtonColor; // // public UserClicksAvatarPictureListener userClicksAvatarPictureListener; // }
import android.view.View; import android.widget.TextView; import it.slyce.messaging.R; import it.slyce.messaging.message.messageItem.MessageViewHolder; import it.slyce.messaging.utils.CustomSettings;
package it.slyce.messaging.message.messageItem.general.generalText; public class MessageGeneralTextViewHolder extends MessageViewHolder { public TextView messageTextView;
// Path: slyce-messaging/src/main/java/it/slyce/messaging/message/messageItem/MessageViewHolder.java // public class MessageViewHolder extends RecyclerView.ViewHolder { // public ImageView avatar; // public TextView initials; // public TextView timestamp; // public ViewGroup avatarContainer; // public CustomSettings customSettings; // // public MessageViewHolder(View itemView, CustomSettings customSettings) { // super(itemView); // this.customSettings = customSettings; // } // } // // Path: slyce-messaging/src/main/java/it/slyce/messaging/utils/CustomSettings.java // public class CustomSettings { // public int backgroudColor; // public int timestampColor; // public int localBubbleBackgroundColor; // public int localBubbleTextColor; // public int externalBubbleBackgroundColor; // public int externalBubbleTextColor; // public int snackbarBackground; // public int snackbarTitleColor; // public int snackbarButtonColor; // // public UserClicksAvatarPictureListener userClicksAvatarPictureListener; // } // Path: slyce-messaging/src/main/java/it/slyce/messaging/message/messageItem/general/generalText/MessageGeneralTextViewHolder.java import android.view.View; import android.widget.TextView; import it.slyce.messaging.R; import it.slyce.messaging.message.messageItem.MessageViewHolder; import it.slyce.messaging.utils.CustomSettings; package it.slyce.messaging.message.messageItem.general.generalText; public class MessageGeneralTextViewHolder extends MessageViewHolder { public TextView messageTextView;
public MessageGeneralTextViewHolder(View itemView, CustomSettings customSettings) {
Slyce-Inc/SlyceMessaging
slyce-messaging/src/main/java/it/slyce/messaging/message/messageItem/MessageViewHolder.java
// Path: slyce-messaging/src/main/java/it/slyce/messaging/utils/CustomSettings.java // public class CustomSettings { // public int backgroudColor; // public int timestampColor; // public int localBubbleBackgroundColor; // public int localBubbleTextColor; // public int externalBubbleBackgroundColor; // public int externalBubbleTextColor; // public int snackbarBackground; // public int snackbarTitleColor; // public int snackbarButtonColor; // // public UserClicksAvatarPictureListener userClicksAvatarPictureListener; // }
import android.support.v7.widget.RecyclerView; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import it.slyce.messaging.utils.CustomSettings;
package it.slyce.messaging.message.messageItem; /** * Created by John C. Hunchar on 5/12/16. */ public class MessageViewHolder extends RecyclerView.ViewHolder { public ImageView avatar; public TextView initials; public TextView timestamp; public ViewGroup avatarContainer;
// Path: slyce-messaging/src/main/java/it/slyce/messaging/utils/CustomSettings.java // public class CustomSettings { // public int backgroudColor; // public int timestampColor; // public int localBubbleBackgroundColor; // public int localBubbleTextColor; // public int externalBubbleBackgroundColor; // public int externalBubbleTextColor; // public int snackbarBackground; // public int snackbarTitleColor; // public int snackbarButtonColor; // // public UserClicksAvatarPictureListener userClicksAvatarPictureListener; // } // Path: slyce-messaging/src/main/java/it/slyce/messaging/message/messageItem/MessageViewHolder.java import android.support.v7.widget.RecyclerView; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import it.slyce.messaging.utils.CustomSettings; package it.slyce.messaging.message.messageItem; /** * Created by John C. Hunchar on 5/12/16. */ public class MessageViewHolder extends RecyclerView.ViewHolder { public ImageView avatar; public TextView initials; public TextView timestamp; public ViewGroup avatarContainer;
public CustomSettings customSettings;
Slyce-Inc/SlyceMessaging
slyce-messaging/src/main/java/it/slyce/messaging/message/GeneralTextMessage.java
// Path: slyce-messaging/src/main/java/it/slyce/messaging/message/messageItem/general/generalText/MessageGeneralTextItem.java // public class MessageGeneralTextItem extends MessageItem { // public MessageGeneralTextItem(GeneralTextMessage message) { // super(message); // } // // @Override // public void buildMessageItem( // MessageViewHolder messageViewHolder) { // MessageGeneralTextViewHolder viewHolder = (MessageGeneralTextViewHolder) messageViewHolder; // GeneralTextMessage generalTextMessage = (GeneralTextMessage) message; // viewHolder.messageTextView.setText(generalTextMessage.getText()); // } // // @Override // public MessageItemType getMessageItemType() { // return MessageItemType.GENERAL_TEXT; // } // // @Override // public MessageSource getMessageSource() { // return MessageSource.GENERAL; // } // }
import android.content.Context; import it.slyce.messaging.message.messageItem.MessageItem; import it.slyce.messaging.message.messageItem.general.generalText.MessageGeneralTextItem;
package it.slyce.messaging.message; public class GeneralTextMessage extends Message { private String text; public void setText(String text) { this.text = text; } public String getText() { return this.text; } @Override public MessageItem toMessageItem(Context context) {
// Path: slyce-messaging/src/main/java/it/slyce/messaging/message/messageItem/general/generalText/MessageGeneralTextItem.java // public class MessageGeneralTextItem extends MessageItem { // public MessageGeneralTextItem(GeneralTextMessage message) { // super(message); // } // // @Override // public void buildMessageItem( // MessageViewHolder messageViewHolder) { // MessageGeneralTextViewHolder viewHolder = (MessageGeneralTextViewHolder) messageViewHolder; // GeneralTextMessage generalTextMessage = (GeneralTextMessage) message; // viewHolder.messageTextView.setText(generalTextMessage.getText()); // } // // @Override // public MessageItemType getMessageItemType() { // return MessageItemType.GENERAL_TEXT; // } // // @Override // public MessageSource getMessageSource() { // return MessageSource.GENERAL; // } // } // Path: slyce-messaging/src/main/java/it/slyce/messaging/message/GeneralTextMessage.java import android.content.Context; import it.slyce.messaging.message.messageItem.MessageItem; import it.slyce.messaging.message.messageItem.general.generalText.MessageGeneralTextItem; package it.slyce.messaging.message; public class GeneralTextMessage extends Message { private String text; public void setText(String text) { this.text = text; } public String getText() { return this.text; } @Override public MessageItem toMessageItem(Context context) {
return new MessageGeneralTextItem(this);
Slyce-Inc/SlyceMessaging
slyce-messaging/src/main/java/it/slyce/messaging/message/messageItem/general/generalOptions/MessageGeneralOptionsItem.java
// Path: slyce-messaging/src/main/java/it/slyce/messaging/message/MessageSource.java // public enum MessageSource { // LOCAL_USER, // EXTERNAL_USER, // GENERAL // } // // Path: slyce-messaging/src/main/java/it/slyce/messaging/message/messageItem/MessageItemType.java // public enum MessageItemType { // INCOMING_MEDIA, // INCOMING_TEXT, // OUTGOING_MEDIA, // OUTGOING_TEXT, // SPINNER, // GENERAL_TEXT, // GENERAL_OPTIONS; // // public static final MessageItemType values[] = values(); // } // // Path: slyce-messaging/src/main/java/it/slyce/messaging/message/messageItem/MessageViewHolder.java // public class MessageViewHolder extends RecyclerView.ViewHolder { // public ImageView avatar; // public TextView initials; // public TextView timestamp; // public ViewGroup avatarContainer; // public CustomSettings customSettings; // // public MessageViewHolder(View itemView, CustomSettings customSettings) { // super(itemView); // this.customSettings = customSettings; // } // }
import android.content.Context; import android.graphics.Color; import android.graphics.PorterDuff; import android.support.v4.content.ContextCompat; import android.view.View; import android.widget.Button; import it.slyce.messaging.R; import it.slyce.messaging.message.GeneralOptionsMessage; import it.slyce.messaging.message.MessageSource; import it.slyce.messaging.message.messageItem.MessageItem; import it.slyce.messaging.message.messageItem.MessageItemType; import it.slyce.messaging.message.messageItem.MessageViewHolder;
package it.slyce.messaging.message.messageItem.general.generalOptions; public class MessageGeneralOptionsItem extends MessageItem { private Context context; public MessageGeneralOptionsItem(GeneralOptionsMessage generalOptionsMessage, Context context) { super(generalOptionsMessage); this.context = context; } @Override
// Path: slyce-messaging/src/main/java/it/slyce/messaging/message/MessageSource.java // public enum MessageSource { // LOCAL_USER, // EXTERNAL_USER, // GENERAL // } // // Path: slyce-messaging/src/main/java/it/slyce/messaging/message/messageItem/MessageItemType.java // public enum MessageItemType { // INCOMING_MEDIA, // INCOMING_TEXT, // OUTGOING_MEDIA, // OUTGOING_TEXT, // SPINNER, // GENERAL_TEXT, // GENERAL_OPTIONS; // // public static final MessageItemType values[] = values(); // } // // Path: slyce-messaging/src/main/java/it/slyce/messaging/message/messageItem/MessageViewHolder.java // public class MessageViewHolder extends RecyclerView.ViewHolder { // public ImageView avatar; // public TextView initials; // public TextView timestamp; // public ViewGroup avatarContainer; // public CustomSettings customSettings; // // public MessageViewHolder(View itemView, CustomSettings customSettings) { // super(itemView); // this.customSettings = customSettings; // } // } // Path: slyce-messaging/src/main/java/it/slyce/messaging/message/messageItem/general/generalOptions/MessageGeneralOptionsItem.java import android.content.Context; import android.graphics.Color; import android.graphics.PorterDuff; import android.support.v4.content.ContextCompat; import android.view.View; import android.widget.Button; import it.slyce.messaging.R; import it.slyce.messaging.message.GeneralOptionsMessage; import it.slyce.messaging.message.MessageSource; import it.slyce.messaging.message.messageItem.MessageItem; import it.slyce.messaging.message.messageItem.MessageItemType; import it.slyce.messaging.message.messageItem.MessageViewHolder; package it.slyce.messaging.message.messageItem.general.generalOptions; public class MessageGeneralOptionsItem extends MessageItem { private Context context; public MessageGeneralOptionsItem(GeneralOptionsMessage generalOptionsMessage, Context context) { super(generalOptionsMessage); this.context = context; } @Override
public void buildMessageItem(MessageViewHolder messageViewHolder) {
Slyce-Inc/SlyceMessaging
slyce-messaging/src/main/java/it/slyce/messaging/message/messageItem/general/generalOptions/MessageGeneralOptionsItem.java
// Path: slyce-messaging/src/main/java/it/slyce/messaging/message/MessageSource.java // public enum MessageSource { // LOCAL_USER, // EXTERNAL_USER, // GENERAL // } // // Path: slyce-messaging/src/main/java/it/slyce/messaging/message/messageItem/MessageItemType.java // public enum MessageItemType { // INCOMING_MEDIA, // INCOMING_TEXT, // OUTGOING_MEDIA, // OUTGOING_TEXT, // SPINNER, // GENERAL_TEXT, // GENERAL_OPTIONS; // // public static final MessageItemType values[] = values(); // } // // Path: slyce-messaging/src/main/java/it/slyce/messaging/message/messageItem/MessageViewHolder.java // public class MessageViewHolder extends RecyclerView.ViewHolder { // public ImageView avatar; // public TextView initials; // public TextView timestamp; // public ViewGroup avatarContainer; // public CustomSettings customSettings; // // public MessageViewHolder(View itemView, CustomSettings customSettings) { // super(itemView); // this.customSettings = customSettings; // } // }
import android.content.Context; import android.graphics.Color; import android.graphics.PorterDuff; import android.support.v4.content.ContextCompat; import android.view.View; import android.widget.Button; import it.slyce.messaging.R; import it.slyce.messaging.message.GeneralOptionsMessage; import it.slyce.messaging.message.MessageSource; import it.slyce.messaging.message.messageItem.MessageItem; import it.slyce.messaging.message.messageItem.MessageItemType; import it.slyce.messaging.message.messageItem.MessageViewHolder;
final MessageGeneralOptionsViewHolder viewHolder = (MessageGeneralOptionsViewHolder) messageViewHolder; final GeneralOptionsMessage generalTextMessage = (GeneralOptionsMessage) message; if (!generalTextMessage.isSelected()) { viewHolder.titleTextView.setText(generalTextMessage.getTitle()); viewHolder.optionsLinearLayout.removeAllViews(); for (int i = 0; i < generalTextMessage.getOptions().length; i++) { String option = generalTextMessage.getOptions()[i]; Button button = new Button(context); button.setText(option); button.getBackground().setColorFilter(ContextCompat.getColor(context, R.color.background_gray_light), PorterDuff.Mode.MULTIPLY); button.setTextColor(Color.BLUE); final int finalI = i; button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { viewHolder.optionsLinearLayout.removeAllViews(); generalTextMessage.setSelected(); String text = generalTextMessage.getOnOptionSelectedListener().onOptionSelected(finalI); viewHolder.titleTextView.setText(text); } }); viewHolder.optionsLinearLayout.addView(button); } } else { viewHolder.titleTextView.setText(generalTextMessage.getFinalText()); viewHolder.optionsLinearLayout.removeAllViews(); } } @Override
// Path: slyce-messaging/src/main/java/it/slyce/messaging/message/MessageSource.java // public enum MessageSource { // LOCAL_USER, // EXTERNAL_USER, // GENERAL // } // // Path: slyce-messaging/src/main/java/it/slyce/messaging/message/messageItem/MessageItemType.java // public enum MessageItemType { // INCOMING_MEDIA, // INCOMING_TEXT, // OUTGOING_MEDIA, // OUTGOING_TEXT, // SPINNER, // GENERAL_TEXT, // GENERAL_OPTIONS; // // public static final MessageItemType values[] = values(); // } // // Path: slyce-messaging/src/main/java/it/slyce/messaging/message/messageItem/MessageViewHolder.java // public class MessageViewHolder extends RecyclerView.ViewHolder { // public ImageView avatar; // public TextView initials; // public TextView timestamp; // public ViewGroup avatarContainer; // public CustomSettings customSettings; // // public MessageViewHolder(View itemView, CustomSettings customSettings) { // super(itemView); // this.customSettings = customSettings; // } // } // Path: slyce-messaging/src/main/java/it/slyce/messaging/message/messageItem/general/generalOptions/MessageGeneralOptionsItem.java import android.content.Context; import android.graphics.Color; import android.graphics.PorterDuff; import android.support.v4.content.ContextCompat; import android.view.View; import android.widget.Button; import it.slyce.messaging.R; import it.slyce.messaging.message.GeneralOptionsMessage; import it.slyce.messaging.message.MessageSource; import it.slyce.messaging.message.messageItem.MessageItem; import it.slyce.messaging.message.messageItem.MessageItemType; import it.slyce.messaging.message.messageItem.MessageViewHolder; final MessageGeneralOptionsViewHolder viewHolder = (MessageGeneralOptionsViewHolder) messageViewHolder; final GeneralOptionsMessage generalTextMessage = (GeneralOptionsMessage) message; if (!generalTextMessage.isSelected()) { viewHolder.titleTextView.setText(generalTextMessage.getTitle()); viewHolder.optionsLinearLayout.removeAllViews(); for (int i = 0; i < generalTextMessage.getOptions().length; i++) { String option = generalTextMessage.getOptions()[i]; Button button = new Button(context); button.setText(option); button.getBackground().setColorFilter(ContextCompat.getColor(context, R.color.background_gray_light), PorterDuff.Mode.MULTIPLY); button.setTextColor(Color.BLUE); final int finalI = i; button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { viewHolder.optionsLinearLayout.removeAllViews(); generalTextMessage.setSelected(); String text = generalTextMessage.getOnOptionSelectedListener().onOptionSelected(finalI); viewHolder.titleTextView.setText(text); } }); viewHolder.optionsLinearLayout.addView(button); } } else { viewHolder.titleTextView.setText(generalTextMessage.getFinalText()); viewHolder.optionsLinearLayout.removeAllViews(); } } @Override
public MessageItemType getMessageItemType() {
Slyce-Inc/SlyceMessaging
slyce-messaging/src/main/java/it/slyce/messaging/message/messageItem/general/generalOptions/MessageGeneralOptionsItem.java
// Path: slyce-messaging/src/main/java/it/slyce/messaging/message/MessageSource.java // public enum MessageSource { // LOCAL_USER, // EXTERNAL_USER, // GENERAL // } // // Path: slyce-messaging/src/main/java/it/slyce/messaging/message/messageItem/MessageItemType.java // public enum MessageItemType { // INCOMING_MEDIA, // INCOMING_TEXT, // OUTGOING_MEDIA, // OUTGOING_TEXT, // SPINNER, // GENERAL_TEXT, // GENERAL_OPTIONS; // // public static final MessageItemType values[] = values(); // } // // Path: slyce-messaging/src/main/java/it/slyce/messaging/message/messageItem/MessageViewHolder.java // public class MessageViewHolder extends RecyclerView.ViewHolder { // public ImageView avatar; // public TextView initials; // public TextView timestamp; // public ViewGroup avatarContainer; // public CustomSettings customSettings; // // public MessageViewHolder(View itemView, CustomSettings customSettings) { // super(itemView); // this.customSettings = customSettings; // } // }
import android.content.Context; import android.graphics.Color; import android.graphics.PorterDuff; import android.support.v4.content.ContextCompat; import android.view.View; import android.widget.Button; import it.slyce.messaging.R; import it.slyce.messaging.message.GeneralOptionsMessage; import it.slyce.messaging.message.MessageSource; import it.slyce.messaging.message.messageItem.MessageItem; import it.slyce.messaging.message.messageItem.MessageItemType; import it.slyce.messaging.message.messageItem.MessageViewHolder;
for (int i = 0; i < generalTextMessage.getOptions().length; i++) { String option = generalTextMessage.getOptions()[i]; Button button = new Button(context); button.setText(option); button.getBackground().setColorFilter(ContextCompat.getColor(context, R.color.background_gray_light), PorterDuff.Mode.MULTIPLY); button.setTextColor(Color.BLUE); final int finalI = i; button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { viewHolder.optionsLinearLayout.removeAllViews(); generalTextMessage.setSelected(); String text = generalTextMessage.getOnOptionSelectedListener().onOptionSelected(finalI); viewHolder.titleTextView.setText(text); } }); viewHolder.optionsLinearLayout.addView(button); } } else { viewHolder.titleTextView.setText(generalTextMessage.getFinalText()); viewHolder.optionsLinearLayout.removeAllViews(); } } @Override public MessageItemType getMessageItemType() { return MessageItemType.GENERAL_OPTIONS; } @Override
// Path: slyce-messaging/src/main/java/it/slyce/messaging/message/MessageSource.java // public enum MessageSource { // LOCAL_USER, // EXTERNAL_USER, // GENERAL // } // // Path: slyce-messaging/src/main/java/it/slyce/messaging/message/messageItem/MessageItemType.java // public enum MessageItemType { // INCOMING_MEDIA, // INCOMING_TEXT, // OUTGOING_MEDIA, // OUTGOING_TEXT, // SPINNER, // GENERAL_TEXT, // GENERAL_OPTIONS; // // public static final MessageItemType values[] = values(); // } // // Path: slyce-messaging/src/main/java/it/slyce/messaging/message/messageItem/MessageViewHolder.java // public class MessageViewHolder extends RecyclerView.ViewHolder { // public ImageView avatar; // public TextView initials; // public TextView timestamp; // public ViewGroup avatarContainer; // public CustomSettings customSettings; // // public MessageViewHolder(View itemView, CustomSettings customSettings) { // super(itemView); // this.customSettings = customSettings; // } // } // Path: slyce-messaging/src/main/java/it/slyce/messaging/message/messageItem/general/generalOptions/MessageGeneralOptionsItem.java import android.content.Context; import android.graphics.Color; import android.graphics.PorterDuff; import android.support.v4.content.ContextCompat; import android.view.View; import android.widget.Button; import it.slyce.messaging.R; import it.slyce.messaging.message.GeneralOptionsMessage; import it.slyce.messaging.message.MessageSource; import it.slyce.messaging.message.messageItem.MessageItem; import it.slyce.messaging.message.messageItem.MessageItemType; import it.slyce.messaging.message.messageItem.MessageViewHolder; for (int i = 0; i < generalTextMessage.getOptions().length; i++) { String option = generalTextMessage.getOptions()[i]; Button button = new Button(context); button.setText(option); button.getBackground().setColorFilter(ContextCompat.getColor(context, R.color.background_gray_light), PorterDuff.Mode.MULTIPLY); button.setTextColor(Color.BLUE); final int finalI = i; button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { viewHolder.optionsLinearLayout.removeAllViews(); generalTextMessage.setSelected(); String text = generalTextMessage.getOnOptionSelectedListener().onOptionSelected(finalI); viewHolder.titleTextView.setText(text); } }); viewHolder.optionsLinearLayout.addView(button); } } else { viewHolder.titleTextView.setText(generalTextMessage.getFinalText()); viewHolder.optionsLinearLayout.removeAllViews(); } } @Override public MessageItemType getMessageItemType() { return MessageItemType.GENERAL_OPTIONS; } @Override
public MessageSource getMessageSource() {
jdbc-json/jdbc-cb
src/main/java/com/couchbase/jdbc/CBDatabaseMetaData.java
// Path: src/main/java/com/couchbase/jdbc/core/CouchMetrics.java // public class CouchMetrics // { // String executionTime; // String elapsedTime; // // long resultCount; // long errorCount; // long resultSize; // long mutationCount; // long warningCount; // // public String getExecutionTime() // { // return executionTime; // } // // public String getElapsedTime() // { // return elapsedTime; // } // // public long getResultCount() // { // return resultCount; // } // // public long getErrorCount() // { // return errorCount; // } // // public long getResultSize() // { // return resultSize; // } // // public long getMutationCount() // { // return mutationCount; // } // // public long getWarningCount() // { // return warningCount; // } // public void setResultCount(int count) // { // resultCount = count; // } // public void setResultSize(int size) // { // resultSize = size; // } // } // // Path: src/main/java/com/couchbase/jdbc/core/CouchResponse.java // public class CouchResponse // { // AtomicBoolean fieldsInitialized = new AtomicBoolean(false); // // Map <String,String> signature=null; // ArrayList<Field> fields; // // List<CouchError> errors; // List<CouchError> warnings; // CouchMetrics metrics; // String requestId; // String status; // List <Map<String,Object>> results; // // // public CouchMetrics getMetrics() // { // return metrics; // } // // // // we don't know which will get called first so set the fields in getFields() // // public void setSignature(Map <String,String> signature) // { // this.signature = signature; // } // // public ArrayList<Field>getFields() // { // // check to make sure we haven't set these yet // if (!fieldsInitialized.getAndSet(true)) // { // if (signature != null) // { // fields = new ArrayList<Field>(signature.size()); // } // // if (signature.containsKey("*") ) // { // if (metrics.getResultSize() > 0) { // Map<String,Object> firstRow = results.get(0); // Set <String>keySet = firstRow.keySet(); // // for (String key : keySet) // { // Object object = firstRow.get(key); // if (object == null ) // { // fields.add( new Field(key, "null")); // } // else // { // Object type = firstRow.get(key); // String jsonType="json"; // // if (type instanceof Number) // jsonType = "number"; // else if ( type instanceof Boolean) // jsonType = "boolean"; // else if ( type instanceof String) // jsonType = "string"; // else if (type instanceof Map ) // jsonType = "json"; // else if ( type instanceof List ) // jsonType = "json"; // // fields.add(new Field(key, jsonType)); // } // } // } // } // else // { // for (String key : signature.keySet()) // { // fields.add(new Field(key, signature.get(key))); // } // } // } // return fields; // } // public List <Map<String,Object>> getResults() // { // return results; // } // public void setResults(List results) // { // //noinspection unchecked // this.results = results; // } // public void setMetrics(CouchMetrics metrics) // { // this.metrics = metrics; // } // public List <CouchError> getWarnings() {return warnings;} // public List <CouchError> getErrors(){return errors;} // // public Map getFirstResult() // { // return (Map)results.get(0); // } // } // // Path: src/main/java/com/couchbase/jdbc/util/StringUtil.java // public class StringUtil { // public static String stripBackquotes(String s) { // if (s == null) { // return s; // } // final String BACKQUOTE = "`"; // // if (s.startsWith(BACKQUOTE) && s.endsWith(BACKQUOTE)) { // return s.substring(1, s.length()-1); // } // return s; // } // }
import com.couchbase.jdbc.core.CouchMetrics; import com.couchbase.jdbc.core.CouchResponse; import com.couchbase.jdbc.util.StringUtil; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; import java.sql.*; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map;
* <LI><B>TABLE_TYPE</B> String =&gt; table type. Typical types are "TABLE", * "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", * "LOCAL TEMPORARY", "ALIAS", "SYNONYM". * </OL> * * @return a <code>ResultSet</code> object in which each row has a * single <code>String</code> column that is a table type * @throws java.sql.SQLException if a database access error occurs */ @Override public ResultSet getTableTypes() throws SQLException { List <Map<String,String>> catalogs = new ArrayList<Map<String,String>>(2); Map <String,String>table = new HashMap<String, String>(); ////SYSTEM; BUCKET; GSI INDEX; VIEW INDEX table.put("TABLE_TYPE","SYSTEM"); catalogs.add(table); table = new HashMap<>(); table.put("TABLE_TYPE", "BUCKET"); catalogs.add(table); table = new HashMap<>(); table.put("TABLE_TYPE", "GSI INDEX"); catalogs.add(table); table = new HashMap<>(); table.put("TABLE_TYPE", "VIEW INDEX"); catalogs.add(table);
// Path: src/main/java/com/couchbase/jdbc/core/CouchMetrics.java // public class CouchMetrics // { // String executionTime; // String elapsedTime; // // long resultCount; // long errorCount; // long resultSize; // long mutationCount; // long warningCount; // // public String getExecutionTime() // { // return executionTime; // } // // public String getElapsedTime() // { // return elapsedTime; // } // // public long getResultCount() // { // return resultCount; // } // // public long getErrorCount() // { // return errorCount; // } // // public long getResultSize() // { // return resultSize; // } // // public long getMutationCount() // { // return mutationCount; // } // // public long getWarningCount() // { // return warningCount; // } // public void setResultCount(int count) // { // resultCount = count; // } // public void setResultSize(int size) // { // resultSize = size; // } // } // // Path: src/main/java/com/couchbase/jdbc/core/CouchResponse.java // public class CouchResponse // { // AtomicBoolean fieldsInitialized = new AtomicBoolean(false); // // Map <String,String> signature=null; // ArrayList<Field> fields; // // List<CouchError> errors; // List<CouchError> warnings; // CouchMetrics metrics; // String requestId; // String status; // List <Map<String,Object>> results; // // // public CouchMetrics getMetrics() // { // return metrics; // } // // // // we don't know which will get called first so set the fields in getFields() // // public void setSignature(Map <String,String> signature) // { // this.signature = signature; // } // // public ArrayList<Field>getFields() // { // // check to make sure we haven't set these yet // if (!fieldsInitialized.getAndSet(true)) // { // if (signature != null) // { // fields = new ArrayList<Field>(signature.size()); // } // // if (signature.containsKey("*") ) // { // if (metrics.getResultSize() > 0) { // Map<String,Object> firstRow = results.get(0); // Set <String>keySet = firstRow.keySet(); // // for (String key : keySet) // { // Object object = firstRow.get(key); // if (object == null ) // { // fields.add( new Field(key, "null")); // } // else // { // Object type = firstRow.get(key); // String jsonType="json"; // // if (type instanceof Number) // jsonType = "number"; // else if ( type instanceof Boolean) // jsonType = "boolean"; // else if ( type instanceof String) // jsonType = "string"; // else if (type instanceof Map ) // jsonType = "json"; // else if ( type instanceof List ) // jsonType = "json"; // // fields.add(new Field(key, jsonType)); // } // } // } // } // else // { // for (String key : signature.keySet()) // { // fields.add(new Field(key, signature.get(key))); // } // } // } // return fields; // } // public List <Map<String,Object>> getResults() // { // return results; // } // public void setResults(List results) // { // //noinspection unchecked // this.results = results; // } // public void setMetrics(CouchMetrics metrics) // { // this.metrics = metrics; // } // public List <CouchError> getWarnings() {return warnings;} // public List <CouchError> getErrors(){return errors;} // // public Map getFirstResult() // { // return (Map)results.get(0); // } // } // // Path: src/main/java/com/couchbase/jdbc/util/StringUtil.java // public class StringUtil { // public static String stripBackquotes(String s) { // if (s == null) { // return s; // } // final String BACKQUOTE = "`"; // // if (s.startsWith(BACKQUOTE) && s.endsWith(BACKQUOTE)) { // return s.substring(1, s.length()-1); // } // return s; // } // } // Path: src/main/java/com/couchbase/jdbc/CBDatabaseMetaData.java import com.couchbase.jdbc.core.CouchMetrics; import com.couchbase.jdbc.core.CouchResponse; import com.couchbase.jdbc.util.StringUtil; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; import java.sql.*; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; * <LI><B>TABLE_TYPE</B> String =&gt; table type. Typical types are "TABLE", * "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", * "LOCAL TEMPORARY", "ALIAS", "SYNONYM". * </OL> * * @return a <code>ResultSet</code> object in which each row has a * single <code>String</code> column that is a table type * @throws java.sql.SQLException if a database access error occurs */ @Override public ResultSet getTableTypes() throws SQLException { List <Map<String,String>> catalogs = new ArrayList<Map<String,String>>(2); Map <String,String>table = new HashMap<String, String>(); ////SYSTEM; BUCKET; GSI INDEX; VIEW INDEX table.put("TABLE_TYPE","SYSTEM"); catalogs.add(table); table = new HashMap<>(); table.put("TABLE_TYPE", "BUCKET"); catalogs.add(table); table = new HashMap<>(); table.put("TABLE_TYPE", "GSI INDEX"); catalogs.add(table); table = new HashMap<>(); table.put("TABLE_TYPE", "VIEW INDEX"); catalogs.add(table);
CouchMetrics metrics = new CouchMetrics();
jdbc-json/jdbc-cb
src/main/java/com/couchbase/jdbc/CBDatabaseMetaData.java
// Path: src/main/java/com/couchbase/jdbc/core/CouchMetrics.java // public class CouchMetrics // { // String executionTime; // String elapsedTime; // // long resultCount; // long errorCount; // long resultSize; // long mutationCount; // long warningCount; // // public String getExecutionTime() // { // return executionTime; // } // // public String getElapsedTime() // { // return elapsedTime; // } // // public long getResultCount() // { // return resultCount; // } // // public long getErrorCount() // { // return errorCount; // } // // public long getResultSize() // { // return resultSize; // } // // public long getMutationCount() // { // return mutationCount; // } // // public long getWarningCount() // { // return warningCount; // } // public void setResultCount(int count) // { // resultCount = count; // } // public void setResultSize(int size) // { // resultSize = size; // } // } // // Path: src/main/java/com/couchbase/jdbc/core/CouchResponse.java // public class CouchResponse // { // AtomicBoolean fieldsInitialized = new AtomicBoolean(false); // // Map <String,String> signature=null; // ArrayList<Field> fields; // // List<CouchError> errors; // List<CouchError> warnings; // CouchMetrics metrics; // String requestId; // String status; // List <Map<String,Object>> results; // // // public CouchMetrics getMetrics() // { // return metrics; // } // // // // we don't know which will get called first so set the fields in getFields() // // public void setSignature(Map <String,String> signature) // { // this.signature = signature; // } // // public ArrayList<Field>getFields() // { // // check to make sure we haven't set these yet // if (!fieldsInitialized.getAndSet(true)) // { // if (signature != null) // { // fields = new ArrayList<Field>(signature.size()); // } // // if (signature.containsKey("*") ) // { // if (metrics.getResultSize() > 0) { // Map<String,Object> firstRow = results.get(0); // Set <String>keySet = firstRow.keySet(); // // for (String key : keySet) // { // Object object = firstRow.get(key); // if (object == null ) // { // fields.add( new Field(key, "null")); // } // else // { // Object type = firstRow.get(key); // String jsonType="json"; // // if (type instanceof Number) // jsonType = "number"; // else if ( type instanceof Boolean) // jsonType = "boolean"; // else if ( type instanceof String) // jsonType = "string"; // else if (type instanceof Map ) // jsonType = "json"; // else if ( type instanceof List ) // jsonType = "json"; // // fields.add(new Field(key, jsonType)); // } // } // } // } // else // { // for (String key : signature.keySet()) // { // fields.add(new Field(key, signature.get(key))); // } // } // } // return fields; // } // public List <Map<String,Object>> getResults() // { // return results; // } // public void setResults(List results) // { // //noinspection unchecked // this.results = results; // } // public void setMetrics(CouchMetrics metrics) // { // this.metrics = metrics; // } // public List <CouchError> getWarnings() {return warnings;} // public List <CouchError> getErrors(){return errors;} // // public Map getFirstResult() // { // return (Map)results.get(0); // } // } // // Path: src/main/java/com/couchbase/jdbc/util/StringUtil.java // public class StringUtil { // public static String stripBackquotes(String s) { // if (s == null) { // return s; // } // final String BACKQUOTE = "`"; // // if (s.startsWith(BACKQUOTE) && s.endsWith(BACKQUOTE)) { // return s.substring(1, s.length()-1); // } // return s; // } // }
import com.couchbase.jdbc.core.CouchMetrics; import com.couchbase.jdbc.core.CouchResponse; import com.couchbase.jdbc.util.StringUtil; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; import java.sql.*; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map;
@Override public ResultSet getTableTypes() throws SQLException { List <Map<String,String>> catalogs = new ArrayList<Map<String,String>>(2); Map <String,String>table = new HashMap<String, String>(); ////SYSTEM; BUCKET; GSI INDEX; VIEW INDEX table.put("TABLE_TYPE","SYSTEM"); catalogs.add(table); table = new HashMap<>(); table.put("TABLE_TYPE", "BUCKET"); catalogs.add(table); table = new HashMap<>(); table.put("TABLE_TYPE", "GSI INDEX"); catalogs.add(table); table = new HashMap<>(); table.put("TABLE_TYPE", "VIEW INDEX"); catalogs.add(table); CouchMetrics metrics = new CouchMetrics(); metrics.setResultCount(table.size()); // this just has to be not 0 metrics.setResultSize(1); @SuppressWarnings("unchecked") Map <String, String> signature = new HashMap(); signature.put("TABLE_TYPE","string");
// Path: src/main/java/com/couchbase/jdbc/core/CouchMetrics.java // public class CouchMetrics // { // String executionTime; // String elapsedTime; // // long resultCount; // long errorCount; // long resultSize; // long mutationCount; // long warningCount; // // public String getExecutionTime() // { // return executionTime; // } // // public String getElapsedTime() // { // return elapsedTime; // } // // public long getResultCount() // { // return resultCount; // } // // public long getErrorCount() // { // return errorCount; // } // // public long getResultSize() // { // return resultSize; // } // // public long getMutationCount() // { // return mutationCount; // } // // public long getWarningCount() // { // return warningCount; // } // public void setResultCount(int count) // { // resultCount = count; // } // public void setResultSize(int size) // { // resultSize = size; // } // } // // Path: src/main/java/com/couchbase/jdbc/core/CouchResponse.java // public class CouchResponse // { // AtomicBoolean fieldsInitialized = new AtomicBoolean(false); // // Map <String,String> signature=null; // ArrayList<Field> fields; // // List<CouchError> errors; // List<CouchError> warnings; // CouchMetrics metrics; // String requestId; // String status; // List <Map<String,Object>> results; // // // public CouchMetrics getMetrics() // { // return metrics; // } // // // // we don't know which will get called first so set the fields in getFields() // // public void setSignature(Map <String,String> signature) // { // this.signature = signature; // } // // public ArrayList<Field>getFields() // { // // check to make sure we haven't set these yet // if (!fieldsInitialized.getAndSet(true)) // { // if (signature != null) // { // fields = new ArrayList<Field>(signature.size()); // } // // if (signature.containsKey("*") ) // { // if (metrics.getResultSize() > 0) { // Map<String,Object> firstRow = results.get(0); // Set <String>keySet = firstRow.keySet(); // // for (String key : keySet) // { // Object object = firstRow.get(key); // if (object == null ) // { // fields.add( new Field(key, "null")); // } // else // { // Object type = firstRow.get(key); // String jsonType="json"; // // if (type instanceof Number) // jsonType = "number"; // else if ( type instanceof Boolean) // jsonType = "boolean"; // else if ( type instanceof String) // jsonType = "string"; // else if (type instanceof Map ) // jsonType = "json"; // else if ( type instanceof List ) // jsonType = "json"; // // fields.add(new Field(key, jsonType)); // } // } // } // } // else // { // for (String key : signature.keySet()) // { // fields.add(new Field(key, signature.get(key))); // } // } // } // return fields; // } // public List <Map<String,Object>> getResults() // { // return results; // } // public void setResults(List results) // { // //noinspection unchecked // this.results = results; // } // public void setMetrics(CouchMetrics metrics) // { // this.metrics = metrics; // } // public List <CouchError> getWarnings() {return warnings;} // public List <CouchError> getErrors(){return errors;} // // public Map getFirstResult() // { // return (Map)results.get(0); // } // } // // Path: src/main/java/com/couchbase/jdbc/util/StringUtil.java // public class StringUtil { // public static String stripBackquotes(String s) { // if (s == null) { // return s; // } // final String BACKQUOTE = "`"; // // if (s.startsWith(BACKQUOTE) && s.endsWith(BACKQUOTE)) { // return s.substring(1, s.length()-1); // } // return s; // } // } // Path: src/main/java/com/couchbase/jdbc/CBDatabaseMetaData.java import com.couchbase.jdbc.core.CouchMetrics; import com.couchbase.jdbc.core.CouchResponse; import com.couchbase.jdbc.util.StringUtil; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; import java.sql.*; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @Override public ResultSet getTableTypes() throws SQLException { List <Map<String,String>> catalogs = new ArrayList<Map<String,String>>(2); Map <String,String>table = new HashMap<String, String>(); ////SYSTEM; BUCKET; GSI INDEX; VIEW INDEX table.put("TABLE_TYPE","SYSTEM"); catalogs.add(table); table = new HashMap<>(); table.put("TABLE_TYPE", "BUCKET"); catalogs.add(table); table = new HashMap<>(); table.put("TABLE_TYPE", "GSI INDEX"); catalogs.add(table); table = new HashMap<>(); table.put("TABLE_TYPE", "VIEW INDEX"); catalogs.add(table); CouchMetrics metrics = new CouchMetrics(); metrics.setResultCount(table.size()); // this just has to be not 0 metrics.setResultSize(1); @SuppressWarnings("unchecked") Map <String, String> signature = new HashMap(); signature.put("TABLE_TYPE","string");
CouchResponse couchResponse = new CouchResponse();
jdbc-json/jdbc-cb
src/test/java/com/couchbase/jdbc/CBDatabaseMetaDataTest.java
// Path: src/main/java/com/couchbase/jdbc/util/Credentials.java // public class Credentials // { // // List <Credential> credentials = new ArrayList<Credential>(); // // public Credentials() // { // } // // public Credentials add(String user, String password) // { // this.credentials.add(new Credential(user,password)); // return this; // } // // private class Credential // { // String user, pass; // // Credential(String user, String password) // { // this.user = user; // this.pass = password; // } // // } // public String toString() // { // return JsonFactory.toJson(credentials); // } // }
import org.junit.After; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import com.couchbase.jdbc.util.Credentials; import junit.framework.TestCase; import java.sql.*; import java.util.Properties;
/* * // Copyright (c) 2015 Couchbase, Inc. * // Licensed 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 com.couchbase.jdbc; /** * Created by davec on 2015-09-09. */ @RunWith(JUnit4.class) public class CBDatabaseMetaDataTest extends TestCase { public Connection con; public static Properties properties; DatabaseMetaData dbmd; @BeforeClass public static void initialize() throws Exception { CBDatabaseMetaDataTest.properties = new Properties(); properties.put(ConnectionParameters.SCAN_CONSISTENCY,"request_plus"); properties.put(ConnectionParameters.USER,TestUtil.getUser()); properties.put(ConnectionParameters.PASSWORD,TestUtil.getPassword());
// Path: src/main/java/com/couchbase/jdbc/util/Credentials.java // public class Credentials // { // // List <Credential> credentials = new ArrayList<Credential>(); // // public Credentials() // { // } // // public Credentials add(String user, String password) // { // this.credentials.add(new Credential(user,password)); // return this; // } // // private class Credential // { // String user, pass; // // Credential(String user, String password) // { // this.user = user; // this.pass = password; // } // // } // public String toString() // { // return JsonFactory.toJson(credentials); // } // } // Path: src/test/java/com/couchbase/jdbc/CBDatabaseMetaDataTest.java import org.junit.After; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import com.couchbase.jdbc.util.Credentials; import junit.framework.TestCase; import java.sql.*; import java.util.Properties; /* * // Copyright (c) 2015 Couchbase, Inc. * // Licensed 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 com.couchbase.jdbc; /** * Created by davec on 2015-09-09. */ @RunWith(JUnit4.class) public class CBDatabaseMetaDataTest extends TestCase { public Connection con; public static Properties properties; DatabaseMetaData dbmd; @BeforeClass public static void initialize() throws Exception { CBDatabaseMetaDataTest.properties = new Properties(); properties.put(ConnectionParameters.SCAN_CONSISTENCY,"request_plus"); properties.put(ConnectionParameters.USER,TestUtil.getUser()); properties.put(ConnectionParameters.PASSWORD,TestUtil.getPassword());
Credentials cred = new Credentials();
jdbc-json/jdbc-cb
src/test/java/com/couchbase/jdbc/SSLConnectionTest.java
// Path: src/main/java/com/couchbase/jdbc/ConnectionParameters.java // public class ConnectionParameters // { // public final static String CONNECTION_TIMEOUT="connectionTimeout"; // public final static String USER="user"; // public final static String PASSWORD="password"; // public final static String SCAN_CONSISTENCY="ScanConsistency"; // public final static String ENABLE_SSL="EnableSSL"; // public final static String REDUNDANCY="Redundancy"; // public final static String SSL_CERTIFICATE="SSLCertificate"; // }
import com.couchbase.jdbc.ConnectionParameters; import junit.framework.TestCase; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import java.sql.ResultSet; import java.sql.Statement; import java.sql.Connection; import java.sql.DriverManager; import java.util.Properties;
/* * // Copyright (c) 2015 Couchbase, Inc. * // Licensed 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 com.couchbase.jdbc; /** * Created by davec on 2015-09-10. */ @RunWith(JUnit4.class) public class SSLConnectionTest extends TestCase { @Test public void openConnection() throws Exception { Properties properties = new Properties();
// Path: src/main/java/com/couchbase/jdbc/ConnectionParameters.java // public class ConnectionParameters // { // public final static String CONNECTION_TIMEOUT="connectionTimeout"; // public final static String USER="user"; // public final static String PASSWORD="password"; // public final static String SCAN_CONSISTENCY="ScanConsistency"; // public final static String ENABLE_SSL="EnableSSL"; // public final static String REDUNDANCY="Redundancy"; // public final static String SSL_CERTIFICATE="SSLCertificate"; // } // Path: src/test/java/com/couchbase/jdbc/SSLConnectionTest.java import com.couchbase.jdbc.ConnectionParameters; import junit.framework.TestCase; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import java.sql.ResultSet; import java.sql.Statement; import java.sql.Connection; import java.sql.DriverManager; import java.util.Properties; /* * // Copyright (c) 2015 Couchbase, Inc. * // Licensed 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 com.couchbase.jdbc; /** * Created by davec on 2015-09-10. */ @RunWith(JUnit4.class) public class SSLConnectionTest extends TestCase { @Test public void openConnection() throws Exception { Properties properties = new Properties();
properties.put(ConnectionParameters.SCAN_CONSISTENCY,"request_plus");
jdbc-json/jdbc-cb
examples/UseCredentials.java
// Path: src/main/java/com/couchbase/jdbc/util/Credentials.java // public class Credentials // { // // List <Credential> credentials = new ArrayList<Credential>(); // // public Credentials() // { // } // // public Credentials add(String user, String password) // { // this.credentials.add(new Credential(user,password)); // return this; // } // // private class Credential // { // String user, pass; // // Credential(String user, String password) // { // this.user = user; // this.pass = password; // } // // } // public String toString() // { // return JsonFactory.toJson(credentials); // } // }
import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; import java.util.Properties; import com.couchbase.jdbc.util.Credentials;
package com.couchbase.jdbc.examples; /* * This example shows how to provide per-bucket credentials (passwords) * through the Couchbase JDBC driver. * * Initially, this code will not work. It requires some setup. * First create two buckets, rb1 and rb2. Then use the CBQ tool to create primary indexes on both * buckets. Finally add passwords rb1p and rb2p on the two buckets. * The code will then run correctly. * * Instead of supplying both per-bucket passwords, you can supply the Administrator * and admin password instead. That overrides the per-bucket passwords. */ public class UseCredentials { static String ConnectionURL = "jdbc:couchbase://localhost:8093"; public static void main(String[] args) throws Exception {
// Path: src/main/java/com/couchbase/jdbc/util/Credentials.java // public class Credentials // { // // List <Credential> credentials = new ArrayList<Credential>(); // // public Credentials() // { // } // // public Credentials add(String user, String password) // { // this.credentials.add(new Credential(user,password)); // return this; // } // // private class Credential // { // String user, pass; // // Credential(String user, String password) // { // this.user = user; // this.pass = password; // } // // } // public String toString() // { // return JsonFactory.toJson(credentials); // } // } // Path: examples/UseCredentials.java import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; import java.util.Properties; import com.couchbase.jdbc.util.Credentials; package com.couchbase.jdbc.examples; /* * This example shows how to provide per-bucket credentials (passwords) * through the Couchbase JDBC driver. * * Initially, this code will not work. It requires some setup. * First create two buckets, rb1 and rb2. Then use the CBQ tool to create primary indexes on both * buckets. Finally add passwords rb1p and rb2p on the two buckets. * The code will then run correctly. * * Instead of supplying both per-bucket passwords, you can supply the Administrator * and admin password instead. That overrides the per-bucket passwords. */ public class UseCredentials { static String ConnectionURL = "jdbc:couchbase://localhost:8093"; public static void main(String[] args) throws Exception {
Credentials cred = new Credentials();
jdbc-json/jdbc-cb
src/test/java/com/couchbase/jdbc/TestUtil.java
// Path: src/main/java/com/couchbase/jdbc/util/Credentials.java // public class Credentials // { // // List <Credential> credentials = new ArrayList<Credential>(); // // public Credentials() // { // } // // public Credentials add(String user, String password) // { // this.credentials.add(new Credential(user,password)); // return this; // } // // private class Credential // { // String user, pass; // // Credential(String user, String password) // { // this.user = user; // this.pass = password; // } // // } // public String toString() // { // return JsonFactory.toJson(credentials); // } // }
import com.couchbase.jdbc.util.Credentials; import java.io.InputStream; import java.util.*;
public static String getPort() { return environment.getProperty("couchbasedb.test.port", "8093"); } public static String getDatabase() { return environment.getProperty("couchbasedb.test.db", "test"); } public static Properties getProperties() { Properties props = new Properties(); props.setProperty("user", getUser()); props.setProperty("password", getPassword()); return props; } public static void setRebalancePermission(){ rebalanceInAllowed = true; } public static String getUser() { return environment.getProperty("couchbasedb.test.user", "Administrator"); } public static String getPassword() { return environment.getProperty("couchbasedb.test.password", "password"); }
// Path: src/main/java/com/couchbase/jdbc/util/Credentials.java // public class Credentials // { // // List <Credential> credentials = new ArrayList<Credential>(); // // public Credentials() // { // } // // public Credentials add(String user, String password) // { // this.credentials.add(new Credential(user,password)); // return this; // } // // private class Credential // { // String user, pass; // // Credential(String user, String password) // { // this.user = user; // this.pass = password; // } // // } // public String toString() // { // return JsonFactory.toJson(credentials); // } // } // Path: src/test/java/com/couchbase/jdbc/TestUtil.java import com.couchbase.jdbc.util.Credentials; import java.io.InputStream; import java.util.*; public static String getPort() { return environment.getProperty("couchbasedb.test.port", "8093"); } public static String getDatabase() { return environment.getProperty("couchbasedb.test.db", "test"); } public static Properties getProperties() { Properties props = new Properties(); props.setProperty("user", getUser()); props.setProperty("password", getPassword()); return props; } public static void setRebalancePermission(){ rebalanceInAllowed = true; } public static String getUser() { return environment.getProperty("couchbasedb.test.user", "Administrator"); } public static String getPassword() { return environment.getProperty("couchbasedb.test.password", "password"); }
public static Credentials getCredentials() {
jdbc-json/jdbc-cb
src/test/java/com/couchbase/jdbc/CouchBaseTestCase.java
// Path: src/main/java/com/couchbase/jdbc/ConnectionParameters.java // public class ConnectionParameters // { // public final static String CONNECTION_TIMEOUT="connectionTimeout"; // public final static String USER="user"; // public final static String PASSWORD="password"; // public final static String SCAN_CONSISTENCY="ScanConsistency"; // public final static String ENABLE_SSL="EnableSSL"; // public final static String REDUNDANCY="Redundancy"; // public final static String SSL_CERTIFICATE="SSLCertificate"; // }
import com.couchbase.jdbc.ConnectionParameters; import junit.framework.TestCase; import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Before; import java.sql.Connection; import java.sql.DriverManager; import java.util.Properties;
/* * // Copyright (c) 2015 Couchbase, Inc. * // Licensed 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 com.couchbase.jdbc; /** * Created by davec on 2015-09-08. */ @Ignore // Do not run this class, since it has no test methods of its own. Run tests derived from it, instead. public class CouchBaseTestCase extends TestCase { public Connection con; public static Properties properties; @BeforeClass public static void initialize() throws Exception { CouchBaseTestCase.properties = new Properties();
// Path: src/main/java/com/couchbase/jdbc/ConnectionParameters.java // public class ConnectionParameters // { // public final static String CONNECTION_TIMEOUT="connectionTimeout"; // public final static String USER="user"; // public final static String PASSWORD="password"; // public final static String SCAN_CONSISTENCY="ScanConsistency"; // public final static String ENABLE_SSL="EnableSSL"; // public final static String REDUNDANCY="Redundancy"; // public final static String SSL_CERTIFICATE="SSLCertificate"; // } // Path: src/test/java/com/couchbase/jdbc/CouchBaseTestCase.java import com.couchbase.jdbc.ConnectionParameters; import junit.framework.TestCase; import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Before; import java.sql.Connection; import java.sql.DriverManager; import java.util.Properties; /* * // Copyright (c) 2015 Couchbase, Inc. * // Licensed 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 com.couchbase.jdbc; /** * Created by davec on 2015-09-08. */ @Ignore // Do not run this class, since it has no test methods of its own. Run tests derived from it, instead. public class CouchBaseTestCase extends TestCase { public Connection con; public static Properties properties; @BeforeClass public static void initialize() throws Exception { CouchBaseTestCase.properties = new Properties();
properties.put(ConnectionParameters.SCAN_CONSISTENCY,"request_plus");
jdbc-json/jdbc-cb
src/main/java/com/couchbase/jdbc/core/Field.java
// Path: src/main/java/com/couchbase/jdbc/util/JSONTypes.java // public class JSONTypes // { // final static public int JSON_NUMBER = 0; // final static public int JSON_STRING = 1; // final static public int JSON_BOOLEAN = 2; // final static public int JSON_ARRAY = 3; // final static public int JSON_MAP = 4; // final static public int JSON_OBJECT = 5; // final static public int JSON_NULL = 6; // // static public Map<String, Integer> jsonTypes = new HashMap<String, Integer>(); // // static { // jsonTypes.put("number",JSON_NUMBER); // jsonTypes.put("string",JSON_STRING); // jsonTypes.put("boolean",JSON_BOOLEAN); // jsonTypes.put("array",JSON_ARRAY); // jsonTypes.put("map",JSON_MAP); // jsonTypes.put("object",JSON_OBJECT); // jsonTypes.put("json",JSON_OBJECT); // jsonTypes.put("null",JSON_NULL); // } // // static public Map <String, Integer> jdbcTypes = new HashMap<String, Integer>(); // // static { // jdbcTypes.put("number", Types.NUMERIC); // jdbcTypes.put("string", Types.VARCHAR); // jdbcTypes.put("boolean", Types.BOOLEAN); // jdbcTypes.put("array", Types.ARRAY); // jdbcTypes.put("map", Types.JAVA_OBJECT); //?? // jdbcTypes.put("object", Types.JAVA_OBJECT); // jdbcTypes.put("json", Types.JAVA_OBJECT); // jdbcTypes.put("null", Types.NULL); // // } // }
import com.couchbase.jdbc.util.JSONTypes;
public void setType(String type) { if (type.equalsIgnoreCase("true") || type.equalsIgnoreCase("false") ) { this.type="boolean"; } else if (type.equalsIgnoreCase("null")) { this.type="unknown"; } else { this.type = type; } } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getSqlType() {
// Path: src/main/java/com/couchbase/jdbc/util/JSONTypes.java // public class JSONTypes // { // final static public int JSON_NUMBER = 0; // final static public int JSON_STRING = 1; // final static public int JSON_BOOLEAN = 2; // final static public int JSON_ARRAY = 3; // final static public int JSON_MAP = 4; // final static public int JSON_OBJECT = 5; // final static public int JSON_NULL = 6; // // static public Map<String, Integer> jsonTypes = new HashMap<String, Integer>(); // // static { // jsonTypes.put("number",JSON_NUMBER); // jsonTypes.put("string",JSON_STRING); // jsonTypes.put("boolean",JSON_BOOLEAN); // jsonTypes.put("array",JSON_ARRAY); // jsonTypes.put("map",JSON_MAP); // jsonTypes.put("object",JSON_OBJECT); // jsonTypes.put("json",JSON_OBJECT); // jsonTypes.put("null",JSON_NULL); // } // // static public Map <String, Integer> jdbcTypes = new HashMap<String, Integer>(); // // static { // jdbcTypes.put("number", Types.NUMERIC); // jdbcTypes.put("string", Types.VARCHAR); // jdbcTypes.put("boolean", Types.BOOLEAN); // jdbcTypes.put("array", Types.ARRAY); // jdbcTypes.put("map", Types.JAVA_OBJECT); //?? // jdbcTypes.put("object", Types.JAVA_OBJECT); // jdbcTypes.put("json", Types.JAVA_OBJECT); // jdbcTypes.put("null", Types.NULL); // // } // } // Path: src/main/java/com/couchbase/jdbc/core/Field.java import com.couchbase.jdbc.util.JSONTypes; public void setType(String type) { if (type.equalsIgnoreCase("true") || type.equalsIgnoreCase("false") ) { this.type="boolean"; } else if (type.equalsIgnoreCase("null")) { this.type="unknown"; } else { this.type = type; } } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getSqlType() {
return JSONTypes.jdbcTypes.get(type);
jamel/j7zip
src/main/java/org/jamel/j7zip/ArchiveExtractCallback.java
// Path: src/main/java/org/jamel/j7zip/archive/IArchiveExtractCallback.java // public interface IArchiveExtractCallback { // // // getStream OUT: OK - OK, FALSE - skip this file // OutputStream getStream(SevenZipEntry item) throws IOException; // // void setOperationResult(IInArchive.OperationResult resultEOperationResult); // // int getNumErrors(); // // IInArchive.AskMode getAskMode(); // } // // Path: src/main/java/org/jamel/j7zip/archive/IInArchive.java // public interface IInArchive { // public static enum AskMode {EXTRACT, TEST, SKIP} // // public static enum OperationResult {OK, UNSUPPORTED_METHOD, DATA_ERROR, CRC_ERROR} // // // Static-SFX (for Linux) can be big. // public final long kMaxCheckStartPosition = 1 << 22; // // SevenZipEntry getEntry(int index); // // int size(); // // void close() throws IOException; // // Result extract(int[] indices, IArchiveExtractCallback extractCallbackSpec) throws IOException; // // Result open(IInStream stream) throws IOException; // // Result open(IInStream stream, long maxCheckStartPosition) throws IOException; // // // } // // Path: src/main/java/org/jamel/j7zip/archive/SevenZipEntry.java // public class SevenZipEntry { // // private final long LastWriteTime; // private final long UnPackSize; // private final long PackSize; // private final int Attributes; // private final long FileCRC; // private final boolean IsDirectory; // private final String Name; // private final long Position; // // // public SevenZipEntry(String name, long packSize, long unPackSize, long crc, long lastWriteTime, // long position, boolean isDir, int att) // { // this.Name = name; // this.PackSize = packSize; // this.UnPackSize = unPackSize; // this.FileCRC = crc; // this.LastWriteTime = lastWriteTime; // this.Position = position; // this.IsDirectory = isDir; // this.Attributes = att; // } // // public long getCompressedSize() { // return PackSize; // } // // public long getSize() { // return UnPackSize; // } // // public long getCrc() { // return FileCRC; // } // // public String getName() { // return Name; // } // // public long getTime() { // return LastWriteTime; // } // // public long getPosition() { // return Position; // } // // public boolean isDirectory() { // return IsDirectory; // } // // static final String kEmptyAttributeChar = "."; // static final String kDirectoryAttributeChar = "D"; // static final String kReadonlyAttributeChar = "R"; // static final String kHiddenAttributeChar = "H"; // static final String kSystemAttributeChar = "S"; // static final String kArchiveAttributeChar = "A"; // static public final int FILE_ATTRIBUTE_READONLY = 0x00000001; // static public final int FILE_ATTRIBUTE_HIDDEN = 0x00000002; // static public final int FILE_ATTRIBUTE_SYSTEM = 0x00000004; // static public final int FILE_ATTRIBUTE_DIRECTORY = 0x00000010; // static public final int FILE_ATTRIBUTE_ARCHIVE = 0x00000020; // // public String getAttributesString() { // String ret = ""; // ret += ((Attributes & FILE_ATTRIBUTE_DIRECTORY) != 0 || IsDirectory) ? // kDirectoryAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_READONLY) != 0) ? // kReadonlyAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_HIDDEN) != 0) ? // kHiddenAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_SYSTEM) != 0) ? // kSystemAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_ARCHIVE) != 0) ? // kArchiveAttributeChar : kEmptyAttributeChar; // return ret; // } // }
import java.io.File; import java.io.IOException; import java.io.OutputStream; import org.jamel.j7zip.archive.IArchiveExtractCallback; import org.jamel.j7zip.archive.IInArchive; import org.jamel.j7zip.archive.SevenZipEntry; import org.slf4j.Logger; import org.slf4j.LoggerFactory;
package org.jamel.j7zip; public class ArchiveExtractCallback implements IArchiveExtractCallback { private static final Logger logger = LoggerFactory.getLogger(ArchiveExtractCallback.class); private int numErrors; private final File outDir; public ArchiveExtractCallback(File outDir) { this.outDir = outDir; } public ArchiveExtractCallback() { outDir = null; } public int getNumErrors() { return numErrors; } @Override
// Path: src/main/java/org/jamel/j7zip/archive/IArchiveExtractCallback.java // public interface IArchiveExtractCallback { // // // getStream OUT: OK - OK, FALSE - skip this file // OutputStream getStream(SevenZipEntry item) throws IOException; // // void setOperationResult(IInArchive.OperationResult resultEOperationResult); // // int getNumErrors(); // // IInArchive.AskMode getAskMode(); // } // // Path: src/main/java/org/jamel/j7zip/archive/IInArchive.java // public interface IInArchive { // public static enum AskMode {EXTRACT, TEST, SKIP} // // public static enum OperationResult {OK, UNSUPPORTED_METHOD, DATA_ERROR, CRC_ERROR} // // // Static-SFX (for Linux) can be big. // public final long kMaxCheckStartPosition = 1 << 22; // // SevenZipEntry getEntry(int index); // // int size(); // // void close() throws IOException; // // Result extract(int[] indices, IArchiveExtractCallback extractCallbackSpec) throws IOException; // // Result open(IInStream stream) throws IOException; // // Result open(IInStream stream, long maxCheckStartPosition) throws IOException; // // // } // // Path: src/main/java/org/jamel/j7zip/archive/SevenZipEntry.java // public class SevenZipEntry { // // private final long LastWriteTime; // private final long UnPackSize; // private final long PackSize; // private final int Attributes; // private final long FileCRC; // private final boolean IsDirectory; // private final String Name; // private final long Position; // // // public SevenZipEntry(String name, long packSize, long unPackSize, long crc, long lastWriteTime, // long position, boolean isDir, int att) // { // this.Name = name; // this.PackSize = packSize; // this.UnPackSize = unPackSize; // this.FileCRC = crc; // this.LastWriteTime = lastWriteTime; // this.Position = position; // this.IsDirectory = isDir; // this.Attributes = att; // } // // public long getCompressedSize() { // return PackSize; // } // // public long getSize() { // return UnPackSize; // } // // public long getCrc() { // return FileCRC; // } // // public String getName() { // return Name; // } // // public long getTime() { // return LastWriteTime; // } // // public long getPosition() { // return Position; // } // // public boolean isDirectory() { // return IsDirectory; // } // // static final String kEmptyAttributeChar = "."; // static final String kDirectoryAttributeChar = "D"; // static final String kReadonlyAttributeChar = "R"; // static final String kHiddenAttributeChar = "H"; // static final String kSystemAttributeChar = "S"; // static final String kArchiveAttributeChar = "A"; // static public final int FILE_ATTRIBUTE_READONLY = 0x00000001; // static public final int FILE_ATTRIBUTE_HIDDEN = 0x00000002; // static public final int FILE_ATTRIBUTE_SYSTEM = 0x00000004; // static public final int FILE_ATTRIBUTE_DIRECTORY = 0x00000010; // static public final int FILE_ATTRIBUTE_ARCHIVE = 0x00000020; // // public String getAttributesString() { // String ret = ""; // ret += ((Attributes & FILE_ATTRIBUTE_DIRECTORY) != 0 || IsDirectory) ? // kDirectoryAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_READONLY) != 0) ? // kReadonlyAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_HIDDEN) != 0) ? // kHiddenAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_SYSTEM) != 0) ? // kSystemAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_ARCHIVE) != 0) ? // kArchiveAttributeChar : kEmptyAttributeChar; // return ret; // } // } // Path: src/main/java/org/jamel/j7zip/ArchiveExtractCallback.java import java.io.File; import java.io.IOException; import java.io.OutputStream; import org.jamel.j7zip.archive.IArchiveExtractCallback; import org.jamel.j7zip.archive.IInArchive; import org.jamel.j7zip.archive.SevenZipEntry; import org.slf4j.Logger; import org.slf4j.LoggerFactory; package org.jamel.j7zip; public class ArchiveExtractCallback implements IArchiveExtractCallback { private static final Logger logger = LoggerFactory.getLogger(ArchiveExtractCallback.class); private int numErrors; private final File outDir; public ArchiveExtractCallback(File outDir) { this.outDir = outDir; } public ArchiveExtractCallback() { outDir = null; } public int getNumErrors() { return numErrors; } @Override
public IInArchive.AskMode getAskMode() {
jamel/j7zip
src/main/java/org/jamel/j7zip/ArchiveExtractCallback.java
// Path: src/main/java/org/jamel/j7zip/archive/IArchiveExtractCallback.java // public interface IArchiveExtractCallback { // // // getStream OUT: OK - OK, FALSE - skip this file // OutputStream getStream(SevenZipEntry item) throws IOException; // // void setOperationResult(IInArchive.OperationResult resultEOperationResult); // // int getNumErrors(); // // IInArchive.AskMode getAskMode(); // } // // Path: src/main/java/org/jamel/j7zip/archive/IInArchive.java // public interface IInArchive { // public static enum AskMode {EXTRACT, TEST, SKIP} // // public static enum OperationResult {OK, UNSUPPORTED_METHOD, DATA_ERROR, CRC_ERROR} // // // Static-SFX (for Linux) can be big. // public final long kMaxCheckStartPosition = 1 << 22; // // SevenZipEntry getEntry(int index); // // int size(); // // void close() throws IOException; // // Result extract(int[] indices, IArchiveExtractCallback extractCallbackSpec) throws IOException; // // Result open(IInStream stream) throws IOException; // // Result open(IInStream stream, long maxCheckStartPosition) throws IOException; // // // } // // Path: src/main/java/org/jamel/j7zip/archive/SevenZipEntry.java // public class SevenZipEntry { // // private final long LastWriteTime; // private final long UnPackSize; // private final long PackSize; // private final int Attributes; // private final long FileCRC; // private final boolean IsDirectory; // private final String Name; // private final long Position; // // // public SevenZipEntry(String name, long packSize, long unPackSize, long crc, long lastWriteTime, // long position, boolean isDir, int att) // { // this.Name = name; // this.PackSize = packSize; // this.UnPackSize = unPackSize; // this.FileCRC = crc; // this.LastWriteTime = lastWriteTime; // this.Position = position; // this.IsDirectory = isDir; // this.Attributes = att; // } // // public long getCompressedSize() { // return PackSize; // } // // public long getSize() { // return UnPackSize; // } // // public long getCrc() { // return FileCRC; // } // // public String getName() { // return Name; // } // // public long getTime() { // return LastWriteTime; // } // // public long getPosition() { // return Position; // } // // public boolean isDirectory() { // return IsDirectory; // } // // static final String kEmptyAttributeChar = "."; // static final String kDirectoryAttributeChar = "D"; // static final String kReadonlyAttributeChar = "R"; // static final String kHiddenAttributeChar = "H"; // static final String kSystemAttributeChar = "S"; // static final String kArchiveAttributeChar = "A"; // static public final int FILE_ATTRIBUTE_READONLY = 0x00000001; // static public final int FILE_ATTRIBUTE_HIDDEN = 0x00000002; // static public final int FILE_ATTRIBUTE_SYSTEM = 0x00000004; // static public final int FILE_ATTRIBUTE_DIRECTORY = 0x00000010; // static public final int FILE_ATTRIBUTE_ARCHIVE = 0x00000020; // // public String getAttributesString() { // String ret = ""; // ret += ((Attributes & FILE_ATTRIBUTE_DIRECTORY) != 0 || IsDirectory) ? // kDirectoryAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_READONLY) != 0) ? // kReadonlyAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_HIDDEN) != 0) ? // kHiddenAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_SYSTEM) != 0) ? // kSystemAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_ARCHIVE) != 0) ? // kArchiveAttributeChar : kEmptyAttributeChar; // return ret; // } // }
import java.io.File; import java.io.IOException; import java.io.OutputStream; import org.jamel.j7zip.archive.IArchiveExtractCallback; import org.jamel.j7zip.archive.IInArchive; import org.jamel.j7zip.archive.SevenZipEntry; import org.slf4j.Logger; import org.slf4j.LoggerFactory;
public int getNumErrors() { return numErrors; } @Override public IInArchive.AskMode getAskMode() { return IInArchive.AskMode.EXTRACT; } public void setOperationResult(IInArchive.OperationResult operationResult) { if (operationResult != IInArchive.OperationResult.OK) { numErrors++; switch (operationResult) { case UNSUPPORTED_METHOD: logger.error("Unsupported Method"); break; case CRC_ERROR: logger.error("CRC Failed"); break; case DATA_ERROR: logger.error("Data Error"); break; default: logger.error("Unknown Error"); break; } } }
// Path: src/main/java/org/jamel/j7zip/archive/IArchiveExtractCallback.java // public interface IArchiveExtractCallback { // // // getStream OUT: OK - OK, FALSE - skip this file // OutputStream getStream(SevenZipEntry item) throws IOException; // // void setOperationResult(IInArchive.OperationResult resultEOperationResult); // // int getNumErrors(); // // IInArchive.AskMode getAskMode(); // } // // Path: src/main/java/org/jamel/j7zip/archive/IInArchive.java // public interface IInArchive { // public static enum AskMode {EXTRACT, TEST, SKIP} // // public static enum OperationResult {OK, UNSUPPORTED_METHOD, DATA_ERROR, CRC_ERROR} // // // Static-SFX (for Linux) can be big. // public final long kMaxCheckStartPosition = 1 << 22; // // SevenZipEntry getEntry(int index); // // int size(); // // void close() throws IOException; // // Result extract(int[] indices, IArchiveExtractCallback extractCallbackSpec) throws IOException; // // Result open(IInStream stream) throws IOException; // // Result open(IInStream stream, long maxCheckStartPosition) throws IOException; // // // } // // Path: src/main/java/org/jamel/j7zip/archive/SevenZipEntry.java // public class SevenZipEntry { // // private final long LastWriteTime; // private final long UnPackSize; // private final long PackSize; // private final int Attributes; // private final long FileCRC; // private final boolean IsDirectory; // private final String Name; // private final long Position; // // // public SevenZipEntry(String name, long packSize, long unPackSize, long crc, long lastWriteTime, // long position, boolean isDir, int att) // { // this.Name = name; // this.PackSize = packSize; // this.UnPackSize = unPackSize; // this.FileCRC = crc; // this.LastWriteTime = lastWriteTime; // this.Position = position; // this.IsDirectory = isDir; // this.Attributes = att; // } // // public long getCompressedSize() { // return PackSize; // } // // public long getSize() { // return UnPackSize; // } // // public long getCrc() { // return FileCRC; // } // // public String getName() { // return Name; // } // // public long getTime() { // return LastWriteTime; // } // // public long getPosition() { // return Position; // } // // public boolean isDirectory() { // return IsDirectory; // } // // static final String kEmptyAttributeChar = "."; // static final String kDirectoryAttributeChar = "D"; // static final String kReadonlyAttributeChar = "R"; // static final String kHiddenAttributeChar = "H"; // static final String kSystemAttributeChar = "S"; // static final String kArchiveAttributeChar = "A"; // static public final int FILE_ATTRIBUTE_READONLY = 0x00000001; // static public final int FILE_ATTRIBUTE_HIDDEN = 0x00000002; // static public final int FILE_ATTRIBUTE_SYSTEM = 0x00000004; // static public final int FILE_ATTRIBUTE_DIRECTORY = 0x00000010; // static public final int FILE_ATTRIBUTE_ARCHIVE = 0x00000020; // // public String getAttributesString() { // String ret = ""; // ret += ((Attributes & FILE_ATTRIBUTE_DIRECTORY) != 0 || IsDirectory) ? // kDirectoryAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_READONLY) != 0) ? // kReadonlyAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_HIDDEN) != 0) ? // kHiddenAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_SYSTEM) != 0) ? // kSystemAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_ARCHIVE) != 0) ? // kArchiveAttributeChar : kEmptyAttributeChar; // return ret; // } // } // Path: src/main/java/org/jamel/j7zip/ArchiveExtractCallback.java import java.io.File; import java.io.IOException; import java.io.OutputStream; import org.jamel.j7zip.archive.IArchiveExtractCallback; import org.jamel.j7zip.archive.IInArchive; import org.jamel.j7zip.archive.SevenZipEntry; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public int getNumErrors() { return numErrors; } @Override public IInArchive.AskMode getAskMode() { return IInArchive.AskMode.EXTRACT; } public void setOperationResult(IInArchive.OperationResult operationResult) { if (operationResult != IInArchive.OperationResult.OK) { numErrors++; switch (operationResult) { case UNSUPPORTED_METHOD: logger.error("Unsupported Method"); break; case CRC_ERROR: logger.error("CRC Failed"); break; case DATA_ERROR: logger.error("Data Error"); break; default: logger.error("Unknown Error"); break; } } }
public OutputStream getStream(SevenZipEntry item) throws IOException {
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/sevenZip/Handler.java
// Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // // Path: src/main/java/org/jamel/j7zip/archive/IArchiveExtractCallback.java // public interface IArchiveExtractCallback { // // // getStream OUT: OK - OK, FALSE - skip this file // OutputStream getStream(SevenZipEntry item) throws IOException; // // void setOperationResult(IInArchive.OperationResult resultEOperationResult); // // int getNumErrors(); // // IInArchive.AskMode getAskMode(); // } // // Path: src/main/java/org/jamel/j7zip/archive/IInArchive.java // public interface IInArchive { // public static enum AskMode {EXTRACT, TEST, SKIP} // // public static enum OperationResult {OK, UNSUPPORTED_METHOD, DATA_ERROR, CRC_ERROR} // // // Static-SFX (for Linux) can be big. // public final long kMaxCheckStartPosition = 1 << 22; // // SevenZipEntry getEntry(int index); // // int size(); // // void close() throws IOException; // // Result extract(int[] indices, IArchiveExtractCallback extractCallbackSpec) throws IOException; // // Result open(IInStream stream) throws IOException; // // Result open(IInStream stream, long maxCheckStartPosition) throws IOException; // // // } // // Path: src/main/java/org/jamel/j7zip/archive/SevenZipEntry.java // public class SevenZipEntry { // // private final long LastWriteTime; // private final long UnPackSize; // private final long PackSize; // private final int Attributes; // private final long FileCRC; // private final boolean IsDirectory; // private final String Name; // private final long Position; // // // public SevenZipEntry(String name, long packSize, long unPackSize, long crc, long lastWriteTime, // long position, boolean isDir, int att) // { // this.Name = name; // this.PackSize = packSize; // this.UnPackSize = unPackSize; // this.FileCRC = crc; // this.LastWriteTime = lastWriteTime; // this.Position = position; // this.IsDirectory = isDir; // this.Attributes = att; // } // // public long getCompressedSize() { // return PackSize; // } // // public long getSize() { // return UnPackSize; // } // // public long getCrc() { // return FileCRC; // } // // public String getName() { // return Name; // } // // public long getTime() { // return LastWriteTime; // } // // public long getPosition() { // return Position; // } // // public boolean isDirectory() { // return IsDirectory; // } // // static final String kEmptyAttributeChar = "."; // static final String kDirectoryAttributeChar = "D"; // static final String kReadonlyAttributeChar = "R"; // static final String kHiddenAttributeChar = "H"; // static final String kSystemAttributeChar = "S"; // static final String kArchiveAttributeChar = "A"; // static public final int FILE_ATTRIBUTE_READONLY = 0x00000001; // static public final int FILE_ATTRIBUTE_HIDDEN = 0x00000002; // static public final int FILE_ATTRIBUTE_SYSTEM = 0x00000004; // static public final int FILE_ATTRIBUTE_DIRECTORY = 0x00000010; // static public final int FILE_ATTRIBUTE_ARCHIVE = 0x00000020; // // public String getAttributesString() { // String ret = ""; // ret += ((Attributes & FILE_ATTRIBUTE_DIRECTORY) != 0 || IsDirectory) ? // kDirectoryAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_READONLY) != 0) ? // kReadonlyAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_HIDDEN) != 0) ? // kHiddenAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_SYSTEM) != 0) ? // kSystemAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_ARCHIVE) != 0) ? // kArchiveAttributeChar : kEmptyAttributeChar; // return ret; // } // } // // Path: src/main/java/org/jamel/j7zip/IInStream.java // public abstract class IInStream extends InputStream { // // public abstract long seekFromBegin(long offset) throws IOException; // // public abstract long seekFromCurrent(long offset) throws IOException; // } // // Path: src/main/java/org/jamel/j7zip/Result.java // public enum Result { // OK, // FALSE, // // ERROR_NOT_IMPLEMENTED, // ERROR_FAIL, // ERROR_INVALID_ARGS, // ; // }
import java.io.IOException; import org.jamel.j7zip.common.ObjectVector; import org.jamel.j7zip.archive.IArchiveExtractCallback; import org.jamel.j7zip.archive.IInArchive; import org.jamel.j7zip.archive.SevenZipEntry; import org.jamel.j7zip.IInStream; import org.jamel.j7zip.Result;
package org.jamel.j7zip.archive.sevenZip; public class Handler implements IInArchive { private final ArchiveDatabaseEx database;
// Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // // Path: src/main/java/org/jamel/j7zip/archive/IArchiveExtractCallback.java // public interface IArchiveExtractCallback { // // // getStream OUT: OK - OK, FALSE - skip this file // OutputStream getStream(SevenZipEntry item) throws IOException; // // void setOperationResult(IInArchive.OperationResult resultEOperationResult); // // int getNumErrors(); // // IInArchive.AskMode getAskMode(); // } // // Path: src/main/java/org/jamel/j7zip/archive/IInArchive.java // public interface IInArchive { // public static enum AskMode {EXTRACT, TEST, SKIP} // // public static enum OperationResult {OK, UNSUPPORTED_METHOD, DATA_ERROR, CRC_ERROR} // // // Static-SFX (for Linux) can be big. // public final long kMaxCheckStartPosition = 1 << 22; // // SevenZipEntry getEntry(int index); // // int size(); // // void close() throws IOException; // // Result extract(int[] indices, IArchiveExtractCallback extractCallbackSpec) throws IOException; // // Result open(IInStream stream) throws IOException; // // Result open(IInStream stream, long maxCheckStartPosition) throws IOException; // // // } // // Path: src/main/java/org/jamel/j7zip/archive/SevenZipEntry.java // public class SevenZipEntry { // // private final long LastWriteTime; // private final long UnPackSize; // private final long PackSize; // private final int Attributes; // private final long FileCRC; // private final boolean IsDirectory; // private final String Name; // private final long Position; // // // public SevenZipEntry(String name, long packSize, long unPackSize, long crc, long lastWriteTime, // long position, boolean isDir, int att) // { // this.Name = name; // this.PackSize = packSize; // this.UnPackSize = unPackSize; // this.FileCRC = crc; // this.LastWriteTime = lastWriteTime; // this.Position = position; // this.IsDirectory = isDir; // this.Attributes = att; // } // // public long getCompressedSize() { // return PackSize; // } // // public long getSize() { // return UnPackSize; // } // // public long getCrc() { // return FileCRC; // } // // public String getName() { // return Name; // } // // public long getTime() { // return LastWriteTime; // } // // public long getPosition() { // return Position; // } // // public boolean isDirectory() { // return IsDirectory; // } // // static final String kEmptyAttributeChar = "."; // static final String kDirectoryAttributeChar = "D"; // static final String kReadonlyAttributeChar = "R"; // static final String kHiddenAttributeChar = "H"; // static final String kSystemAttributeChar = "S"; // static final String kArchiveAttributeChar = "A"; // static public final int FILE_ATTRIBUTE_READONLY = 0x00000001; // static public final int FILE_ATTRIBUTE_HIDDEN = 0x00000002; // static public final int FILE_ATTRIBUTE_SYSTEM = 0x00000004; // static public final int FILE_ATTRIBUTE_DIRECTORY = 0x00000010; // static public final int FILE_ATTRIBUTE_ARCHIVE = 0x00000020; // // public String getAttributesString() { // String ret = ""; // ret += ((Attributes & FILE_ATTRIBUTE_DIRECTORY) != 0 || IsDirectory) ? // kDirectoryAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_READONLY) != 0) ? // kReadonlyAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_HIDDEN) != 0) ? // kHiddenAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_SYSTEM) != 0) ? // kSystemAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_ARCHIVE) != 0) ? // kArchiveAttributeChar : kEmptyAttributeChar; // return ret; // } // } // // Path: src/main/java/org/jamel/j7zip/IInStream.java // public abstract class IInStream extends InputStream { // // public abstract long seekFromBegin(long offset) throws IOException; // // public abstract long seekFromCurrent(long offset) throws IOException; // } // // Path: src/main/java/org/jamel/j7zip/Result.java // public enum Result { // OK, // FALSE, // // ERROR_NOT_IMPLEMENTED, // ERROR_FAIL, // ERROR_INVALID_ARGS, // ; // } // Path: src/main/java/org/jamel/j7zip/archive/sevenZip/Handler.java import java.io.IOException; import org.jamel.j7zip.common.ObjectVector; import org.jamel.j7zip.archive.IArchiveExtractCallback; import org.jamel.j7zip.archive.IInArchive; import org.jamel.j7zip.archive.SevenZipEntry; import org.jamel.j7zip.IInStream; import org.jamel.j7zip.Result; package org.jamel.j7zip.archive.sevenZip; public class Handler implements IInArchive { private final ArchiveDatabaseEx database;
private IInStream inStream;
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/sevenZip/Handler.java
// Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // // Path: src/main/java/org/jamel/j7zip/archive/IArchiveExtractCallback.java // public interface IArchiveExtractCallback { // // // getStream OUT: OK - OK, FALSE - skip this file // OutputStream getStream(SevenZipEntry item) throws IOException; // // void setOperationResult(IInArchive.OperationResult resultEOperationResult); // // int getNumErrors(); // // IInArchive.AskMode getAskMode(); // } // // Path: src/main/java/org/jamel/j7zip/archive/IInArchive.java // public interface IInArchive { // public static enum AskMode {EXTRACT, TEST, SKIP} // // public static enum OperationResult {OK, UNSUPPORTED_METHOD, DATA_ERROR, CRC_ERROR} // // // Static-SFX (for Linux) can be big. // public final long kMaxCheckStartPosition = 1 << 22; // // SevenZipEntry getEntry(int index); // // int size(); // // void close() throws IOException; // // Result extract(int[] indices, IArchiveExtractCallback extractCallbackSpec) throws IOException; // // Result open(IInStream stream) throws IOException; // // Result open(IInStream stream, long maxCheckStartPosition) throws IOException; // // // } // // Path: src/main/java/org/jamel/j7zip/archive/SevenZipEntry.java // public class SevenZipEntry { // // private final long LastWriteTime; // private final long UnPackSize; // private final long PackSize; // private final int Attributes; // private final long FileCRC; // private final boolean IsDirectory; // private final String Name; // private final long Position; // // // public SevenZipEntry(String name, long packSize, long unPackSize, long crc, long lastWriteTime, // long position, boolean isDir, int att) // { // this.Name = name; // this.PackSize = packSize; // this.UnPackSize = unPackSize; // this.FileCRC = crc; // this.LastWriteTime = lastWriteTime; // this.Position = position; // this.IsDirectory = isDir; // this.Attributes = att; // } // // public long getCompressedSize() { // return PackSize; // } // // public long getSize() { // return UnPackSize; // } // // public long getCrc() { // return FileCRC; // } // // public String getName() { // return Name; // } // // public long getTime() { // return LastWriteTime; // } // // public long getPosition() { // return Position; // } // // public boolean isDirectory() { // return IsDirectory; // } // // static final String kEmptyAttributeChar = "."; // static final String kDirectoryAttributeChar = "D"; // static final String kReadonlyAttributeChar = "R"; // static final String kHiddenAttributeChar = "H"; // static final String kSystemAttributeChar = "S"; // static final String kArchiveAttributeChar = "A"; // static public final int FILE_ATTRIBUTE_READONLY = 0x00000001; // static public final int FILE_ATTRIBUTE_HIDDEN = 0x00000002; // static public final int FILE_ATTRIBUTE_SYSTEM = 0x00000004; // static public final int FILE_ATTRIBUTE_DIRECTORY = 0x00000010; // static public final int FILE_ATTRIBUTE_ARCHIVE = 0x00000020; // // public String getAttributesString() { // String ret = ""; // ret += ((Attributes & FILE_ATTRIBUTE_DIRECTORY) != 0 || IsDirectory) ? // kDirectoryAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_READONLY) != 0) ? // kReadonlyAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_HIDDEN) != 0) ? // kHiddenAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_SYSTEM) != 0) ? // kSystemAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_ARCHIVE) != 0) ? // kArchiveAttributeChar : kEmptyAttributeChar; // return ret; // } // } // // Path: src/main/java/org/jamel/j7zip/IInStream.java // public abstract class IInStream extends InputStream { // // public abstract long seekFromBegin(long offset) throws IOException; // // public abstract long seekFromCurrent(long offset) throws IOException; // } // // Path: src/main/java/org/jamel/j7zip/Result.java // public enum Result { // OK, // FALSE, // // ERROR_NOT_IMPLEMENTED, // ERROR_FAIL, // ERROR_INVALID_ARGS, // ; // }
import java.io.IOException; import org.jamel.j7zip.common.ObjectVector; import org.jamel.j7zip.archive.IArchiveExtractCallback; import org.jamel.j7zip.archive.IInArchive; import org.jamel.j7zip.archive.SevenZipEntry; import org.jamel.j7zip.IInStream; import org.jamel.j7zip.Result;
package org.jamel.j7zip.archive.sevenZip; public class Handler implements IInArchive { private final ArchiveDatabaseEx database; private IInStream inStream; public Handler() { database = new ArchiveDatabaseEx(); }
// Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // // Path: src/main/java/org/jamel/j7zip/archive/IArchiveExtractCallback.java // public interface IArchiveExtractCallback { // // // getStream OUT: OK - OK, FALSE - skip this file // OutputStream getStream(SevenZipEntry item) throws IOException; // // void setOperationResult(IInArchive.OperationResult resultEOperationResult); // // int getNumErrors(); // // IInArchive.AskMode getAskMode(); // } // // Path: src/main/java/org/jamel/j7zip/archive/IInArchive.java // public interface IInArchive { // public static enum AskMode {EXTRACT, TEST, SKIP} // // public static enum OperationResult {OK, UNSUPPORTED_METHOD, DATA_ERROR, CRC_ERROR} // // // Static-SFX (for Linux) can be big. // public final long kMaxCheckStartPosition = 1 << 22; // // SevenZipEntry getEntry(int index); // // int size(); // // void close() throws IOException; // // Result extract(int[] indices, IArchiveExtractCallback extractCallbackSpec) throws IOException; // // Result open(IInStream stream) throws IOException; // // Result open(IInStream stream, long maxCheckStartPosition) throws IOException; // // // } // // Path: src/main/java/org/jamel/j7zip/archive/SevenZipEntry.java // public class SevenZipEntry { // // private final long LastWriteTime; // private final long UnPackSize; // private final long PackSize; // private final int Attributes; // private final long FileCRC; // private final boolean IsDirectory; // private final String Name; // private final long Position; // // // public SevenZipEntry(String name, long packSize, long unPackSize, long crc, long lastWriteTime, // long position, boolean isDir, int att) // { // this.Name = name; // this.PackSize = packSize; // this.UnPackSize = unPackSize; // this.FileCRC = crc; // this.LastWriteTime = lastWriteTime; // this.Position = position; // this.IsDirectory = isDir; // this.Attributes = att; // } // // public long getCompressedSize() { // return PackSize; // } // // public long getSize() { // return UnPackSize; // } // // public long getCrc() { // return FileCRC; // } // // public String getName() { // return Name; // } // // public long getTime() { // return LastWriteTime; // } // // public long getPosition() { // return Position; // } // // public boolean isDirectory() { // return IsDirectory; // } // // static final String kEmptyAttributeChar = "."; // static final String kDirectoryAttributeChar = "D"; // static final String kReadonlyAttributeChar = "R"; // static final String kHiddenAttributeChar = "H"; // static final String kSystemAttributeChar = "S"; // static final String kArchiveAttributeChar = "A"; // static public final int FILE_ATTRIBUTE_READONLY = 0x00000001; // static public final int FILE_ATTRIBUTE_HIDDEN = 0x00000002; // static public final int FILE_ATTRIBUTE_SYSTEM = 0x00000004; // static public final int FILE_ATTRIBUTE_DIRECTORY = 0x00000010; // static public final int FILE_ATTRIBUTE_ARCHIVE = 0x00000020; // // public String getAttributesString() { // String ret = ""; // ret += ((Attributes & FILE_ATTRIBUTE_DIRECTORY) != 0 || IsDirectory) ? // kDirectoryAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_READONLY) != 0) ? // kReadonlyAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_HIDDEN) != 0) ? // kHiddenAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_SYSTEM) != 0) ? // kSystemAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_ARCHIVE) != 0) ? // kArchiveAttributeChar : kEmptyAttributeChar; // return ret; // } // } // // Path: src/main/java/org/jamel/j7zip/IInStream.java // public abstract class IInStream extends InputStream { // // public abstract long seekFromBegin(long offset) throws IOException; // // public abstract long seekFromCurrent(long offset) throws IOException; // } // // Path: src/main/java/org/jamel/j7zip/Result.java // public enum Result { // OK, // FALSE, // // ERROR_NOT_IMPLEMENTED, // ERROR_FAIL, // ERROR_INVALID_ARGS, // ; // } // Path: src/main/java/org/jamel/j7zip/archive/sevenZip/Handler.java import java.io.IOException; import org.jamel.j7zip.common.ObjectVector; import org.jamel.j7zip.archive.IArchiveExtractCallback; import org.jamel.j7zip.archive.IInArchive; import org.jamel.j7zip.archive.SevenZipEntry; import org.jamel.j7zip.IInStream; import org.jamel.j7zip.Result; package org.jamel.j7zip.archive.sevenZip; public class Handler implements IInArchive { private final ArchiveDatabaseEx database; private IInStream inStream; public Handler() { database = new ArchiveDatabaseEx(); }
public Result open(IInStream stream) throws IOException {
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/sevenZip/Handler.java
// Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // // Path: src/main/java/org/jamel/j7zip/archive/IArchiveExtractCallback.java // public interface IArchiveExtractCallback { // // // getStream OUT: OK - OK, FALSE - skip this file // OutputStream getStream(SevenZipEntry item) throws IOException; // // void setOperationResult(IInArchive.OperationResult resultEOperationResult); // // int getNumErrors(); // // IInArchive.AskMode getAskMode(); // } // // Path: src/main/java/org/jamel/j7zip/archive/IInArchive.java // public interface IInArchive { // public static enum AskMode {EXTRACT, TEST, SKIP} // // public static enum OperationResult {OK, UNSUPPORTED_METHOD, DATA_ERROR, CRC_ERROR} // // // Static-SFX (for Linux) can be big. // public final long kMaxCheckStartPosition = 1 << 22; // // SevenZipEntry getEntry(int index); // // int size(); // // void close() throws IOException; // // Result extract(int[] indices, IArchiveExtractCallback extractCallbackSpec) throws IOException; // // Result open(IInStream stream) throws IOException; // // Result open(IInStream stream, long maxCheckStartPosition) throws IOException; // // // } // // Path: src/main/java/org/jamel/j7zip/archive/SevenZipEntry.java // public class SevenZipEntry { // // private final long LastWriteTime; // private final long UnPackSize; // private final long PackSize; // private final int Attributes; // private final long FileCRC; // private final boolean IsDirectory; // private final String Name; // private final long Position; // // // public SevenZipEntry(String name, long packSize, long unPackSize, long crc, long lastWriteTime, // long position, boolean isDir, int att) // { // this.Name = name; // this.PackSize = packSize; // this.UnPackSize = unPackSize; // this.FileCRC = crc; // this.LastWriteTime = lastWriteTime; // this.Position = position; // this.IsDirectory = isDir; // this.Attributes = att; // } // // public long getCompressedSize() { // return PackSize; // } // // public long getSize() { // return UnPackSize; // } // // public long getCrc() { // return FileCRC; // } // // public String getName() { // return Name; // } // // public long getTime() { // return LastWriteTime; // } // // public long getPosition() { // return Position; // } // // public boolean isDirectory() { // return IsDirectory; // } // // static final String kEmptyAttributeChar = "."; // static final String kDirectoryAttributeChar = "D"; // static final String kReadonlyAttributeChar = "R"; // static final String kHiddenAttributeChar = "H"; // static final String kSystemAttributeChar = "S"; // static final String kArchiveAttributeChar = "A"; // static public final int FILE_ATTRIBUTE_READONLY = 0x00000001; // static public final int FILE_ATTRIBUTE_HIDDEN = 0x00000002; // static public final int FILE_ATTRIBUTE_SYSTEM = 0x00000004; // static public final int FILE_ATTRIBUTE_DIRECTORY = 0x00000010; // static public final int FILE_ATTRIBUTE_ARCHIVE = 0x00000020; // // public String getAttributesString() { // String ret = ""; // ret += ((Attributes & FILE_ATTRIBUTE_DIRECTORY) != 0 || IsDirectory) ? // kDirectoryAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_READONLY) != 0) ? // kReadonlyAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_HIDDEN) != 0) ? // kHiddenAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_SYSTEM) != 0) ? // kSystemAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_ARCHIVE) != 0) ? // kArchiveAttributeChar : kEmptyAttributeChar; // return ret; // } // } // // Path: src/main/java/org/jamel/j7zip/IInStream.java // public abstract class IInStream extends InputStream { // // public abstract long seekFromBegin(long offset) throws IOException; // // public abstract long seekFromCurrent(long offset) throws IOException; // } // // Path: src/main/java/org/jamel/j7zip/Result.java // public enum Result { // OK, // FALSE, // // ERROR_NOT_IMPLEMENTED, // ERROR_FAIL, // ERROR_INVALID_ARGS, // ; // }
import java.io.IOException; import org.jamel.j7zip.common.ObjectVector; import org.jamel.j7zip.archive.IArchiveExtractCallback; import org.jamel.j7zip.archive.IInArchive; import org.jamel.j7zip.archive.SevenZipEntry; import org.jamel.j7zip.IInStream; import org.jamel.j7zip.Result;
package org.jamel.j7zip.archive.sevenZip; public class Handler implements IInArchive { private final ArchiveDatabaseEx database; private IInStream inStream; public Handler() { database = new ArchiveDatabaseEx(); } public Result open(IInStream stream) throws IOException { return open(stream, kMaxCheckStartPosition); } public Result open(IInStream stream, long maxCheckStartPosition) throws IOException { close(); InArchive archive = new InArchive(); Result ret = archive.open(stream, maxCheckStartPosition); if (ret != Result.OK) return ret; ret = archive.readDatabase(database); // getTextPassword if (ret != Result.OK) return ret; database.fill(); inStream = stream; return Result.OK; }
// Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // // Path: src/main/java/org/jamel/j7zip/archive/IArchiveExtractCallback.java // public interface IArchiveExtractCallback { // // // getStream OUT: OK - OK, FALSE - skip this file // OutputStream getStream(SevenZipEntry item) throws IOException; // // void setOperationResult(IInArchive.OperationResult resultEOperationResult); // // int getNumErrors(); // // IInArchive.AskMode getAskMode(); // } // // Path: src/main/java/org/jamel/j7zip/archive/IInArchive.java // public interface IInArchive { // public static enum AskMode {EXTRACT, TEST, SKIP} // // public static enum OperationResult {OK, UNSUPPORTED_METHOD, DATA_ERROR, CRC_ERROR} // // // Static-SFX (for Linux) can be big. // public final long kMaxCheckStartPosition = 1 << 22; // // SevenZipEntry getEntry(int index); // // int size(); // // void close() throws IOException; // // Result extract(int[] indices, IArchiveExtractCallback extractCallbackSpec) throws IOException; // // Result open(IInStream stream) throws IOException; // // Result open(IInStream stream, long maxCheckStartPosition) throws IOException; // // // } // // Path: src/main/java/org/jamel/j7zip/archive/SevenZipEntry.java // public class SevenZipEntry { // // private final long LastWriteTime; // private final long UnPackSize; // private final long PackSize; // private final int Attributes; // private final long FileCRC; // private final boolean IsDirectory; // private final String Name; // private final long Position; // // // public SevenZipEntry(String name, long packSize, long unPackSize, long crc, long lastWriteTime, // long position, boolean isDir, int att) // { // this.Name = name; // this.PackSize = packSize; // this.UnPackSize = unPackSize; // this.FileCRC = crc; // this.LastWriteTime = lastWriteTime; // this.Position = position; // this.IsDirectory = isDir; // this.Attributes = att; // } // // public long getCompressedSize() { // return PackSize; // } // // public long getSize() { // return UnPackSize; // } // // public long getCrc() { // return FileCRC; // } // // public String getName() { // return Name; // } // // public long getTime() { // return LastWriteTime; // } // // public long getPosition() { // return Position; // } // // public boolean isDirectory() { // return IsDirectory; // } // // static final String kEmptyAttributeChar = "."; // static final String kDirectoryAttributeChar = "D"; // static final String kReadonlyAttributeChar = "R"; // static final String kHiddenAttributeChar = "H"; // static final String kSystemAttributeChar = "S"; // static final String kArchiveAttributeChar = "A"; // static public final int FILE_ATTRIBUTE_READONLY = 0x00000001; // static public final int FILE_ATTRIBUTE_HIDDEN = 0x00000002; // static public final int FILE_ATTRIBUTE_SYSTEM = 0x00000004; // static public final int FILE_ATTRIBUTE_DIRECTORY = 0x00000010; // static public final int FILE_ATTRIBUTE_ARCHIVE = 0x00000020; // // public String getAttributesString() { // String ret = ""; // ret += ((Attributes & FILE_ATTRIBUTE_DIRECTORY) != 0 || IsDirectory) ? // kDirectoryAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_READONLY) != 0) ? // kReadonlyAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_HIDDEN) != 0) ? // kHiddenAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_SYSTEM) != 0) ? // kSystemAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_ARCHIVE) != 0) ? // kArchiveAttributeChar : kEmptyAttributeChar; // return ret; // } // } // // Path: src/main/java/org/jamel/j7zip/IInStream.java // public abstract class IInStream extends InputStream { // // public abstract long seekFromBegin(long offset) throws IOException; // // public abstract long seekFromCurrent(long offset) throws IOException; // } // // Path: src/main/java/org/jamel/j7zip/Result.java // public enum Result { // OK, // FALSE, // // ERROR_NOT_IMPLEMENTED, // ERROR_FAIL, // ERROR_INVALID_ARGS, // ; // } // Path: src/main/java/org/jamel/j7zip/archive/sevenZip/Handler.java import java.io.IOException; import org.jamel.j7zip.common.ObjectVector; import org.jamel.j7zip.archive.IArchiveExtractCallback; import org.jamel.j7zip.archive.IInArchive; import org.jamel.j7zip.archive.SevenZipEntry; import org.jamel.j7zip.IInStream; import org.jamel.j7zip.Result; package org.jamel.j7zip.archive.sevenZip; public class Handler implements IInArchive { private final ArchiveDatabaseEx database; private IInStream inStream; public Handler() { database = new ArchiveDatabaseEx(); } public Result open(IInStream stream) throws IOException { return open(stream, kMaxCheckStartPosition); } public Result open(IInStream stream, long maxCheckStartPosition) throws IOException { close(); InArchive archive = new InArchive(); Result ret = archive.open(stream, maxCheckStartPosition); if (ret != Result.OK) return ret; ret = archive.readDatabase(database); // getTextPassword if (ret != Result.OK) return ret; database.fill(); inStream = stream; return Result.OK; }
public Result extract(int[] indices, IArchiveExtractCallback extractCallbackSpec) throws IOException {
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/sevenZip/Handler.java
// Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // // Path: src/main/java/org/jamel/j7zip/archive/IArchiveExtractCallback.java // public interface IArchiveExtractCallback { // // // getStream OUT: OK - OK, FALSE - skip this file // OutputStream getStream(SevenZipEntry item) throws IOException; // // void setOperationResult(IInArchive.OperationResult resultEOperationResult); // // int getNumErrors(); // // IInArchive.AskMode getAskMode(); // } // // Path: src/main/java/org/jamel/j7zip/archive/IInArchive.java // public interface IInArchive { // public static enum AskMode {EXTRACT, TEST, SKIP} // // public static enum OperationResult {OK, UNSUPPORTED_METHOD, DATA_ERROR, CRC_ERROR} // // // Static-SFX (for Linux) can be big. // public final long kMaxCheckStartPosition = 1 << 22; // // SevenZipEntry getEntry(int index); // // int size(); // // void close() throws IOException; // // Result extract(int[] indices, IArchiveExtractCallback extractCallbackSpec) throws IOException; // // Result open(IInStream stream) throws IOException; // // Result open(IInStream stream, long maxCheckStartPosition) throws IOException; // // // } // // Path: src/main/java/org/jamel/j7zip/archive/SevenZipEntry.java // public class SevenZipEntry { // // private final long LastWriteTime; // private final long UnPackSize; // private final long PackSize; // private final int Attributes; // private final long FileCRC; // private final boolean IsDirectory; // private final String Name; // private final long Position; // // // public SevenZipEntry(String name, long packSize, long unPackSize, long crc, long lastWriteTime, // long position, boolean isDir, int att) // { // this.Name = name; // this.PackSize = packSize; // this.UnPackSize = unPackSize; // this.FileCRC = crc; // this.LastWriteTime = lastWriteTime; // this.Position = position; // this.IsDirectory = isDir; // this.Attributes = att; // } // // public long getCompressedSize() { // return PackSize; // } // // public long getSize() { // return UnPackSize; // } // // public long getCrc() { // return FileCRC; // } // // public String getName() { // return Name; // } // // public long getTime() { // return LastWriteTime; // } // // public long getPosition() { // return Position; // } // // public boolean isDirectory() { // return IsDirectory; // } // // static final String kEmptyAttributeChar = "."; // static final String kDirectoryAttributeChar = "D"; // static final String kReadonlyAttributeChar = "R"; // static final String kHiddenAttributeChar = "H"; // static final String kSystemAttributeChar = "S"; // static final String kArchiveAttributeChar = "A"; // static public final int FILE_ATTRIBUTE_READONLY = 0x00000001; // static public final int FILE_ATTRIBUTE_HIDDEN = 0x00000002; // static public final int FILE_ATTRIBUTE_SYSTEM = 0x00000004; // static public final int FILE_ATTRIBUTE_DIRECTORY = 0x00000010; // static public final int FILE_ATTRIBUTE_ARCHIVE = 0x00000020; // // public String getAttributesString() { // String ret = ""; // ret += ((Attributes & FILE_ATTRIBUTE_DIRECTORY) != 0 || IsDirectory) ? // kDirectoryAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_READONLY) != 0) ? // kReadonlyAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_HIDDEN) != 0) ? // kHiddenAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_SYSTEM) != 0) ? // kSystemAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_ARCHIVE) != 0) ? // kArchiveAttributeChar : kEmptyAttributeChar; // return ret; // } // } // // Path: src/main/java/org/jamel/j7zip/IInStream.java // public abstract class IInStream extends InputStream { // // public abstract long seekFromBegin(long offset) throws IOException; // // public abstract long seekFromCurrent(long offset) throws IOException; // } // // Path: src/main/java/org/jamel/j7zip/Result.java // public enum Result { // OK, // FALSE, // // ERROR_NOT_IMPLEMENTED, // ERROR_FAIL, // ERROR_INVALID_ARGS, // ; // }
import java.io.IOException; import org.jamel.j7zip.common.ObjectVector; import org.jamel.j7zip.archive.IArchiveExtractCallback; import org.jamel.j7zip.archive.IInArchive; import org.jamel.j7zip.archive.SevenZipEntry; import org.jamel.j7zip.IInStream; import org.jamel.j7zip.Result;
System.out.println("IOException : " + e); e.printStackTrace(); folderOutStream.flushCorrupted(OperationResult.UNSUPPORTED_METHOD); } } return Result.OK; } public void close() throws IOException { if (inStream != null) inStream.close(); inStream = null; database.clear(); } public int size() { return database.files.size(); } long getPackSize(int index2) { long packSize = 0; int folderIndex = database.FileIndexToFolderIndexMap.get(index2); if (folderIndex != InArchive.kNumNoIndex) { if (database.FolderStartFileIndex.get(folderIndex) == index2) { packSize = database.getFolderFullPackSize(folderIndex); } } return packSize; }
// Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // // Path: src/main/java/org/jamel/j7zip/archive/IArchiveExtractCallback.java // public interface IArchiveExtractCallback { // // // getStream OUT: OK - OK, FALSE - skip this file // OutputStream getStream(SevenZipEntry item) throws IOException; // // void setOperationResult(IInArchive.OperationResult resultEOperationResult); // // int getNumErrors(); // // IInArchive.AskMode getAskMode(); // } // // Path: src/main/java/org/jamel/j7zip/archive/IInArchive.java // public interface IInArchive { // public static enum AskMode {EXTRACT, TEST, SKIP} // // public static enum OperationResult {OK, UNSUPPORTED_METHOD, DATA_ERROR, CRC_ERROR} // // // Static-SFX (for Linux) can be big. // public final long kMaxCheckStartPosition = 1 << 22; // // SevenZipEntry getEntry(int index); // // int size(); // // void close() throws IOException; // // Result extract(int[] indices, IArchiveExtractCallback extractCallbackSpec) throws IOException; // // Result open(IInStream stream) throws IOException; // // Result open(IInStream stream, long maxCheckStartPosition) throws IOException; // // // } // // Path: src/main/java/org/jamel/j7zip/archive/SevenZipEntry.java // public class SevenZipEntry { // // private final long LastWriteTime; // private final long UnPackSize; // private final long PackSize; // private final int Attributes; // private final long FileCRC; // private final boolean IsDirectory; // private final String Name; // private final long Position; // // // public SevenZipEntry(String name, long packSize, long unPackSize, long crc, long lastWriteTime, // long position, boolean isDir, int att) // { // this.Name = name; // this.PackSize = packSize; // this.UnPackSize = unPackSize; // this.FileCRC = crc; // this.LastWriteTime = lastWriteTime; // this.Position = position; // this.IsDirectory = isDir; // this.Attributes = att; // } // // public long getCompressedSize() { // return PackSize; // } // // public long getSize() { // return UnPackSize; // } // // public long getCrc() { // return FileCRC; // } // // public String getName() { // return Name; // } // // public long getTime() { // return LastWriteTime; // } // // public long getPosition() { // return Position; // } // // public boolean isDirectory() { // return IsDirectory; // } // // static final String kEmptyAttributeChar = "."; // static final String kDirectoryAttributeChar = "D"; // static final String kReadonlyAttributeChar = "R"; // static final String kHiddenAttributeChar = "H"; // static final String kSystemAttributeChar = "S"; // static final String kArchiveAttributeChar = "A"; // static public final int FILE_ATTRIBUTE_READONLY = 0x00000001; // static public final int FILE_ATTRIBUTE_HIDDEN = 0x00000002; // static public final int FILE_ATTRIBUTE_SYSTEM = 0x00000004; // static public final int FILE_ATTRIBUTE_DIRECTORY = 0x00000010; // static public final int FILE_ATTRIBUTE_ARCHIVE = 0x00000020; // // public String getAttributesString() { // String ret = ""; // ret += ((Attributes & FILE_ATTRIBUTE_DIRECTORY) != 0 || IsDirectory) ? // kDirectoryAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_READONLY) != 0) ? // kReadonlyAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_HIDDEN) != 0) ? // kHiddenAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_SYSTEM) != 0) ? // kSystemAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_ARCHIVE) != 0) ? // kArchiveAttributeChar : kEmptyAttributeChar; // return ret; // } // } // // Path: src/main/java/org/jamel/j7zip/IInStream.java // public abstract class IInStream extends InputStream { // // public abstract long seekFromBegin(long offset) throws IOException; // // public abstract long seekFromCurrent(long offset) throws IOException; // } // // Path: src/main/java/org/jamel/j7zip/Result.java // public enum Result { // OK, // FALSE, // // ERROR_NOT_IMPLEMENTED, // ERROR_FAIL, // ERROR_INVALID_ARGS, // ; // } // Path: src/main/java/org/jamel/j7zip/archive/sevenZip/Handler.java import java.io.IOException; import org.jamel.j7zip.common.ObjectVector; import org.jamel.j7zip.archive.IArchiveExtractCallback; import org.jamel.j7zip.archive.IInArchive; import org.jamel.j7zip.archive.SevenZipEntry; import org.jamel.j7zip.IInStream; import org.jamel.j7zip.Result; System.out.println("IOException : " + e); e.printStackTrace(); folderOutStream.flushCorrupted(OperationResult.UNSUPPORTED_METHOD); } } return Result.OK; } public void close() throws IOException { if (inStream != null) inStream.close(); inStream = null; database.clear(); } public int size() { return database.files.size(); } long getPackSize(int index2) { long packSize = 0; int folderIndex = database.FileIndexToFolderIndexMap.get(index2); if (folderIndex != InArchive.kNumNoIndex) { if (database.FolderStartFileIndex.get(folderIndex) == index2) { packSize = database.getFolderFullPackSize(folderIndex); } } return packSize; }
public SevenZipEntry getEntry(int index) {
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/sevenZip/Folder.java
// Path: src/main/java/org/jamel/j7zip/common/IntVector.java // public class IntVector { // private static final int CAPACITY_INCR = 10; // // private int[] data = new int[CAPACITY_INCR]; // int elt = 0; // // public IntVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // int[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new int[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public int get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public void add(int b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // } // // Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // // Path: src/main/java/org/jamel/j7zip/archive/common/BindPair.java // public class BindPair { // // public final int inIndex; // public final int outIndex; // // // public BindPair(int inIndex, int outIndex) { // this.inIndex = inIndex; // this.outIndex = outIndex; // } // // public int getInIndex() { // return inIndex; // } // // public int getOutIndex() { // return outIndex; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // BindPair bindPair = (BindPair) o; // return inIndex == bindPair.inIndex && outIndex == bindPair.outIndex; // } // // @Override // public int hashCode() { // int result = inIndex; // result = 31 * result + outIndex; // return result; // } // }
import java.io.IOException; import org.jamel.j7zip.common.IntVector; import org.jamel.j7zip.common.LongVector; import org.jamel.j7zip.common.ObjectVector; import org.jamel.j7zip.archive.common.BindPair;
package org.jamel.j7zip.archive.sevenZip; class Folder { public ObjectVector<CoderInfo> coders = new ObjectVector<>();
// Path: src/main/java/org/jamel/j7zip/common/IntVector.java // public class IntVector { // private static final int CAPACITY_INCR = 10; // // private int[] data = new int[CAPACITY_INCR]; // int elt = 0; // // public IntVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // int[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new int[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public int get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public void add(int b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // } // // Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // // Path: src/main/java/org/jamel/j7zip/archive/common/BindPair.java // public class BindPair { // // public final int inIndex; // public final int outIndex; // // // public BindPair(int inIndex, int outIndex) { // this.inIndex = inIndex; // this.outIndex = outIndex; // } // // public int getInIndex() { // return inIndex; // } // // public int getOutIndex() { // return outIndex; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // BindPair bindPair = (BindPair) o; // return inIndex == bindPair.inIndex && outIndex == bindPair.outIndex; // } // // @Override // public int hashCode() { // int result = inIndex; // result = 31 * result + outIndex; // return result; // } // } // Path: src/main/java/org/jamel/j7zip/archive/sevenZip/Folder.java import java.io.IOException; import org.jamel.j7zip.common.IntVector; import org.jamel.j7zip.common.LongVector; import org.jamel.j7zip.common.ObjectVector; import org.jamel.j7zip.archive.common.BindPair; package org.jamel.j7zip.archive.sevenZip; class Folder { public ObjectVector<CoderInfo> coders = new ObjectVector<>();
ObjectVector<BindPair> bindPairs = new ObjectVector<>();
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/sevenZip/Folder.java
// Path: src/main/java/org/jamel/j7zip/common/IntVector.java // public class IntVector { // private static final int CAPACITY_INCR = 10; // // private int[] data = new int[CAPACITY_INCR]; // int elt = 0; // // public IntVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // int[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new int[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public int get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public void add(int b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // } // // Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // // Path: src/main/java/org/jamel/j7zip/archive/common/BindPair.java // public class BindPair { // // public final int inIndex; // public final int outIndex; // // // public BindPair(int inIndex, int outIndex) { // this.inIndex = inIndex; // this.outIndex = outIndex; // } // // public int getInIndex() { // return inIndex; // } // // public int getOutIndex() { // return outIndex; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // BindPair bindPair = (BindPair) o; // return inIndex == bindPair.inIndex && outIndex == bindPair.outIndex; // } // // @Override // public int hashCode() { // int result = inIndex; // result = 31 * result + outIndex; // return result; // } // }
import java.io.IOException; import org.jamel.j7zip.common.IntVector; import org.jamel.j7zip.common.LongVector; import org.jamel.j7zip.common.ObjectVector; import org.jamel.j7zip.archive.common.BindPair;
package org.jamel.j7zip.archive.sevenZip; class Folder { public ObjectVector<CoderInfo> coders = new ObjectVector<>(); ObjectVector<BindPair> bindPairs = new ObjectVector<>();
// Path: src/main/java/org/jamel/j7zip/common/IntVector.java // public class IntVector { // private static final int CAPACITY_INCR = 10; // // private int[] data = new int[CAPACITY_INCR]; // int elt = 0; // // public IntVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // int[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new int[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public int get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public void add(int b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // } // // Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // // Path: src/main/java/org/jamel/j7zip/archive/common/BindPair.java // public class BindPair { // // public final int inIndex; // public final int outIndex; // // // public BindPair(int inIndex, int outIndex) { // this.inIndex = inIndex; // this.outIndex = outIndex; // } // // public int getInIndex() { // return inIndex; // } // // public int getOutIndex() { // return outIndex; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // BindPair bindPair = (BindPair) o; // return inIndex == bindPair.inIndex && outIndex == bindPair.outIndex; // } // // @Override // public int hashCode() { // int result = inIndex; // result = 31 * result + outIndex; // return result; // } // } // Path: src/main/java/org/jamel/j7zip/archive/sevenZip/Folder.java import java.io.IOException; import org.jamel.j7zip.common.IntVector; import org.jamel.j7zip.common.LongVector; import org.jamel.j7zip.common.ObjectVector; import org.jamel.j7zip.archive.common.BindPair; package org.jamel.j7zip.archive.sevenZip; class Folder { public ObjectVector<CoderInfo> coders = new ObjectVector<>(); ObjectVector<BindPair> bindPairs = new ObjectVector<>();
IntVector packStreams = new IntVector();
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/sevenZip/Folder.java
// Path: src/main/java/org/jamel/j7zip/common/IntVector.java // public class IntVector { // private static final int CAPACITY_INCR = 10; // // private int[] data = new int[CAPACITY_INCR]; // int elt = 0; // // public IntVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // int[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new int[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public int get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public void add(int b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // } // // Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // // Path: src/main/java/org/jamel/j7zip/archive/common/BindPair.java // public class BindPair { // // public final int inIndex; // public final int outIndex; // // // public BindPair(int inIndex, int outIndex) { // this.inIndex = inIndex; // this.outIndex = outIndex; // } // // public int getInIndex() { // return inIndex; // } // // public int getOutIndex() { // return outIndex; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // BindPair bindPair = (BindPair) o; // return inIndex == bindPair.inIndex && outIndex == bindPair.outIndex; // } // // @Override // public int hashCode() { // int result = inIndex; // result = 31 * result + outIndex; // return result; // } // }
import java.io.IOException; import org.jamel.j7zip.common.IntVector; import org.jamel.j7zip.common.LongVector; import org.jamel.j7zip.common.ObjectVector; import org.jamel.j7zip.archive.common.BindPair;
package org.jamel.j7zip.archive.sevenZip; class Folder { public ObjectVector<CoderInfo> coders = new ObjectVector<>(); ObjectVector<BindPair> bindPairs = new ObjectVector<>(); IntVector packStreams = new IntVector();
// Path: src/main/java/org/jamel/j7zip/common/IntVector.java // public class IntVector { // private static final int CAPACITY_INCR = 10; // // private int[] data = new int[CAPACITY_INCR]; // int elt = 0; // // public IntVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // int[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new int[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public int get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public void add(int b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // } // // Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // // Path: src/main/java/org/jamel/j7zip/archive/common/BindPair.java // public class BindPair { // // public final int inIndex; // public final int outIndex; // // // public BindPair(int inIndex, int outIndex) { // this.inIndex = inIndex; // this.outIndex = outIndex; // } // // public int getInIndex() { // return inIndex; // } // // public int getOutIndex() { // return outIndex; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // BindPair bindPair = (BindPair) o; // return inIndex == bindPair.inIndex && outIndex == bindPair.outIndex; // } // // @Override // public int hashCode() { // int result = inIndex; // result = 31 * result + outIndex; // return result; // } // } // Path: src/main/java/org/jamel/j7zip/archive/sevenZip/Folder.java import java.io.IOException; import org.jamel.j7zip.common.IntVector; import org.jamel.j7zip.common.LongVector; import org.jamel.j7zip.common.ObjectVector; import org.jamel.j7zip.archive.common.BindPair; package org.jamel.j7zip.archive.sevenZip; class Folder { public ObjectVector<CoderInfo> coders = new ObjectVector<>(); ObjectVector<BindPair> bindPairs = new ObjectVector<>(); IntVector packStreams = new IntVector();
LongVector unPackSizes = new LongVector();
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/sevenZip/ArchiveDatabase.java
// Path: src/main/java/org/jamel/j7zip/common/BoolVector.java // public class BoolVector { // // private static final int CAPACITY_INCR = 10; // // protected boolean[] data = new boolean[CAPACITY_INCR]; // int elt = 0; // // public BoolVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // boolean[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new boolean[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public boolean get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public void add(boolean b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // } // // Path: src/main/java/org/jamel/j7zip/common/IntVector.java // public class IntVector { // private static final int CAPACITY_INCR = 10; // // private int[] data = new int[CAPACITY_INCR]; // int elt = 0; // // public IntVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // int[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new int[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public int get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public void add(int b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // } // // Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // }
import org.jamel.j7zip.common.BoolVector; import org.jamel.j7zip.common.IntVector; import org.jamel.j7zip.common.LongVector; import org.jamel.j7zip.common.ObjectVector;
package org.jamel.j7zip.archive.sevenZip; class ArchiveDatabase { public final LongVector packSizes = new LongVector();
// Path: src/main/java/org/jamel/j7zip/common/BoolVector.java // public class BoolVector { // // private static final int CAPACITY_INCR = 10; // // protected boolean[] data = new boolean[CAPACITY_INCR]; // int elt = 0; // // public BoolVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // boolean[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new boolean[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public boolean get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public void add(boolean b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // } // // Path: src/main/java/org/jamel/j7zip/common/IntVector.java // public class IntVector { // private static final int CAPACITY_INCR = 10; // // private int[] data = new int[CAPACITY_INCR]; // int elt = 0; // // public IntVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // int[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new int[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public int get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public void add(int b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // } // // Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // Path: src/main/java/org/jamel/j7zip/archive/sevenZip/ArchiveDatabase.java import org.jamel.j7zip.common.BoolVector; import org.jamel.j7zip.common.IntVector; import org.jamel.j7zip.common.LongVector; import org.jamel.j7zip.common.ObjectVector; package org.jamel.j7zip.archive.sevenZip; class ArchiveDatabase { public final LongVector packSizes = new LongVector();
public final BoolVector packCRCsDefined = new BoolVector();
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/sevenZip/ArchiveDatabase.java
// Path: src/main/java/org/jamel/j7zip/common/BoolVector.java // public class BoolVector { // // private static final int CAPACITY_INCR = 10; // // protected boolean[] data = new boolean[CAPACITY_INCR]; // int elt = 0; // // public BoolVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // boolean[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new boolean[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public boolean get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public void add(boolean b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // } // // Path: src/main/java/org/jamel/j7zip/common/IntVector.java // public class IntVector { // private static final int CAPACITY_INCR = 10; // // private int[] data = new int[CAPACITY_INCR]; // int elt = 0; // // public IntVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // int[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new int[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public int get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public void add(int b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // } // // Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // }
import org.jamel.j7zip.common.BoolVector; import org.jamel.j7zip.common.IntVector; import org.jamel.j7zip.common.LongVector; import org.jamel.j7zip.common.ObjectVector;
package org.jamel.j7zip.archive.sevenZip; class ArchiveDatabase { public final LongVector packSizes = new LongVector(); public final BoolVector packCRCsDefined = new BoolVector();
// Path: src/main/java/org/jamel/j7zip/common/BoolVector.java // public class BoolVector { // // private static final int CAPACITY_INCR = 10; // // protected boolean[] data = new boolean[CAPACITY_INCR]; // int elt = 0; // // public BoolVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // boolean[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new boolean[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public boolean get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public void add(boolean b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // } // // Path: src/main/java/org/jamel/j7zip/common/IntVector.java // public class IntVector { // private static final int CAPACITY_INCR = 10; // // private int[] data = new int[CAPACITY_INCR]; // int elt = 0; // // public IntVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // int[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new int[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public int get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public void add(int b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // } // // Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // Path: src/main/java/org/jamel/j7zip/archive/sevenZip/ArchiveDatabase.java import org.jamel.j7zip.common.BoolVector; import org.jamel.j7zip.common.IntVector; import org.jamel.j7zip.common.LongVector; import org.jamel.j7zip.common.ObjectVector; package org.jamel.j7zip.archive.sevenZip; class ArchiveDatabase { public final LongVector packSizes = new LongVector(); public final BoolVector packCRCsDefined = new BoolVector();
public final IntVector packCRCs = new IntVector();
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/sevenZip/ArchiveDatabase.java
// Path: src/main/java/org/jamel/j7zip/common/BoolVector.java // public class BoolVector { // // private static final int CAPACITY_INCR = 10; // // protected boolean[] data = new boolean[CAPACITY_INCR]; // int elt = 0; // // public BoolVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // boolean[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new boolean[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public boolean get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public void add(boolean b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // } // // Path: src/main/java/org/jamel/j7zip/common/IntVector.java // public class IntVector { // private static final int CAPACITY_INCR = 10; // // private int[] data = new int[CAPACITY_INCR]; // int elt = 0; // // public IntVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // int[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new int[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public int get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public void add(int b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // } // // Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // }
import org.jamel.j7zip.common.BoolVector; import org.jamel.j7zip.common.IntVector; import org.jamel.j7zip.common.LongVector; import org.jamel.j7zip.common.ObjectVector;
package org.jamel.j7zip.archive.sevenZip; class ArchiveDatabase { public final LongVector packSizes = new LongVector(); public final BoolVector packCRCsDefined = new BoolVector(); public final IntVector packCRCs = new IntVector();
// Path: src/main/java/org/jamel/j7zip/common/BoolVector.java // public class BoolVector { // // private static final int CAPACITY_INCR = 10; // // protected boolean[] data = new boolean[CAPACITY_INCR]; // int elt = 0; // // public BoolVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // boolean[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new boolean[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public boolean get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public void add(boolean b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // } // // Path: src/main/java/org/jamel/j7zip/common/IntVector.java // public class IntVector { // private static final int CAPACITY_INCR = 10; // // private int[] data = new int[CAPACITY_INCR]; // int elt = 0; // // public IntVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // int[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new int[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public int get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public void add(int b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // } // // Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // Path: src/main/java/org/jamel/j7zip/archive/sevenZip/ArchiveDatabase.java import org.jamel.j7zip.common.BoolVector; import org.jamel.j7zip.common.IntVector; import org.jamel.j7zip.common.LongVector; import org.jamel.j7zip.common.ObjectVector; package org.jamel.j7zip.archive.sevenZip; class ArchiveDatabase { public final LongVector packSizes = new LongVector(); public final BoolVector packCRCsDefined = new BoolVector(); public final IntVector packCRCs = new IntVector();
public final ObjectVector<Folder> folders = new ObjectVector<>();
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/common/OutStreamWithCRC.java
// Path: src/main/java/org/jamel/j7zip/common/CRC.java // public class CRC { // static public int[] Table = new int[256]; // // static { // for (int i = 0; i < 256; i++) { // int r = i; // for (int j = 0; j < 8; j++) { // if ((r & 1) != 0) { // r = (r >>> 1) ^ 0xEDB88320; // } else { // r >>>= 1; // } // } // Table[i] = r; // } // } // // int _value = -1; // // public void Init() { // _value = -1; // } // // public void UpdateByte(int b) { // _value = Table[(_value ^ b) & 0xFF] ^ (_value >>> 8); // } // // public void UpdateUInt32(int v) { // for (int i = 0; i < 4; i++) { // UpdateByte((v >> (8 * i)) & 0xFF); // } // } // // public void UpdateUInt64(long v) { // for (int i = 0; i < 8; i++) { // UpdateByte((int) ((v >> (8 * i))) & 0xFF); // } // } // // public int getDigest() { // return ~_value; // } // // public void Update(byte[] data, int size) { // for (int i = 0; i < size; i++) { // _value = Table[(_value ^ data[i]) & 0xFF] ^ (_value >>> 8); // } // } // // public void Update(byte[] data, int offset, int size) { // for (int i = 0; i < size; i++) { // _value = Table[(_value ^ data[offset + i]) & 0xFF] ^ (_value >>> 8); // } // } // // public static int CalculateDigest(byte[] data, int size) { // CRC crc = new CRC(); // crc.Update(data, size); // return crc.getDigest(); // } // // static public boolean VerifyDigest(int digest, byte[] data, int size) { // return (CalculateDigest(data, size) == digest); // } // }
import org.jamel.j7zip.common.CRC;
package org.jamel.j7zip.archive.common; public class OutStreamWithCRC extends java.io.OutputStream { java.io.OutputStream _stream; long _size;
// Path: src/main/java/org/jamel/j7zip/common/CRC.java // public class CRC { // static public int[] Table = new int[256]; // // static { // for (int i = 0; i < 256; i++) { // int r = i; // for (int j = 0; j < 8; j++) { // if ((r & 1) != 0) { // r = (r >>> 1) ^ 0xEDB88320; // } else { // r >>>= 1; // } // } // Table[i] = r; // } // } // // int _value = -1; // // public void Init() { // _value = -1; // } // // public void UpdateByte(int b) { // _value = Table[(_value ^ b) & 0xFF] ^ (_value >>> 8); // } // // public void UpdateUInt32(int v) { // for (int i = 0; i < 4; i++) { // UpdateByte((v >> (8 * i)) & 0xFF); // } // } // // public void UpdateUInt64(long v) { // for (int i = 0; i < 8; i++) { // UpdateByte((int) ((v >> (8 * i))) & 0xFF); // } // } // // public int getDigest() { // return ~_value; // } // // public void Update(byte[] data, int size) { // for (int i = 0; i < size; i++) { // _value = Table[(_value ^ data[i]) & 0xFF] ^ (_value >>> 8); // } // } // // public void Update(byte[] data, int offset, int size) { // for (int i = 0; i < size; i++) { // _value = Table[(_value ^ data[offset + i]) & 0xFF] ^ (_value >>> 8); // } // } // // public static int CalculateDigest(byte[] data, int size) { // CRC crc = new CRC(); // crc.Update(data, size); // return crc.getDigest(); // } // // static public boolean VerifyDigest(int digest, byte[] data, int size) { // return (CalculateDigest(data, size) == digest); // } // } // Path: src/main/java/org/jamel/j7zip/archive/common/OutStreamWithCRC.java import org.jamel.j7zip.common.CRC; package org.jamel.j7zip.archive.common; public class OutStreamWithCRC extends java.io.OutputStream { java.io.OutputStream _stream; long _size;
CRC _crc = new CRC();
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/sevenZip/InArchiveInfo.java
// Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // }
import org.jamel.j7zip.common.LongVector;
package org.jamel.j7zip.archive.sevenZip; class InArchiveInfo { public byte ArchiveVersion_Major; public byte ArchiveVersion_Minor; public long StartPosition; public long StartPositionAfterHeader; public long DataStartPosition; public long DataStartPosition2;
// Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // Path: src/main/java/org/jamel/j7zip/archive/sevenZip/InArchiveInfo.java import org.jamel.j7zip.common.LongVector; package org.jamel.j7zip.archive.sevenZip; class InArchiveInfo { public byte ArchiveVersion_Major; public byte ArchiveVersion_Minor; public long StartPosition; public long StartPositionAfterHeader; public long DataStartPosition; public long DataStartPosition2;
LongVector FileInfoPopIDs = new LongVector();
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/sevenZip/StreamSwitch.java
// Path: src/main/java/org/jamel/j7zip/common/ByteBuffer.java // public class ByteBuffer { // int _capacity; // byte[] _items; // // public ByteBuffer() { // _capacity = 0; // _items = null; // } // // public byte[] data() { // return _items; // } // // public int GetCapacity() { // return _capacity; // } // // public void SetCapacity(int newCapacity) { // if (newCapacity == _capacity) { // return; // } // // byte[] newBuffer; // if (newCapacity > 0) { // newBuffer = new byte[newCapacity]; // if (_capacity > 0) { // int len = _capacity; // if (newCapacity < len) len = newCapacity; // // System.arraycopy(_items, 0, newBuffer, 0, len); // } // } else { // newBuffer = null; // } // // _items = newBuffer; // _capacity = newCapacity; // } // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // }
import org.jamel.j7zip.common.ByteBuffer; import org.jamel.j7zip.common.ObjectVector;
package org.jamel.j7zip.archive.sevenZip; class StreamSwitch { InArchive _archive; boolean _needRemove; public StreamSwitch() { _needRemove = false; } public void close() { remove(); } void remove() { if (_needRemove) { _archive.deleteByteStream(); _needRemove = false; } }
// Path: src/main/java/org/jamel/j7zip/common/ByteBuffer.java // public class ByteBuffer { // int _capacity; // byte[] _items; // // public ByteBuffer() { // _capacity = 0; // _items = null; // } // // public byte[] data() { // return _items; // } // // public int GetCapacity() { // return _capacity; // } // // public void SetCapacity(int newCapacity) { // if (newCapacity == _capacity) { // return; // } // // byte[] newBuffer; // if (newCapacity > 0) { // newBuffer = new byte[newCapacity]; // if (_capacity > 0) { // int len = _capacity; // if (newCapacity < len) len = newCapacity; // // System.arraycopy(_items, 0, newBuffer, 0, len); // } // } else { // newBuffer = null; // } // // _items = newBuffer; // _capacity = newCapacity; // } // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // Path: src/main/java/org/jamel/j7zip/archive/sevenZip/StreamSwitch.java import org.jamel.j7zip.common.ByteBuffer; import org.jamel.j7zip.common.ObjectVector; package org.jamel.j7zip.archive.sevenZip; class StreamSwitch { InArchive _archive; boolean _needRemove; public StreamSwitch() { _needRemove = false; } public void close() { remove(); } void remove() { if (_needRemove) { _archive.deleteByteStream(); _needRemove = false; } }
void set(InArchive archive, ByteBuffer byteBuffer) {
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/sevenZip/StreamSwitch.java
// Path: src/main/java/org/jamel/j7zip/common/ByteBuffer.java // public class ByteBuffer { // int _capacity; // byte[] _items; // // public ByteBuffer() { // _capacity = 0; // _items = null; // } // // public byte[] data() { // return _items; // } // // public int GetCapacity() { // return _capacity; // } // // public void SetCapacity(int newCapacity) { // if (newCapacity == _capacity) { // return; // } // // byte[] newBuffer; // if (newCapacity > 0) { // newBuffer = new byte[newCapacity]; // if (_capacity > 0) { // int len = _capacity; // if (newCapacity < len) len = newCapacity; // // System.arraycopy(_items, 0, newBuffer, 0, len); // } // } else { // newBuffer = null; // } // // _items = newBuffer; // _capacity = newCapacity; // } // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // }
import org.jamel.j7zip.common.ByteBuffer; import org.jamel.j7zip.common.ObjectVector;
package org.jamel.j7zip.archive.sevenZip; class StreamSwitch { InArchive _archive; boolean _needRemove; public StreamSwitch() { _needRemove = false; } public void close() { remove(); } void remove() { if (_needRemove) { _archive.deleteByteStream(); _needRemove = false; } } void set(InArchive archive, ByteBuffer byteBuffer) { remove(); _archive = archive; _archive.addByteStream(byteBuffer.data(), byteBuffer.GetCapacity()); _needRemove = true; }
// Path: src/main/java/org/jamel/j7zip/common/ByteBuffer.java // public class ByteBuffer { // int _capacity; // byte[] _items; // // public ByteBuffer() { // _capacity = 0; // _items = null; // } // // public byte[] data() { // return _items; // } // // public int GetCapacity() { // return _capacity; // } // // public void SetCapacity(int newCapacity) { // if (newCapacity == _capacity) { // return; // } // // byte[] newBuffer; // if (newCapacity > 0) { // newBuffer = new byte[newCapacity]; // if (_capacity > 0) { // int len = _capacity; // if (newCapacity < len) len = newCapacity; // // System.arraycopy(_items, 0, newBuffer, 0, len); // } // } else { // newBuffer = null; // } // // _items = newBuffer; // _capacity = newCapacity; // } // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // Path: src/main/java/org/jamel/j7zip/archive/sevenZip/StreamSwitch.java import org.jamel.j7zip.common.ByteBuffer; import org.jamel.j7zip.common.ObjectVector; package org.jamel.j7zip.archive.sevenZip; class StreamSwitch { InArchive _archive; boolean _needRemove; public StreamSwitch() { _needRemove = false; } public void close() { remove(); } void remove() { if (_needRemove) { _archive.deleteByteStream(); _needRemove = false; } } void set(InArchive archive, ByteBuffer byteBuffer) { remove(); _archive = archive; _archive.addByteStream(byteBuffer.data(), byteBuffer.GetCapacity()); _needRemove = true; }
void set(InArchive archive, ObjectVector<ByteBuffer> dataVector) throws java.io.IOException {
jamel/j7zip
src/main/java/org/jamel/j7zip/ICompressCoder2.java
// Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // }
import java.io.InputStream; import java.io.OutputStream; import org.jamel.j7zip.common.ObjectVector;
package org.jamel.j7zip; public interface ICompressCoder2 { public Result code(
// Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // Path: src/main/java/org/jamel/j7zip/ICompressCoder2.java import java.io.InputStream; import java.io.OutputStream; import org.jamel.j7zip.common.ObjectVector; package org.jamel.j7zip; public interface ICompressCoder2 { public Result code(
ObjectVector<InputStream> inStreams,
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/common/CoderInfo.java
// Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder.java // public interface ICompressCoder { // // void code(InputStream inStream, OutputStream outStream, long outSize) throws IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder2.java // public interface ICompressCoder2 { // // public Result code( // ObjectVector<InputStream> inStreams, // int numInStreams, // ObjectVector<OutputStream> outStreams, // int numOutStreams) throws java.io.IOException; // // public void close() throws java.io.IOException; // }
import org.jamel.j7zip.common.LongVector; import org.jamel.j7zip.ICompressCoder; import org.jamel.j7zip.ICompressCoder2;
package org.jamel.j7zip.archive.common; public class CoderInfo { ICompressCoder Coder;
// Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder.java // public interface ICompressCoder { // // void code(InputStream inStream, OutputStream outStream, long outSize) throws IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder2.java // public interface ICompressCoder2 { // // public Result code( // ObjectVector<InputStream> inStreams, // int numInStreams, // ObjectVector<OutputStream> outStreams, // int numOutStreams) throws java.io.IOException; // // public void close() throws java.io.IOException; // } // Path: src/main/java/org/jamel/j7zip/archive/common/CoderInfo.java import org.jamel.j7zip.common.LongVector; import org.jamel.j7zip.ICompressCoder; import org.jamel.j7zip.ICompressCoder2; package org.jamel.j7zip.archive.common; public class CoderInfo { ICompressCoder Coder;
ICompressCoder2 Coder2;
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/common/CoderInfo.java
// Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder.java // public interface ICompressCoder { // // void code(InputStream inStream, OutputStream outStream, long outSize) throws IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder2.java // public interface ICompressCoder2 { // // public Result code( // ObjectVector<InputStream> inStreams, // int numInStreams, // ObjectVector<OutputStream> outStreams, // int numOutStreams) throws java.io.IOException; // // public void close() throws java.io.IOException; // }
import org.jamel.j7zip.common.LongVector; import org.jamel.j7zip.ICompressCoder; import org.jamel.j7zip.ICompressCoder2;
package org.jamel.j7zip.archive.common; public class CoderInfo { ICompressCoder Coder; ICompressCoder2 Coder2; int NumInStreams; int NumOutStreams;
// Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder.java // public interface ICompressCoder { // // void code(InputStream inStream, OutputStream outStream, long outSize) throws IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder2.java // public interface ICompressCoder2 { // // public Result code( // ObjectVector<InputStream> inStreams, // int numInStreams, // ObjectVector<OutputStream> outStreams, // int numOutStreams) throws java.io.IOException; // // public void close() throws java.io.IOException; // } // Path: src/main/java/org/jamel/j7zip/archive/common/CoderInfo.java import org.jamel.j7zip.common.LongVector; import org.jamel.j7zip.ICompressCoder; import org.jamel.j7zip.ICompressCoder2; package org.jamel.j7zip.archive.common; public class CoderInfo { ICompressCoder Coder; ICompressCoder2 Coder2; int NumInStreams; int NumOutStreams;
LongVector InSizes = new LongVector();
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/sevenZip/ExtractFolderInfo.java
// Path: src/main/java/org/jamel/j7zip/common/BoolVector.java // public class BoolVector { // // private static final int CAPACITY_INCR = 10; // // protected boolean[] data = new boolean[CAPACITY_INCR]; // int elt = 0; // // public BoolVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // boolean[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new boolean[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public boolean get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public void add(boolean b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // }
import org.jamel.j7zip.common.BoolVector;
package org.jamel.j7zip.archive.sevenZip; class ExtractFolderInfo { public int FileIndex; public int FolderIndex;
// Path: src/main/java/org/jamel/j7zip/common/BoolVector.java // public class BoolVector { // // private static final int CAPACITY_INCR = 10; // // protected boolean[] data = new boolean[CAPACITY_INCR]; // int elt = 0; // // public BoolVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // boolean[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new boolean[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public boolean get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public void add(boolean b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // } // Path: src/main/java/org/jamel/j7zip/archive/sevenZip/ExtractFolderInfo.java import org.jamel.j7zip.common.BoolVector; package org.jamel.j7zip.archive.sevenZip; class ExtractFolderInfo { public int FileIndex; public int FolderIndex;
public BoolVector ExtractStatuses = new BoolVector();
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/sevenZip/AltCoderInfo.java
// Path: src/main/java/org/jamel/j7zip/common/ByteBuffer.java // public class ByteBuffer { // int _capacity; // byte[] _items; // // public ByteBuffer() { // _capacity = 0; // _items = null; // } // // public byte[] data() { // return _items; // } // // public int GetCapacity() { // return _capacity; // } // // public void SetCapacity(int newCapacity) { // if (newCapacity == _capacity) { // return; // } // // byte[] newBuffer; // if (newCapacity > 0) { // newBuffer = new byte[newCapacity]; // if (_capacity > 0) { // int len = _capacity; // if (newCapacity < len) len = newCapacity; // // System.arraycopy(_items, 0, newBuffer, 0, len); // } // } else { // newBuffer = null; // } // // _items = newBuffer; // _capacity = newCapacity; // } // }
import org.jamel.j7zip.common.ByteBuffer;
package org.jamel.j7zip.archive.sevenZip; class AltCoderInfo { public final MethodID MethodID;
// Path: src/main/java/org/jamel/j7zip/common/ByteBuffer.java // public class ByteBuffer { // int _capacity; // byte[] _items; // // public ByteBuffer() { // _capacity = 0; // _items = null; // } // // public byte[] data() { // return _items; // } // // public int GetCapacity() { // return _capacity; // } // // public void SetCapacity(int newCapacity) { // if (newCapacity == _capacity) { // return; // } // // byte[] newBuffer; // if (newCapacity > 0) { // newBuffer = new byte[newCapacity]; // if (_capacity > 0) { // int len = _capacity; // if (newCapacity < len) len = newCapacity; // // System.arraycopy(_items, 0, newBuffer, 0, len); // } // } else { // newBuffer = null; // } // // _items = newBuffer; // _capacity = newCapacity; // } // } // Path: src/main/java/org/jamel/j7zip/archive/sevenZip/AltCoderInfo.java import org.jamel.j7zip.common.ByteBuffer; package org.jamel.j7zip.archive.sevenZip; class AltCoderInfo { public final MethodID MethodID;
public final ByteBuffer Properties;
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/IInArchive.java
// Path: src/main/java/org/jamel/j7zip/IInStream.java // public abstract class IInStream extends InputStream { // // public abstract long seekFromBegin(long offset) throws IOException; // // public abstract long seekFromCurrent(long offset) throws IOException; // } // // Path: src/main/java/org/jamel/j7zip/Result.java // public enum Result { // OK, // FALSE, // // ERROR_NOT_IMPLEMENTED, // ERROR_FAIL, // ERROR_INVALID_ARGS, // ; // }
import java.io.IOException; import org.jamel.j7zip.IInStream; import org.jamel.j7zip.Result;
package org.jamel.j7zip.archive; public interface IInArchive { public static enum AskMode {EXTRACT, TEST, SKIP} public static enum OperationResult {OK, UNSUPPORTED_METHOD, DATA_ERROR, CRC_ERROR} // Static-SFX (for Linux) can be big. public final long kMaxCheckStartPosition = 1 << 22; SevenZipEntry getEntry(int index); int size(); void close() throws IOException;
// Path: src/main/java/org/jamel/j7zip/IInStream.java // public abstract class IInStream extends InputStream { // // public abstract long seekFromBegin(long offset) throws IOException; // // public abstract long seekFromCurrent(long offset) throws IOException; // } // // Path: src/main/java/org/jamel/j7zip/Result.java // public enum Result { // OK, // FALSE, // // ERROR_NOT_IMPLEMENTED, // ERROR_FAIL, // ERROR_INVALID_ARGS, // ; // } // Path: src/main/java/org/jamel/j7zip/archive/IInArchive.java import java.io.IOException; import org.jamel.j7zip.IInStream; import org.jamel.j7zip.Result; package org.jamel.j7zip.archive; public interface IInArchive { public static enum AskMode {EXTRACT, TEST, SKIP} public static enum OperationResult {OK, UNSUPPORTED_METHOD, DATA_ERROR, CRC_ERROR} // Static-SFX (for Linux) can be big. public final long kMaxCheckStartPosition = 1 << 22; SevenZipEntry getEntry(int index); int size(); void close() throws IOException;
Result extract(int[] indices, IArchiveExtractCallback extractCallbackSpec) throws IOException;
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/IInArchive.java
// Path: src/main/java/org/jamel/j7zip/IInStream.java // public abstract class IInStream extends InputStream { // // public abstract long seekFromBegin(long offset) throws IOException; // // public abstract long seekFromCurrent(long offset) throws IOException; // } // // Path: src/main/java/org/jamel/j7zip/Result.java // public enum Result { // OK, // FALSE, // // ERROR_NOT_IMPLEMENTED, // ERROR_FAIL, // ERROR_INVALID_ARGS, // ; // }
import java.io.IOException; import org.jamel.j7zip.IInStream; import org.jamel.j7zip.Result;
package org.jamel.j7zip.archive; public interface IInArchive { public static enum AskMode {EXTRACT, TEST, SKIP} public static enum OperationResult {OK, UNSUPPORTED_METHOD, DATA_ERROR, CRC_ERROR} // Static-SFX (for Linux) can be big. public final long kMaxCheckStartPosition = 1 << 22; SevenZipEntry getEntry(int index); int size(); void close() throws IOException; Result extract(int[] indices, IArchiveExtractCallback extractCallbackSpec) throws IOException;
// Path: src/main/java/org/jamel/j7zip/IInStream.java // public abstract class IInStream extends InputStream { // // public abstract long seekFromBegin(long offset) throws IOException; // // public abstract long seekFromCurrent(long offset) throws IOException; // } // // Path: src/main/java/org/jamel/j7zip/Result.java // public enum Result { // OK, // FALSE, // // ERROR_NOT_IMPLEMENTED, // ERROR_FAIL, // ERROR_INVALID_ARGS, // ; // } // Path: src/main/java/org/jamel/j7zip/archive/IInArchive.java import java.io.IOException; import org.jamel.j7zip.IInStream; import org.jamel.j7zip.Result; package org.jamel.j7zip.archive; public interface IInArchive { public static enum AskMode {EXTRACT, TEST, SKIP} public static enum OperationResult {OK, UNSUPPORTED_METHOD, DATA_ERROR, CRC_ERROR} // Static-SFX (for Linux) can be big. public final long kMaxCheckStartPosition = 1 << 22; SevenZipEntry getEntry(int index); int size(); void close() throws IOException; Result extract(int[] indices, IArchiveExtractCallback extractCallbackSpec) throws IOException;
Result open(IInStream stream) throws IOException;
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/common/CoderMixer2.java
// Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // }
import org.jamel.j7zip.common.LongVector;
package org.jamel.j7zip.archive.common; public interface CoderMixer2 { void setBindInfo(BindInfo bindInfo);
// Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // Path: src/main/java/org/jamel/j7zip/archive/common/CoderMixer2.java import org.jamel.j7zip.common.LongVector; package org.jamel.j7zip.archive.common; public interface CoderMixer2 { void setBindInfo(BindInfo bindInfo);
void setCoderInfo(int coderIndex, LongVector inSizes, LongVector outSizes);
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/common/CoderMixer2ST.java
// Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder.java // public interface ICompressCoder { // // void code(InputStream inStream, OutputStream outStream, long outSize) throws IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder2.java // public interface ICompressCoder2 { // // public Result code( // ObjectVector<InputStream> inStreams, // int numInStreams, // ObjectVector<OutputStream> outStreams, // int numOutStreams) throws java.io.IOException; // // public void close() throws java.io.IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetInStream.java // public interface ICompressSetInStream { // // public void setInStream(java.io.InputStream inStream); // // public void releaseInStream() throws java.io.IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetOutStream.java // public interface ICompressSetOutStream { // // void setOutStream(OutputStream inStream); // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetOutStreamSize.java // public interface ICompressSetOutStreamSize { // public static final int INVALID_OUTSIZE = -1; // // public void setOutStreamSize(long outSize); // } // // Path: src/main/java/org/jamel/j7zip/Result.java // public enum Result { // OK, // FALSE, // // ERROR_NOT_IMPLEMENTED, // ERROR_FAIL, // ERROR_INVALID_ARGS, // ; // }
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.jamel.j7zip.common.LongVector; import org.jamel.j7zip.common.ObjectVector; import org.jamel.j7zip.ICompressCoder; import org.jamel.j7zip.ICompressCoder2; import org.jamel.j7zip.ICompressSetInStream; import org.jamel.j7zip.ICompressSetOutStream; import org.jamel.j7zip.ICompressSetOutStreamSize; import org.jamel.j7zip.Result;
package org.jamel.j7zip.archive.common; public class CoderMixer2ST implements ICompressCoder2, CoderMixer2 { private BindInfo bindInfo = new BindInfo();
// Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder.java // public interface ICompressCoder { // // void code(InputStream inStream, OutputStream outStream, long outSize) throws IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder2.java // public interface ICompressCoder2 { // // public Result code( // ObjectVector<InputStream> inStreams, // int numInStreams, // ObjectVector<OutputStream> outStreams, // int numOutStreams) throws java.io.IOException; // // public void close() throws java.io.IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetInStream.java // public interface ICompressSetInStream { // // public void setInStream(java.io.InputStream inStream); // // public void releaseInStream() throws java.io.IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetOutStream.java // public interface ICompressSetOutStream { // // void setOutStream(OutputStream inStream); // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetOutStreamSize.java // public interface ICompressSetOutStreamSize { // public static final int INVALID_OUTSIZE = -1; // // public void setOutStreamSize(long outSize); // } // // Path: src/main/java/org/jamel/j7zip/Result.java // public enum Result { // OK, // FALSE, // // ERROR_NOT_IMPLEMENTED, // ERROR_FAIL, // ERROR_INVALID_ARGS, // ; // } // Path: src/main/java/org/jamel/j7zip/archive/common/CoderMixer2ST.java import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.jamel.j7zip.common.LongVector; import org.jamel.j7zip.common.ObjectVector; import org.jamel.j7zip.ICompressCoder; import org.jamel.j7zip.ICompressCoder2; import org.jamel.j7zip.ICompressSetInStream; import org.jamel.j7zip.ICompressSetOutStream; import org.jamel.j7zip.ICompressSetOutStreamSize; import org.jamel.j7zip.Result; package org.jamel.j7zip.archive.common; public class CoderMixer2ST implements ICompressCoder2, CoderMixer2 { private BindInfo bindInfo = new BindInfo();
private ObjectVector<STCoderInfo> coders = new ObjectVector<>();
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/common/CoderMixer2ST.java
// Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder.java // public interface ICompressCoder { // // void code(InputStream inStream, OutputStream outStream, long outSize) throws IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder2.java // public interface ICompressCoder2 { // // public Result code( // ObjectVector<InputStream> inStreams, // int numInStreams, // ObjectVector<OutputStream> outStreams, // int numOutStreams) throws java.io.IOException; // // public void close() throws java.io.IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetInStream.java // public interface ICompressSetInStream { // // public void setInStream(java.io.InputStream inStream); // // public void releaseInStream() throws java.io.IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetOutStream.java // public interface ICompressSetOutStream { // // void setOutStream(OutputStream inStream); // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetOutStreamSize.java // public interface ICompressSetOutStreamSize { // public static final int INVALID_OUTSIZE = -1; // // public void setOutStreamSize(long outSize); // } // // Path: src/main/java/org/jamel/j7zip/Result.java // public enum Result { // OK, // FALSE, // // ERROR_NOT_IMPLEMENTED, // ERROR_FAIL, // ERROR_INVALID_ARGS, // ; // }
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.jamel.j7zip.common.LongVector; import org.jamel.j7zip.common.ObjectVector; import org.jamel.j7zip.ICompressCoder; import org.jamel.j7zip.ICompressCoder2; import org.jamel.j7zip.ICompressSetInStream; import org.jamel.j7zip.ICompressSetOutStream; import org.jamel.j7zip.ICompressSetOutStreamSize; import org.jamel.j7zip.Result;
package org.jamel.j7zip.archive.common; public class CoderMixer2ST implements ICompressCoder2, CoderMixer2 { private BindInfo bindInfo = new BindInfo(); private ObjectVector<STCoderInfo> coders = new ObjectVector<>(); public void setBindInfo(BindInfo bindInfo) { this.bindInfo = bindInfo; } public void addCoderCommon(boolean isMain) { CoderStreamsInfo csi = bindInfo.coders.get(coders.size()); coders.add(new STCoderInfo(csi.getInStreamsCount(), csi.getOutStreamsCount(), isMain)); } public void addCoder2(ICompressCoder2 coder, boolean isMain) { addCoderCommon(isMain); coders.last().Coder2 = coder; }
// Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder.java // public interface ICompressCoder { // // void code(InputStream inStream, OutputStream outStream, long outSize) throws IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder2.java // public interface ICompressCoder2 { // // public Result code( // ObjectVector<InputStream> inStreams, // int numInStreams, // ObjectVector<OutputStream> outStreams, // int numOutStreams) throws java.io.IOException; // // public void close() throws java.io.IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetInStream.java // public interface ICompressSetInStream { // // public void setInStream(java.io.InputStream inStream); // // public void releaseInStream() throws java.io.IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetOutStream.java // public interface ICompressSetOutStream { // // void setOutStream(OutputStream inStream); // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetOutStreamSize.java // public interface ICompressSetOutStreamSize { // public static final int INVALID_OUTSIZE = -1; // // public void setOutStreamSize(long outSize); // } // // Path: src/main/java/org/jamel/j7zip/Result.java // public enum Result { // OK, // FALSE, // // ERROR_NOT_IMPLEMENTED, // ERROR_FAIL, // ERROR_INVALID_ARGS, // ; // } // Path: src/main/java/org/jamel/j7zip/archive/common/CoderMixer2ST.java import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.jamel.j7zip.common.LongVector; import org.jamel.j7zip.common.ObjectVector; import org.jamel.j7zip.ICompressCoder; import org.jamel.j7zip.ICompressCoder2; import org.jamel.j7zip.ICompressSetInStream; import org.jamel.j7zip.ICompressSetOutStream; import org.jamel.j7zip.ICompressSetOutStreamSize; import org.jamel.j7zip.Result; package org.jamel.j7zip.archive.common; public class CoderMixer2ST implements ICompressCoder2, CoderMixer2 { private BindInfo bindInfo = new BindInfo(); private ObjectVector<STCoderInfo> coders = new ObjectVector<>(); public void setBindInfo(BindInfo bindInfo) { this.bindInfo = bindInfo; } public void addCoderCommon(boolean isMain) { CoderStreamsInfo csi = bindInfo.coders.get(coders.size()); coders.add(new STCoderInfo(csi.getInStreamsCount(), csi.getOutStreamsCount(), isMain)); } public void addCoder2(ICompressCoder2 coder, boolean isMain) { addCoderCommon(isMain); coders.last().Coder2 = coder; }
public void addCoder(ICompressCoder coder, boolean isMain) {
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/common/CoderMixer2ST.java
// Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder.java // public interface ICompressCoder { // // void code(InputStream inStream, OutputStream outStream, long outSize) throws IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder2.java // public interface ICompressCoder2 { // // public Result code( // ObjectVector<InputStream> inStreams, // int numInStreams, // ObjectVector<OutputStream> outStreams, // int numOutStreams) throws java.io.IOException; // // public void close() throws java.io.IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetInStream.java // public interface ICompressSetInStream { // // public void setInStream(java.io.InputStream inStream); // // public void releaseInStream() throws java.io.IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetOutStream.java // public interface ICompressSetOutStream { // // void setOutStream(OutputStream inStream); // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetOutStreamSize.java // public interface ICompressSetOutStreamSize { // public static final int INVALID_OUTSIZE = -1; // // public void setOutStreamSize(long outSize); // } // // Path: src/main/java/org/jamel/j7zip/Result.java // public enum Result { // OK, // FALSE, // // ERROR_NOT_IMPLEMENTED, // ERROR_FAIL, // ERROR_INVALID_ARGS, // ; // }
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.jamel.j7zip.common.LongVector; import org.jamel.j7zip.common.ObjectVector; import org.jamel.j7zip.ICompressCoder; import org.jamel.j7zip.ICompressCoder2; import org.jamel.j7zip.ICompressSetInStream; import org.jamel.j7zip.ICompressSetOutStream; import org.jamel.j7zip.ICompressSetOutStreamSize; import org.jamel.j7zip.Result;
package org.jamel.j7zip.archive.common; public class CoderMixer2ST implements ICompressCoder2, CoderMixer2 { private BindInfo bindInfo = new BindInfo(); private ObjectVector<STCoderInfo> coders = new ObjectVector<>(); public void setBindInfo(BindInfo bindInfo) { this.bindInfo = bindInfo; } public void addCoderCommon(boolean isMain) { CoderStreamsInfo csi = bindInfo.coders.get(coders.size()); coders.add(new STCoderInfo(csi.getInStreamsCount(), csi.getOutStreamsCount(), isMain)); } public void addCoder2(ICompressCoder2 coder, boolean isMain) { addCoderCommon(isMain); coders.last().Coder2 = coder; } public void addCoder(ICompressCoder coder, boolean isMain) { addCoderCommon(isMain); coders.last().Coder = coder; }
// Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder.java // public interface ICompressCoder { // // void code(InputStream inStream, OutputStream outStream, long outSize) throws IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder2.java // public interface ICompressCoder2 { // // public Result code( // ObjectVector<InputStream> inStreams, // int numInStreams, // ObjectVector<OutputStream> outStreams, // int numOutStreams) throws java.io.IOException; // // public void close() throws java.io.IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetInStream.java // public interface ICompressSetInStream { // // public void setInStream(java.io.InputStream inStream); // // public void releaseInStream() throws java.io.IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetOutStream.java // public interface ICompressSetOutStream { // // void setOutStream(OutputStream inStream); // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetOutStreamSize.java // public interface ICompressSetOutStreamSize { // public static final int INVALID_OUTSIZE = -1; // // public void setOutStreamSize(long outSize); // } // // Path: src/main/java/org/jamel/j7zip/Result.java // public enum Result { // OK, // FALSE, // // ERROR_NOT_IMPLEMENTED, // ERROR_FAIL, // ERROR_INVALID_ARGS, // ; // } // Path: src/main/java/org/jamel/j7zip/archive/common/CoderMixer2ST.java import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.jamel.j7zip.common.LongVector; import org.jamel.j7zip.common.ObjectVector; import org.jamel.j7zip.ICompressCoder; import org.jamel.j7zip.ICompressCoder2; import org.jamel.j7zip.ICompressSetInStream; import org.jamel.j7zip.ICompressSetOutStream; import org.jamel.j7zip.ICompressSetOutStreamSize; import org.jamel.j7zip.Result; package org.jamel.j7zip.archive.common; public class CoderMixer2ST implements ICompressCoder2, CoderMixer2 { private BindInfo bindInfo = new BindInfo(); private ObjectVector<STCoderInfo> coders = new ObjectVector<>(); public void setBindInfo(BindInfo bindInfo) { this.bindInfo = bindInfo; } public void addCoderCommon(boolean isMain) { CoderStreamsInfo csi = bindInfo.coders.get(coders.size()); coders.add(new STCoderInfo(csi.getInStreamsCount(), csi.getOutStreamsCount(), isMain)); } public void addCoder2(ICompressCoder2 coder, boolean isMain) { addCoderCommon(isMain); coders.last().Coder2 = coder; } public void addCoder(ICompressCoder coder, boolean isMain) { addCoderCommon(isMain); coders.last().Coder = coder; }
public void setCoderInfo(int coderIndex, LongVector inSizes, LongVector outSizes) {
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/common/CoderMixer2ST.java
// Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder.java // public interface ICompressCoder { // // void code(InputStream inStream, OutputStream outStream, long outSize) throws IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder2.java // public interface ICompressCoder2 { // // public Result code( // ObjectVector<InputStream> inStreams, // int numInStreams, // ObjectVector<OutputStream> outStreams, // int numOutStreams) throws java.io.IOException; // // public void close() throws java.io.IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetInStream.java // public interface ICompressSetInStream { // // public void setInStream(java.io.InputStream inStream); // // public void releaseInStream() throws java.io.IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetOutStream.java // public interface ICompressSetOutStream { // // void setOutStream(OutputStream inStream); // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetOutStreamSize.java // public interface ICompressSetOutStreamSize { // public static final int INVALID_OUTSIZE = -1; // // public void setOutStreamSize(long outSize); // } // // Path: src/main/java/org/jamel/j7zip/Result.java // public enum Result { // OK, // FALSE, // // ERROR_NOT_IMPLEMENTED, // ERROR_FAIL, // ERROR_INVALID_ARGS, // ; // }
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.jamel.j7zip.common.LongVector; import org.jamel.j7zip.common.ObjectVector; import org.jamel.j7zip.ICompressCoder; import org.jamel.j7zip.ICompressCoder2; import org.jamel.j7zip.ICompressSetInStream; import org.jamel.j7zip.ICompressSetOutStream; import org.jamel.j7zip.ICompressSetOutStreamSize; import org.jamel.j7zip.Result;
} public void addCoder2(ICompressCoder2 coder, boolean isMain) { addCoderCommon(isMain); coders.last().Coder2 = coder; } public void addCoder(ICompressCoder coder, boolean isMain) { addCoderCommon(isMain); coders.last().Coder = coder; } public void setCoderInfo(int coderIndex, LongVector inSizes, LongVector outSizes) { coders.get(coderIndex).setCoderInfo(inSizes, outSizes); } public InputStream getInStream(ObjectVector<InputStream> inStreams, int streamIndex) throws IOException { for (int i = 0; i < bindInfo.inStreams.size(); i++) { if (bindInfo.inStreams.get(i) == streamIndex) { return inStreams.get(i); } } int binderIndex = bindInfo.findBinderForInStream(streamIndex); if (binderIndex < 0) { throw new IOException("Can't find binder for input stream"); } int coderIndex = bindInfo.findOutStream(bindInfo.bindPairs.get(binderIndex).outIndex); CoderInfo coder = coders.get(coderIndex);
// Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder.java // public interface ICompressCoder { // // void code(InputStream inStream, OutputStream outStream, long outSize) throws IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder2.java // public interface ICompressCoder2 { // // public Result code( // ObjectVector<InputStream> inStreams, // int numInStreams, // ObjectVector<OutputStream> outStreams, // int numOutStreams) throws java.io.IOException; // // public void close() throws java.io.IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetInStream.java // public interface ICompressSetInStream { // // public void setInStream(java.io.InputStream inStream); // // public void releaseInStream() throws java.io.IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetOutStream.java // public interface ICompressSetOutStream { // // void setOutStream(OutputStream inStream); // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetOutStreamSize.java // public interface ICompressSetOutStreamSize { // public static final int INVALID_OUTSIZE = -1; // // public void setOutStreamSize(long outSize); // } // // Path: src/main/java/org/jamel/j7zip/Result.java // public enum Result { // OK, // FALSE, // // ERROR_NOT_IMPLEMENTED, // ERROR_FAIL, // ERROR_INVALID_ARGS, // ; // } // Path: src/main/java/org/jamel/j7zip/archive/common/CoderMixer2ST.java import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.jamel.j7zip.common.LongVector; import org.jamel.j7zip.common.ObjectVector; import org.jamel.j7zip.ICompressCoder; import org.jamel.j7zip.ICompressCoder2; import org.jamel.j7zip.ICompressSetInStream; import org.jamel.j7zip.ICompressSetOutStream; import org.jamel.j7zip.ICompressSetOutStreamSize; import org.jamel.j7zip.Result; } public void addCoder2(ICompressCoder2 coder, boolean isMain) { addCoderCommon(isMain); coders.last().Coder2 = coder; } public void addCoder(ICompressCoder coder, boolean isMain) { addCoderCommon(isMain); coders.last().Coder = coder; } public void setCoderInfo(int coderIndex, LongVector inSizes, LongVector outSizes) { coders.get(coderIndex).setCoderInfo(inSizes, outSizes); } public InputStream getInStream(ObjectVector<InputStream> inStreams, int streamIndex) throws IOException { for (int i = 0; i < bindInfo.inStreams.size(); i++) { if (bindInfo.inStreams.get(i) == streamIndex) { return inStreams.get(i); } } int binderIndex = bindInfo.findBinderForInStream(streamIndex); if (binderIndex < 0) { throw new IOException("Can't find binder for input stream"); } int coderIndex = bindInfo.findOutStream(bindInfo.bindPairs.get(binderIndex).outIndex); CoderInfo coder = coders.get(coderIndex);
if (!(coder.Coder instanceof InputStream) || !(coder.Coder instanceof ICompressSetInStream)
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/common/CoderMixer2ST.java
// Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder.java // public interface ICompressCoder { // // void code(InputStream inStream, OutputStream outStream, long outSize) throws IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder2.java // public interface ICompressCoder2 { // // public Result code( // ObjectVector<InputStream> inStreams, // int numInStreams, // ObjectVector<OutputStream> outStreams, // int numOutStreams) throws java.io.IOException; // // public void close() throws java.io.IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetInStream.java // public interface ICompressSetInStream { // // public void setInStream(java.io.InputStream inStream); // // public void releaseInStream() throws java.io.IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetOutStream.java // public interface ICompressSetOutStream { // // void setOutStream(OutputStream inStream); // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetOutStreamSize.java // public interface ICompressSetOutStreamSize { // public static final int INVALID_OUTSIZE = -1; // // public void setOutStreamSize(long outSize); // } // // Path: src/main/java/org/jamel/j7zip/Result.java // public enum Result { // OK, // FALSE, // // ERROR_NOT_IMPLEMENTED, // ERROR_FAIL, // ERROR_INVALID_ARGS, // ; // }
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.jamel.j7zip.common.LongVector; import org.jamel.j7zip.common.ObjectVector; import org.jamel.j7zip.ICompressCoder; import org.jamel.j7zip.ICompressCoder2; import org.jamel.j7zip.ICompressSetInStream; import org.jamel.j7zip.ICompressSetOutStream; import org.jamel.j7zip.ICompressSetOutStreamSize; import org.jamel.j7zip.Result;
if (!(coder.Coder instanceof InputStream) || !(coder.Coder instanceof ICompressSetInStream) || coder.NumInStreams > 1) { throw new IOException("Coder is not implemented"); } ICompressSetInStream setInStream = (ICompressSetInStream) coder.Coder; int startIndex = bindInfo.getCoderInStreamIndex(coderIndex); for (int i = 0; i < coder.NumInStreams; i++) { setInStream.setInStream(getInStream(inStreams, startIndex + i)); } return (InputStream) coder.Coder; } public OutputStream getOutStream(ObjectVector<OutputStream> outStreams, int streamIndex) throws IOException { for (int i = 0; i < bindInfo.outStreams.size(); i++) { if (bindInfo.outStreams.get(i) == streamIndex) { return outStreams.get(i); } } int binderIndex = bindInfo.findBinderForOutStream(streamIndex); if (binderIndex < 0) { throw new IOException("Can't find binder for out stream"); } int coderIndex = bindInfo.findInStream(bindInfo.bindPairs.get(binderIndex).inIndex); CoderInfo coder = coders.get(coderIndex);
// Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder.java // public interface ICompressCoder { // // void code(InputStream inStream, OutputStream outStream, long outSize) throws IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder2.java // public interface ICompressCoder2 { // // public Result code( // ObjectVector<InputStream> inStreams, // int numInStreams, // ObjectVector<OutputStream> outStreams, // int numOutStreams) throws java.io.IOException; // // public void close() throws java.io.IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetInStream.java // public interface ICompressSetInStream { // // public void setInStream(java.io.InputStream inStream); // // public void releaseInStream() throws java.io.IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetOutStream.java // public interface ICompressSetOutStream { // // void setOutStream(OutputStream inStream); // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetOutStreamSize.java // public interface ICompressSetOutStreamSize { // public static final int INVALID_OUTSIZE = -1; // // public void setOutStreamSize(long outSize); // } // // Path: src/main/java/org/jamel/j7zip/Result.java // public enum Result { // OK, // FALSE, // // ERROR_NOT_IMPLEMENTED, // ERROR_FAIL, // ERROR_INVALID_ARGS, // ; // } // Path: src/main/java/org/jamel/j7zip/archive/common/CoderMixer2ST.java import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.jamel.j7zip.common.LongVector; import org.jamel.j7zip.common.ObjectVector; import org.jamel.j7zip.ICompressCoder; import org.jamel.j7zip.ICompressCoder2; import org.jamel.j7zip.ICompressSetInStream; import org.jamel.j7zip.ICompressSetOutStream; import org.jamel.j7zip.ICompressSetOutStreamSize; import org.jamel.j7zip.Result; if (!(coder.Coder instanceof InputStream) || !(coder.Coder instanceof ICompressSetInStream) || coder.NumInStreams > 1) { throw new IOException("Coder is not implemented"); } ICompressSetInStream setInStream = (ICompressSetInStream) coder.Coder; int startIndex = bindInfo.getCoderInStreamIndex(coderIndex); for (int i = 0; i < coder.NumInStreams; i++) { setInStream.setInStream(getInStream(inStreams, startIndex + i)); } return (InputStream) coder.Coder; } public OutputStream getOutStream(ObjectVector<OutputStream> outStreams, int streamIndex) throws IOException { for (int i = 0; i < bindInfo.outStreams.size(); i++) { if (bindInfo.outStreams.get(i) == streamIndex) { return outStreams.get(i); } } int binderIndex = bindInfo.findBinderForOutStream(streamIndex); if (binderIndex < 0) { throw new IOException("Can't find binder for out stream"); } int coderIndex = bindInfo.findInStream(bindInfo.bindPairs.get(binderIndex).inIndex); CoderInfo coder = coders.get(coderIndex);
if (!(coder.Coder instanceof OutputStream) || !(coder.Coder instanceof ICompressSetOutStream)
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/common/CoderMixer2ST.java
// Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder.java // public interface ICompressCoder { // // void code(InputStream inStream, OutputStream outStream, long outSize) throws IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder2.java // public interface ICompressCoder2 { // // public Result code( // ObjectVector<InputStream> inStreams, // int numInStreams, // ObjectVector<OutputStream> outStreams, // int numOutStreams) throws java.io.IOException; // // public void close() throws java.io.IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetInStream.java // public interface ICompressSetInStream { // // public void setInStream(java.io.InputStream inStream); // // public void releaseInStream() throws java.io.IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetOutStream.java // public interface ICompressSetOutStream { // // void setOutStream(OutputStream inStream); // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetOutStreamSize.java // public interface ICompressSetOutStreamSize { // public static final int INVALID_OUTSIZE = -1; // // public void setOutStreamSize(long outSize); // } // // Path: src/main/java/org/jamel/j7zip/Result.java // public enum Result { // OK, // FALSE, // // ERROR_NOT_IMPLEMENTED, // ERROR_FAIL, // ERROR_INVALID_ARGS, // ; // }
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.jamel.j7zip.common.LongVector; import org.jamel.j7zip.common.ObjectVector; import org.jamel.j7zip.ICompressCoder; import org.jamel.j7zip.ICompressCoder2; import org.jamel.j7zip.ICompressSetInStream; import org.jamel.j7zip.ICompressSetOutStream; import org.jamel.j7zip.ICompressSetOutStreamSize; import org.jamel.j7zip.Result;
public OutputStream getOutStream(ObjectVector<OutputStream> outStreams, int streamIndex) throws IOException { for (int i = 0; i < bindInfo.outStreams.size(); i++) { if (bindInfo.outStreams.get(i) == streamIndex) { return outStreams.get(i); } } int binderIndex = bindInfo.findBinderForOutStream(streamIndex); if (binderIndex < 0) { throw new IOException("Can't find binder for out stream"); } int coderIndex = bindInfo.findInStream(bindInfo.bindPairs.get(binderIndex).inIndex); CoderInfo coder = coders.get(coderIndex); if (!(coder.Coder instanceof OutputStream) || !(coder.Coder instanceof ICompressSetOutStream) || coder.NumOutStreams > 1) { throw new IOException("Coder is not implemented"); } ICompressSetOutStream setOutStream = (ICompressSetOutStream) coder.Coder; int startIndex = bindInfo.GetCoderOutStreamIndex(coderIndex); for (int i = 0; i < coder.NumOutStreams; i++) { setOutStream.setOutStream(getOutStream(outStreams, startIndex + i)); } return (OutputStream) coder.Coder; }
// Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder.java // public interface ICompressCoder { // // void code(InputStream inStream, OutputStream outStream, long outSize) throws IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder2.java // public interface ICompressCoder2 { // // public Result code( // ObjectVector<InputStream> inStreams, // int numInStreams, // ObjectVector<OutputStream> outStreams, // int numOutStreams) throws java.io.IOException; // // public void close() throws java.io.IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetInStream.java // public interface ICompressSetInStream { // // public void setInStream(java.io.InputStream inStream); // // public void releaseInStream() throws java.io.IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetOutStream.java // public interface ICompressSetOutStream { // // void setOutStream(OutputStream inStream); // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetOutStreamSize.java // public interface ICompressSetOutStreamSize { // public static final int INVALID_OUTSIZE = -1; // // public void setOutStreamSize(long outSize); // } // // Path: src/main/java/org/jamel/j7zip/Result.java // public enum Result { // OK, // FALSE, // // ERROR_NOT_IMPLEMENTED, // ERROR_FAIL, // ERROR_INVALID_ARGS, // ; // } // Path: src/main/java/org/jamel/j7zip/archive/common/CoderMixer2ST.java import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.jamel.j7zip.common.LongVector; import org.jamel.j7zip.common.ObjectVector; import org.jamel.j7zip.ICompressCoder; import org.jamel.j7zip.ICompressCoder2; import org.jamel.j7zip.ICompressSetInStream; import org.jamel.j7zip.ICompressSetOutStream; import org.jamel.j7zip.ICompressSetOutStreamSize; import org.jamel.j7zip.Result; public OutputStream getOutStream(ObjectVector<OutputStream> outStreams, int streamIndex) throws IOException { for (int i = 0; i < bindInfo.outStreams.size(); i++) { if (bindInfo.outStreams.get(i) == streamIndex) { return outStreams.get(i); } } int binderIndex = bindInfo.findBinderForOutStream(streamIndex); if (binderIndex < 0) { throw new IOException("Can't find binder for out stream"); } int coderIndex = bindInfo.findInStream(bindInfo.bindPairs.get(binderIndex).inIndex); CoderInfo coder = coders.get(coderIndex); if (!(coder.Coder instanceof OutputStream) || !(coder.Coder instanceof ICompressSetOutStream) || coder.NumOutStreams > 1) { throw new IOException("Coder is not implemented"); } ICompressSetOutStream setOutStream = (ICompressSetOutStream) coder.Coder; int startIndex = bindInfo.GetCoderOutStreamIndex(coderIndex); for (int i = 0; i < coder.NumOutStreams; i++) { setOutStream.setOutStream(getOutStream(outStreams, startIndex + i)); } return (OutputStream) coder.Coder; }
public Result code(
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/common/CoderMixer2ST.java
// Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder.java // public interface ICompressCoder { // // void code(InputStream inStream, OutputStream outStream, long outSize) throws IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder2.java // public interface ICompressCoder2 { // // public Result code( // ObjectVector<InputStream> inStreams, // int numInStreams, // ObjectVector<OutputStream> outStreams, // int numOutStreams) throws java.io.IOException; // // public void close() throws java.io.IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetInStream.java // public interface ICompressSetInStream { // // public void setInStream(java.io.InputStream inStream); // // public void releaseInStream() throws java.io.IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetOutStream.java // public interface ICompressSetOutStream { // // void setOutStream(OutputStream inStream); // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetOutStreamSize.java // public interface ICompressSetOutStreamSize { // public static final int INVALID_OUTSIZE = -1; // // public void setOutStreamSize(long outSize); // } // // Path: src/main/java/org/jamel/j7zip/Result.java // public enum Result { // OK, // FALSE, // // ERROR_NOT_IMPLEMENTED, // ERROR_FAIL, // ERROR_INVALID_ARGS, // ; // }
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.jamel.j7zip.common.LongVector; import org.jamel.j7zip.common.ObjectVector; import org.jamel.j7zip.ICompressCoder; import org.jamel.j7zip.ICompressCoder2; import org.jamel.j7zip.ICompressSetInStream; import org.jamel.j7zip.ICompressSetOutStream; import org.jamel.j7zip.ICompressSetOutStreamSize; import org.jamel.j7zip.Result;
_mainCoderIndex = 0; } CoderInfo mainCoder = coders.get(_mainCoderIndex); ObjectVector<InputStream> seqInStreams = new ObjectVector<>(); ObjectVector<OutputStream> seqOutStreams = new ObjectVector<>(); int startInIndex = bindInfo.getCoderInStreamIndex(_mainCoderIndex); int startOutIndex = bindInfo.GetCoderOutStreamIndex(_mainCoderIndex); for (int i = 0; i < mainCoder.NumInStreams; i++) { seqInStreams.add(getInStream(inStreams, startInIndex + i)); } for (int i = 0; i < mainCoder.NumOutStreams; i++) { seqOutStreams.add(getOutStream(outStreams, startOutIndex + i)); } ObjectVector<InputStream> seqInStreamsSpec = new ObjectVector<>(); ObjectVector<OutputStream> seqOutStreamsSpec = new ObjectVector<>(); for (int i = 0; i < mainCoder.NumInStreams; i++) { seqInStreamsSpec.add(seqInStreams.get(i)); } for (int i = 0; i < mainCoder.NumOutStreams; i++) { seqOutStreamsSpec.add(seqOutStreams.get(i)); } for (int i = 0; i < coders.size(); i++) { if (i == _mainCoderIndex) { continue; } CoderInfo coder = coders.get(i);
// Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder.java // public interface ICompressCoder { // // void code(InputStream inStream, OutputStream outStream, long outSize) throws IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressCoder2.java // public interface ICompressCoder2 { // // public Result code( // ObjectVector<InputStream> inStreams, // int numInStreams, // ObjectVector<OutputStream> outStreams, // int numOutStreams) throws java.io.IOException; // // public void close() throws java.io.IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetInStream.java // public interface ICompressSetInStream { // // public void setInStream(java.io.InputStream inStream); // // public void releaseInStream() throws java.io.IOException; // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetOutStream.java // public interface ICompressSetOutStream { // // void setOutStream(OutputStream inStream); // } // // Path: src/main/java/org/jamel/j7zip/ICompressSetOutStreamSize.java // public interface ICompressSetOutStreamSize { // public static final int INVALID_OUTSIZE = -1; // // public void setOutStreamSize(long outSize); // } // // Path: src/main/java/org/jamel/j7zip/Result.java // public enum Result { // OK, // FALSE, // // ERROR_NOT_IMPLEMENTED, // ERROR_FAIL, // ERROR_INVALID_ARGS, // ; // } // Path: src/main/java/org/jamel/j7zip/archive/common/CoderMixer2ST.java import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.jamel.j7zip.common.LongVector; import org.jamel.j7zip.common.ObjectVector; import org.jamel.j7zip.ICompressCoder; import org.jamel.j7zip.ICompressCoder2; import org.jamel.j7zip.ICompressSetInStream; import org.jamel.j7zip.ICompressSetOutStream; import org.jamel.j7zip.ICompressSetOutStreamSize; import org.jamel.j7zip.Result; _mainCoderIndex = 0; } CoderInfo mainCoder = coders.get(_mainCoderIndex); ObjectVector<InputStream> seqInStreams = new ObjectVector<>(); ObjectVector<OutputStream> seqOutStreams = new ObjectVector<>(); int startInIndex = bindInfo.getCoderInStreamIndex(_mainCoderIndex); int startOutIndex = bindInfo.GetCoderOutStreamIndex(_mainCoderIndex); for (int i = 0; i < mainCoder.NumInStreams; i++) { seqInStreams.add(getInStream(inStreams, startInIndex + i)); } for (int i = 0; i < mainCoder.NumOutStreams; i++) { seqOutStreams.add(getOutStream(outStreams, startOutIndex + i)); } ObjectVector<InputStream> seqInStreamsSpec = new ObjectVector<>(); ObjectVector<OutputStream> seqOutStreamsSpec = new ObjectVector<>(); for (int i = 0; i < mainCoder.NumInStreams; i++) { seqInStreamsSpec.add(seqInStreams.get(i)); } for (int i = 0; i < mainCoder.NumOutStreams; i++) { seqOutStreamsSpec.add(seqOutStreams.get(i)); } for (int i = 0; i < coders.size(); i++) { if (i == _mainCoderIndex) { continue; } CoderInfo coder = coders.get(i);
if (coder instanceof ICompressSetOutStreamSize) {
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/sevenZip/ArchiveDatabaseEx.java
// Path: src/main/java/org/jamel/j7zip/common/IntVector.java // public class IntVector { // private static final int CAPACITY_INCR = 10; // // private int[] data = new int[CAPACITY_INCR]; // int elt = 0; // // public IntVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // int[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new int[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public int get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public void add(int b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // } // // Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // }
import org.jamel.j7zip.common.IntVector; import org.jamel.j7zip.common.LongVector;
package org.jamel.j7zip.archive.sevenZip; public class ArchiveDatabaseEx extends ArchiveDatabase { final InArchiveInfo ArchiveInfo = new InArchiveInfo();
// Path: src/main/java/org/jamel/j7zip/common/IntVector.java // public class IntVector { // private static final int CAPACITY_INCR = 10; // // private int[] data = new int[CAPACITY_INCR]; // int elt = 0; // // public IntVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // int[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new int[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public int get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public void add(int b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // } // // Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // Path: src/main/java/org/jamel/j7zip/archive/sevenZip/ArchiveDatabaseEx.java import org.jamel.j7zip.common.IntVector; import org.jamel.j7zip.common.LongVector; package org.jamel.j7zip.archive.sevenZip; public class ArchiveDatabaseEx extends ArchiveDatabase { final InArchiveInfo ArchiveInfo = new InArchiveInfo();
final LongVector PackStreamStartPositions = new LongVector();
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/sevenZip/ArchiveDatabaseEx.java
// Path: src/main/java/org/jamel/j7zip/common/IntVector.java // public class IntVector { // private static final int CAPACITY_INCR = 10; // // private int[] data = new int[CAPACITY_INCR]; // int elt = 0; // // public IntVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // int[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new int[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public int get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public void add(int b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // } // // Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // }
import org.jamel.j7zip.common.IntVector; import org.jamel.j7zip.common.LongVector;
package org.jamel.j7zip.archive.sevenZip; public class ArchiveDatabaseEx extends ArchiveDatabase { final InArchiveInfo ArchiveInfo = new InArchiveInfo(); final LongVector PackStreamStartPositions = new LongVector();
// Path: src/main/java/org/jamel/j7zip/common/IntVector.java // public class IntVector { // private static final int CAPACITY_INCR = 10; // // private int[] data = new int[CAPACITY_INCR]; // int elt = 0; // // public IntVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // int[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new int[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public int get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public void add(int b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // } // // Path: src/main/java/org/jamel/j7zip/common/LongVector.java // public class LongVector { // private static final int CAPACITY_INCR = 10; // // private long[] data = new long[CAPACITY_INCR]; // int elt = 0; // // public LongVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // long[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new long[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public long get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void Reserve(int s) { // ensureCapacity(s); // } // // public void add(long b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // // public long Back() { // if (elt < 1) { // throw new ArrayIndexOutOfBoundsException(0); // } // // return data[elt - 1]; // } // // public void DeleteBack() { // remove(elt - 1); // } // // public long remove(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // long oldValue = data[index]; // // int numMoved = elt - index - 1; // if (numMoved > 0) { // System.arraycopy(data, index + 1, data, index, numMoved); // } // // return oldValue; // } // // } // Path: src/main/java/org/jamel/j7zip/archive/sevenZip/ArchiveDatabaseEx.java import org.jamel.j7zip.common.IntVector; import org.jamel.j7zip.common.LongVector; package org.jamel.j7zip.archive.sevenZip; public class ArchiveDatabaseEx extends ArchiveDatabase { final InArchiveInfo ArchiveInfo = new InArchiveInfo(); final LongVector PackStreamStartPositions = new LongVector();
final IntVector FolderStartPackStreamIndex = new IntVector();
jamel/j7zip
src/main/java/org/jamel/j7zip/compression/RangeCoder/Decoder.java
// Path: src/main/java/org/jamel/j7zip/common/InBuffer.java // public class InBuffer { // int _bufferPos; // int _bufferLimit; // byte[] _bufferBase; // java.io.InputStream _stream = null; // long _processedSize; // int _bufferSize; // boolean _wasFinished; // // public InBuffer() { // } // // public void Create(int bufferSize) { // final int kMinBlockSize = 1; // if (bufferSize < kMinBlockSize) { // bufferSize = kMinBlockSize; // } // if (_bufferBase != null && _bufferSize == bufferSize) { // return; // } // Free(); // _bufferSize = bufferSize; // _bufferBase = new byte[bufferSize]; // } // // void Free() { // _bufferBase = null; // } // // public void SetStream(java.io.InputStream stream) { // _stream = stream; // } // // public void Init() { // _processedSize = 0; // _bufferPos = 0; // _bufferLimit = 0; // _wasFinished = false; // } // // public void ReleaseStream() throws java.io.IOException { // if (_stream != null) _stream.close(); // _stream = null; // } // // public int read() throws java.io.IOException { // if (_bufferPos >= _bufferLimit) { // return readBlock2(); // } // return _bufferBase[_bufferPos++] & 0xFF; // } // // public boolean readBlock() throws java.io.IOException { // if (_wasFinished) { // return false; // } // _processedSize += _bufferPos; // // int numProcessedBytes = _stream.read(_bufferBase, 0, _bufferSize); // if (numProcessedBytes == -1) numProcessedBytes = 0; // // _bufferPos = 0; // _bufferLimit = numProcessedBytes; // _wasFinished = (numProcessedBytes == 0); // return (!_wasFinished); // } // // private int readBlock2() throws java.io.IOException { // if (!readBlock()) { // return -1; // 0xFF; // } // return _bufferBase[_bufferPos++] & 0xFF; // } // // public boolean wasFinished() { // return _wasFinished; // } // }
import java.io.IOException; import org.jamel.j7zip.common.InBuffer;
package org.jamel.j7zip.compression.RangeCoder; public class Decoder { static final int kTopMask = ~((1 << 24) - 1); static final int kNumBitModelTotalBits = 11; static final int kBitModelTotal = (1 << kNumBitModelTotalBits); static final int kNumMoveBits = 5; int Range; int Code;
// Path: src/main/java/org/jamel/j7zip/common/InBuffer.java // public class InBuffer { // int _bufferPos; // int _bufferLimit; // byte[] _bufferBase; // java.io.InputStream _stream = null; // long _processedSize; // int _bufferSize; // boolean _wasFinished; // // public InBuffer() { // } // // public void Create(int bufferSize) { // final int kMinBlockSize = 1; // if (bufferSize < kMinBlockSize) { // bufferSize = kMinBlockSize; // } // if (_bufferBase != null && _bufferSize == bufferSize) { // return; // } // Free(); // _bufferSize = bufferSize; // _bufferBase = new byte[bufferSize]; // } // // void Free() { // _bufferBase = null; // } // // public void SetStream(java.io.InputStream stream) { // _stream = stream; // } // // public void Init() { // _processedSize = 0; // _bufferPos = 0; // _bufferLimit = 0; // _wasFinished = false; // } // // public void ReleaseStream() throws java.io.IOException { // if (_stream != null) _stream.close(); // _stream = null; // } // // public int read() throws java.io.IOException { // if (_bufferPos >= _bufferLimit) { // return readBlock2(); // } // return _bufferBase[_bufferPos++] & 0xFF; // } // // public boolean readBlock() throws java.io.IOException { // if (_wasFinished) { // return false; // } // _processedSize += _bufferPos; // // int numProcessedBytes = _stream.read(_bufferBase, 0, _bufferSize); // if (numProcessedBytes == -1) numProcessedBytes = 0; // // _bufferPos = 0; // _bufferLimit = numProcessedBytes; // _wasFinished = (numProcessedBytes == 0); // return (!_wasFinished); // } // // private int readBlock2() throws java.io.IOException { // if (!readBlock()) { // return -1; // 0xFF; // } // return _bufferBase[_bufferPos++] & 0xFF; // } // // public boolean wasFinished() { // return _wasFinished; // } // } // Path: src/main/java/org/jamel/j7zip/compression/RangeCoder/Decoder.java import java.io.IOException; import org.jamel.j7zip.common.InBuffer; package org.jamel.j7zip.compression.RangeCoder; public class Decoder { static final int kTopMask = ~((1 << 24) - 1); static final int kNumBitModelTotalBits = 11; static final int kBitModelTotal = (1 << kNumBitModelTotalBits); static final int kNumMoveBits = 5; int Range; int Code;
public InBuffer bufferedStream = new InBuffer();
jamel/j7zip
src/main/java/org/jamel/j7zip/ArchiveTestCallback.java
// Path: src/main/java/org/jamel/j7zip/archive/IArchiveExtractCallback.java // public interface IArchiveExtractCallback { // // // getStream OUT: OK - OK, FALSE - skip this file // OutputStream getStream(SevenZipEntry item) throws IOException; // // void setOperationResult(IInArchive.OperationResult resultEOperationResult); // // int getNumErrors(); // // IInArchive.AskMode getAskMode(); // } // // Path: src/main/java/org/jamel/j7zip/archive/IInArchive.java // public interface IInArchive { // public static enum AskMode {EXTRACT, TEST, SKIP} // // public static enum OperationResult {OK, UNSUPPORTED_METHOD, DATA_ERROR, CRC_ERROR} // // // Static-SFX (for Linux) can be big. // public final long kMaxCheckStartPosition = 1 << 22; // // SevenZipEntry getEntry(int index); // // int size(); // // void close() throws IOException; // // Result extract(int[] indices, IArchiveExtractCallback extractCallbackSpec) throws IOException; // // Result open(IInStream stream) throws IOException; // // Result open(IInStream stream, long maxCheckStartPosition) throws IOException; // // // } // // Path: src/main/java/org/jamel/j7zip/archive/SevenZipEntry.java // public class SevenZipEntry { // // private final long LastWriteTime; // private final long UnPackSize; // private final long PackSize; // private final int Attributes; // private final long FileCRC; // private final boolean IsDirectory; // private final String Name; // private final long Position; // // // public SevenZipEntry(String name, long packSize, long unPackSize, long crc, long lastWriteTime, // long position, boolean isDir, int att) // { // this.Name = name; // this.PackSize = packSize; // this.UnPackSize = unPackSize; // this.FileCRC = crc; // this.LastWriteTime = lastWriteTime; // this.Position = position; // this.IsDirectory = isDir; // this.Attributes = att; // } // // public long getCompressedSize() { // return PackSize; // } // // public long getSize() { // return UnPackSize; // } // // public long getCrc() { // return FileCRC; // } // // public String getName() { // return Name; // } // // public long getTime() { // return LastWriteTime; // } // // public long getPosition() { // return Position; // } // // public boolean isDirectory() { // return IsDirectory; // } // // static final String kEmptyAttributeChar = "."; // static final String kDirectoryAttributeChar = "D"; // static final String kReadonlyAttributeChar = "R"; // static final String kHiddenAttributeChar = "H"; // static final String kSystemAttributeChar = "S"; // static final String kArchiveAttributeChar = "A"; // static public final int FILE_ATTRIBUTE_READONLY = 0x00000001; // static public final int FILE_ATTRIBUTE_HIDDEN = 0x00000002; // static public final int FILE_ATTRIBUTE_SYSTEM = 0x00000004; // static public final int FILE_ATTRIBUTE_DIRECTORY = 0x00000010; // static public final int FILE_ATTRIBUTE_ARCHIVE = 0x00000020; // // public String getAttributesString() { // String ret = ""; // ret += ((Attributes & FILE_ATTRIBUTE_DIRECTORY) != 0 || IsDirectory) ? // kDirectoryAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_READONLY) != 0) ? // kReadonlyAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_HIDDEN) != 0) ? // kHiddenAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_SYSTEM) != 0) ? // kSystemAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_ARCHIVE) != 0) ? // kArchiveAttributeChar : kEmptyAttributeChar; // return ret; // } // }
import java.io.IOException; import java.io.OutputStream; import org.jamel.j7zip.archive.IArchiveExtractCallback; import org.jamel.j7zip.archive.IInArchive; import org.jamel.j7zip.archive.SevenZipEntry; import org.slf4j.Logger; import org.slf4j.LoggerFactory;
package org.jamel.j7zip; public class ArchiveTestCallback implements IArchiveExtractCallback { private static final Logger logger = LoggerFactory.getLogger(ArchiveTestCallback.class); private int numErrors; public int getNumErrors() { return numErrors; } @Override
// Path: src/main/java/org/jamel/j7zip/archive/IArchiveExtractCallback.java // public interface IArchiveExtractCallback { // // // getStream OUT: OK - OK, FALSE - skip this file // OutputStream getStream(SevenZipEntry item) throws IOException; // // void setOperationResult(IInArchive.OperationResult resultEOperationResult); // // int getNumErrors(); // // IInArchive.AskMode getAskMode(); // } // // Path: src/main/java/org/jamel/j7zip/archive/IInArchive.java // public interface IInArchive { // public static enum AskMode {EXTRACT, TEST, SKIP} // // public static enum OperationResult {OK, UNSUPPORTED_METHOD, DATA_ERROR, CRC_ERROR} // // // Static-SFX (for Linux) can be big. // public final long kMaxCheckStartPosition = 1 << 22; // // SevenZipEntry getEntry(int index); // // int size(); // // void close() throws IOException; // // Result extract(int[] indices, IArchiveExtractCallback extractCallbackSpec) throws IOException; // // Result open(IInStream stream) throws IOException; // // Result open(IInStream stream, long maxCheckStartPosition) throws IOException; // // // } // // Path: src/main/java/org/jamel/j7zip/archive/SevenZipEntry.java // public class SevenZipEntry { // // private final long LastWriteTime; // private final long UnPackSize; // private final long PackSize; // private final int Attributes; // private final long FileCRC; // private final boolean IsDirectory; // private final String Name; // private final long Position; // // // public SevenZipEntry(String name, long packSize, long unPackSize, long crc, long lastWriteTime, // long position, boolean isDir, int att) // { // this.Name = name; // this.PackSize = packSize; // this.UnPackSize = unPackSize; // this.FileCRC = crc; // this.LastWriteTime = lastWriteTime; // this.Position = position; // this.IsDirectory = isDir; // this.Attributes = att; // } // // public long getCompressedSize() { // return PackSize; // } // // public long getSize() { // return UnPackSize; // } // // public long getCrc() { // return FileCRC; // } // // public String getName() { // return Name; // } // // public long getTime() { // return LastWriteTime; // } // // public long getPosition() { // return Position; // } // // public boolean isDirectory() { // return IsDirectory; // } // // static final String kEmptyAttributeChar = "."; // static final String kDirectoryAttributeChar = "D"; // static final String kReadonlyAttributeChar = "R"; // static final String kHiddenAttributeChar = "H"; // static final String kSystemAttributeChar = "S"; // static final String kArchiveAttributeChar = "A"; // static public final int FILE_ATTRIBUTE_READONLY = 0x00000001; // static public final int FILE_ATTRIBUTE_HIDDEN = 0x00000002; // static public final int FILE_ATTRIBUTE_SYSTEM = 0x00000004; // static public final int FILE_ATTRIBUTE_DIRECTORY = 0x00000010; // static public final int FILE_ATTRIBUTE_ARCHIVE = 0x00000020; // // public String getAttributesString() { // String ret = ""; // ret += ((Attributes & FILE_ATTRIBUTE_DIRECTORY) != 0 || IsDirectory) ? // kDirectoryAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_READONLY) != 0) ? // kReadonlyAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_HIDDEN) != 0) ? // kHiddenAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_SYSTEM) != 0) ? // kSystemAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_ARCHIVE) != 0) ? // kArchiveAttributeChar : kEmptyAttributeChar; // return ret; // } // } // Path: src/main/java/org/jamel/j7zip/ArchiveTestCallback.java import java.io.IOException; import java.io.OutputStream; import org.jamel.j7zip.archive.IArchiveExtractCallback; import org.jamel.j7zip.archive.IInArchive; import org.jamel.j7zip.archive.SevenZipEntry; import org.slf4j.Logger; import org.slf4j.LoggerFactory; package org.jamel.j7zip; public class ArchiveTestCallback implements IArchiveExtractCallback { private static final Logger logger = LoggerFactory.getLogger(ArchiveTestCallback.class); private int numErrors; public int getNumErrors() { return numErrors; } @Override
public IInArchive.AskMode getAskMode() {
jamel/j7zip
src/main/java/org/jamel/j7zip/ArchiveTestCallback.java
// Path: src/main/java/org/jamel/j7zip/archive/IArchiveExtractCallback.java // public interface IArchiveExtractCallback { // // // getStream OUT: OK - OK, FALSE - skip this file // OutputStream getStream(SevenZipEntry item) throws IOException; // // void setOperationResult(IInArchive.OperationResult resultEOperationResult); // // int getNumErrors(); // // IInArchive.AskMode getAskMode(); // } // // Path: src/main/java/org/jamel/j7zip/archive/IInArchive.java // public interface IInArchive { // public static enum AskMode {EXTRACT, TEST, SKIP} // // public static enum OperationResult {OK, UNSUPPORTED_METHOD, DATA_ERROR, CRC_ERROR} // // // Static-SFX (for Linux) can be big. // public final long kMaxCheckStartPosition = 1 << 22; // // SevenZipEntry getEntry(int index); // // int size(); // // void close() throws IOException; // // Result extract(int[] indices, IArchiveExtractCallback extractCallbackSpec) throws IOException; // // Result open(IInStream stream) throws IOException; // // Result open(IInStream stream, long maxCheckStartPosition) throws IOException; // // // } // // Path: src/main/java/org/jamel/j7zip/archive/SevenZipEntry.java // public class SevenZipEntry { // // private final long LastWriteTime; // private final long UnPackSize; // private final long PackSize; // private final int Attributes; // private final long FileCRC; // private final boolean IsDirectory; // private final String Name; // private final long Position; // // // public SevenZipEntry(String name, long packSize, long unPackSize, long crc, long lastWriteTime, // long position, boolean isDir, int att) // { // this.Name = name; // this.PackSize = packSize; // this.UnPackSize = unPackSize; // this.FileCRC = crc; // this.LastWriteTime = lastWriteTime; // this.Position = position; // this.IsDirectory = isDir; // this.Attributes = att; // } // // public long getCompressedSize() { // return PackSize; // } // // public long getSize() { // return UnPackSize; // } // // public long getCrc() { // return FileCRC; // } // // public String getName() { // return Name; // } // // public long getTime() { // return LastWriteTime; // } // // public long getPosition() { // return Position; // } // // public boolean isDirectory() { // return IsDirectory; // } // // static final String kEmptyAttributeChar = "."; // static final String kDirectoryAttributeChar = "D"; // static final String kReadonlyAttributeChar = "R"; // static final String kHiddenAttributeChar = "H"; // static final String kSystemAttributeChar = "S"; // static final String kArchiveAttributeChar = "A"; // static public final int FILE_ATTRIBUTE_READONLY = 0x00000001; // static public final int FILE_ATTRIBUTE_HIDDEN = 0x00000002; // static public final int FILE_ATTRIBUTE_SYSTEM = 0x00000004; // static public final int FILE_ATTRIBUTE_DIRECTORY = 0x00000010; // static public final int FILE_ATTRIBUTE_ARCHIVE = 0x00000020; // // public String getAttributesString() { // String ret = ""; // ret += ((Attributes & FILE_ATTRIBUTE_DIRECTORY) != 0 || IsDirectory) ? // kDirectoryAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_READONLY) != 0) ? // kReadonlyAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_HIDDEN) != 0) ? // kHiddenAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_SYSTEM) != 0) ? // kSystemAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_ARCHIVE) != 0) ? // kArchiveAttributeChar : kEmptyAttributeChar; // return ret; // } // }
import java.io.IOException; import java.io.OutputStream; import org.jamel.j7zip.archive.IArchiveExtractCallback; import org.jamel.j7zip.archive.IInArchive; import org.jamel.j7zip.archive.SevenZipEntry; import org.slf4j.Logger; import org.slf4j.LoggerFactory;
package org.jamel.j7zip; public class ArchiveTestCallback implements IArchiveExtractCallback { private static final Logger logger = LoggerFactory.getLogger(ArchiveTestCallback.class); private int numErrors; public int getNumErrors() { return numErrors; } @Override public IInArchive.AskMode getAskMode() { return IInArchive.AskMode.TEST; }
// Path: src/main/java/org/jamel/j7zip/archive/IArchiveExtractCallback.java // public interface IArchiveExtractCallback { // // // getStream OUT: OK - OK, FALSE - skip this file // OutputStream getStream(SevenZipEntry item) throws IOException; // // void setOperationResult(IInArchive.OperationResult resultEOperationResult); // // int getNumErrors(); // // IInArchive.AskMode getAskMode(); // } // // Path: src/main/java/org/jamel/j7zip/archive/IInArchive.java // public interface IInArchive { // public static enum AskMode {EXTRACT, TEST, SKIP} // // public static enum OperationResult {OK, UNSUPPORTED_METHOD, DATA_ERROR, CRC_ERROR} // // // Static-SFX (for Linux) can be big. // public final long kMaxCheckStartPosition = 1 << 22; // // SevenZipEntry getEntry(int index); // // int size(); // // void close() throws IOException; // // Result extract(int[] indices, IArchiveExtractCallback extractCallbackSpec) throws IOException; // // Result open(IInStream stream) throws IOException; // // Result open(IInStream stream, long maxCheckStartPosition) throws IOException; // // // } // // Path: src/main/java/org/jamel/j7zip/archive/SevenZipEntry.java // public class SevenZipEntry { // // private final long LastWriteTime; // private final long UnPackSize; // private final long PackSize; // private final int Attributes; // private final long FileCRC; // private final boolean IsDirectory; // private final String Name; // private final long Position; // // // public SevenZipEntry(String name, long packSize, long unPackSize, long crc, long lastWriteTime, // long position, boolean isDir, int att) // { // this.Name = name; // this.PackSize = packSize; // this.UnPackSize = unPackSize; // this.FileCRC = crc; // this.LastWriteTime = lastWriteTime; // this.Position = position; // this.IsDirectory = isDir; // this.Attributes = att; // } // // public long getCompressedSize() { // return PackSize; // } // // public long getSize() { // return UnPackSize; // } // // public long getCrc() { // return FileCRC; // } // // public String getName() { // return Name; // } // // public long getTime() { // return LastWriteTime; // } // // public long getPosition() { // return Position; // } // // public boolean isDirectory() { // return IsDirectory; // } // // static final String kEmptyAttributeChar = "."; // static final String kDirectoryAttributeChar = "D"; // static final String kReadonlyAttributeChar = "R"; // static final String kHiddenAttributeChar = "H"; // static final String kSystemAttributeChar = "S"; // static final String kArchiveAttributeChar = "A"; // static public final int FILE_ATTRIBUTE_READONLY = 0x00000001; // static public final int FILE_ATTRIBUTE_HIDDEN = 0x00000002; // static public final int FILE_ATTRIBUTE_SYSTEM = 0x00000004; // static public final int FILE_ATTRIBUTE_DIRECTORY = 0x00000010; // static public final int FILE_ATTRIBUTE_ARCHIVE = 0x00000020; // // public String getAttributesString() { // String ret = ""; // ret += ((Attributes & FILE_ATTRIBUTE_DIRECTORY) != 0 || IsDirectory) ? // kDirectoryAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_READONLY) != 0) ? // kReadonlyAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_HIDDEN) != 0) ? // kHiddenAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_SYSTEM) != 0) ? // kSystemAttributeChar : kEmptyAttributeChar; // ret += ((Attributes & FILE_ATTRIBUTE_ARCHIVE) != 0) ? // kArchiveAttributeChar : kEmptyAttributeChar; // return ret; // } // } // Path: src/main/java/org/jamel/j7zip/ArchiveTestCallback.java import java.io.IOException; import java.io.OutputStream; import org.jamel.j7zip.archive.IArchiveExtractCallback; import org.jamel.j7zip.archive.IInArchive; import org.jamel.j7zip.archive.SevenZipEntry; import org.slf4j.Logger; import org.slf4j.LoggerFactory; package org.jamel.j7zip; public class ArchiveTestCallback implements IArchiveExtractCallback { private static final Logger logger = LoggerFactory.getLogger(ArchiveTestCallback.class); private int numErrors; public int getNumErrors() { return numErrors; } @Override public IInArchive.AskMode getAskMode() { return IInArchive.AskMode.TEST; }
public OutputStream getStream(SevenZipEntry item) throws IOException {
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/common/BindInfo.java
// Path: src/main/java/org/jamel/j7zip/common/IntVector.java // public class IntVector { // private static final int CAPACITY_INCR = 10; // // private int[] data = new int[CAPACITY_INCR]; // int elt = 0; // // public IntVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // int[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new int[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public int get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public void add(int b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // }
import org.jamel.j7zip.common.IntVector; import org.jamel.j7zip.common.ObjectVector;
package org.jamel.j7zip.archive.common; public class BindInfo { public ObjectVector<CoderStreamsInfo> coders = new ObjectVector<>(); public ObjectVector<BindPair> bindPairs = new ObjectVector<>();
// Path: src/main/java/org/jamel/j7zip/common/IntVector.java // public class IntVector { // private static final int CAPACITY_INCR = 10; // // private int[] data = new int[CAPACITY_INCR]; // int elt = 0; // // public IntVector() { // } // // public int size() { // return elt; // } // // private void ensureCapacity(int minCapacity) { // int oldCapacity = data.length; // if (minCapacity > oldCapacity) { // int[] oldData = data; // int newCapacity = oldCapacity + CAPACITY_INCR; // if (newCapacity < minCapacity) { // newCapacity = minCapacity; // } // data = new int[newCapacity]; // System.arraycopy(oldData, 0, data, 0, elt); // } // } // // public int get(int index) { // if (index >= elt) { // throw new ArrayIndexOutOfBoundsException(index); // } // // return data[index]; // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public void add(int b) { // ensureCapacity(elt + 1); // data[elt++] = b; // } // // public void clear() { // elt = 0; // } // // public boolean isEmpty() { // return elt == 0; // } // } // // Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // Path: src/main/java/org/jamel/j7zip/archive/common/BindInfo.java import org.jamel.j7zip.common.IntVector; import org.jamel.j7zip.common.ObjectVector; package org.jamel.j7zip.archive.common; public class BindInfo { public ObjectVector<CoderStreamsInfo> coders = new ObjectVector<>(); public ObjectVector<BindPair> bindPairs = new ObjectVector<>();
public IntVector inStreams = new IntVector();
jamel/j7zip
src/main/java/org/jamel/j7zip/archive/sevenZip/CoderInfo.java
// Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // }
import org.jamel.j7zip.common.ObjectVector;
package org.jamel.j7zip.archive.sevenZip; class CoderInfo { private int inStreamsCount; private int outStreamsCount;
// Path: src/main/java/org/jamel/j7zip/common/ObjectVector.java // public class ObjectVector<E> extends ArrayList<E> { // // public ObjectVector() { // super(); // } // // public void reserve(int s) { // ensureCapacity(s); // } // // public E last() { // return get(size() - 1); // } // // public E first() { // return get(0); // } // // public E popLast() { // return remove(size() - 1); // } // } // Path: src/main/java/org/jamel/j7zip/archive/sevenZip/CoderInfo.java import org.jamel.j7zip.common.ObjectVector; package org.jamel.j7zip.archive.sevenZip; class CoderInfo { private int inStreamsCount; private int outStreamsCount;
private ObjectVector<AltCoderInfo> altCoders = new ObjectVector<>();
sastix/cms
common/services/src/test/com/sastix/cms/common/services/htmltopdf/config/HtmlToPdfConfiguration.java
// Path: common/services/src/main/java/com/sastix/cms/common/services/htmltopdf/config/HtmlToPdfConfig.java // @Slf4j // @Getter @Setter @AllArgsConstructor @NoArgsConstructor // public class HtmlToPdfConfig { // // private String wkhtmltopdfCommand; // // /** // * Attempts to find the `wkhtmltopdf` executable in the system path. // * // * @return // */ // public String findExecutable() { // String ret = null; // try { // String osname = System.getProperty("os.name").toLowerCase(); // // String cmd; // if (osname.contains("windows")) // cmd = "where wkhtmltopdf"; // else cmd = "which wkhtmltopdf"; // // Process p = Runtime.getRuntime().exec(cmd); // p.waitFor(); // // BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); // // StringBuilder sb = new StringBuilder(); // String line = ""; // while ((line = reader.readLine()) != null) { // sb.append(line); // } // // if (sb.toString().isEmpty()) // throw new RuntimeException(); // // ret = sb.toString(); // } catch (InterruptedException e) { // log.error("InterruptedException while trying to find wkhtmltopdf executable",e); // } catch (IOException e) { // log.error("IOException while trying to find wkhtmltopdf executable", e); // } catch (RuntimeException e) { // log.error("RuntimeException while trying to find wkhtmltopdf executable", e); // } // return ret; // } // }
import com.sastix.cms.common.services.htmltopdf.config.HtmlToPdfConfig; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration;
/* * Copyright(c) 2016 the original author or authors. * * Licensed 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 com.sastix.cms.common.services.htmltopdf.config; @Configuration @ComponentScan({"com.sastix.cms.common.services.htmltopdf.config"}) public class HtmlToPdfConfiguration { @Value("/data/common/wkhtmltopdf/wkhtmltopdf") private String wkhtmltopdf; @Bean
// Path: common/services/src/main/java/com/sastix/cms/common/services/htmltopdf/config/HtmlToPdfConfig.java // @Slf4j // @Getter @Setter @AllArgsConstructor @NoArgsConstructor // public class HtmlToPdfConfig { // // private String wkhtmltopdfCommand; // // /** // * Attempts to find the `wkhtmltopdf` executable in the system path. // * // * @return // */ // public String findExecutable() { // String ret = null; // try { // String osname = System.getProperty("os.name").toLowerCase(); // // String cmd; // if (osname.contains("windows")) // cmd = "where wkhtmltopdf"; // else cmd = "which wkhtmltopdf"; // // Process p = Runtime.getRuntime().exec(cmd); // p.waitFor(); // // BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); // // StringBuilder sb = new StringBuilder(); // String line = ""; // while ((line = reader.readLine()) != null) { // sb.append(line); // } // // if (sb.toString().isEmpty()) // throw new RuntimeException(); // // ret = sb.toString(); // } catch (InterruptedException e) { // log.error("InterruptedException while trying to find wkhtmltopdf executable",e); // } catch (IOException e) { // log.error("IOException while trying to find wkhtmltopdf executable", e); // } catch (RuntimeException e) { // log.error("RuntimeException while trying to find wkhtmltopdf executable", e); // } // return ret; // } // } // Path: common/services/src/test/com/sastix/cms/common/services/htmltopdf/config/HtmlToPdfConfiguration.java import com.sastix.cms.common.services.htmltopdf.config.HtmlToPdfConfig; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; /* * Copyright(c) 2016 the original author or authors. * * Licensed 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 com.sastix.cms.common.services.htmltopdf.config; @Configuration @ComponentScan({"com.sastix.cms.common.services.htmltopdf.config"}) public class HtmlToPdfConfiguration { @Value("/data/common/wkhtmltopdf/wkhtmltopdf") private String wkhtmltopdf; @Bean
HtmlToPdfConfig htmlToPdfConfig(){
sastix/cms
common/client/src/main/java/com/sastix/cms/common/client/exception/CommonExceptionHandler.java
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/dataobjects/RestErrorDTO.java // @Getter @Setter @NoArgsConstructor @ToString // public class RestErrorDTO { // // private String exception; // // private String path; // // private String error; // // private String message; // // private String timestamp; // // private String status; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/exception/BusinessException.java // public class BusinessException extends CommonException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -4503174570809593447L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public BusinessException(String message) { // super(message); // } // // /** // * Creates a {@code BusinessException} with the specified // * detail message and cause. // * // * @param message the detail message // * @param cause the cause // */ // public BusinessException(String message, Throwable cause) { // super(message, cause); // } // }
import java.io.InputStream; import java.nio.charset.Charset; import java.util.concurrent.ConcurrentHashMap; import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.databind.ObjectMapper; import com.sastix.cms.common.dataobjects.RestErrorDTO; import com.sastix.cms.common.exception.BusinessException; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.client.ClientHttpResponse; import org.springframework.util.FileCopyUtils; import org.springframework.web.client.*; import lombok.extern.slf4j.Slf4j; import java.io.IOException;
/* * Copyright(c) 2016 the original author or authors. * * Licensed 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 com.sastix.cms.common.client.exception; /** * RestTemplate Custom Exception Handler. */ @Slf4j public class CommonExceptionHandler implements ResponseErrorHandler { /** * Json factory instance. */ private final JsonFactory factory = new JsonFactory(); /** * Object Mapper used to covert JSON object to Java object. */ private final ObjectMapper objectMapper = new ObjectMapper(factory); /** * HashMap which holds the supported exception classes. */ private final ConcurrentHashMap<String, ExceptionHandler> exceptionClasses = new ConcurrentHashMap<>(); public CommonExceptionHandler() {
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/dataobjects/RestErrorDTO.java // @Getter @Setter @NoArgsConstructor @ToString // public class RestErrorDTO { // // private String exception; // // private String path; // // private String error; // // private String message; // // private String timestamp; // // private String status; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/exception/BusinessException.java // public class BusinessException extends CommonException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -4503174570809593447L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public BusinessException(String message) { // super(message); // } // // /** // * Creates a {@code BusinessException} with the specified // * detail message and cause. // * // * @param message the detail message // * @param cause the cause // */ // public BusinessException(String message, Throwable cause) { // super(message, cause); // } // } // Path: common/client/src/main/java/com/sastix/cms/common/client/exception/CommonExceptionHandler.java import java.io.InputStream; import java.nio.charset.Charset; import java.util.concurrent.ConcurrentHashMap; import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.databind.ObjectMapper; import com.sastix.cms.common.dataobjects.RestErrorDTO; import com.sastix.cms.common.exception.BusinessException; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.client.ClientHttpResponse; import org.springframework.util.FileCopyUtils; import org.springframework.web.client.*; import lombok.extern.slf4j.Slf4j; import java.io.IOException; /* * Copyright(c) 2016 the original author or authors. * * Licensed 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 com.sastix.cms.common.client.exception; /** * RestTemplate Custom Exception Handler. */ @Slf4j public class CommonExceptionHandler implements ResponseErrorHandler { /** * Json factory instance. */ private final JsonFactory factory = new JsonFactory(); /** * Object Mapper used to covert JSON object to Java object. */ private final ObjectMapper objectMapper = new ObjectMapper(factory); /** * HashMap which holds the supported exception classes. */ private final ConcurrentHashMap<String, ExceptionHandler> exceptionClasses = new ConcurrentHashMap<>(); public CommonExceptionHandler() {
exceptionClasses.put(BusinessException.class.getName(), BusinessException::new);
sastix/cms
common/client/src/main/java/com/sastix/cms/common/client/exception/CommonExceptionHandler.java
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/dataobjects/RestErrorDTO.java // @Getter @Setter @NoArgsConstructor @ToString // public class RestErrorDTO { // // private String exception; // // private String path; // // private String error; // // private String message; // // private String timestamp; // // private String status; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/exception/BusinessException.java // public class BusinessException extends CommonException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -4503174570809593447L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public BusinessException(String message) { // super(message); // } // // /** // * Creates a {@code BusinessException} with the specified // * detail message and cause. // * // * @param message the detail message // * @param cause the cause // */ // public BusinessException(String message, Throwable cause) { // super(message, cause); // } // }
import java.io.InputStream; import java.nio.charset.Charset; import java.util.concurrent.ConcurrentHashMap; import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.databind.ObjectMapper; import com.sastix.cms.common.dataobjects.RestErrorDTO; import com.sastix.cms.common.exception.BusinessException; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.client.ClientHttpResponse; import org.springframework.util.FileCopyUtils; import org.springframework.web.client.*; import lombok.extern.slf4j.Slf4j; import java.io.IOException;
* Template method called from {@link #hasError(ClientHttpResponse)}. * <p>The default implementation checks if the given status code is * {@link HttpStatus.Series#CLIENT_ERROR CLIENT_ERROR} * or {@link HttpStatus.Series#SERVER_ERROR SERVER_ERROR}. * Can be overridden in subclasses. * * @param statusCode the HTTP status code * @return {@code true} if the response has an error; {@code false} otherwise */ protected boolean hasError(HttpStatus statusCode) { return (statusCode.series() == HttpStatus.Series.CLIENT_ERROR || statusCode.series() == HttpStatus.Series.SERVER_ERROR); } /** * This default implementation throws a {@link HttpClientErrorException} if the response status code * is {@link HttpStatus.Series#CLIENT_ERROR}, a {@link HttpServerErrorException} * if it is {@link HttpStatus.Series#SERVER_ERROR}, * and a {@link RestClientException} in other cases. */ @Override public void handleError(ClientHttpResponse response) throws IOException, RestClientException { HttpStatus statusCode = getHttpStatusCode(response); switch (statusCode.series()) { case CLIENT_ERROR: final byte[] responseBody = getResponseBody(response); final Charset charset = getCharset(response); final String statusText = response.getStatusText(); final HttpHeaders httpHeaders = response.getHeaders();
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/dataobjects/RestErrorDTO.java // @Getter @Setter @NoArgsConstructor @ToString // public class RestErrorDTO { // // private String exception; // // private String path; // // private String error; // // private String message; // // private String timestamp; // // private String status; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/exception/BusinessException.java // public class BusinessException extends CommonException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -4503174570809593447L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public BusinessException(String message) { // super(message); // } // // /** // * Creates a {@code BusinessException} with the specified // * detail message and cause. // * // * @param message the detail message // * @param cause the cause // */ // public BusinessException(String message, Throwable cause) { // super(message, cause); // } // } // Path: common/client/src/main/java/com/sastix/cms/common/client/exception/CommonExceptionHandler.java import java.io.InputStream; import java.nio.charset.Charset; import java.util.concurrent.ConcurrentHashMap; import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.databind.ObjectMapper; import com.sastix.cms.common.dataobjects.RestErrorDTO; import com.sastix.cms.common.exception.BusinessException; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.client.ClientHttpResponse; import org.springframework.util.FileCopyUtils; import org.springframework.web.client.*; import lombok.extern.slf4j.Slf4j; import java.io.IOException; * Template method called from {@link #hasError(ClientHttpResponse)}. * <p>The default implementation checks if the given status code is * {@link HttpStatus.Series#CLIENT_ERROR CLIENT_ERROR} * or {@link HttpStatus.Series#SERVER_ERROR SERVER_ERROR}. * Can be overridden in subclasses. * * @param statusCode the HTTP status code * @return {@code true} if the response has an error; {@code false} otherwise */ protected boolean hasError(HttpStatus statusCode) { return (statusCode.series() == HttpStatus.Series.CLIENT_ERROR || statusCode.series() == HttpStatus.Series.SERVER_ERROR); } /** * This default implementation throws a {@link HttpClientErrorException} if the response status code * is {@link HttpStatus.Series#CLIENT_ERROR}, a {@link HttpServerErrorException} * if it is {@link HttpStatus.Series#SERVER_ERROR}, * and a {@link RestClientException} in other cases. */ @Override public void handleError(ClientHttpResponse response) throws IOException, RestClientException { HttpStatus statusCode = getHttpStatusCode(response); switch (statusCode.series()) { case CLIENT_ERROR: final byte[] responseBody = getResponseBody(response); final Charset charset = getCharset(response); final String statusText = response.getStatusText(); final HttpHeaders httpHeaders = response.getHeaders();
final RestErrorDTO errorDTO;
sastix/cms
server/src/main/java/com/sastix/cms/server/services/content/impl/HashedDirectoryServiceImpl.java
// Path: server/src/main/java/com/sastix/cms/server/services/content/HashedDirectoryService.java // public interface HashedDirectoryService { // // String storeFile(final String UURI, final String tenantID, final byte[] resourceBinary) throws IOException; // // String replaceFile(final String UURI, final String tenantID, final byte[] resourceBinary) throws IOException; // // String storeFile(final String UURI, final String tenantID, final URI resourceURI) throws IOException; // // String replaceFile(final String UURI, final String tenantID, final URI resourceURI) throws IOException; // // String storeFile(final String UURI, final String tenantID, final String resourceURI) throws IOException, URISyntaxException; // // String replaceFile(final String UURI, final String tenantID, final String resourceURI) throws IOException, URISyntaxException; // // Path getDataByUID(final String UID, final String tenantID) throws IOException; // // byte[] getBytesByUID(final String UID, final String tenantID) throws IOException; // // Path getDataByURI(final String resourceURI, final String tenantID) throws IOException, URISyntaxException; // // byte[] getBytesByURI(final String resourceURI, final String tenantID) throws IOException; // // long getFileSize(final String resourceURI, final String tenantID) throws IOException; // // String hashText(String text); // // String getAbsolutePath(String resourceURI, final String tenantID); // // String createTenantDirectory(final String tenantID) throws IOException; // // String getVolume(); // // void setVolume(String value); // // void storeChecksum(final String tenantID, final String checksum) throws IOException; // // String getChecksum(final String tenantID) throws IOException; // }
import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import com.sastix.cms.server.services.content.HashedDirectoryService; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import lombok.extern.slf4j.Slf4j; import java.io.File; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.net.URLDecoder; import java.nio.ByteBuffer; import java.nio.channels.Channels; import java.nio.channels.ReadableByteChannel; import java.nio.channels.SeekableByteChannel; import java.nio.file.*; import java.util.EnumSet; import java.util.HashMap; import java.util.Map; import java.util.zip.CRC32;
/* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.content.impl; @Slf4j @Service
// Path: server/src/main/java/com/sastix/cms/server/services/content/HashedDirectoryService.java // public interface HashedDirectoryService { // // String storeFile(final String UURI, final String tenantID, final byte[] resourceBinary) throws IOException; // // String replaceFile(final String UURI, final String tenantID, final byte[] resourceBinary) throws IOException; // // String storeFile(final String UURI, final String tenantID, final URI resourceURI) throws IOException; // // String replaceFile(final String UURI, final String tenantID, final URI resourceURI) throws IOException; // // String storeFile(final String UURI, final String tenantID, final String resourceURI) throws IOException, URISyntaxException; // // String replaceFile(final String UURI, final String tenantID, final String resourceURI) throws IOException, URISyntaxException; // // Path getDataByUID(final String UID, final String tenantID) throws IOException; // // byte[] getBytesByUID(final String UID, final String tenantID) throws IOException; // // Path getDataByURI(final String resourceURI, final String tenantID) throws IOException, URISyntaxException; // // byte[] getBytesByURI(final String resourceURI, final String tenantID) throws IOException; // // long getFileSize(final String resourceURI, final String tenantID) throws IOException; // // String hashText(String text); // // String getAbsolutePath(String resourceURI, final String tenantID); // // String createTenantDirectory(final String tenantID) throws IOException; // // String getVolume(); // // void setVolume(String value); // // void storeChecksum(final String tenantID, final String checksum) throws IOException; // // String getChecksum(final String tenantID) throws IOException; // } // Path: server/src/main/java/com/sastix/cms/server/services/content/impl/HashedDirectoryServiceImpl.java import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import com.sastix.cms.server.services.content.HashedDirectoryService; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import lombok.extern.slf4j.Slf4j; import java.io.File; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.net.URLDecoder; import java.nio.ByteBuffer; import java.nio.channels.Channels; import java.nio.channels.ReadableByteChannel; import java.nio.channels.SeekableByteChannel; import java.nio.file.*; import java.util.EnumSet; import java.util.HashMap; import java.util.Map; import java.util.zip.CRC32; /* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.content.impl; @Slf4j @Service
public class HashedDirectoryServiceImpl implements HashedDirectoryService {
sastix/cms
server/src/test/java/com/sastix/cms/server/services/cache/UIDServiceTest.java
// Path: server/src/main/java/com/sastix/cms/server/CmsServer.java // @Slf4j // @EnableTransactionManagement // @ComponentScan("com.sastix.cms") // @SpringBootApplication(exclude = { SecurityAutoConfiguration.class }) // public class CmsServer { // // public static final String CONTEXT = "cms"; // // public static void main(String[] args) { // log.info("**** Starting Sastix CMS server ****"); // SpringApplication.run(CmsServer.class, args); // } // }
import java.util.Map; import java.util.concurrent.*; import com.sastix.cms.server.CmsServer; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; import lombok.extern.slf4j.Slf4j; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.HashMap;
/* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.cache; @Slf4j @ActiveProfiles({"production", "test"})
// Path: server/src/main/java/com/sastix/cms/server/CmsServer.java // @Slf4j // @EnableTransactionManagement // @ComponentScan("com.sastix.cms") // @SpringBootApplication(exclude = { SecurityAutoConfiguration.class }) // public class CmsServer { // // public static final String CONTEXT = "cms"; // // public static void main(String[] args) { // log.info("**** Starting Sastix CMS server ****"); // SpringApplication.run(CmsServer.class, args); // } // } // Path: server/src/test/java/com/sastix/cms/server/services/cache/UIDServiceTest.java import java.util.Map; import java.util.concurrent.*; import com.sastix.cms.server.CmsServer; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; import lombok.extern.slf4j.Slf4j; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.HashMap; /* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.cache; @Slf4j @ActiveProfiles({"production", "test"})
@SpringBootTest(classes = CmsServer.class)
sastix/cms
server/src/main/java/com/sastix/cms/server/services/lock/dummy/DummyLockService.java
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/LockDTO.java // @Getter @Setter @NoArgsConstructor @AllArgsConstructor // public class LockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -1244256114246115089L; // // /** // * The UID that has been now locked. // */ // private String UID; // // /** // * A Unique Lock ID that has been defined to hold this lock. // */ // private String lockID; // // /** // * The owner of this lock. // */ // private String lockOwner; // // /** // * The DateTime that this lock will expire. // */ // private DateTime lockExpiration; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/NewLockDTO.java // @Getter @Setter @NoArgsConstructor // public class NewLockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 8706080938884218602L; // // /** // * The Unique Identifier that the caller attempts to lock. // */ // private String UID; // // /** // * The owner of this lock. // */ // private String lockOwner; // // /** // * If provided, the expiration of the lock is set to this DateTime. // * </p> // * If not provided, the default lock expiration is set to T0+30m. Lock Expiration cannot be set to more than 8hrs. // */ // private DateTime lockExpiration; // // /** // * Constructor with Mandatory fields. // * // * @param UID a String with the UID // * @param lockOwner a String with owner of this lock // */ // public NewLockDTO(final String UID, final String lockOwner) { // this.UID = UID; // this.lockOwner = lockOwner; // lockExpiration = new DateTime().plusMinutes(30); // } // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/QueryLockDTO.java // @Getter @Setter @NoArgsConstructor @AllArgsConstructor // public class QueryLockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 3214527307576872325L; // // /** // * The Unique Identifier that the caller attempts to lock. // */ // @NotNull // private String UID; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/exceptions/LockNotAllowed.java // public class LockNotAllowed extends BusinessException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -8248743010140162906L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public LockNotAllowed(String message) { // super(message); // } // } // // Path: server/src/main/java/com/sastix/cms/server/services/lock/LockService.java // public interface LockService extends LockApi{ // // Add any additional implementation // }
import com.sastix.cms.common.lock.LockDTO; import com.sastix.cms.common.lock.NewLockDTO; import com.sastix.cms.common.lock.QueryLockDTO; import com.sastix.cms.common.lock.exceptions.LockNotAllowed; import com.sastix.cms.common.lock.exceptions.LockNotHeld; import com.sastix.cms.server.services.lock.LockService; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Service; import lombok.extern.slf4j.Slf4j;
/* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.lock.dummy; @Slf4j @Service @Profile("dummy")
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/LockDTO.java // @Getter @Setter @NoArgsConstructor @AllArgsConstructor // public class LockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -1244256114246115089L; // // /** // * The UID that has been now locked. // */ // private String UID; // // /** // * A Unique Lock ID that has been defined to hold this lock. // */ // private String lockID; // // /** // * The owner of this lock. // */ // private String lockOwner; // // /** // * The DateTime that this lock will expire. // */ // private DateTime lockExpiration; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/NewLockDTO.java // @Getter @Setter @NoArgsConstructor // public class NewLockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 8706080938884218602L; // // /** // * The Unique Identifier that the caller attempts to lock. // */ // private String UID; // // /** // * The owner of this lock. // */ // private String lockOwner; // // /** // * If provided, the expiration of the lock is set to this DateTime. // * </p> // * If not provided, the default lock expiration is set to T0+30m. Lock Expiration cannot be set to more than 8hrs. // */ // private DateTime lockExpiration; // // /** // * Constructor with Mandatory fields. // * // * @param UID a String with the UID // * @param lockOwner a String with owner of this lock // */ // public NewLockDTO(final String UID, final String lockOwner) { // this.UID = UID; // this.lockOwner = lockOwner; // lockExpiration = new DateTime().plusMinutes(30); // } // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/QueryLockDTO.java // @Getter @Setter @NoArgsConstructor @AllArgsConstructor // public class QueryLockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 3214527307576872325L; // // /** // * The Unique Identifier that the caller attempts to lock. // */ // @NotNull // private String UID; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/exceptions/LockNotAllowed.java // public class LockNotAllowed extends BusinessException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -8248743010140162906L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public LockNotAllowed(String message) { // super(message); // } // } // // Path: server/src/main/java/com/sastix/cms/server/services/lock/LockService.java // public interface LockService extends LockApi{ // // Add any additional implementation // } // Path: server/src/main/java/com/sastix/cms/server/services/lock/dummy/DummyLockService.java import com.sastix.cms.common.lock.LockDTO; import com.sastix.cms.common.lock.NewLockDTO; import com.sastix.cms.common.lock.QueryLockDTO; import com.sastix.cms.common.lock.exceptions.LockNotAllowed; import com.sastix.cms.common.lock.exceptions.LockNotHeld; import com.sastix.cms.server.services.lock.LockService; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Service; import lombok.extern.slf4j.Slf4j; /* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.lock.dummy; @Slf4j @Service @Profile("dummy")
public class DummyLockService implements LockService {
sastix/cms
server/src/main/java/com/sastix/cms/server/services/lock/dummy/DummyLockService.java
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/LockDTO.java // @Getter @Setter @NoArgsConstructor @AllArgsConstructor // public class LockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -1244256114246115089L; // // /** // * The UID that has been now locked. // */ // private String UID; // // /** // * A Unique Lock ID that has been defined to hold this lock. // */ // private String lockID; // // /** // * The owner of this lock. // */ // private String lockOwner; // // /** // * The DateTime that this lock will expire. // */ // private DateTime lockExpiration; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/NewLockDTO.java // @Getter @Setter @NoArgsConstructor // public class NewLockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 8706080938884218602L; // // /** // * The Unique Identifier that the caller attempts to lock. // */ // private String UID; // // /** // * The owner of this lock. // */ // private String lockOwner; // // /** // * If provided, the expiration of the lock is set to this DateTime. // * </p> // * If not provided, the default lock expiration is set to T0+30m. Lock Expiration cannot be set to more than 8hrs. // */ // private DateTime lockExpiration; // // /** // * Constructor with Mandatory fields. // * // * @param UID a String with the UID // * @param lockOwner a String with owner of this lock // */ // public NewLockDTO(final String UID, final String lockOwner) { // this.UID = UID; // this.lockOwner = lockOwner; // lockExpiration = new DateTime().plusMinutes(30); // } // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/QueryLockDTO.java // @Getter @Setter @NoArgsConstructor @AllArgsConstructor // public class QueryLockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 3214527307576872325L; // // /** // * The Unique Identifier that the caller attempts to lock. // */ // @NotNull // private String UID; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/exceptions/LockNotAllowed.java // public class LockNotAllowed extends BusinessException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -8248743010140162906L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public LockNotAllowed(String message) { // super(message); // } // } // // Path: server/src/main/java/com/sastix/cms/server/services/lock/LockService.java // public interface LockService extends LockApi{ // // Add any additional implementation // }
import com.sastix.cms.common.lock.LockDTO; import com.sastix.cms.common.lock.NewLockDTO; import com.sastix.cms.common.lock.QueryLockDTO; import com.sastix.cms.common.lock.exceptions.LockNotAllowed; import com.sastix.cms.common.lock.exceptions.LockNotHeld; import com.sastix.cms.server.services.lock.LockService; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Service; import lombok.extern.slf4j.Slf4j;
/* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.lock.dummy; @Slf4j @Service @Profile("dummy") public class DummyLockService implements LockService { @Override
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/LockDTO.java // @Getter @Setter @NoArgsConstructor @AllArgsConstructor // public class LockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -1244256114246115089L; // // /** // * The UID that has been now locked. // */ // private String UID; // // /** // * A Unique Lock ID that has been defined to hold this lock. // */ // private String lockID; // // /** // * The owner of this lock. // */ // private String lockOwner; // // /** // * The DateTime that this lock will expire. // */ // private DateTime lockExpiration; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/NewLockDTO.java // @Getter @Setter @NoArgsConstructor // public class NewLockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 8706080938884218602L; // // /** // * The Unique Identifier that the caller attempts to lock. // */ // private String UID; // // /** // * The owner of this lock. // */ // private String lockOwner; // // /** // * If provided, the expiration of the lock is set to this DateTime. // * </p> // * If not provided, the default lock expiration is set to T0+30m. Lock Expiration cannot be set to more than 8hrs. // */ // private DateTime lockExpiration; // // /** // * Constructor with Mandatory fields. // * // * @param UID a String with the UID // * @param lockOwner a String with owner of this lock // */ // public NewLockDTO(final String UID, final String lockOwner) { // this.UID = UID; // this.lockOwner = lockOwner; // lockExpiration = new DateTime().plusMinutes(30); // } // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/QueryLockDTO.java // @Getter @Setter @NoArgsConstructor @AllArgsConstructor // public class QueryLockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 3214527307576872325L; // // /** // * The Unique Identifier that the caller attempts to lock. // */ // @NotNull // private String UID; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/exceptions/LockNotAllowed.java // public class LockNotAllowed extends BusinessException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -8248743010140162906L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public LockNotAllowed(String message) { // super(message); // } // } // // Path: server/src/main/java/com/sastix/cms/server/services/lock/LockService.java // public interface LockService extends LockApi{ // // Add any additional implementation // } // Path: server/src/main/java/com/sastix/cms/server/services/lock/dummy/DummyLockService.java import com.sastix.cms.common.lock.LockDTO; import com.sastix.cms.common.lock.NewLockDTO; import com.sastix.cms.common.lock.QueryLockDTO; import com.sastix.cms.common.lock.exceptions.LockNotAllowed; import com.sastix.cms.common.lock.exceptions.LockNotHeld; import com.sastix.cms.server.services.lock.LockService; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Service; import lombok.extern.slf4j.Slf4j; /* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.lock.dummy; @Slf4j @Service @Profile("dummy") public class DummyLockService implements LockService { @Override
public LockDTO lockResource(final NewLockDTO newLockDTO) throws LockNotAllowed {
sastix/cms
server/src/main/java/com/sastix/cms/server/services/lock/dummy/DummyLockService.java
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/LockDTO.java // @Getter @Setter @NoArgsConstructor @AllArgsConstructor // public class LockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -1244256114246115089L; // // /** // * The UID that has been now locked. // */ // private String UID; // // /** // * A Unique Lock ID that has been defined to hold this lock. // */ // private String lockID; // // /** // * The owner of this lock. // */ // private String lockOwner; // // /** // * The DateTime that this lock will expire. // */ // private DateTime lockExpiration; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/NewLockDTO.java // @Getter @Setter @NoArgsConstructor // public class NewLockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 8706080938884218602L; // // /** // * The Unique Identifier that the caller attempts to lock. // */ // private String UID; // // /** // * The owner of this lock. // */ // private String lockOwner; // // /** // * If provided, the expiration of the lock is set to this DateTime. // * </p> // * If not provided, the default lock expiration is set to T0+30m. Lock Expiration cannot be set to more than 8hrs. // */ // private DateTime lockExpiration; // // /** // * Constructor with Mandatory fields. // * // * @param UID a String with the UID // * @param lockOwner a String with owner of this lock // */ // public NewLockDTO(final String UID, final String lockOwner) { // this.UID = UID; // this.lockOwner = lockOwner; // lockExpiration = new DateTime().plusMinutes(30); // } // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/QueryLockDTO.java // @Getter @Setter @NoArgsConstructor @AllArgsConstructor // public class QueryLockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 3214527307576872325L; // // /** // * The Unique Identifier that the caller attempts to lock. // */ // @NotNull // private String UID; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/exceptions/LockNotAllowed.java // public class LockNotAllowed extends BusinessException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -8248743010140162906L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public LockNotAllowed(String message) { // super(message); // } // } // // Path: server/src/main/java/com/sastix/cms/server/services/lock/LockService.java // public interface LockService extends LockApi{ // // Add any additional implementation // }
import com.sastix.cms.common.lock.LockDTO; import com.sastix.cms.common.lock.NewLockDTO; import com.sastix.cms.common.lock.QueryLockDTO; import com.sastix.cms.common.lock.exceptions.LockNotAllowed; import com.sastix.cms.common.lock.exceptions.LockNotHeld; import com.sastix.cms.server.services.lock.LockService; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Service; import lombok.extern.slf4j.Slf4j;
/* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.lock.dummy; @Slf4j @Service @Profile("dummy") public class DummyLockService implements LockService { @Override
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/LockDTO.java // @Getter @Setter @NoArgsConstructor @AllArgsConstructor // public class LockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -1244256114246115089L; // // /** // * The UID that has been now locked. // */ // private String UID; // // /** // * A Unique Lock ID that has been defined to hold this lock. // */ // private String lockID; // // /** // * The owner of this lock. // */ // private String lockOwner; // // /** // * The DateTime that this lock will expire. // */ // private DateTime lockExpiration; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/NewLockDTO.java // @Getter @Setter @NoArgsConstructor // public class NewLockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 8706080938884218602L; // // /** // * The Unique Identifier that the caller attempts to lock. // */ // private String UID; // // /** // * The owner of this lock. // */ // private String lockOwner; // // /** // * If provided, the expiration of the lock is set to this DateTime. // * </p> // * If not provided, the default lock expiration is set to T0+30m. Lock Expiration cannot be set to more than 8hrs. // */ // private DateTime lockExpiration; // // /** // * Constructor with Mandatory fields. // * // * @param UID a String with the UID // * @param lockOwner a String with owner of this lock // */ // public NewLockDTO(final String UID, final String lockOwner) { // this.UID = UID; // this.lockOwner = lockOwner; // lockExpiration = new DateTime().plusMinutes(30); // } // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/QueryLockDTO.java // @Getter @Setter @NoArgsConstructor @AllArgsConstructor // public class QueryLockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 3214527307576872325L; // // /** // * The Unique Identifier that the caller attempts to lock. // */ // @NotNull // private String UID; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/exceptions/LockNotAllowed.java // public class LockNotAllowed extends BusinessException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -8248743010140162906L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public LockNotAllowed(String message) { // super(message); // } // } // // Path: server/src/main/java/com/sastix/cms/server/services/lock/LockService.java // public interface LockService extends LockApi{ // // Add any additional implementation // } // Path: server/src/main/java/com/sastix/cms/server/services/lock/dummy/DummyLockService.java import com.sastix.cms.common.lock.LockDTO; import com.sastix.cms.common.lock.NewLockDTO; import com.sastix.cms.common.lock.QueryLockDTO; import com.sastix.cms.common.lock.exceptions.LockNotAllowed; import com.sastix.cms.common.lock.exceptions.LockNotHeld; import com.sastix.cms.server.services.lock.LockService; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Service; import lombok.extern.slf4j.Slf4j; /* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.lock.dummy; @Slf4j @Service @Profile("dummy") public class DummyLockService implements LockService { @Override
public LockDTO lockResource(final NewLockDTO newLockDTO) throws LockNotAllowed {
sastix/cms
server/src/main/java/com/sastix/cms/server/services/lock/dummy/DummyLockService.java
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/LockDTO.java // @Getter @Setter @NoArgsConstructor @AllArgsConstructor // public class LockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -1244256114246115089L; // // /** // * The UID that has been now locked. // */ // private String UID; // // /** // * A Unique Lock ID that has been defined to hold this lock. // */ // private String lockID; // // /** // * The owner of this lock. // */ // private String lockOwner; // // /** // * The DateTime that this lock will expire. // */ // private DateTime lockExpiration; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/NewLockDTO.java // @Getter @Setter @NoArgsConstructor // public class NewLockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 8706080938884218602L; // // /** // * The Unique Identifier that the caller attempts to lock. // */ // private String UID; // // /** // * The owner of this lock. // */ // private String lockOwner; // // /** // * If provided, the expiration of the lock is set to this DateTime. // * </p> // * If not provided, the default lock expiration is set to T0+30m. Lock Expiration cannot be set to more than 8hrs. // */ // private DateTime lockExpiration; // // /** // * Constructor with Mandatory fields. // * // * @param UID a String with the UID // * @param lockOwner a String with owner of this lock // */ // public NewLockDTO(final String UID, final String lockOwner) { // this.UID = UID; // this.lockOwner = lockOwner; // lockExpiration = new DateTime().plusMinutes(30); // } // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/QueryLockDTO.java // @Getter @Setter @NoArgsConstructor @AllArgsConstructor // public class QueryLockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 3214527307576872325L; // // /** // * The Unique Identifier that the caller attempts to lock. // */ // @NotNull // private String UID; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/exceptions/LockNotAllowed.java // public class LockNotAllowed extends BusinessException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -8248743010140162906L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public LockNotAllowed(String message) { // super(message); // } // } // // Path: server/src/main/java/com/sastix/cms/server/services/lock/LockService.java // public interface LockService extends LockApi{ // // Add any additional implementation // }
import com.sastix.cms.common.lock.LockDTO; import com.sastix.cms.common.lock.NewLockDTO; import com.sastix.cms.common.lock.QueryLockDTO; import com.sastix.cms.common.lock.exceptions.LockNotAllowed; import com.sastix.cms.common.lock.exceptions.LockNotHeld; import com.sastix.cms.server.services.lock.LockService; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Service; import lombok.extern.slf4j.Slf4j;
/* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.lock.dummy; @Slf4j @Service @Profile("dummy") public class DummyLockService implements LockService { @Override
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/LockDTO.java // @Getter @Setter @NoArgsConstructor @AllArgsConstructor // public class LockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -1244256114246115089L; // // /** // * The UID that has been now locked. // */ // private String UID; // // /** // * A Unique Lock ID that has been defined to hold this lock. // */ // private String lockID; // // /** // * The owner of this lock. // */ // private String lockOwner; // // /** // * The DateTime that this lock will expire. // */ // private DateTime lockExpiration; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/NewLockDTO.java // @Getter @Setter @NoArgsConstructor // public class NewLockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 8706080938884218602L; // // /** // * The Unique Identifier that the caller attempts to lock. // */ // private String UID; // // /** // * The owner of this lock. // */ // private String lockOwner; // // /** // * If provided, the expiration of the lock is set to this DateTime. // * </p> // * If not provided, the default lock expiration is set to T0+30m. Lock Expiration cannot be set to more than 8hrs. // */ // private DateTime lockExpiration; // // /** // * Constructor with Mandatory fields. // * // * @param UID a String with the UID // * @param lockOwner a String with owner of this lock // */ // public NewLockDTO(final String UID, final String lockOwner) { // this.UID = UID; // this.lockOwner = lockOwner; // lockExpiration = new DateTime().plusMinutes(30); // } // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/QueryLockDTO.java // @Getter @Setter @NoArgsConstructor @AllArgsConstructor // public class QueryLockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 3214527307576872325L; // // /** // * The Unique Identifier that the caller attempts to lock. // */ // @NotNull // private String UID; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/exceptions/LockNotAllowed.java // public class LockNotAllowed extends BusinessException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -8248743010140162906L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public LockNotAllowed(String message) { // super(message); // } // } // // Path: server/src/main/java/com/sastix/cms/server/services/lock/LockService.java // public interface LockService extends LockApi{ // // Add any additional implementation // } // Path: server/src/main/java/com/sastix/cms/server/services/lock/dummy/DummyLockService.java import com.sastix.cms.common.lock.LockDTO; import com.sastix.cms.common.lock.NewLockDTO; import com.sastix.cms.common.lock.QueryLockDTO; import com.sastix.cms.common.lock.exceptions.LockNotAllowed; import com.sastix.cms.common.lock.exceptions.LockNotHeld; import com.sastix.cms.server.services.lock.LockService; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Service; import lombok.extern.slf4j.Slf4j; /* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.lock.dummy; @Slf4j @Service @Profile("dummy") public class DummyLockService implements LockService { @Override
public LockDTO lockResource(final NewLockDTO newLockDTO) throws LockNotAllowed {
sastix/cms
server/src/main/java/com/sastix/cms/server/services/lock/dummy/DummyLockService.java
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/LockDTO.java // @Getter @Setter @NoArgsConstructor @AllArgsConstructor // public class LockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -1244256114246115089L; // // /** // * The UID that has been now locked. // */ // private String UID; // // /** // * A Unique Lock ID that has been defined to hold this lock. // */ // private String lockID; // // /** // * The owner of this lock. // */ // private String lockOwner; // // /** // * The DateTime that this lock will expire. // */ // private DateTime lockExpiration; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/NewLockDTO.java // @Getter @Setter @NoArgsConstructor // public class NewLockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 8706080938884218602L; // // /** // * The Unique Identifier that the caller attempts to lock. // */ // private String UID; // // /** // * The owner of this lock. // */ // private String lockOwner; // // /** // * If provided, the expiration of the lock is set to this DateTime. // * </p> // * If not provided, the default lock expiration is set to T0+30m. Lock Expiration cannot be set to more than 8hrs. // */ // private DateTime lockExpiration; // // /** // * Constructor with Mandatory fields. // * // * @param UID a String with the UID // * @param lockOwner a String with owner of this lock // */ // public NewLockDTO(final String UID, final String lockOwner) { // this.UID = UID; // this.lockOwner = lockOwner; // lockExpiration = new DateTime().plusMinutes(30); // } // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/QueryLockDTO.java // @Getter @Setter @NoArgsConstructor @AllArgsConstructor // public class QueryLockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 3214527307576872325L; // // /** // * The Unique Identifier that the caller attempts to lock. // */ // @NotNull // private String UID; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/exceptions/LockNotAllowed.java // public class LockNotAllowed extends BusinessException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -8248743010140162906L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public LockNotAllowed(String message) { // super(message); // } // } // // Path: server/src/main/java/com/sastix/cms/server/services/lock/LockService.java // public interface LockService extends LockApi{ // // Add any additional implementation // }
import com.sastix.cms.common.lock.LockDTO; import com.sastix.cms.common.lock.NewLockDTO; import com.sastix.cms.common.lock.QueryLockDTO; import com.sastix.cms.common.lock.exceptions.LockNotAllowed; import com.sastix.cms.common.lock.exceptions.LockNotHeld; import com.sastix.cms.server.services.lock.LockService; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Service; import lombok.extern.slf4j.Slf4j;
/* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.lock.dummy; @Slf4j @Service @Profile("dummy") public class DummyLockService implements LockService { @Override public LockDTO lockResource(final NewLockDTO newLockDTO) throws LockNotAllowed { log.info("DummyLockService->lockResource"); return null; } @Override public void unlockResource(final LockDTO lockDTO) throws LockNotHeld { log.info("DummyLockService->unlockResource"); } @Override public LockDTO renewResourceLock(final LockDTO lockDTO) throws LockNotHeld, LockNotAllowed { log.info("DummyLockService->renewResourceLock"); return null; } @Override
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/LockDTO.java // @Getter @Setter @NoArgsConstructor @AllArgsConstructor // public class LockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -1244256114246115089L; // // /** // * The UID that has been now locked. // */ // private String UID; // // /** // * A Unique Lock ID that has been defined to hold this lock. // */ // private String lockID; // // /** // * The owner of this lock. // */ // private String lockOwner; // // /** // * The DateTime that this lock will expire. // */ // private DateTime lockExpiration; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/NewLockDTO.java // @Getter @Setter @NoArgsConstructor // public class NewLockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 8706080938884218602L; // // /** // * The Unique Identifier that the caller attempts to lock. // */ // private String UID; // // /** // * The owner of this lock. // */ // private String lockOwner; // // /** // * If provided, the expiration of the lock is set to this DateTime. // * </p> // * If not provided, the default lock expiration is set to T0+30m. Lock Expiration cannot be set to more than 8hrs. // */ // private DateTime lockExpiration; // // /** // * Constructor with Mandatory fields. // * // * @param UID a String with the UID // * @param lockOwner a String with owner of this lock // */ // public NewLockDTO(final String UID, final String lockOwner) { // this.UID = UID; // this.lockOwner = lockOwner; // lockExpiration = new DateTime().plusMinutes(30); // } // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/QueryLockDTO.java // @Getter @Setter @NoArgsConstructor @AllArgsConstructor // public class QueryLockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 3214527307576872325L; // // /** // * The Unique Identifier that the caller attempts to lock. // */ // @NotNull // private String UID; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/exceptions/LockNotAllowed.java // public class LockNotAllowed extends BusinessException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -8248743010140162906L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public LockNotAllowed(String message) { // super(message); // } // } // // Path: server/src/main/java/com/sastix/cms/server/services/lock/LockService.java // public interface LockService extends LockApi{ // // Add any additional implementation // } // Path: server/src/main/java/com/sastix/cms/server/services/lock/dummy/DummyLockService.java import com.sastix.cms.common.lock.LockDTO; import com.sastix.cms.common.lock.NewLockDTO; import com.sastix.cms.common.lock.QueryLockDTO; import com.sastix.cms.common.lock.exceptions.LockNotAllowed; import com.sastix.cms.common.lock.exceptions.LockNotHeld; import com.sastix.cms.server.services.lock.LockService; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Service; import lombok.extern.slf4j.Slf4j; /* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.lock.dummy; @Slf4j @Service @Profile("dummy") public class DummyLockService implements LockService { @Override public LockDTO lockResource(final NewLockDTO newLockDTO) throws LockNotAllowed { log.info("DummyLockService->lockResource"); return null; } @Override public void unlockResource(final LockDTO lockDTO) throws LockNotHeld { log.info("DummyLockService->unlockResource"); } @Override public LockDTO renewResourceLock(final LockDTO lockDTO) throws LockNotHeld, LockNotAllowed { log.info("DummyLockService->renewResourceLock"); return null; } @Override
public LockDTO queryResourceLock(QueryLockDTO queryLockDTO) {
sastix/cms
common/services/src/main/java/com/sastix/cms/common/services/htmltopdf/PdfImpl.java
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/dataobjects/htmltopdf/Param.java // @Getter @Setter @AllArgsConstructor @ToString // public class Param { // // String key; // // String value; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/dataobjects/htmltopdf/page/Page.java // @Getter @Setter @AllArgsConstructor // public class Page { // private String source; // // private PageType type; // // } // // Path: common/services/src/main/java/com/sastix/cms/common/services/htmltopdf/config/HtmlToPdfConfig.java // @Slf4j // @Getter @Setter @AllArgsConstructor @NoArgsConstructor // public class HtmlToPdfConfig { // // private String wkhtmltopdfCommand; // // /** // * Attempts to find the `wkhtmltopdf` executable in the system path. // * // * @return // */ // public String findExecutable() { // String ret = null; // try { // String osname = System.getProperty("os.name").toLowerCase(); // // String cmd; // if (osname.contains("windows")) // cmd = "where wkhtmltopdf"; // else cmd = "which wkhtmltopdf"; // // Process p = Runtime.getRuntime().exec(cmd); // p.waitFor(); // // BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); // // StringBuilder sb = new StringBuilder(); // String line = ""; // while ((line = reader.readLine()) != null) { // sb.append(line); // } // // if (sb.toString().isEmpty()) // throw new RuntimeException(); // // ret = sb.toString(); // } catch (InterruptedException e) { // log.error("InterruptedException while trying to find wkhtmltopdf executable",e); // } catch (IOException e) { // log.error("IOException while trying to find wkhtmltopdf executable", e); // } catch (RuntimeException e) { // log.error("RuntimeException while trying to find wkhtmltopdf executable", e); // } // return ret; // } // }
import com.sastix.cms.common.dataobjects.htmltopdf.Param; import com.sastix.cms.common.dataobjects.htmltopdf.Params; import com.sastix.cms.common.dataobjects.htmltopdf.page.Page; import com.sastix.cms.common.dataobjects.htmltopdf.page.PageType; import com.sastix.cms.common.services.htmltopdf.config.HtmlToPdfConfig; import org.apache.commons.lang3.StringUtils; import java.io.*; import java.util.ArrayList; import java.util.List;
/* * Copyright(c) 2016 the original author or authors. * * Licensed 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 com.sastix.cms.common.services.htmltopdf; public class PdfImpl implements Pdf { private static final String STDINOUT = "-";
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/dataobjects/htmltopdf/Param.java // @Getter @Setter @AllArgsConstructor @ToString // public class Param { // // String key; // // String value; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/dataobjects/htmltopdf/page/Page.java // @Getter @Setter @AllArgsConstructor // public class Page { // private String source; // // private PageType type; // // } // // Path: common/services/src/main/java/com/sastix/cms/common/services/htmltopdf/config/HtmlToPdfConfig.java // @Slf4j // @Getter @Setter @AllArgsConstructor @NoArgsConstructor // public class HtmlToPdfConfig { // // private String wkhtmltopdfCommand; // // /** // * Attempts to find the `wkhtmltopdf` executable in the system path. // * // * @return // */ // public String findExecutable() { // String ret = null; // try { // String osname = System.getProperty("os.name").toLowerCase(); // // String cmd; // if (osname.contains("windows")) // cmd = "where wkhtmltopdf"; // else cmd = "which wkhtmltopdf"; // // Process p = Runtime.getRuntime().exec(cmd); // p.waitFor(); // // BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); // // StringBuilder sb = new StringBuilder(); // String line = ""; // while ((line = reader.readLine()) != null) { // sb.append(line); // } // // if (sb.toString().isEmpty()) // throw new RuntimeException(); // // ret = sb.toString(); // } catch (InterruptedException e) { // log.error("InterruptedException while trying to find wkhtmltopdf executable",e); // } catch (IOException e) { // log.error("IOException while trying to find wkhtmltopdf executable", e); // } catch (RuntimeException e) { // log.error("RuntimeException while trying to find wkhtmltopdf executable", e); // } // return ret; // } // } // Path: common/services/src/main/java/com/sastix/cms/common/services/htmltopdf/PdfImpl.java import com.sastix.cms.common.dataobjects.htmltopdf.Param; import com.sastix.cms.common.dataobjects.htmltopdf.Params; import com.sastix.cms.common.dataobjects.htmltopdf.page.Page; import com.sastix.cms.common.dataobjects.htmltopdf.page.PageType; import com.sastix.cms.common.services.htmltopdf.config.HtmlToPdfConfig; import org.apache.commons.lang3.StringUtils; import java.io.*; import java.util.ArrayList; import java.util.List; /* * Copyright(c) 2016 the original author or authors. * * Licensed 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 com.sastix.cms.common.services.htmltopdf; public class PdfImpl implements Pdf { private static final String STDINOUT = "-";
HtmlToPdfConfig htmlToPdfConfig;
sastix/cms
common/services/src/main/java/com/sastix/cms/common/services/htmltopdf/PdfImpl.java
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/dataobjects/htmltopdf/Param.java // @Getter @Setter @AllArgsConstructor @ToString // public class Param { // // String key; // // String value; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/dataobjects/htmltopdf/page/Page.java // @Getter @Setter @AllArgsConstructor // public class Page { // private String source; // // private PageType type; // // } // // Path: common/services/src/main/java/com/sastix/cms/common/services/htmltopdf/config/HtmlToPdfConfig.java // @Slf4j // @Getter @Setter @AllArgsConstructor @NoArgsConstructor // public class HtmlToPdfConfig { // // private String wkhtmltopdfCommand; // // /** // * Attempts to find the `wkhtmltopdf` executable in the system path. // * // * @return // */ // public String findExecutable() { // String ret = null; // try { // String osname = System.getProperty("os.name").toLowerCase(); // // String cmd; // if (osname.contains("windows")) // cmd = "where wkhtmltopdf"; // else cmd = "which wkhtmltopdf"; // // Process p = Runtime.getRuntime().exec(cmd); // p.waitFor(); // // BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); // // StringBuilder sb = new StringBuilder(); // String line = ""; // while ((line = reader.readLine()) != null) { // sb.append(line); // } // // if (sb.toString().isEmpty()) // throw new RuntimeException(); // // ret = sb.toString(); // } catch (InterruptedException e) { // log.error("InterruptedException while trying to find wkhtmltopdf executable",e); // } catch (IOException e) { // log.error("IOException while trying to find wkhtmltopdf executable", e); // } catch (RuntimeException e) { // log.error("RuntimeException while trying to find wkhtmltopdf executable", e); // } // return ret; // } // }
import com.sastix.cms.common.dataobjects.htmltopdf.Param; import com.sastix.cms.common.dataobjects.htmltopdf.Params; import com.sastix.cms.common.dataobjects.htmltopdf.page.Page; import com.sastix.cms.common.dataobjects.htmltopdf.page.PageType; import com.sastix.cms.common.services.htmltopdf.config.HtmlToPdfConfig; import org.apache.commons.lang3.StringUtils; import java.io.*; import java.util.ArrayList; import java.util.List;
/* * Copyright(c) 2016 the original author or authors. * * Licensed 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 com.sastix.cms.common.services.htmltopdf; public class PdfImpl implements Pdf { private static final String STDINOUT = "-"; HtmlToPdfConfig htmlToPdfConfig; private Params params;
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/dataobjects/htmltopdf/Param.java // @Getter @Setter @AllArgsConstructor @ToString // public class Param { // // String key; // // String value; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/dataobjects/htmltopdf/page/Page.java // @Getter @Setter @AllArgsConstructor // public class Page { // private String source; // // private PageType type; // // } // // Path: common/services/src/main/java/com/sastix/cms/common/services/htmltopdf/config/HtmlToPdfConfig.java // @Slf4j // @Getter @Setter @AllArgsConstructor @NoArgsConstructor // public class HtmlToPdfConfig { // // private String wkhtmltopdfCommand; // // /** // * Attempts to find the `wkhtmltopdf` executable in the system path. // * // * @return // */ // public String findExecutable() { // String ret = null; // try { // String osname = System.getProperty("os.name").toLowerCase(); // // String cmd; // if (osname.contains("windows")) // cmd = "where wkhtmltopdf"; // else cmd = "which wkhtmltopdf"; // // Process p = Runtime.getRuntime().exec(cmd); // p.waitFor(); // // BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); // // StringBuilder sb = new StringBuilder(); // String line = ""; // while ((line = reader.readLine()) != null) { // sb.append(line); // } // // if (sb.toString().isEmpty()) // throw new RuntimeException(); // // ret = sb.toString(); // } catch (InterruptedException e) { // log.error("InterruptedException while trying to find wkhtmltopdf executable",e); // } catch (IOException e) { // log.error("IOException while trying to find wkhtmltopdf executable", e); // } catch (RuntimeException e) { // log.error("RuntimeException while trying to find wkhtmltopdf executable", e); // } // return ret; // } // } // Path: common/services/src/main/java/com/sastix/cms/common/services/htmltopdf/PdfImpl.java import com.sastix.cms.common.dataobjects.htmltopdf.Param; import com.sastix.cms.common.dataobjects.htmltopdf.Params; import com.sastix.cms.common.dataobjects.htmltopdf.page.Page; import com.sastix.cms.common.dataobjects.htmltopdf.page.PageType; import com.sastix.cms.common.services.htmltopdf.config.HtmlToPdfConfig; import org.apache.commons.lang3.StringUtils; import java.io.*; import java.util.ArrayList; import java.util.List; /* * Copyright(c) 2016 the original author or authors. * * Licensed 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 com.sastix.cms.common.services.htmltopdf; public class PdfImpl implements Pdf { private static final String STDINOUT = "-"; HtmlToPdfConfig htmlToPdfConfig; private Params params;
private List<Page> pages;
sastix/cms
common/services/src/main/java/com/sastix/cms/common/services/htmltopdf/PdfImpl.java
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/dataobjects/htmltopdf/Param.java // @Getter @Setter @AllArgsConstructor @ToString // public class Param { // // String key; // // String value; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/dataobjects/htmltopdf/page/Page.java // @Getter @Setter @AllArgsConstructor // public class Page { // private String source; // // private PageType type; // // } // // Path: common/services/src/main/java/com/sastix/cms/common/services/htmltopdf/config/HtmlToPdfConfig.java // @Slf4j // @Getter @Setter @AllArgsConstructor @NoArgsConstructor // public class HtmlToPdfConfig { // // private String wkhtmltopdfCommand; // // /** // * Attempts to find the `wkhtmltopdf` executable in the system path. // * // * @return // */ // public String findExecutable() { // String ret = null; // try { // String osname = System.getProperty("os.name").toLowerCase(); // // String cmd; // if (osname.contains("windows")) // cmd = "where wkhtmltopdf"; // else cmd = "which wkhtmltopdf"; // // Process p = Runtime.getRuntime().exec(cmd); // p.waitFor(); // // BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); // // StringBuilder sb = new StringBuilder(); // String line = ""; // while ((line = reader.readLine()) != null) { // sb.append(line); // } // // if (sb.toString().isEmpty()) // throw new RuntimeException(); // // ret = sb.toString(); // } catch (InterruptedException e) { // log.error("InterruptedException while trying to find wkhtmltopdf executable",e); // } catch (IOException e) { // log.error("IOException while trying to find wkhtmltopdf executable", e); // } catch (RuntimeException e) { // log.error("RuntimeException while trying to find wkhtmltopdf executable", e); // } // return ret; // } // }
import com.sastix.cms.common.dataobjects.htmltopdf.Param; import com.sastix.cms.common.dataobjects.htmltopdf.Params; import com.sastix.cms.common.dataobjects.htmltopdf.page.Page; import com.sastix.cms.common.dataobjects.htmltopdf.page.PageType; import com.sastix.cms.common.services.htmltopdf.config.HtmlToPdfConfig; import org.apache.commons.lang3.StringUtils; import java.io.*; import java.util.ArrayList; import java.util.List;
/* * Copyright(c) 2016 the original author or authors. * * Licensed 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 com.sastix.cms.common.services.htmltopdf; public class PdfImpl implements Pdf { private static final String STDINOUT = "-"; HtmlToPdfConfig htmlToPdfConfig; private Params params; private List<Page> pages; private boolean hasToc = false; public PdfImpl(HtmlToPdfConfig htmlToPdfConfig) { this.htmlToPdfConfig = htmlToPdfConfig; this.params = new Params(); this.pages = new ArrayList<Page>(); } public void addPage(String source, PageType type) { this.pages.add(new Page(source, type)); } public void addToc() { this.hasToc = true; }
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/dataobjects/htmltopdf/Param.java // @Getter @Setter @AllArgsConstructor @ToString // public class Param { // // String key; // // String value; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/dataobjects/htmltopdf/page/Page.java // @Getter @Setter @AllArgsConstructor // public class Page { // private String source; // // private PageType type; // // } // // Path: common/services/src/main/java/com/sastix/cms/common/services/htmltopdf/config/HtmlToPdfConfig.java // @Slf4j // @Getter @Setter @AllArgsConstructor @NoArgsConstructor // public class HtmlToPdfConfig { // // private String wkhtmltopdfCommand; // // /** // * Attempts to find the `wkhtmltopdf` executable in the system path. // * // * @return // */ // public String findExecutable() { // String ret = null; // try { // String osname = System.getProperty("os.name").toLowerCase(); // // String cmd; // if (osname.contains("windows")) // cmd = "where wkhtmltopdf"; // else cmd = "which wkhtmltopdf"; // // Process p = Runtime.getRuntime().exec(cmd); // p.waitFor(); // // BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); // // StringBuilder sb = new StringBuilder(); // String line = ""; // while ((line = reader.readLine()) != null) { // sb.append(line); // } // // if (sb.toString().isEmpty()) // throw new RuntimeException(); // // ret = sb.toString(); // } catch (InterruptedException e) { // log.error("InterruptedException while trying to find wkhtmltopdf executable",e); // } catch (IOException e) { // log.error("IOException while trying to find wkhtmltopdf executable", e); // } catch (RuntimeException e) { // log.error("RuntimeException while trying to find wkhtmltopdf executable", e); // } // return ret; // } // } // Path: common/services/src/main/java/com/sastix/cms/common/services/htmltopdf/PdfImpl.java import com.sastix.cms.common.dataobjects.htmltopdf.Param; import com.sastix.cms.common.dataobjects.htmltopdf.Params; import com.sastix.cms.common.dataobjects.htmltopdf.page.Page; import com.sastix.cms.common.dataobjects.htmltopdf.page.PageType; import com.sastix.cms.common.services.htmltopdf.config.HtmlToPdfConfig; import org.apache.commons.lang3.StringUtils; import java.io.*; import java.util.ArrayList; import java.util.List; /* * Copyright(c) 2016 the original author or authors. * * Licensed 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 com.sastix.cms.common.services.htmltopdf; public class PdfImpl implements Pdf { private static final String STDINOUT = "-"; HtmlToPdfConfig htmlToPdfConfig; private Params params; private List<Page> pages; private boolean hasToc = false; public PdfImpl(HtmlToPdfConfig htmlToPdfConfig) { this.htmlToPdfConfig = htmlToPdfConfig; this.params = new Params(); this.pages = new ArrayList<Page>(); } public void addPage(String source, PageType type) { this.pages.add(new Page(source, type)); } public void addToc() { this.hasToc = true; }
public void addParam(Param param) {
sastix/cms
common/services/src/main/java/com/sastix/cms/common/services/htmltopdf/Pdf.java
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/dataobjects/htmltopdf/Param.java // @Getter @Setter @AllArgsConstructor @ToString // public class Param { // // String key; // // String value; // // }
import com.sastix.cms.common.dataobjects.htmltopdf.Param; import com.sastix.cms.common.dataobjects.htmltopdf.page.PageType; import java.io.IOException;
/* * Copyright(c) 2016 the original author or authors. * * Licensed 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 com.sastix.cms.common.services.htmltopdf; /** * A java interface (wrapping usually a 3rd party command line tool) exposing methods for html to pdf conversion */ public interface Pdf { void addPage(String page, PageType type); void addToc();
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/dataobjects/htmltopdf/Param.java // @Getter @Setter @AllArgsConstructor @ToString // public class Param { // // String key; // // String value; // // } // Path: common/services/src/main/java/com/sastix/cms/common/services/htmltopdf/Pdf.java import com.sastix.cms.common.dataobjects.htmltopdf.Param; import com.sastix.cms.common.dataobjects.htmltopdf.page.PageType; import java.io.IOException; /* * Copyright(c) 2016 the original author or authors. * * Licensed 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 com.sastix.cms.common.services.htmltopdf; /** * A java interface (wrapping usually a 3rd party command line tool) exposing methods for html to pdf conversion */ public interface Pdf { void addPage(String page, PageType type); void addToc();
void addParam(Param param);
sastix/cms
server/src/main/java/com/sastix/cms/server/services/content/impl/TenantServiceImpl.java
// Path: server/src/main/java/com/sastix/cms/server/domain/entities/Tenant.java // @Entity // @Table(name = "tenant") // @Getter @Setter @NoArgsConstructor // public class Tenant implements Serializable { // // private static final long serialVersionUID = -2275542617850965462L; // // @Id // @Column(name = "id") // @GeneratedValue(strategy = GenerationType.AUTO) // private Integer id; // // @Column(name = "tenantId") // private String tenantId; // // @Column(name = "volume") // private String volume; // // @Column(name = "checksum", columnDefinition = "Text") // private String checksum; // // } // // Path: server/src/main/java/com/sastix/cms/server/domain/repositories/TenantRepository.java // @Transactional // public interface TenantRepository extends CrudRepository<Tenant, Long> { // // Tenant findByTenantId(@Param("tenantId") String tenantId); // } // // Path: server/src/main/java/com/sastix/cms/server/services/content/HashedDirectoryService.java // public interface HashedDirectoryService { // // String storeFile(final String UURI, final String tenantID, final byte[] resourceBinary) throws IOException; // // String replaceFile(final String UURI, final String tenantID, final byte[] resourceBinary) throws IOException; // // String storeFile(final String UURI, final String tenantID, final URI resourceURI) throws IOException; // // String replaceFile(final String UURI, final String tenantID, final URI resourceURI) throws IOException; // // String storeFile(final String UURI, final String tenantID, final String resourceURI) throws IOException, URISyntaxException; // // String replaceFile(final String UURI, final String tenantID, final String resourceURI) throws IOException, URISyntaxException; // // Path getDataByUID(final String UID, final String tenantID) throws IOException; // // byte[] getBytesByUID(final String UID, final String tenantID) throws IOException; // // Path getDataByURI(final String resourceURI, final String tenantID) throws IOException, URISyntaxException; // // byte[] getBytesByURI(final String resourceURI, final String tenantID) throws IOException; // // long getFileSize(final String resourceURI, final String tenantID) throws IOException; // // String hashText(String text); // // String getAbsolutePath(String resourceURI, final String tenantID); // // String createTenantDirectory(final String tenantID) throws IOException; // // String getVolume(); // // void setVolume(String value); // // void storeChecksum(final String tenantID, final String checksum) throws IOException; // // String getChecksum(final String tenantID) throws IOException; // }
import com.sastix.cms.server.domain.entities.Tenant; import com.sastix.cms.server.domain.repositories.TenantRepository; import com.sastix.cms.server.services.content.HashedDirectoryService; import com.sastix.cms.server.services.content.TenantService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; import java.io.IOException; import java.util.UUID;
/* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.content.impl; @Service public class TenantServiceImpl implements TenantService { @Autowired
// Path: server/src/main/java/com/sastix/cms/server/domain/entities/Tenant.java // @Entity // @Table(name = "tenant") // @Getter @Setter @NoArgsConstructor // public class Tenant implements Serializable { // // private static final long serialVersionUID = -2275542617850965462L; // // @Id // @Column(name = "id") // @GeneratedValue(strategy = GenerationType.AUTO) // private Integer id; // // @Column(name = "tenantId") // private String tenantId; // // @Column(name = "volume") // private String volume; // // @Column(name = "checksum", columnDefinition = "Text") // private String checksum; // // } // // Path: server/src/main/java/com/sastix/cms/server/domain/repositories/TenantRepository.java // @Transactional // public interface TenantRepository extends CrudRepository<Tenant, Long> { // // Tenant findByTenantId(@Param("tenantId") String tenantId); // } // // Path: server/src/main/java/com/sastix/cms/server/services/content/HashedDirectoryService.java // public interface HashedDirectoryService { // // String storeFile(final String UURI, final String tenantID, final byte[] resourceBinary) throws IOException; // // String replaceFile(final String UURI, final String tenantID, final byte[] resourceBinary) throws IOException; // // String storeFile(final String UURI, final String tenantID, final URI resourceURI) throws IOException; // // String replaceFile(final String UURI, final String tenantID, final URI resourceURI) throws IOException; // // String storeFile(final String UURI, final String tenantID, final String resourceURI) throws IOException, URISyntaxException; // // String replaceFile(final String UURI, final String tenantID, final String resourceURI) throws IOException, URISyntaxException; // // Path getDataByUID(final String UID, final String tenantID) throws IOException; // // byte[] getBytesByUID(final String UID, final String tenantID) throws IOException; // // Path getDataByURI(final String resourceURI, final String tenantID) throws IOException, URISyntaxException; // // byte[] getBytesByURI(final String resourceURI, final String tenantID) throws IOException; // // long getFileSize(final String resourceURI, final String tenantID) throws IOException; // // String hashText(String text); // // String getAbsolutePath(String resourceURI, final String tenantID); // // String createTenantDirectory(final String tenantID) throws IOException; // // String getVolume(); // // void setVolume(String value); // // void storeChecksum(final String tenantID, final String checksum) throws IOException; // // String getChecksum(final String tenantID) throws IOException; // } // Path: server/src/main/java/com/sastix/cms/server/services/content/impl/TenantServiceImpl.java import com.sastix.cms.server.domain.entities.Tenant; import com.sastix.cms.server.domain.repositories.TenantRepository; import com.sastix.cms.server.services.content.HashedDirectoryService; import com.sastix.cms.server.services.content.TenantService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; import java.io.IOException; import java.util.UUID; /* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.content.impl; @Service public class TenantServiceImpl implements TenantService { @Autowired
HashedDirectoryService hashedDirectoryService;
sastix/cms
server/src/main/java/com/sastix/cms/server/services/content/impl/TenantServiceImpl.java
// Path: server/src/main/java/com/sastix/cms/server/domain/entities/Tenant.java // @Entity // @Table(name = "tenant") // @Getter @Setter @NoArgsConstructor // public class Tenant implements Serializable { // // private static final long serialVersionUID = -2275542617850965462L; // // @Id // @Column(name = "id") // @GeneratedValue(strategy = GenerationType.AUTO) // private Integer id; // // @Column(name = "tenantId") // private String tenantId; // // @Column(name = "volume") // private String volume; // // @Column(name = "checksum", columnDefinition = "Text") // private String checksum; // // } // // Path: server/src/main/java/com/sastix/cms/server/domain/repositories/TenantRepository.java // @Transactional // public interface TenantRepository extends CrudRepository<Tenant, Long> { // // Tenant findByTenantId(@Param("tenantId") String tenantId); // } // // Path: server/src/main/java/com/sastix/cms/server/services/content/HashedDirectoryService.java // public interface HashedDirectoryService { // // String storeFile(final String UURI, final String tenantID, final byte[] resourceBinary) throws IOException; // // String replaceFile(final String UURI, final String tenantID, final byte[] resourceBinary) throws IOException; // // String storeFile(final String UURI, final String tenantID, final URI resourceURI) throws IOException; // // String replaceFile(final String UURI, final String tenantID, final URI resourceURI) throws IOException; // // String storeFile(final String UURI, final String tenantID, final String resourceURI) throws IOException, URISyntaxException; // // String replaceFile(final String UURI, final String tenantID, final String resourceURI) throws IOException, URISyntaxException; // // Path getDataByUID(final String UID, final String tenantID) throws IOException; // // byte[] getBytesByUID(final String UID, final String tenantID) throws IOException; // // Path getDataByURI(final String resourceURI, final String tenantID) throws IOException, URISyntaxException; // // byte[] getBytesByURI(final String resourceURI, final String tenantID) throws IOException; // // long getFileSize(final String resourceURI, final String tenantID) throws IOException; // // String hashText(String text); // // String getAbsolutePath(String resourceURI, final String tenantID); // // String createTenantDirectory(final String tenantID) throws IOException; // // String getVolume(); // // void setVolume(String value); // // void storeChecksum(final String tenantID, final String checksum) throws IOException; // // String getChecksum(final String tenantID) throws IOException; // }
import com.sastix.cms.server.domain.entities.Tenant; import com.sastix.cms.server.domain.repositories.TenantRepository; import com.sastix.cms.server.services.content.HashedDirectoryService; import com.sastix.cms.server.services.content.TenantService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; import java.io.IOException; import java.util.UUID;
/* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.content.impl; @Service public class TenantServiceImpl implements TenantService { @Autowired HashedDirectoryService hashedDirectoryService; @Autowired
// Path: server/src/main/java/com/sastix/cms/server/domain/entities/Tenant.java // @Entity // @Table(name = "tenant") // @Getter @Setter @NoArgsConstructor // public class Tenant implements Serializable { // // private static final long serialVersionUID = -2275542617850965462L; // // @Id // @Column(name = "id") // @GeneratedValue(strategy = GenerationType.AUTO) // private Integer id; // // @Column(name = "tenantId") // private String tenantId; // // @Column(name = "volume") // private String volume; // // @Column(name = "checksum", columnDefinition = "Text") // private String checksum; // // } // // Path: server/src/main/java/com/sastix/cms/server/domain/repositories/TenantRepository.java // @Transactional // public interface TenantRepository extends CrudRepository<Tenant, Long> { // // Tenant findByTenantId(@Param("tenantId") String tenantId); // } // // Path: server/src/main/java/com/sastix/cms/server/services/content/HashedDirectoryService.java // public interface HashedDirectoryService { // // String storeFile(final String UURI, final String tenantID, final byte[] resourceBinary) throws IOException; // // String replaceFile(final String UURI, final String tenantID, final byte[] resourceBinary) throws IOException; // // String storeFile(final String UURI, final String tenantID, final URI resourceURI) throws IOException; // // String replaceFile(final String UURI, final String tenantID, final URI resourceURI) throws IOException; // // String storeFile(final String UURI, final String tenantID, final String resourceURI) throws IOException, URISyntaxException; // // String replaceFile(final String UURI, final String tenantID, final String resourceURI) throws IOException, URISyntaxException; // // Path getDataByUID(final String UID, final String tenantID) throws IOException; // // byte[] getBytesByUID(final String UID, final String tenantID) throws IOException; // // Path getDataByURI(final String resourceURI, final String tenantID) throws IOException, URISyntaxException; // // byte[] getBytesByURI(final String resourceURI, final String tenantID) throws IOException; // // long getFileSize(final String resourceURI, final String tenantID) throws IOException; // // String hashText(String text); // // String getAbsolutePath(String resourceURI, final String tenantID); // // String createTenantDirectory(final String tenantID) throws IOException; // // String getVolume(); // // void setVolume(String value); // // void storeChecksum(final String tenantID, final String checksum) throws IOException; // // String getChecksum(final String tenantID) throws IOException; // } // Path: server/src/main/java/com/sastix/cms/server/services/content/impl/TenantServiceImpl.java import com.sastix.cms.server.domain.entities.Tenant; import com.sastix.cms.server.domain.repositories.TenantRepository; import com.sastix.cms.server.services.content.HashedDirectoryService; import com.sastix.cms.server.services.content.TenantService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; import java.io.IOException; import java.util.UUID; /* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.content.impl; @Service public class TenantServiceImpl implements TenantService { @Autowired HashedDirectoryService hashedDirectoryService; @Autowired
TenantRepository tenantRepository;
sastix/cms
server/src/main/java/com/sastix/cms/server/services/content/impl/TenantServiceImpl.java
// Path: server/src/main/java/com/sastix/cms/server/domain/entities/Tenant.java // @Entity // @Table(name = "tenant") // @Getter @Setter @NoArgsConstructor // public class Tenant implements Serializable { // // private static final long serialVersionUID = -2275542617850965462L; // // @Id // @Column(name = "id") // @GeneratedValue(strategy = GenerationType.AUTO) // private Integer id; // // @Column(name = "tenantId") // private String tenantId; // // @Column(name = "volume") // private String volume; // // @Column(name = "checksum", columnDefinition = "Text") // private String checksum; // // } // // Path: server/src/main/java/com/sastix/cms/server/domain/repositories/TenantRepository.java // @Transactional // public interface TenantRepository extends CrudRepository<Tenant, Long> { // // Tenant findByTenantId(@Param("tenantId") String tenantId); // } // // Path: server/src/main/java/com/sastix/cms/server/services/content/HashedDirectoryService.java // public interface HashedDirectoryService { // // String storeFile(final String UURI, final String tenantID, final byte[] resourceBinary) throws IOException; // // String replaceFile(final String UURI, final String tenantID, final byte[] resourceBinary) throws IOException; // // String storeFile(final String UURI, final String tenantID, final URI resourceURI) throws IOException; // // String replaceFile(final String UURI, final String tenantID, final URI resourceURI) throws IOException; // // String storeFile(final String UURI, final String tenantID, final String resourceURI) throws IOException, URISyntaxException; // // String replaceFile(final String UURI, final String tenantID, final String resourceURI) throws IOException, URISyntaxException; // // Path getDataByUID(final String UID, final String tenantID) throws IOException; // // byte[] getBytesByUID(final String UID, final String tenantID) throws IOException; // // Path getDataByURI(final String resourceURI, final String tenantID) throws IOException, URISyntaxException; // // byte[] getBytesByURI(final String resourceURI, final String tenantID) throws IOException; // // long getFileSize(final String resourceURI, final String tenantID) throws IOException; // // String hashText(String text); // // String getAbsolutePath(String resourceURI, final String tenantID); // // String createTenantDirectory(final String tenantID) throws IOException; // // String getVolume(); // // void setVolume(String value); // // void storeChecksum(final String tenantID, final String checksum) throws IOException; // // String getChecksum(final String tenantID) throws IOException; // }
import com.sastix.cms.server.domain.entities.Tenant; import com.sastix.cms.server.domain.repositories.TenantRepository; import com.sastix.cms.server.services.content.HashedDirectoryService; import com.sastix.cms.server.services.content.TenantService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; import java.io.IOException; import java.util.UUID;
/* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.content.impl; @Service public class TenantServiceImpl implements TenantService { @Autowired HashedDirectoryService hashedDirectoryService; @Autowired TenantRepository tenantRepository; @PostConstruct private void init() { checkTenants(); } @Override public void checkTenants() {
// Path: server/src/main/java/com/sastix/cms/server/domain/entities/Tenant.java // @Entity // @Table(name = "tenant") // @Getter @Setter @NoArgsConstructor // public class Tenant implements Serializable { // // private static final long serialVersionUID = -2275542617850965462L; // // @Id // @Column(name = "id") // @GeneratedValue(strategy = GenerationType.AUTO) // private Integer id; // // @Column(name = "tenantId") // private String tenantId; // // @Column(name = "volume") // private String volume; // // @Column(name = "checksum", columnDefinition = "Text") // private String checksum; // // } // // Path: server/src/main/java/com/sastix/cms/server/domain/repositories/TenantRepository.java // @Transactional // public interface TenantRepository extends CrudRepository<Tenant, Long> { // // Tenant findByTenantId(@Param("tenantId") String tenantId); // } // // Path: server/src/main/java/com/sastix/cms/server/services/content/HashedDirectoryService.java // public interface HashedDirectoryService { // // String storeFile(final String UURI, final String tenantID, final byte[] resourceBinary) throws IOException; // // String replaceFile(final String UURI, final String tenantID, final byte[] resourceBinary) throws IOException; // // String storeFile(final String UURI, final String tenantID, final URI resourceURI) throws IOException; // // String replaceFile(final String UURI, final String tenantID, final URI resourceURI) throws IOException; // // String storeFile(final String UURI, final String tenantID, final String resourceURI) throws IOException, URISyntaxException; // // String replaceFile(final String UURI, final String tenantID, final String resourceURI) throws IOException, URISyntaxException; // // Path getDataByUID(final String UID, final String tenantID) throws IOException; // // byte[] getBytesByUID(final String UID, final String tenantID) throws IOException; // // Path getDataByURI(final String resourceURI, final String tenantID) throws IOException, URISyntaxException; // // byte[] getBytesByURI(final String resourceURI, final String tenantID) throws IOException; // // long getFileSize(final String resourceURI, final String tenantID) throws IOException; // // String hashText(String text); // // String getAbsolutePath(String resourceURI, final String tenantID); // // String createTenantDirectory(final String tenantID) throws IOException; // // String getVolume(); // // void setVolume(String value); // // void storeChecksum(final String tenantID, final String checksum) throws IOException; // // String getChecksum(final String tenantID) throws IOException; // } // Path: server/src/main/java/com/sastix/cms/server/services/content/impl/TenantServiceImpl.java import com.sastix.cms.server.domain.entities.Tenant; import com.sastix.cms.server.domain.repositories.TenantRepository; import com.sastix.cms.server.services.content.HashedDirectoryService; import com.sastix.cms.server.services.content.TenantService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; import java.io.IOException; import java.util.UUID; /* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.content.impl; @Service public class TenantServiceImpl implements TenantService { @Autowired HashedDirectoryService hashedDirectoryService; @Autowired TenantRepository tenantRepository; @PostConstruct private void init() { checkTenants(); } @Override public void checkTenants() {
final Iterable<Tenant> tenants = tenantRepository.findAll();
sastix/cms
common/services/src/main/java/com/sastix/cms/common/services/api/ApiVersionServiceImpl.java
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/dataobjects/VersionDTO.java // @Getter @Setter @NoArgsConstructor // public class VersionDTO { // // /** // * Minimum version of API supported, initial should be "1.0". // */ // private double minVersion; // // /** // * Maximum version of API. // */ // private double maxVersion; // // private Map<String, String> versionContexts; // // public VersionDTO withMinVersion(double min) { // minVersion = min; // return this; // } // // public VersionDTO withMaxVersion(double max) { // maxVersion = max; // return this; // } // // public VersionDTO withVersionContext(double version, String contextPrefix) { // if (null == versionContexts) { // versionContexts = new HashMap<String,String>(); // } // versionContexts.put(Double.toString(version), contextPrefix); // return this; // } // // @Override // public String toString() { // StringBuilder builder = new StringBuilder(); // builder.append("VersionDTO [minVersion=").append(minVersion) // .append(", maxVersion=").append(maxVersion) // .append(", versionContexts=").append(versionContexts) // .append("]"); // return builder.toString(); // } // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // long temp; // temp = Double.doubleToLongBits(maxVersion); // result = prime * result + (int) (temp ^ (temp >>> 32)); // temp = Double.doubleToLongBits(minVersion); // result = prime * result + (int) (temp ^ (temp >>> 32)); // result = prime * result // + ((versionContexts == null) ? 0 : versionContexts.hashCode()); // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (!(obj instanceof VersionDTO)) // return false; // VersionDTO other = (VersionDTO) obj; // if (Double.doubleToLongBits(maxVersion) != Double // .doubleToLongBits(other.maxVersion)) // return false; // if (Double.doubleToLongBits(minVersion) != Double // .doubleToLongBits(other.minVersion)) // return false; // if (versionContexts == null) { // if (other.versionContexts != null) // return false; // } else if (!versionContexts.equals(other.versionContexts)) // return false; // return true; // } // // }
import com.sastix.cms.common.dataobjects.VersionDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service;
/* * Copyright(c) 2016 the original author or authors. * * Licensed 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 com.sastix.cms.common.services.api; @Service public class ApiVersionServiceImpl implements ApiVersionService { /** * this is the API version we support */
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/dataobjects/VersionDTO.java // @Getter @Setter @NoArgsConstructor // public class VersionDTO { // // /** // * Minimum version of API supported, initial should be "1.0". // */ // private double minVersion; // // /** // * Maximum version of API. // */ // private double maxVersion; // // private Map<String, String> versionContexts; // // public VersionDTO withMinVersion(double min) { // minVersion = min; // return this; // } // // public VersionDTO withMaxVersion(double max) { // maxVersion = max; // return this; // } // // public VersionDTO withVersionContext(double version, String contextPrefix) { // if (null == versionContexts) { // versionContexts = new HashMap<String,String>(); // } // versionContexts.put(Double.toString(version), contextPrefix); // return this; // } // // @Override // public String toString() { // StringBuilder builder = new StringBuilder(); // builder.append("VersionDTO [minVersion=").append(minVersion) // .append(", maxVersion=").append(maxVersion) // .append(", versionContexts=").append(versionContexts) // .append("]"); // return builder.toString(); // } // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // long temp; // temp = Double.doubleToLongBits(maxVersion); // result = prime * result + (int) (temp ^ (temp >>> 32)); // temp = Double.doubleToLongBits(minVersion); // result = prime * result + (int) (temp ^ (temp >>> 32)); // result = prime * result // + ((versionContexts == null) ? 0 : versionContexts.hashCode()); // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (!(obj instanceof VersionDTO)) // return false; // VersionDTO other = (VersionDTO) obj; // if (Double.doubleToLongBits(maxVersion) != Double // .doubleToLongBits(other.maxVersion)) // return false; // if (Double.doubleToLongBits(minVersion) != Double // .doubleToLongBits(other.minVersion)) // return false; // if (versionContexts == null) { // if (other.versionContexts != null) // return false; // } else if (!versionContexts.equals(other.versionContexts)) // return false; // return true; // } // // } // Path: common/services/src/main/java/com/sastix/cms/common/services/api/ApiVersionServiceImpl.java import com.sastix.cms.common.dataobjects.VersionDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; /* * Copyright(c) 2016 the original author or authors. * * Licensed 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 com.sastix.cms.common.services.api; @Service public class ApiVersionServiceImpl implements ApiVersionService { /** * this is the API version we support */
private VersionDTO version;
sastix/cms
common/services/src/main/java/com/sastix/cms/common/services/web/ExceptionHandlingController.java
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ResourceNotFound.java // @ResponseStatus(value = HttpStatus.NOT_FOUND, reason = Constants.RESOURCE_NOT_FOUND) // public class ResourceNotFound extends GeneralResourceException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 6032702930609853039L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ResourceNotFound(String message) { // super(message); // } // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/exception/CommonException.java // public class CommonException extends RestClientException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -7037833658038044223L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public CommonException(String message) { // super(message); // } // // /** // * Creates a {@code CommonException} with the specified // * detail message and cause. // * // * @param message the detail message // * @param cause the cause // */ // public CommonException(String message, Throwable cause) { // super(message, cause); // } // }
import com.sastix.cms.common.content.exceptions.ResourceNotFound; import com.sastix.cms.common.exception.CommonException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseStatus; import lombok.extern.slf4j.Slf4j; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException;
/* * Copyright(c) 2016 the original author or authors. * * Licensed 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 com.sastix.cms.common.services.web; @Slf4j @ControllerAdvice public class ExceptionHandlingController {
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ResourceNotFound.java // @ResponseStatus(value = HttpStatus.NOT_FOUND, reason = Constants.RESOURCE_NOT_FOUND) // public class ResourceNotFound extends GeneralResourceException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 6032702930609853039L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ResourceNotFound(String message) { // super(message); // } // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/exception/CommonException.java // public class CommonException extends RestClientException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -7037833658038044223L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public CommonException(String message) { // super(message); // } // // /** // * Creates a {@code CommonException} with the specified // * detail message and cause. // * // * @param message the detail message // * @param cause the cause // */ // public CommonException(String message, Throwable cause) { // super(message, cause); // } // } // Path: common/services/src/main/java/com/sastix/cms/common/services/web/ExceptionHandlingController.java import com.sastix.cms.common.content.exceptions.ResourceNotFound; import com.sastix.cms.common.exception.CommonException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseStatus; import lombok.extern.slf4j.Slf4j; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; /* * Copyright(c) 2016 the original author or authors. * * Licensed 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 com.sastix.cms.common.services.web; @Slf4j @ControllerAdvice public class ExceptionHandlingController {
@ExceptionHandler({CommonException.class})
sastix/cms
common/services/src/main/java/com/sastix/cms/common/services/web/ExceptionHandlingController.java
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ResourceNotFound.java // @ResponseStatus(value = HttpStatus.NOT_FOUND, reason = Constants.RESOURCE_NOT_FOUND) // public class ResourceNotFound extends GeneralResourceException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 6032702930609853039L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ResourceNotFound(String message) { // super(message); // } // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/exception/CommonException.java // public class CommonException extends RestClientException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -7037833658038044223L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public CommonException(String message) { // super(message); // } // // /** // * Creates a {@code CommonException} with the specified // * detail message and cause. // * // * @param message the detail message // * @param cause the cause // */ // public CommonException(String message, Throwable cause) { // super(message, cause); // } // }
import com.sastix.cms.common.content.exceptions.ResourceNotFound; import com.sastix.cms.common.exception.CommonException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseStatus; import lombok.extern.slf4j.Slf4j; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException;
/* * Copyright(c) 2016 the original author or authors. * * Licensed 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 com.sastix.cms.common.services.web; @Slf4j @ControllerAdvice public class ExceptionHandlingController { @ExceptionHandler({CommonException.class}) public void handleBadRequests(HttpServletRequest request, HttpServletResponse response, Exception e) throws IOException { log.error("Bad request: {} from {}, Exception: {} {}", request.getRequestURI(), request.getRemoteHost(), e.getStackTrace()[0].toString(), e.getLocalizedMessage()); response.sendError(HttpStatus.BAD_REQUEST.value(), e.getLocalizedMessage()); } @ResponseStatus(HttpStatus.NOT_FOUND) // 404
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ResourceNotFound.java // @ResponseStatus(value = HttpStatus.NOT_FOUND, reason = Constants.RESOURCE_NOT_FOUND) // public class ResourceNotFound extends GeneralResourceException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 6032702930609853039L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ResourceNotFound(String message) { // super(message); // } // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/exception/CommonException.java // public class CommonException extends RestClientException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -7037833658038044223L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public CommonException(String message) { // super(message); // } // // /** // * Creates a {@code CommonException} with the specified // * detail message and cause. // * // * @param message the detail message // * @param cause the cause // */ // public CommonException(String message, Throwable cause) { // super(message, cause); // } // } // Path: common/services/src/main/java/com/sastix/cms/common/services/web/ExceptionHandlingController.java import com.sastix.cms.common.content.exceptions.ResourceNotFound; import com.sastix.cms.common.exception.CommonException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseStatus; import lombok.extern.slf4j.Slf4j; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; /* * Copyright(c) 2016 the original author or authors. * * Licensed 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 com.sastix.cms.common.services.web; @Slf4j @ControllerAdvice public class ExceptionHandlingController { @ExceptionHandler({CommonException.class}) public void handleBadRequests(HttpServletRequest request, HttpServletResponse response, Exception e) throws IOException { log.error("Bad request: {} from {}, Exception: {} {}", request.getRequestURI(), request.getRemoteHost(), e.getStackTrace()[0].toString(), e.getLocalizedMessage()); response.sendError(HttpStatus.BAD_REQUEST.value(), e.getLocalizedMessage()); } @ResponseStatus(HttpStatus.NOT_FOUND) // 404
@ExceptionHandler(ResourceNotFound.class)
sastix/cms
common/services/src/main/java/com/sastix/cms/common/services/htmltopdf/PdfBuilder.java
// Path: common/services/src/main/java/com/sastix/cms/common/services/htmltopdf/config/HtmlToPdfConfig.java // @Slf4j // @Getter @Setter @AllArgsConstructor @NoArgsConstructor // public class HtmlToPdfConfig { // // private String wkhtmltopdfCommand; // // /** // * Attempts to find the `wkhtmltopdf` executable in the system path. // * // * @return // */ // public String findExecutable() { // String ret = null; // try { // String osname = System.getProperty("os.name").toLowerCase(); // // String cmd; // if (osname.contains("windows")) // cmd = "where wkhtmltopdf"; // else cmd = "which wkhtmltopdf"; // // Process p = Runtime.getRuntime().exec(cmd); // p.waitFor(); // // BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); // // StringBuilder sb = new StringBuilder(); // String line = ""; // while ((line = reader.readLine()) != null) { // sb.append(line); // } // // if (sb.toString().isEmpty()) // throw new RuntimeException(); // // ret = sb.toString(); // } catch (InterruptedException e) { // log.error("InterruptedException while trying to find wkhtmltopdf executable",e); // } catch (IOException e) { // log.error("IOException while trying to find wkhtmltopdf executable", e); // } catch (RuntimeException e) { // log.error("RuntimeException while trying to find wkhtmltopdf executable", e); // } // return ret; // } // }
import com.sastix.cms.common.services.htmltopdf.config.HtmlToPdfConfig; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service;
/* * Copyright(c) 2016 the original author or authors. * * Licensed 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 com.sastix.cms.common.services.htmltopdf; @Service public class PdfBuilder { @Autowired
// Path: common/services/src/main/java/com/sastix/cms/common/services/htmltopdf/config/HtmlToPdfConfig.java // @Slf4j // @Getter @Setter @AllArgsConstructor @NoArgsConstructor // public class HtmlToPdfConfig { // // private String wkhtmltopdfCommand; // // /** // * Attempts to find the `wkhtmltopdf` executable in the system path. // * // * @return // */ // public String findExecutable() { // String ret = null; // try { // String osname = System.getProperty("os.name").toLowerCase(); // // String cmd; // if (osname.contains("windows")) // cmd = "where wkhtmltopdf"; // else cmd = "which wkhtmltopdf"; // // Process p = Runtime.getRuntime().exec(cmd); // p.waitFor(); // // BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); // // StringBuilder sb = new StringBuilder(); // String line = ""; // while ((line = reader.readLine()) != null) { // sb.append(line); // } // // if (sb.toString().isEmpty()) // throw new RuntimeException(); // // ret = sb.toString(); // } catch (InterruptedException e) { // log.error("InterruptedException while trying to find wkhtmltopdf executable",e); // } catch (IOException e) { // log.error("IOException while trying to find wkhtmltopdf executable", e); // } catch (RuntimeException e) { // log.error("RuntimeException while trying to find wkhtmltopdf executable", e); // } // return ret; // } // } // Path: common/services/src/main/java/com/sastix/cms/common/services/htmltopdf/PdfBuilder.java import com.sastix.cms.common.services.htmltopdf.config.HtmlToPdfConfig; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /* * Copyright(c) 2016 the original author or authors. * * Licensed 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 com.sastix.cms.common.services.htmltopdf; @Service public class PdfBuilder { @Autowired
HtmlToPdfConfig htmlToPdfConfig;
sastix/cms
server/src/main/java/com/sastix/cms/server/services/lock/hazelcast/HazelcastLockService.java
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/LockDTO.java // @Getter @Setter @NoArgsConstructor @AllArgsConstructor // public class LockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -1244256114246115089L; // // /** // * The UID that has been now locked. // */ // private String UID; // // /** // * A Unique Lock ID that has been defined to hold this lock. // */ // private String lockID; // // /** // * The owner of this lock. // */ // private String lockOwner; // // /** // * The DateTime that this lock will expire. // */ // private DateTime lockExpiration; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/NewLockDTO.java // @Getter @Setter @NoArgsConstructor // public class NewLockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 8706080938884218602L; // // /** // * The Unique Identifier that the caller attempts to lock. // */ // private String UID; // // /** // * The owner of this lock. // */ // private String lockOwner; // // /** // * If provided, the expiration of the lock is set to this DateTime. // * </p> // * If not provided, the default lock expiration is set to T0+30m. Lock Expiration cannot be set to more than 8hrs. // */ // private DateTime lockExpiration; // // /** // * Constructor with Mandatory fields. // * // * @param UID a String with the UID // * @param lockOwner a String with owner of this lock // */ // public NewLockDTO(final String UID, final String lockOwner) { // this.UID = UID; // this.lockOwner = lockOwner; // lockExpiration = new DateTime().plusMinutes(30); // } // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/QueryLockDTO.java // @Getter @Setter @NoArgsConstructor @AllArgsConstructor // public class QueryLockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 3214527307576872325L; // // /** // * The Unique Identifier that the caller attempts to lock. // */ // @NotNull // private String UID; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/exceptions/LockNotAllowed.java // public class LockNotAllowed extends BusinessException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -8248743010140162906L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public LockNotAllowed(String message) { // super(message); // } // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/exceptions/LockValidationException.java // public class LockValidationException extends BusinessException { // // private static final long serialVersionUID = 1318419478939387138L; // // public LockValidationException(String message) { // super(message); // } // // public LockValidationException(String message, Throwable cause) { // super(message, cause); // } // } // // Path: server/src/main/java/com/sastix/cms/server/services/lock/LockService.java // public interface LockService extends LockApi{ // // Add any additional implementation // } // // Path: server/src/main/java/com/sastix/cms/server/services/lock/manager/DistributedLockManager.java // public interface DistributedLockManager { // /** // * Get map for locks for specific region. // * If map does not exist - creates new one based on config. // * // * @param region of a specific region. // * // * @return distributed locks map. // */ // <K, V> ConcurrentMap<K, V> getLockMap(final String region); // // /** // * Get specific id generator. // * // * @param value the specific context of id generator // * @return id generator. // */ // IdGenerator getIdGenerator(String value); // // }
import com.sastix.cms.common.lock.LockDTO; import com.sastix.cms.common.lock.NewLockDTO; import com.sastix.cms.common.lock.QueryLockDTO; import com.sastix.cms.common.lock.exceptions.LockNotAllowed; import com.sastix.cms.common.lock.exceptions.LockNotFound; import com.sastix.cms.common.lock.exceptions.LockNotHeld; import com.sastix.cms.common.lock.exceptions.LockValidationException; import com.sastix.cms.server.services.lock.LockService; import com.sastix.cms.server.services.lock.manager.DistributedLockManager; import org.joda.time.DateTime; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactoryAware; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Service; import lombok.extern.slf4j.Slf4j; import java.util.concurrent.ConcurrentMap;
/* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.lock.hazelcast; @Slf4j @Service @Profile("production")
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/LockDTO.java // @Getter @Setter @NoArgsConstructor @AllArgsConstructor // public class LockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -1244256114246115089L; // // /** // * The UID that has been now locked. // */ // private String UID; // // /** // * A Unique Lock ID that has been defined to hold this lock. // */ // private String lockID; // // /** // * The owner of this lock. // */ // private String lockOwner; // // /** // * The DateTime that this lock will expire. // */ // private DateTime lockExpiration; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/NewLockDTO.java // @Getter @Setter @NoArgsConstructor // public class NewLockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 8706080938884218602L; // // /** // * The Unique Identifier that the caller attempts to lock. // */ // private String UID; // // /** // * The owner of this lock. // */ // private String lockOwner; // // /** // * If provided, the expiration of the lock is set to this DateTime. // * </p> // * If not provided, the default lock expiration is set to T0+30m. Lock Expiration cannot be set to more than 8hrs. // */ // private DateTime lockExpiration; // // /** // * Constructor with Mandatory fields. // * // * @param UID a String with the UID // * @param lockOwner a String with owner of this lock // */ // public NewLockDTO(final String UID, final String lockOwner) { // this.UID = UID; // this.lockOwner = lockOwner; // lockExpiration = new DateTime().plusMinutes(30); // } // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/QueryLockDTO.java // @Getter @Setter @NoArgsConstructor @AllArgsConstructor // public class QueryLockDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 3214527307576872325L; // // /** // * The Unique Identifier that the caller attempts to lock. // */ // @NotNull // private String UID; // // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/exceptions/LockNotAllowed.java // public class LockNotAllowed extends BusinessException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -8248743010140162906L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public LockNotAllowed(String message) { // super(message); // } // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/lock/exceptions/LockValidationException.java // public class LockValidationException extends BusinessException { // // private static final long serialVersionUID = 1318419478939387138L; // // public LockValidationException(String message) { // super(message); // } // // public LockValidationException(String message, Throwable cause) { // super(message, cause); // } // } // // Path: server/src/main/java/com/sastix/cms/server/services/lock/LockService.java // public interface LockService extends LockApi{ // // Add any additional implementation // } // // Path: server/src/main/java/com/sastix/cms/server/services/lock/manager/DistributedLockManager.java // public interface DistributedLockManager { // /** // * Get map for locks for specific region. // * If map does not exist - creates new one based on config. // * // * @param region of a specific region. // * // * @return distributed locks map. // */ // <K, V> ConcurrentMap<K, V> getLockMap(final String region); // // /** // * Get specific id generator. // * // * @param value the specific context of id generator // * @return id generator. // */ // IdGenerator getIdGenerator(String value); // // } // Path: server/src/main/java/com/sastix/cms/server/services/lock/hazelcast/HazelcastLockService.java import com.sastix.cms.common.lock.LockDTO; import com.sastix.cms.common.lock.NewLockDTO; import com.sastix.cms.common.lock.QueryLockDTO; import com.sastix.cms.common.lock.exceptions.LockNotAllowed; import com.sastix.cms.common.lock.exceptions.LockNotFound; import com.sastix.cms.common.lock.exceptions.LockNotHeld; import com.sastix.cms.common.lock.exceptions.LockValidationException; import com.sastix.cms.server.services.lock.LockService; import com.sastix.cms.server.services.lock.manager.DistributedLockManager; import org.joda.time.DateTime; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactoryAware; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Service; import lombok.extern.slf4j.Slf4j; import java.util.concurrent.ConcurrentMap; /* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.lock.hazelcast; @Slf4j @Service @Profile("production")
public class HazelcastLockService implements LockService,BeanFactoryAware {
sastix/cms
common/client/src/main/java/com/sastix/cms/common/client/CmsRetryPolicy.java
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/exception/BusinessException.java // public class BusinessException extends CommonException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -4503174570809593447L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public BusinessException(String message) { // super(message); // } // // /** // * Creates a {@code BusinessException} with the specified // * detail message and cause. // * // * @param message the detail message // * @param cause the cause // */ // public BusinessException(String message, Throwable cause) { // super(message, cause); // } // }
import com.sastix.cms.common.exception.BusinessException; import org.springframework.classify.BinaryExceptionClassifier; import org.springframework.retry.RetryContext; import org.springframework.retry.policy.SimpleRetryPolicy; import java.util.Collections; import java.util.Map;
/* * Copyright(c) 2016 the original author or authors. * * Licensed 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 com.sastix.cms.common.client; public class CmsRetryPolicy extends SimpleRetryPolicy { private static final long serialVersionUID = 1L; private BinaryExceptionClassifier businessExceptionClassifier = new BinaryExceptionClassifier(false); public CmsRetryPolicy() { this(DEFAULT_MAX_ATTEMPTS, Collections .<Class<? extends Throwable>, Boolean>singletonMap(Exception.class, true)); } public CmsRetryPolicy(int maxAttempts, Map<Class<? extends Throwable>, Boolean> retryableExceptions) { this(maxAttempts, retryableExceptions, false); } public CmsRetryPolicy(int maxAttempts, Map<Class<? extends Throwable>, Boolean> retryableExceptions, boolean traverseCauses) { super(maxAttempts, retryableExceptions, traverseCauses); this.businessExceptionClassifier = new BinaryExceptionClassifier(Collections
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/exception/BusinessException.java // public class BusinessException extends CommonException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = -4503174570809593447L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public BusinessException(String message) { // super(message); // } // // /** // * Creates a {@code BusinessException} with the specified // * detail message and cause. // * // * @param message the detail message // * @param cause the cause // */ // public BusinessException(String message, Throwable cause) { // super(message, cause); // } // } // Path: common/client/src/main/java/com/sastix/cms/common/client/CmsRetryPolicy.java import com.sastix.cms.common.exception.BusinessException; import org.springframework.classify.BinaryExceptionClassifier; import org.springframework.retry.RetryContext; import org.springframework.retry.policy.SimpleRetryPolicy; import java.util.Collections; import java.util.Map; /* * Copyright(c) 2016 the original author or authors. * * Licensed 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 com.sastix.cms.common.client; public class CmsRetryPolicy extends SimpleRetryPolicy { private static final long serialVersionUID = 1L; private BinaryExceptionClassifier businessExceptionClassifier = new BinaryExceptionClassifier(false); public CmsRetryPolicy() { this(DEFAULT_MAX_ATTEMPTS, Collections .<Class<? extends Throwable>, Boolean>singletonMap(Exception.class, true)); } public CmsRetryPolicy(int maxAttempts, Map<Class<? extends Throwable>, Boolean> retryableExceptions) { this(maxAttempts, retryableExceptions, false); } public CmsRetryPolicy(int maxAttempts, Map<Class<? extends Throwable>, Boolean> retryableExceptions, boolean traverseCauses) { super(maxAttempts, retryableExceptions, traverseCauses); this.businessExceptionClassifier = new BinaryExceptionClassifier(Collections
.<Class<? extends Throwable>, Boolean>singletonMap(BusinessException.class, true));
sastix/cms
common/services/src/test/com/sastix/cms/common/services/htmltopdf/PdfTest.java
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/dataobjects/htmltopdf/Param.java // @Getter @Setter @AllArgsConstructor @ToString // public class Param { // // String key; // // String value; // // } // // Path: common/services/src/test/com/sastix/cms/common/services/htmltopdf/config/HtmlToPdfConfiguration.java // @Configuration // @ComponentScan({"com.sastix.cms.common.services.htmltopdf.config"}) // public class HtmlToPdfConfiguration { // @Value("/data/common/wkhtmltopdf/wkhtmltopdf") // private String wkhtmltopdf; // // @Bean // HtmlToPdfConfig htmlToPdfConfig(){ // return new HtmlToPdfConfig(wkhtmltopdf); // } // } // // Path: common/services/src/main/java/com/sastix/cms/common/services/htmltopdf/config/HtmlToPdfConfig.java // @Slf4j // @Getter @Setter @AllArgsConstructor @NoArgsConstructor // public class HtmlToPdfConfig { // // private String wkhtmltopdfCommand; // // /** // * Attempts to find the `wkhtmltopdf` executable in the system path. // * // * @return // */ // public String findExecutable() { // String ret = null; // try { // String osname = System.getProperty("os.name").toLowerCase(); // // String cmd; // if (osname.contains("windows")) // cmd = "where wkhtmltopdf"; // else cmd = "which wkhtmltopdf"; // // Process p = Runtime.getRuntime().exec(cmd); // p.waitFor(); // // BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); // // StringBuilder sb = new StringBuilder(); // String line = ""; // while ((line = reader.readLine()) != null) { // sb.append(line); // } // // if (sb.toString().isEmpty()) // throw new RuntimeException(); // // ret = sb.toString(); // } catch (InterruptedException e) { // log.error("InterruptedException while trying to find wkhtmltopdf executable",e); // } catch (IOException e) { // log.error("IOException while trying to find wkhtmltopdf executable", e); // } catch (RuntimeException e) { // log.error("RuntimeException while trying to find wkhtmltopdf executable", e); // } // return ret; // } // }
import com.sastix.cms.common.dataobjects.htmltopdf.Param; import com.sastix.cms.common.dataobjects.htmltopdf.page.PageType; import com.sastix.cms.common.services.htmltopdf.config.HtmlToPdfConfiguration; import com.sastix.cms.common.services.htmltopdf.config.HtmlToPdfConfig; import org.apache.pdfbox.io.RandomAccessBufferedFileInputStream; import org.apache.pdfbox.pdfparser.PDFParser; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.text.PDFTextStripper; import org.joda.time.DateTime; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import lombok.extern.slf4j.Slf4j; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.concurrent.*; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.greaterThan; import static org.junit.Assert.assertEquals;
/* * Copyright(c) 2016 the original author or authors. * * Licensed 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 com.sastix.cms.common.services.htmltopdf; @Slf4j @RunWith(SpringJUnit4ClassRunner.class)
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/dataobjects/htmltopdf/Param.java // @Getter @Setter @AllArgsConstructor @ToString // public class Param { // // String key; // // String value; // // } // // Path: common/services/src/test/com/sastix/cms/common/services/htmltopdf/config/HtmlToPdfConfiguration.java // @Configuration // @ComponentScan({"com.sastix.cms.common.services.htmltopdf.config"}) // public class HtmlToPdfConfiguration { // @Value("/data/common/wkhtmltopdf/wkhtmltopdf") // private String wkhtmltopdf; // // @Bean // HtmlToPdfConfig htmlToPdfConfig(){ // return new HtmlToPdfConfig(wkhtmltopdf); // } // } // // Path: common/services/src/main/java/com/sastix/cms/common/services/htmltopdf/config/HtmlToPdfConfig.java // @Slf4j // @Getter @Setter @AllArgsConstructor @NoArgsConstructor // public class HtmlToPdfConfig { // // private String wkhtmltopdfCommand; // // /** // * Attempts to find the `wkhtmltopdf` executable in the system path. // * // * @return // */ // public String findExecutable() { // String ret = null; // try { // String osname = System.getProperty("os.name").toLowerCase(); // // String cmd; // if (osname.contains("windows")) // cmd = "where wkhtmltopdf"; // else cmd = "which wkhtmltopdf"; // // Process p = Runtime.getRuntime().exec(cmd); // p.waitFor(); // // BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); // // StringBuilder sb = new StringBuilder(); // String line = ""; // while ((line = reader.readLine()) != null) { // sb.append(line); // } // // if (sb.toString().isEmpty()) // throw new RuntimeException(); // // ret = sb.toString(); // } catch (InterruptedException e) { // log.error("InterruptedException while trying to find wkhtmltopdf executable",e); // } catch (IOException e) { // log.error("IOException while trying to find wkhtmltopdf executable", e); // } catch (RuntimeException e) { // log.error("RuntimeException while trying to find wkhtmltopdf executable", e); // } // return ret; // } // } // Path: common/services/src/test/com/sastix/cms/common/services/htmltopdf/PdfTest.java import com.sastix.cms.common.dataobjects.htmltopdf.Param; import com.sastix.cms.common.dataobjects.htmltopdf.page.PageType; import com.sastix.cms.common.services.htmltopdf.config.HtmlToPdfConfiguration; import com.sastix.cms.common.services.htmltopdf.config.HtmlToPdfConfig; import org.apache.pdfbox.io.RandomAccessBufferedFileInputStream; import org.apache.pdfbox.pdfparser.PDFParser; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.text.PDFTextStripper; import org.joda.time.DateTime; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import lombok.extern.slf4j.Slf4j; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.concurrent.*; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.greaterThan; import static org.junit.Assert.assertEquals; /* * Copyright(c) 2016 the original author or authors. * * Licensed 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 com.sastix.cms.common.services.htmltopdf; @Slf4j @RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = {HtmlToPdfConfiguration.class,PdfBuilder.class})
sastix/cms
common/services/src/test/com/sastix/cms/common/services/htmltopdf/PdfTest.java
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/dataobjects/htmltopdf/Param.java // @Getter @Setter @AllArgsConstructor @ToString // public class Param { // // String key; // // String value; // // } // // Path: common/services/src/test/com/sastix/cms/common/services/htmltopdf/config/HtmlToPdfConfiguration.java // @Configuration // @ComponentScan({"com.sastix.cms.common.services.htmltopdf.config"}) // public class HtmlToPdfConfiguration { // @Value("/data/common/wkhtmltopdf/wkhtmltopdf") // private String wkhtmltopdf; // // @Bean // HtmlToPdfConfig htmlToPdfConfig(){ // return new HtmlToPdfConfig(wkhtmltopdf); // } // } // // Path: common/services/src/main/java/com/sastix/cms/common/services/htmltopdf/config/HtmlToPdfConfig.java // @Slf4j // @Getter @Setter @AllArgsConstructor @NoArgsConstructor // public class HtmlToPdfConfig { // // private String wkhtmltopdfCommand; // // /** // * Attempts to find the `wkhtmltopdf` executable in the system path. // * // * @return // */ // public String findExecutable() { // String ret = null; // try { // String osname = System.getProperty("os.name").toLowerCase(); // // String cmd; // if (osname.contains("windows")) // cmd = "where wkhtmltopdf"; // else cmd = "which wkhtmltopdf"; // // Process p = Runtime.getRuntime().exec(cmd); // p.waitFor(); // // BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); // // StringBuilder sb = new StringBuilder(); // String line = ""; // while ((line = reader.readLine()) != null) { // sb.append(line); // } // // if (sb.toString().isEmpty()) // throw new RuntimeException(); // // ret = sb.toString(); // } catch (InterruptedException e) { // log.error("InterruptedException while trying to find wkhtmltopdf executable",e); // } catch (IOException e) { // log.error("IOException while trying to find wkhtmltopdf executable", e); // } catch (RuntimeException e) { // log.error("RuntimeException while trying to find wkhtmltopdf executable", e); // } // return ret; // } // }
import com.sastix.cms.common.dataobjects.htmltopdf.Param; import com.sastix.cms.common.dataobjects.htmltopdf.page.PageType; import com.sastix.cms.common.services.htmltopdf.config.HtmlToPdfConfiguration; import com.sastix.cms.common.services.htmltopdf.config.HtmlToPdfConfig; import org.apache.pdfbox.io.RandomAccessBufferedFileInputStream; import org.apache.pdfbox.pdfparser.PDFParser; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.text.PDFTextStripper; import org.joda.time.DateTime; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import lombok.extern.slf4j.Slf4j; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.concurrent.*; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.greaterThan; import static org.junit.Assert.assertEquals;
/* * Copyright(c) 2016 the original author or authors. * * Licensed 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 com.sastix.cms.common.services.htmltopdf; @Slf4j @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = {HtmlToPdfConfiguration.class,PdfBuilder.class}) public class PdfTest { @Autowired PdfBuilder pdfBuilder; @Autowired
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/dataobjects/htmltopdf/Param.java // @Getter @Setter @AllArgsConstructor @ToString // public class Param { // // String key; // // String value; // // } // // Path: common/services/src/test/com/sastix/cms/common/services/htmltopdf/config/HtmlToPdfConfiguration.java // @Configuration // @ComponentScan({"com.sastix.cms.common.services.htmltopdf.config"}) // public class HtmlToPdfConfiguration { // @Value("/data/common/wkhtmltopdf/wkhtmltopdf") // private String wkhtmltopdf; // // @Bean // HtmlToPdfConfig htmlToPdfConfig(){ // return new HtmlToPdfConfig(wkhtmltopdf); // } // } // // Path: common/services/src/main/java/com/sastix/cms/common/services/htmltopdf/config/HtmlToPdfConfig.java // @Slf4j // @Getter @Setter @AllArgsConstructor @NoArgsConstructor // public class HtmlToPdfConfig { // // private String wkhtmltopdfCommand; // // /** // * Attempts to find the `wkhtmltopdf` executable in the system path. // * // * @return // */ // public String findExecutable() { // String ret = null; // try { // String osname = System.getProperty("os.name").toLowerCase(); // // String cmd; // if (osname.contains("windows")) // cmd = "where wkhtmltopdf"; // else cmd = "which wkhtmltopdf"; // // Process p = Runtime.getRuntime().exec(cmd); // p.waitFor(); // // BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); // // StringBuilder sb = new StringBuilder(); // String line = ""; // while ((line = reader.readLine()) != null) { // sb.append(line); // } // // if (sb.toString().isEmpty()) // throw new RuntimeException(); // // ret = sb.toString(); // } catch (InterruptedException e) { // log.error("InterruptedException while trying to find wkhtmltopdf executable",e); // } catch (IOException e) { // log.error("IOException while trying to find wkhtmltopdf executable", e); // } catch (RuntimeException e) { // log.error("RuntimeException while trying to find wkhtmltopdf executable", e); // } // return ret; // } // } // Path: common/services/src/test/com/sastix/cms/common/services/htmltopdf/PdfTest.java import com.sastix.cms.common.dataobjects.htmltopdf.Param; import com.sastix.cms.common.dataobjects.htmltopdf.page.PageType; import com.sastix.cms.common.services.htmltopdf.config.HtmlToPdfConfiguration; import com.sastix.cms.common.services.htmltopdf.config.HtmlToPdfConfig; import org.apache.pdfbox.io.RandomAccessBufferedFileInputStream; import org.apache.pdfbox.pdfparser.PDFParser; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.text.PDFTextStripper; import org.joda.time.DateTime; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import lombok.extern.slf4j.Slf4j; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.concurrent.*; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.greaterThan; import static org.junit.Assert.assertEquals; /* * Copyright(c) 2016 the original author or authors. * * Licensed 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 com.sastix.cms.common.services.htmltopdf; @Slf4j @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = {HtmlToPdfConfiguration.class,PdfBuilder.class}) public class PdfTest { @Autowired PdfBuilder pdfBuilder; @Autowired
HtmlToPdfConfig htmlToPdfConfig;
sastix/cms
common/services/src/test/com/sastix/cms/common/services/htmltopdf/PdfTest.java
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/dataobjects/htmltopdf/Param.java // @Getter @Setter @AllArgsConstructor @ToString // public class Param { // // String key; // // String value; // // } // // Path: common/services/src/test/com/sastix/cms/common/services/htmltopdf/config/HtmlToPdfConfiguration.java // @Configuration // @ComponentScan({"com.sastix.cms.common.services.htmltopdf.config"}) // public class HtmlToPdfConfiguration { // @Value("/data/common/wkhtmltopdf/wkhtmltopdf") // private String wkhtmltopdf; // // @Bean // HtmlToPdfConfig htmlToPdfConfig(){ // return new HtmlToPdfConfig(wkhtmltopdf); // } // } // // Path: common/services/src/main/java/com/sastix/cms/common/services/htmltopdf/config/HtmlToPdfConfig.java // @Slf4j // @Getter @Setter @AllArgsConstructor @NoArgsConstructor // public class HtmlToPdfConfig { // // private String wkhtmltopdfCommand; // // /** // * Attempts to find the `wkhtmltopdf` executable in the system path. // * // * @return // */ // public String findExecutable() { // String ret = null; // try { // String osname = System.getProperty("os.name").toLowerCase(); // // String cmd; // if (osname.contains("windows")) // cmd = "where wkhtmltopdf"; // else cmd = "which wkhtmltopdf"; // // Process p = Runtime.getRuntime().exec(cmd); // p.waitFor(); // // BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); // // StringBuilder sb = new StringBuilder(); // String line = ""; // while ((line = reader.readLine()) != null) { // sb.append(line); // } // // if (sb.toString().isEmpty()) // throw new RuntimeException(); // // ret = sb.toString(); // } catch (InterruptedException e) { // log.error("InterruptedException while trying to find wkhtmltopdf executable",e); // } catch (IOException e) { // log.error("IOException while trying to find wkhtmltopdf executable", e); // } catch (RuntimeException e) { // log.error("RuntimeException while trying to find wkhtmltopdf executable", e); // } // return ret; // } // }
import com.sastix.cms.common.dataobjects.htmltopdf.Param; import com.sastix.cms.common.dataobjects.htmltopdf.page.PageType; import com.sastix.cms.common.services.htmltopdf.config.HtmlToPdfConfiguration; import com.sastix.cms.common.services.htmltopdf.config.HtmlToPdfConfig; import org.apache.pdfbox.io.RandomAccessBufferedFileInputStream; import org.apache.pdfbox.pdfparser.PDFParser; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.text.PDFTextStripper; import org.joda.time.DateTime; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import lombok.extern.slf4j.Slf4j; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.concurrent.*; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.greaterThan; import static org.junit.Assert.assertEquals;
/* * Copyright(c) 2016 the original author or authors. * * Licensed 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 com.sastix.cms.common.services.htmltopdf; @Slf4j @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = {HtmlToPdfConfiguration.class,PdfBuilder.class}) public class PdfTest { @Autowired PdfBuilder pdfBuilder; @Autowired HtmlToPdfConfig htmlToPdfConfig; @Rule public TemporaryFolder temporaryFolder = new TemporaryFolder(); @Test public void testCommand() throws Exception { Pdf pdf = pdfBuilder.build(); pdf.addToc();
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/dataobjects/htmltopdf/Param.java // @Getter @Setter @AllArgsConstructor @ToString // public class Param { // // String key; // // String value; // // } // // Path: common/services/src/test/com/sastix/cms/common/services/htmltopdf/config/HtmlToPdfConfiguration.java // @Configuration // @ComponentScan({"com.sastix.cms.common.services.htmltopdf.config"}) // public class HtmlToPdfConfiguration { // @Value("/data/common/wkhtmltopdf/wkhtmltopdf") // private String wkhtmltopdf; // // @Bean // HtmlToPdfConfig htmlToPdfConfig(){ // return new HtmlToPdfConfig(wkhtmltopdf); // } // } // // Path: common/services/src/main/java/com/sastix/cms/common/services/htmltopdf/config/HtmlToPdfConfig.java // @Slf4j // @Getter @Setter @AllArgsConstructor @NoArgsConstructor // public class HtmlToPdfConfig { // // private String wkhtmltopdfCommand; // // /** // * Attempts to find the `wkhtmltopdf` executable in the system path. // * // * @return // */ // public String findExecutable() { // String ret = null; // try { // String osname = System.getProperty("os.name").toLowerCase(); // // String cmd; // if (osname.contains("windows")) // cmd = "where wkhtmltopdf"; // else cmd = "which wkhtmltopdf"; // // Process p = Runtime.getRuntime().exec(cmd); // p.waitFor(); // // BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); // // StringBuilder sb = new StringBuilder(); // String line = ""; // while ((line = reader.readLine()) != null) { // sb.append(line); // } // // if (sb.toString().isEmpty()) // throw new RuntimeException(); // // ret = sb.toString(); // } catch (InterruptedException e) { // log.error("InterruptedException while trying to find wkhtmltopdf executable",e); // } catch (IOException e) { // log.error("IOException while trying to find wkhtmltopdf executable", e); // } catch (RuntimeException e) { // log.error("RuntimeException while trying to find wkhtmltopdf executable", e); // } // return ret; // } // } // Path: common/services/src/test/com/sastix/cms/common/services/htmltopdf/PdfTest.java import com.sastix.cms.common.dataobjects.htmltopdf.Param; import com.sastix.cms.common.dataobjects.htmltopdf.page.PageType; import com.sastix.cms.common.services.htmltopdf.config.HtmlToPdfConfiguration; import com.sastix.cms.common.services.htmltopdf.config.HtmlToPdfConfig; import org.apache.pdfbox.io.RandomAccessBufferedFileInputStream; import org.apache.pdfbox.pdfparser.PDFParser; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.text.PDFTextStripper; import org.joda.time.DateTime; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import lombok.extern.slf4j.Slf4j; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.concurrent.*; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.greaterThan; import static org.junit.Assert.assertEquals; /* * Copyright(c) 2016 the original author or authors. * * Licensed 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 com.sastix.cms.common.services.htmltopdf; @Slf4j @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = {HtmlToPdfConfiguration.class,PdfBuilder.class}) public class PdfTest { @Autowired PdfBuilder pdfBuilder; @Autowired HtmlToPdfConfig htmlToPdfConfig; @Rule public TemporaryFolder temporaryFolder = new TemporaryFolder(); @Test public void testCommand() throws Exception { Pdf pdf = pdfBuilder.build(); pdf.addToc();
pdf.addParam(new Param("--enable-javascript"), new Param("--html-header", "file:///example.html"));
sastix/cms
server/src/main/java/com/sastix/cms/server/services/content/impl/ZipFileHandlerServiceImpl.java
// Path: server/src/main/java/com/sastix/cms/server/dataobjects/DataMaps.java // @Getter @Setter // public class DataMaps { // Map<String, byte[]> bytesMap; // Map<String, byte[]> modifiedBytesMap; // Map<String, String> foldersMap = new HashMap<>(); // Map<String, String> uidMap = new HashMap<>(); // Map<String, String> uidPathMap = new HashMap<>(); // // public Map<String, String> getUriMap() { // return uidMap; // } // // } // // Path: server/src/main/java/com/sastix/cms/server/services/content/GeneralFileHandlerService.java // public interface GeneralFileHandlerService { // /** // * Find the charset from a stream // * // * @param is // * @return charset // * */ // Charset guessCharset(InputStream is) throws IOException; // // /** // * Get the media type format from bytes // * // * @param bytes // * @return a string representation of mediaType format // * */ // String getMediaType(byte[] bytes) throws IOException; // // /** // * Find the parent file from the metadata xml provided in the unit resource // * // * @param xml string content // * @return the filename of the parent // * */ // String findParentFile(String xml); // // /** // * Replace all relative paths used in web files (html, htm, js, css) // * with resource UID urls // * // * */ // void replaceRelativePathsInWebFiles(File file, Map<String, String> paths); // } // // Path: server/src/main/java/com/sastix/cms/server/services/content/ZipFileHandlerService.java // public interface ZipFileHandlerService { // // // /** // * Get the zip file in byte array and unzip it // * // * @param bytes // * @return a DataMaps with the extracted resources (bytes, filenames, folders) // * */ // DataMaps unzip(byte[] bytes) throws IOException; // // /** // * Check if a byte array is a zip file // * */ // boolean isZipFile(byte[] bytes) throws IOException; // // /** // * Check if the extracted files from byte array include a scorm type // * */ // boolean isScormType(Map<String, byte[]> bytesMap); // // /** // * Check if the extracted files from byte array include info.json file with a startpage attribute. // * If present, the specified zip is a cms resource. // * // * a sample of info.json could be: // * { // * "content_uid":"12345qwerty", // * "thumbnailphoto_uid":"54321ytrewq", // * "startpage":"start.html", // * "totalpages":"1" // * } // * */ // String getResourceStartPage(Map<String, byte[]> bytesMap); // // /** // * Find the parent resource from metadata // * */ // String findParentResource(Map<String, byte[]> bytesMap); // // /** // * Replace relative paths in web files with paths from CMS // * */ // // @Deprecated // DataMaps replaceRelativePaths(DataMaps dataMaps) throws IOException; // }
import java.io.*; import java.nio.ByteBuffer; import java.util.HashMap; import java.util.Map; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import com.sastix.cms.server.dataobjects.DataMaps; import com.sastix.cms.server.services.content.GeneralFileHandlerService; import com.sastix.cms.server.services.content.ZipFileHandlerService; import org.apache.tika.Tika; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.parser.Parser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.json.GsonJsonParser; import org.springframework.stereotype.Service; import lombok.extern.slf4j.Slf4j;
/* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.content.impl; @Slf4j @Service
// Path: server/src/main/java/com/sastix/cms/server/dataobjects/DataMaps.java // @Getter @Setter // public class DataMaps { // Map<String, byte[]> bytesMap; // Map<String, byte[]> modifiedBytesMap; // Map<String, String> foldersMap = new HashMap<>(); // Map<String, String> uidMap = new HashMap<>(); // Map<String, String> uidPathMap = new HashMap<>(); // // public Map<String, String> getUriMap() { // return uidMap; // } // // } // // Path: server/src/main/java/com/sastix/cms/server/services/content/GeneralFileHandlerService.java // public interface GeneralFileHandlerService { // /** // * Find the charset from a stream // * // * @param is // * @return charset // * */ // Charset guessCharset(InputStream is) throws IOException; // // /** // * Get the media type format from bytes // * // * @param bytes // * @return a string representation of mediaType format // * */ // String getMediaType(byte[] bytes) throws IOException; // // /** // * Find the parent file from the metadata xml provided in the unit resource // * // * @param xml string content // * @return the filename of the parent // * */ // String findParentFile(String xml); // // /** // * Replace all relative paths used in web files (html, htm, js, css) // * with resource UID urls // * // * */ // void replaceRelativePathsInWebFiles(File file, Map<String, String> paths); // } // // Path: server/src/main/java/com/sastix/cms/server/services/content/ZipFileHandlerService.java // public interface ZipFileHandlerService { // // // /** // * Get the zip file in byte array and unzip it // * // * @param bytes // * @return a DataMaps with the extracted resources (bytes, filenames, folders) // * */ // DataMaps unzip(byte[] bytes) throws IOException; // // /** // * Check if a byte array is a zip file // * */ // boolean isZipFile(byte[] bytes) throws IOException; // // /** // * Check if the extracted files from byte array include a scorm type // * */ // boolean isScormType(Map<String, byte[]> bytesMap); // // /** // * Check if the extracted files from byte array include info.json file with a startpage attribute. // * If present, the specified zip is a cms resource. // * // * a sample of info.json could be: // * { // * "content_uid":"12345qwerty", // * "thumbnailphoto_uid":"54321ytrewq", // * "startpage":"start.html", // * "totalpages":"1" // * } // * */ // String getResourceStartPage(Map<String, byte[]> bytesMap); // // /** // * Find the parent resource from metadata // * */ // String findParentResource(Map<String, byte[]> bytesMap); // // /** // * Replace relative paths in web files with paths from CMS // * */ // // @Deprecated // DataMaps replaceRelativePaths(DataMaps dataMaps) throws IOException; // } // Path: server/src/main/java/com/sastix/cms/server/services/content/impl/ZipFileHandlerServiceImpl.java import java.io.*; import java.nio.ByteBuffer; import java.util.HashMap; import java.util.Map; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import com.sastix.cms.server.dataobjects.DataMaps; import com.sastix.cms.server.services.content.GeneralFileHandlerService; import com.sastix.cms.server.services.content.ZipFileHandlerService; import org.apache.tika.Tika; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.parser.Parser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.json.GsonJsonParser; import org.springframework.stereotype.Service; import lombok.extern.slf4j.Slf4j; /* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.content.impl; @Slf4j @Service
public class ZipFileHandlerServiceImpl implements ZipFileHandlerService {
sastix/cms
server/src/main/java/com/sastix/cms/server/services/content/impl/ZipFileHandlerServiceImpl.java
// Path: server/src/main/java/com/sastix/cms/server/dataobjects/DataMaps.java // @Getter @Setter // public class DataMaps { // Map<String, byte[]> bytesMap; // Map<String, byte[]> modifiedBytesMap; // Map<String, String> foldersMap = new HashMap<>(); // Map<String, String> uidMap = new HashMap<>(); // Map<String, String> uidPathMap = new HashMap<>(); // // public Map<String, String> getUriMap() { // return uidMap; // } // // } // // Path: server/src/main/java/com/sastix/cms/server/services/content/GeneralFileHandlerService.java // public interface GeneralFileHandlerService { // /** // * Find the charset from a stream // * // * @param is // * @return charset // * */ // Charset guessCharset(InputStream is) throws IOException; // // /** // * Get the media type format from bytes // * // * @param bytes // * @return a string representation of mediaType format // * */ // String getMediaType(byte[] bytes) throws IOException; // // /** // * Find the parent file from the metadata xml provided in the unit resource // * // * @param xml string content // * @return the filename of the parent // * */ // String findParentFile(String xml); // // /** // * Replace all relative paths used in web files (html, htm, js, css) // * with resource UID urls // * // * */ // void replaceRelativePathsInWebFiles(File file, Map<String, String> paths); // } // // Path: server/src/main/java/com/sastix/cms/server/services/content/ZipFileHandlerService.java // public interface ZipFileHandlerService { // // // /** // * Get the zip file in byte array and unzip it // * // * @param bytes // * @return a DataMaps with the extracted resources (bytes, filenames, folders) // * */ // DataMaps unzip(byte[] bytes) throws IOException; // // /** // * Check if a byte array is a zip file // * */ // boolean isZipFile(byte[] bytes) throws IOException; // // /** // * Check if the extracted files from byte array include a scorm type // * */ // boolean isScormType(Map<String, byte[]> bytesMap); // // /** // * Check if the extracted files from byte array include info.json file with a startpage attribute. // * If present, the specified zip is a cms resource. // * // * a sample of info.json could be: // * { // * "content_uid":"12345qwerty", // * "thumbnailphoto_uid":"54321ytrewq", // * "startpage":"start.html", // * "totalpages":"1" // * } // * */ // String getResourceStartPage(Map<String, byte[]> bytesMap); // // /** // * Find the parent resource from metadata // * */ // String findParentResource(Map<String, byte[]> bytesMap); // // /** // * Replace relative paths in web files with paths from CMS // * */ // // @Deprecated // DataMaps replaceRelativePaths(DataMaps dataMaps) throws IOException; // }
import java.io.*; import java.nio.ByteBuffer; import java.util.HashMap; import java.util.Map; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import com.sastix.cms.server.dataobjects.DataMaps; import com.sastix.cms.server.services.content.GeneralFileHandlerService; import com.sastix.cms.server.services.content.ZipFileHandlerService; import org.apache.tika.Tika; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.parser.Parser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.json.GsonJsonParser; import org.springframework.stereotype.Service; import lombok.extern.slf4j.Slf4j;
/* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.content.impl; @Slf4j @Service public class ZipFileHandlerServiceImpl implements ZipFileHandlerService { String acceptedExtensions = "html, htm, js, css"; private final Tika tika = new Tika(); GsonJsonParser gsonJsonParser = new GsonJsonParser(); public static final String METADATA_XML_FILE = "imsmanifest.xml"; public static final String METADATA_JSON_FILE = "info.json"; public static final String METADATA_STARTPAGE = "startpage"; public static final String METADATA_STARTPAGE_CAMEL = "startPage"; @Autowired
// Path: server/src/main/java/com/sastix/cms/server/dataobjects/DataMaps.java // @Getter @Setter // public class DataMaps { // Map<String, byte[]> bytesMap; // Map<String, byte[]> modifiedBytesMap; // Map<String, String> foldersMap = new HashMap<>(); // Map<String, String> uidMap = new HashMap<>(); // Map<String, String> uidPathMap = new HashMap<>(); // // public Map<String, String> getUriMap() { // return uidMap; // } // // } // // Path: server/src/main/java/com/sastix/cms/server/services/content/GeneralFileHandlerService.java // public interface GeneralFileHandlerService { // /** // * Find the charset from a stream // * // * @param is // * @return charset // * */ // Charset guessCharset(InputStream is) throws IOException; // // /** // * Get the media type format from bytes // * // * @param bytes // * @return a string representation of mediaType format // * */ // String getMediaType(byte[] bytes) throws IOException; // // /** // * Find the parent file from the metadata xml provided in the unit resource // * // * @param xml string content // * @return the filename of the parent // * */ // String findParentFile(String xml); // // /** // * Replace all relative paths used in web files (html, htm, js, css) // * with resource UID urls // * // * */ // void replaceRelativePathsInWebFiles(File file, Map<String, String> paths); // } // // Path: server/src/main/java/com/sastix/cms/server/services/content/ZipFileHandlerService.java // public interface ZipFileHandlerService { // // // /** // * Get the zip file in byte array and unzip it // * // * @param bytes // * @return a DataMaps with the extracted resources (bytes, filenames, folders) // * */ // DataMaps unzip(byte[] bytes) throws IOException; // // /** // * Check if a byte array is a zip file // * */ // boolean isZipFile(byte[] bytes) throws IOException; // // /** // * Check if the extracted files from byte array include a scorm type // * */ // boolean isScormType(Map<String, byte[]> bytesMap); // // /** // * Check if the extracted files from byte array include info.json file with a startpage attribute. // * If present, the specified zip is a cms resource. // * // * a sample of info.json could be: // * { // * "content_uid":"12345qwerty", // * "thumbnailphoto_uid":"54321ytrewq", // * "startpage":"start.html", // * "totalpages":"1" // * } // * */ // String getResourceStartPage(Map<String, byte[]> bytesMap); // // /** // * Find the parent resource from metadata // * */ // String findParentResource(Map<String, byte[]> bytesMap); // // /** // * Replace relative paths in web files with paths from CMS // * */ // // @Deprecated // DataMaps replaceRelativePaths(DataMaps dataMaps) throws IOException; // } // Path: server/src/main/java/com/sastix/cms/server/services/content/impl/ZipFileHandlerServiceImpl.java import java.io.*; import java.nio.ByteBuffer; import java.util.HashMap; import java.util.Map; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import com.sastix.cms.server.dataobjects.DataMaps; import com.sastix.cms.server.services.content.GeneralFileHandlerService; import com.sastix.cms.server.services.content.ZipFileHandlerService; import org.apache.tika.Tika; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.parser.Parser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.json.GsonJsonParser; import org.springframework.stereotype.Service; import lombok.extern.slf4j.Slf4j; /* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.content.impl; @Slf4j @Service public class ZipFileHandlerServiceImpl implements ZipFileHandlerService { String acceptedExtensions = "html, htm, js, css"; private final Tika tika = new Tika(); GsonJsonParser gsonJsonParser = new GsonJsonParser(); public static final String METADATA_XML_FILE = "imsmanifest.xml"; public static final String METADATA_JSON_FILE = "info.json"; public static final String METADATA_STARTPAGE = "startpage"; public static final String METADATA_STARTPAGE_CAMEL = "startPage"; @Autowired
GeneralFileHandlerService generalFileHandlerService;
sastix/cms
server/src/main/java/com/sastix/cms/server/services/content/impl/ZipFileHandlerServiceImpl.java
// Path: server/src/main/java/com/sastix/cms/server/dataobjects/DataMaps.java // @Getter @Setter // public class DataMaps { // Map<String, byte[]> bytesMap; // Map<String, byte[]> modifiedBytesMap; // Map<String, String> foldersMap = new HashMap<>(); // Map<String, String> uidMap = new HashMap<>(); // Map<String, String> uidPathMap = new HashMap<>(); // // public Map<String, String> getUriMap() { // return uidMap; // } // // } // // Path: server/src/main/java/com/sastix/cms/server/services/content/GeneralFileHandlerService.java // public interface GeneralFileHandlerService { // /** // * Find the charset from a stream // * // * @param is // * @return charset // * */ // Charset guessCharset(InputStream is) throws IOException; // // /** // * Get the media type format from bytes // * // * @param bytes // * @return a string representation of mediaType format // * */ // String getMediaType(byte[] bytes) throws IOException; // // /** // * Find the parent file from the metadata xml provided in the unit resource // * // * @param xml string content // * @return the filename of the parent // * */ // String findParentFile(String xml); // // /** // * Replace all relative paths used in web files (html, htm, js, css) // * with resource UID urls // * // * */ // void replaceRelativePathsInWebFiles(File file, Map<String, String> paths); // } // // Path: server/src/main/java/com/sastix/cms/server/services/content/ZipFileHandlerService.java // public interface ZipFileHandlerService { // // // /** // * Get the zip file in byte array and unzip it // * // * @param bytes // * @return a DataMaps with the extracted resources (bytes, filenames, folders) // * */ // DataMaps unzip(byte[] bytes) throws IOException; // // /** // * Check if a byte array is a zip file // * */ // boolean isZipFile(byte[] bytes) throws IOException; // // /** // * Check if the extracted files from byte array include a scorm type // * */ // boolean isScormType(Map<String, byte[]> bytesMap); // // /** // * Check if the extracted files from byte array include info.json file with a startpage attribute. // * If present, the specified zip is a cms resource. // * // * a sample of info.json could be: // * { // * "content_uid":"12345qwerty", // * "thumbnailphoto_uid":"54321ytrewq", // * "startpage":"start.html", // * "totalpages":"1" // * } // * */ // String getResourceStartPage(Map<String, byte[]> bytesMap); // // /** // * Find the parent resource from metadata // * */ // String findParentResource(Map<String, byte[]> bytesMap); // // /** // * Replace relative paths in web files with paths from CMS // * */ // // @Deprecated // DataMaps replaceRelativePaths(DataMaps dataMaps) throws IOException; // }
import java.io.*; import java.nio.ByteBuffer; import java.util.HashMap; import java.util.Map; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import com.sastix.cms.server.dataobjects.DataMaps; import com.sastix.cms.server.services.content.GeneralFileHandlerService; import com.sastix.cms.server.services.content.ZipFileHandlerService; import org.apache.tika.Tika; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.parser.Parser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.json.GsonJsonParser; import org.springframework.stereotype.Service; import lombok.extern.slf4j.Slf4j;
/* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.content.impl; @Slf4j @Service public class ZipFileHandlerServiceImpl implements ZipFileHandlerService { String acceptedExtensions = "html, htm, js, css"; private final Tika tika = new Tika(); GsonJsonParser gsonJsonParser = new GsonJsonParser(); public static final String METADATA_XML_FILE = "imsmanifest.xml"; public static final String METADATA_JSON_FILE = "info.json"; public static final String METADATA_STARTPAGE = "startpage"; public static final String METADATA_STARTPAGE_CAMEL = "startPage"; @Autowired GeneralFileHandlerService generalFileHandlerService; @Override
// Path: server/src/main/java/com/sastix/cms/server/dataobjects/DataMaps.java // @Getter @Setter // public class DataMaps { // Map<String, byte[]> bytesMap; // Map<String, byte[]> modifiedBytesMap; // Map<String, String> foldersMap = new HashMap<>(); // Map<String, String> uidMap = new HashMap<>(); // Map<String, String> uidPathMap = new HashMap<>(); // // public Map<String, String> getUriMap() { // return uidMap; // } // // } // // Path: server/src/main/java/com/sastix/cms/server/services/content/GeneralFileHandlerService.java // public interface GeneralFileHandlerService { // /** // * Find the charset from a stream // * // * @param is // * @return charset // * */ // Charset guessCharset(InputStream is) throws IOException; // // /** // * Get the media type format from bytes // * // * @param bytes // * @return a string representation of mediaType format // * */ // String getMediaType(byte[] bytes) throws IOException; // // /** // * Find the parent file from the metadata xml provided in the unit resource // * // * @param xml string content // * @return the filename of the parent // * */ // String findParentFile(String xml); // // /** // * Replace all relative paths used in web files (html, htm, js, css) // * with resource UID urls // * // * */ // void replaceRelativePathsInWebFiles(File file, Map<String, String> paths); // } // // Path: server/src/main/java/com/sastix/cms/server/services/content/ZipFileHandlerService.java // public interface ZipFileHandlerService { // // // /** // * Get the zip file in byte array and unzip it // * // * @param bytes // * @return a DataMaps with the extracted resources (bytes, filenames, folders) // * */ // DataMaps unzip(byte[] bytes) throws IOException; // // /** // * Check if a byte array is a zip file // * */ // boolean isZipFile(byte[] bytes) throws IOException; // // /** // * Check if the extracted files from byte array include a scorm type // * */ // boolean isScormType(Map<String, byte[]> bytesMap); // // /** // * Check if the extracted files from byte array include info.json file with a startpage attribute. // * If present, the specified zip is a cms resource. // * // * a sample of info.json could be: // * { // * "content_uid":"12345qwerty", // * "thumbnailphoto_uid":"54321ytrewq", // * "startpage":"start.html", // * "totalpages":"1" // * } // * */ // String getResourceStartPage(Map<String, byte[]> bytesMap); // // /** // * Find the parent resource from metadata // * */ // String findParentResource(Map<String, byte[]> bytesMap); // // /** // * Replace relative paths in web files with paths from CMS // * */ // // @Deprecated // DataMaps replaceRelativePaths(DataMaps dataMaps) throws IOException; // } // Path: server/src/main/java/com/sastix/cms/server/services/content/impl/ZipFileHandlerServiceImpl.java import java.io.*; import java.nio.ByteBuffer; import java.util.HashMap; import java.util.Map; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import com.sastix.cms.server.dataobjects.DataMaps; import com.sastix.cms.server.services.content.GeneralFileHandlerService; import com.sastix.cms.server.services.content.ZipFileHandlerService; import org.apache.tika.Tika; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.parser.Parser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.json.GsonJsonParser; import org.springframework.stereotype.Service; import lombok.extern.slf4j.Slf4j; /* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.content.impl; @Slf4j @Service public class ZipFileHandlerServiceImpl implements ZipFileHandlerService { String acceptedExtensions = "html, htm, js, css"; private final Tika tika = new Tika(); GsonJsonParser gsonJsonParser = new GsonJsonParser(); public static final String METADATA_XML_FILE = "imsmanifest.xml"; public static final String METADATA_JSON_FILE = "info.json"; public static final String METADATA_STARTPAGE = "startpage"; public static final String METADATA_STARTPAGE_CAMEL = "startPage"; @Autowired GeneralFileHandlerService generalFileHandlerService; @Override
public DataMaps unzip(byte[] bytes) throws IOException {
sastix/cms
server/src/main/java/com/sastix/cms/server/utils/ValidationHelper.java
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ContentValidationException.java // @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = Constants.VALIDATION_ERROR) // public class ContentValidationException extends GeneralResourceException { // // private static final long serialVersionUID = -1431873343798668900L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ContentValidationException(String message) { // super(message); // } // }
import com.google.common.base.Joiner; import com.sastix.cms.common.content.exceptions.ContentValidationException; import org.springframework.stereotype.Component; import org.springframework.validation.BindingResult; import org.springframework.validation.FieldError; import lombok.extern.slf4j.Slf4j; import java.util.ArrayList; import java.util.List;
/* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.utils; @Slf4j @Component public class ValidationHelper { public String createMessage(List<FieldError> errors) { String message = null; if (errors != null && errors.size() > 0) { List<String> messages = new ArrayList<String>(); for (FieldError error : errors) { messages.add(error.getField() + " " + error.getDefaultMessage()); } Joiner joiner = Joiner.on(", ").skipNulls(); message = joiner.join(messages); } return message; }
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ContentValidationException.java // @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = Constants.VALIDATION_ERROR) // public class ContentValidationException extends GeneralResourceException { // // private static final long serialVersionUID = -1431873343798668900L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ContentValidationException(String message) { // super(message); // } // } // Path: server/src/main/java/com/sastix/cms/server/utils/ValidationHelper.java import com.google.common.base.Joiner; import com.sastix.cms.common.content.exceptions.ContentValidationException; import org.springframework.stereotype.Component; import org.springframework.validation.BindingResult; import org.springframework.validation.FieldError; import lombok.extern.slf4j.Slf4j; import java.util.ArrayList; import java.util.List; /* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.utils; @Slf4j @Component public class ValidationHelper { public String createMessage(List<FieldError> errors) { String message = null; if (errors != null && errors.size() > 0) { List<String> messages = new ArrayList<String>(); for (FieldError error : errors) { messages.add(error.getField() + " " + error.getDefaultMessage()); } Joiner joiner = Joiner.on(", ").skipNulls(); message = joiner.join(messages); } return message; }
public void validate(BindingResult result) throws ContentValidationException {
sastix/cms
common/dataobjects/src/main/java/com/sastix/cms/common/content/DataDTO.java
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ContentValidationException.java // @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = Constants.VALIDATION_ERROR) // public class ContentValidationException extends GeneralResourceException { // // private static final long serialVersionUID = -1431873343798668900L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ContentValidationException(String message) { // super(message); // } // }
import com.fasterxml.jackson.annotation.JsonIgnore; import com.sastix.cms.common.content.exceptions.ContentValidationException; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import lombok.ToString;
/* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.common.content; /** * The specific object holds all the information related to a DataDTO. */ @Getter @Setter @NoArgsConstructor @ToString public class DataDTO { /** * The UID of the object to lock. */ private String resourceUID; /** * It is a self-sufficient URI that holds the precise resource location. */ private String resourceURI; @JsonIgnore
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ContentValidationException.java // @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = Constants.VALIDATION_ERROR) // public class ContentValidationException extends GeneralResourceException { // // private static final long serialVersionUID = -1431873343798668900L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ContentValidationException(String message) { // super(message); // } // } // Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/DataDTO.java import com.fasterxml.jackson.annotation.JsonIgnore; import com.sastix.cms.common.content.exceptions.ContentValidationException; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import lombok.ToString; /* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.common.content; /** * The specific object holds all the information related to a DataDTO. */ @Getter @Setter @NoArgsConstructor @ToString public class DataDTO { /** * The UID of the object to lock. */ private String resourceUID; /** * It is a self-sufficient URI that holds the precise resource location. */ private String resourceURI; @JsonIgnore
public String getTenantID() throws ContentValidationException {
sastix/cms
server/src/main/java/com/sastix/cms/server/services/cache/CacheFileUtilsService.java
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/cache/CacheDTO.java // @Getter @Setter @NoArgsConstructor // public class CacheDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 4215735359530723728L; // // /** // * The key of the object to be cached // */ // private String cacheKey; // // /** // * The cache blob binary // */ // byte[] cacheBlobBinary; // // /** // * The cache blob uri // */ // String cacheBlobURI; // // /** // * An optional cache region to be used to group related keys together. // * If not specified, the default region is used, named “default” // */ // String cacheRegion; // // /** // * An optional cache expiration time for this entry. // * The server does not return entries that are past // * the expiration time and silently removes them from the cache // */ // DateTime cacheExpirationTime; // // /** // * Constructor with mandatory fields // * // * @param cacheKey // * @param cacheBlobBinary // */ // public CacheDTO(String cacheKey, byte[] cacheBlobBinary) { // this.cacheKey = cacheKey; // this.cacheBlobBinary = cacheBlobBinary; // } // // public CacheDTO(String cacheKey, Serializable cacheBlobObject, String cacheRegion) { // this.cacheKey = cacheKey; // this.cacheRegion = cacheRegion; // if (cacheBlobObject instanceof byte[]) { // this.cacheBlobBinary = (byte[]) cacheBlobObject; // } else { // this.cacheBlobBinary = serialize(cacheBlobObject); // } // } // // @JsonIgnore // private byte[] serialize(Serializable cacheBlobObject) { // ObjectOutputStream oout = null; // ByteArrayOutputStream bout = null; // // try { // bout = new ByteArrayOutputStream(4096); // oout = new ObjectOutputStream(bout); // oout.writeObject(cacheBlobObject); // oout.flush(); // byte[] result = bout.toByteArray(); // return result; // } catch (IOException e) { // throw new RuntimeException("Unable to serialize object ", e); // } finally { // if (oout != null) { // try { // oout.close(); // } catch (IOException e) { // // e.printStackTrace(); // } // } // if (bout != null) { // try { // bout.close(); // } catch (IOException e) { // // e.printStackTrace(); // } // } // } // // // } // // // /** // * Constructor with mandatory fields // * // * @param cacheKey // * @param cacheBlobURI // */ // public CacheDTO(String cacheKey, String cacheBlobURI) { // this.cacheKey = cacheKey; // this.cacheBlobURI = cacheBlobURI; // } // // /** // * A more generic method to retrieve the object directly from the carrier byte[] // * // * @param <T> the object type required // * @return the return type // */ // @JsonIgnore // public <T> T getCacheBlobBinaryObject() { // ByteArrayInputStream bis = new ByteArrayInputStream(getCacheBlobBinary()); // ObjectInput in = null; // T object; // try { // in = new ObjectInputStream(bis); // object = (T) in.readObject(); // return object; // } catch (Exception e) { // throw new RuntimeException("Unable to deserialize object ", e); // } finally { // try { // bis.close(); // } catch (IOException ex) { // // ignore close exception // } // try { // if (in != null) { // in.close(); // } // } catch (IOException ex) { // // ignore close exception // } // } // } // // }
import com.sastix.cms.common.cache.CacheDTO; import java.io.IOException; import java.net.URL;
/* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.cache; public interface CacheFileUtilsService { byte[] downloadResource(URL url) throws IOException; /** * Check if the cached object has expired * * @return true if the cached resource has expired * */
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/cache/CacheDTO.java // @Getter @Setter @NoArgsConstructor // public class CacheDTO implements Serializable { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 4215735359530723728L; // // /** // * The key of the object to be cached // */ // private String cacheKey; // // /** // * The cache blob binary // */ // byte[] cacheBlobBinary; // // /** // * The cache blob uri // */ // String cacheBlobURI; // // /** // * An optional cache region to be used to group related keys together. // * If not specified, the default region is used, named “default” // */ // String cacheRegion; // // /** // * An optional cache expiration time for this entry. // * The server does not return entries that are past // * the expiration time and silently removes them from the cache // */ // DateTime cacheExpirationTime; // // /** // * Constructor with mandatory fields // * // * @param cacheKey // * @param cacheBlobBinary // */ // public CacheDTO(String cacheKey, byte[] cacheBlobBinary) { // this.cacheKey = cacheKey; // this.cacheBlobBinary = cacheBlobBinary; // } // // public CacheDTO(String cacheKey, Serializable cacheBlobObject, String cacheRegion) { // this.cacheKey = cacheKey; // this.cacheRegion = cacheRegion; // if (cacheBlobObject instanceof byte[]) { // this.cacheBlobBinary = (byte[]) cacheBlobObject; // } else { // this.cacheBlobBinary = serialize(cacheBlobObject); // } // } // // @JsonIgnore // private byte[] serialize(Serializable cacheBlobObject) { // ObjectOutputStream oout = null; // ByteArrayOutputStream bout = null; // // try { // bout = new ByteArrayOutputStream(4096); // oout = new ObjectOutputStream(bout); // oout.writeObject(cacheBlobObject); // oout.flush(); // byte[] result = bout.toByteArray(); // return result; // } catch (IOException e) { // throw new RuntimeException("Unable to serialize object ", e); // } finally { // if (oout != null) { // try { // oout.close(); // } catch (IOException e) { // // e.printStackTrace(); // } // } // if (bout != null) { // try { // bout.close(); // } catch (IOException e) { // // e.printStackTrace(); // } // } // } // // // } // // // /** // * Constructor with mandatory fields // * // * @param cacheKey // * @param cacheBlobURI // */ // public CacheDTO(String cacheKey, String cacheBlobURI) { // this.cacheKey = cacheKey; // this.cacheBlobURI = cacheBlobURI; // } // // /** // * A more generic method to retrieve the object directly from the carrier byte[] // * // * @param <T> the object type required // * @return the return type // */ // @JsonIgnore // public <T> T getCacheBlobBinaryObject() { // ByteArrayInputStream bis = new ByteArrayInputStream(getCacheBlobBinary()); // ObjectInput in = null; // T object; // try { // in = new ObjectInputStream(bis); // object = (T) in.readObject(); // return object; // } catch (Exception e) { // throw new RuntimeException("Unable to deserialize object ", e); // } finally { // try { // bis.close(); // } catch (IOException ex) { // // ignore close exception // } // try { // if (in != null) { // in.close(); // } // } catch (IOException ex) { // // ignore close exception // } // } // } // // } // Path: server/src/main/java/com/sastix/cms/server/services/cache/CacheFileUtilsService.java import com.sastix.cms.common.cache.CacheDTO; import java.io.IOException; import java.net.URL; /* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.cache; public interface CacheFileUtilsService { byte[] downloadResource(URL url) throws IOException; /** * Check if the cached object has expired * * @return true if the cached resource has expired * */
boolean isExpiredCachedResource(CacheDTO cacheDTO);
sastix/cms
server/src/test/java/com/sastix/cms/server/services/content/ResourceServiceTest.java
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ContentValidationException.java // @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = Constants.VALIDATION_ERROR) // public class ContentValidationException extends GeneralResourceException { // // private static final long serialVersionUID = -1431873343798668900L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ContentValidationException(String message) { // super(message); // } // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ResourceAccessError.java // @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = Constants.RESOURCE_ACCESS_ERROR) // public class ResourceAccessError extends GeneralResourceException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 7739893346328334895L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ResourceAccessError(String message) { // super(message); // } // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ResourceNotFound.java // @ResponseStatus(value = HttpStatus.NOT_FOUND, reason = Constants.RESOURCE_NOT_FOUND) // public class ResourceNotFound extends GeneralResourceException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 6032702930609853039L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ResourceNotFound(String message) { // super(message); // } // // } // // Path: server/src/main/java/com/sastix/cms/server/CmsServer.java // @Slf4j // @EnableTransactionManagement // @ComponentScan("com.sastix.cms") // @SpringBootApplication(exclude = { SecurityAutoConfiguration.class }) // public class CmsServer { // // public static final String CONTEXT = "cms"; // // public static void main(String[] args) { // log.info("**** Starting Sastix CMS server ****"); // SpringApplication.run(CmsServer.class, args); // } // }
import com.sastix.cms.common.content.*; import com.sastix.cms.common.content.exceptions.ContentValidationException; import com.sastix.cms.common.content.exceptions.ResourceAccessError; import com.sastix.cms.common.content.exceptions.ResourceNotFound; import com.sastix.cms.server.CmsServer; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.TestInstance.Lifecycle; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; import java.io.File; import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Arrays; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail;
/* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.content; @TestInstance(Lifecycle.PER_CLASS) @ActiveProfiles({"production", "test"})
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ContentValidationException.java // @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = Constants.VALIDATION_ERROR) // public class ContentValidationException extends GeneralResourceException { // // private static final long serialVersionUID = -1431873343798668900L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ContentValidationException(String message) { // super(message); // } // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ResourceAccessError.java // @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = Constants.RESOURCE_ACCESS_ERROR) // public class ResourceAccessError extends GeneralResourceException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 7739893346328334895L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ResourceAccessError(String message) { // super(message); // } // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ResourceNotFound.java // @ResponseStatus(value = HttpStatus.NOT_FOUND, reason = Constants.RESOURCE_NOT_FOUND) // public class ResourceNotFound extends GeneralResourceException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 6032702930609853039L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ResourceNotFound(String message) { // super(message); // } // // } // // Path: server/src/main/java/com/sastix/cms/server/CmsServer.java // @Slf4j // @EnableTransactionManagement // @ComponentScan("com.sastix.cms") // @SpringBootApplication(exclude = { SecurityAutoConfiguration.class }) // public class CmsServer { // // public static final String CONTEXT = "cms"; // // public static void main(String[] args) { // log.info("**** Starting Sastix CMS server ****"); // SpringApplication.run(CmsServer.class, args); // } // } // Path: server/src/test/java/com/sastix/cms/server/services/content/ResourceServiceTest.java import com.sastix.cms.common.content.*; import com.sastix.cms.common.content.exceptions.ContentValidationException; import com.sastix.cms.common.content.exceptions.ResourceAccessError; import com.sastix.cms.common.content.exceptions.ResourceNotFound; import com.sastix.cms.server.CmsServer; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.TestInstance.Lifecycle; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; import java.io.File; import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Arrays; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; /* * Copyright(c) 2017 the original author or authors. * * Licensed 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 com.sastix.cms.server.services.content; @TestInstance(Lifecycle.PER_CLASS) @ActiveProfiles({"production", "test"})
@SpringBootTest(classes = {CmsServer.class})
sastix/cms
server/src/test/java/com/sastix/cms/server/services/content/ResourceServiceTest.java
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ContentValidationException.java // @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = Constants.VALIDATION_ERROR) // public class ContentValidationException extends GeneralResourceException { // // private static final long serialVersionUID = -1431873343798668900L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ContentValidationException(String message) { // super(message); // } // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ResourceAccessError.java // @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = Constants.RESOURCE_ACCESS_ERROR) // public class ResourceAccessError extends GeneralResourceException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 7739893346328334895L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ResourceAccessError(String message) { // super(message); // } // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ResourceNotFound.java // @ResponseStatus(value = HttpStatus.NOT_FOUND, reason = Constants.RESOURCE_NOT_FOUND) // public class ResourceNotFound extends GeneralResourceException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 6032702930609853039L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ResourceNotFound(String message) { // super(message); // } // // } // // Path: server/src/main/java/com/sastix/cms/server/CmsServer.java // @Slf4j // @EnableTransactionManagement // @ComponentScan("com.sastix.cms") // @SpringBootApplication(exclude = { SecurityAutoConfiguration.class }) // public class CmsServer { // // public static final String CONTEXT = "cms"; // // public static void main(String[] args) { // log.info("**** Starting Sastix CMS server ****"); // SpringApplication.run(CmsServer.class, args); // } // }
import com.sastix.cms.common.content.*; import com.sastix.cms.common.content.exceptions.ContentValidationException; import com.sastix.cms.common.content.exceptions.ResourceAccessError; import com.sastix.cms.common.content.exceptions.ResourceNotFound; import com.sastix.cms.server.CmsServer; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.TestInstance.Lifecycle; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; import java.io.File; import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Arrays; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail;
public void shouldCreateResourceFromExternalUri() throws Exception { URL localFile = getClass().getClassLoader().getResource("./logo.png"); CreateResourceDTO createResourceDTO = new CreateResourceDTO(); createResourceDTO.setResourceAuthor("Demo Author"); createResourceDTO.setResourceExternalURI(localFile.getProtocol() + "://" + localFile.getFile()); createResourceDTO.setResourceMediaType("image/png"); createResourceDTO.setResourceName("logo.png"); createResourceDTO.setResourceTenantId("zaq12345"); ResourceDTO resourceDTO = resourceService.createResource(createResourceDTO); String resourceUri = resourceDTO.getResourceURI(); //Extract TenantID final String tenantID = resourceUri.substring(resourceUri.lastIndexOf('-') + 1, resourceUri.indexOf("/")); final Path responseFile = hashedDirectoryService.getDataByURI(resourceUri, tenantID); File file = responseFile.toFile(); byte[] actualBytes = Files.readAllBytes(file.toPath()); byte[] expectedBytes = Files.readAllBytes(Paths.get(localFile.getPath())); assertTrue(Arrays.equals(expectedBytes, actualBytes)); } @Test public void shouldNotCreateResource() throws Exception { CreateResourceDTO createResourceDTO = new CreateResourceDTO(); try { resourceService.createResource(createResourceDTO); fail("Expected ContentValidationException exception");
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ContentValidationException.java // @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = Constants.VALIDATION_ERROR) // public class ContentValidationException extends GeneralResourceException { // // private static final long serialVersionUID = -1431873343798668900L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ContentValidationException(String message) { // super(message); // } // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ResourceAccessError.java // @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = Constants.RESOURCE_ACCESS_ERROR) // public class ResourceAccessError extends GeneralResourceException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 7739893346328334895L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ResourceAccessError(String message) { // super(message); // } // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ResourceNotFound.java // @ResponseStatus(value = HttpStatus.NOT_FOUND, reason = Constants.RESOURCE_NOT_FOUND) // public class ResourceNotFound extends GeneralResourceException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 6032702930609853039L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ResourceNotFound(String message) { // super(message); // } // // } // // Path: server/src/main/java/com/sastix/cms/server/CmsServer.java // @Slf4j // @EnableTransactionManagement // @ComponentScan("com.sastix.cms") // @SpringBootApplication(exclude = { SecurityAutoConfiguration.class }) // public class CmsServer { // // public static final String CONTEXT = "cms"; // // public static void main(String[] args) { // log.info("**** Starting Sastix CMS server ****"); // SpringApplication.run(CmsServer.class, args); // } // } // Path: server/src/test/java/com/sastix/cms/server/services/content/ResourceServiceTest.java import com.sastix.cms.common.content.*; import com.sastix.cms.common.content.exceptions.ContentValidationException; import com.sastix.cms.common.content.exceptions.ResourceAccessError; import com.sastix.cms.common.content.exceptions.ResourceNotFound; import com.sastix.cms.server.CmsServer; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.TestInstance.Lifecycle; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; import java.io.File; import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Arrays; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; public void shouldCreateResourceFromExternalUri() throws Exception { URL localFile = getClass().getClassLoader().getResource("./logo.png"); CreateResourceDTO createResourceDTO = new CreateResourceDTO(); createResourceDTO.setResourceAuthor("Demo Author"); createResourceDTO.setResourceExternalURI(localFile.getProtocol() + "://" + localFile.getFile()); createResourceDTO.setResourceMediaType("image/png"); createResourceDTO.setResourceName("logo.png"); createResourceDTO.setResourceTenantId("zaq12345"); ResourceDTO resourceDTO = resourceService.createResource(createResourceDTO); String resourceUri = resourceDTO.getResourceURI(); //Extract TenantID final String tenantID = resourceUri.substring(resourceUri.lastIndexOf('-') + 1, resourceUri.indexOf("/")); final Path responseFile = hashedDirectoryService.getDataByURI(resourceUri, tenantID); File file = responseFile.toFile(); byte[] actualBytes = Files.readAllBytes(file.toPath()); byte[] expectedBytes = Files.readAllBytes(Paths.get(localFile.getPath())); assertTrue(Arrays.equals(expectedBytes, actualBytes)); } @Test public void shouldNotCreateResource() throws Exception { CreateResourceDTO createResourceDTO = new CreateResourceDTO(); try { resourceService.createResource(createResourceDTO); fail("Expected ContentValidationException exception");
} catch (ContentValidationException e) {
sastix/cms
server/src/test/java/com/sastix/cms/server/services/content/ResourceServiceTest.java
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ContentValidationException.java // @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = Constants.VALIDATION_ERROR) // public class ContentValidationException extends GeneralResourceException { // // private static final long serialVersionUID = -1431873343798668900L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ContentValidationException(String message) { // super(message); // } // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ResourceAccessError.java // @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = Constants.RESOURCE_ACCESS_ERROR) // public class ResourceAccessError extends GeneralResourceException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 7739893346328334895L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ResourceAccessError(String message) { // super(message); // } // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ResourceNotFound.java // @ResponseStatus(value = HttpStatus.NOT_FOUND, reason = Constants.RESOURCE_NOT_FOUND) // public class ResourceNotFound extends GeneralResourceException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 6032702930609853039L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ResourceNotFound(String message) { // super(message); // } // // } // // Path: server/src/main/java/com/sastix/cms/server/CmsServer.java // @Slf4j // @EnableTransactionManagement // @ComponentScan("com.sastix.cms") // @SpringBootApplication(exclude = { SecurityAutoConfiguration.class }) // public class CmsServer { // // public static final String CONTEXT = "cms"; // // public static void main(String[] args) { // log.info("**** Starting Sastix CMS server ****"); // SpringApplication.run(CmsServer.class, args); // } // }
import com.sastix.cms.common.content.*; import com.sastix.cms.common.content.exceptions.ContentValidationException; import com.sastix.cms.common.content.exceptions.ResourceAccessError; import com.sastix.cms.common.content.exceptions.ResourceNotFound; import com.sastix.cms.server.CmsServer; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.TestInstance.Lifecycle; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; import java.io.File; import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Arrays; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail;
//Extract TenantID final String tenantID = resourceUri.substring(resourceUri.lastIndexOf('-') + 1, resourceUri.indexOf("/")); final Path responseFile = hashedDirectoryService.getDataByURI(resourceUri, tenantID); File file = responseFile.toFile(); byte[] actualBytes = Files.readAllBytes(file.toPath()); byte[] expectedBytes = Files.readAllBytes(Paths.get(localFile.getPath())); assertTrue(Arrays.equals(expectedBytes, actualBytes)); } @Test public void shouldNotCreateResource() throws Exception { CreateResourceDTO createResourceDTO = new CreateResourceDTO(); try { resourceService.createResource(createResourceDTO); fail("Expected ContentValidationException exception"); } catch (ContentValidationException e) { assertTrue(e.getMessage().contains("Field errors: resourceBinary OR resourceExternalURI may not be null")); } } @Test public void shouldNotLockResource() throws Exception { ResourceDTO resourceDTO = new ResourceDTO(); try { resourceService.lockResource(resourceDTO); fail("Expected ResourceNotFound exception");
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ContentValidationException.java // @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = Constants.VALIDATION_ERROR) // public class ContentValidationException extends GeneralResourceException { // // private static final long serialVersionUID = -1431873343798668900L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ContentValidationException(String message) { // super(message); // } // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ResourceAccessError.java // @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = Constants.RESOURCE_ACCESS_ERROR) // public class ResourceAccessError extends GeneralResourceException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 7739893346328334895L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ResourceAccessError(String message) { // super(message); // } // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ResourceNotFound.java // @ResponseStatus(value = HttpStatus.NOT_FOUND, reason = Constants.RESOURCE_NOT_FOUND) // public class ResourceNotFound extends GeneralResourceException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 6032702930609853039L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ResourceNotFound(String message) { // super(message); // } // // } // // Path: server/src/main/java/com/sastix/cms/server/CmsServer.java // @Slf4j // @EnableTransactionManagement // @ComponentScan("com.sastix.cms") // @SpringBootApplication(exclude = { SecurityAutoConfiguration.class }) // public class CmsServer { // // public static final String CONTEXT = "cms"; // // public static void main(String[] args) { // log.info("**** Starting Sastix CMS server ****"); // SpringApplication.run(CmsServer.class, args); // } // } // Path: server/src/test/java/com/sastix/cms/server/services/content/ResourceServiceTest.java import com.sastix.cms.common.content.*; import com.sastix.cms.common.content.exceptions.ContentValidationException; import com.sastix.cms.common.content.exceptions.ResourceAccessError; import com.sastix.cms.common.content.exceptions.ResourceNotFound; import com.sastix.cms.server.CmsServer; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.TestInstance.Lifecycle; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; import java.io.File; import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Arrays; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; //Extract TenantID final String tenantID = resourceUri.substring(resourceUri.lastIndexOf('-') + 1, resourceUri.indexOf("/")); final Path responseFile = hashedDirectoryService.getDataByURI(resourceUri, tenantID); File file = responseFile.toFile(); byte[] actualBytes = Files.readAllBytes(file.toPath()); byte[] expectedBytes = Files.readAllBytes(Paths.get(localFile.getPath())); assertTrue(Arrays.equals(expectedBytes, actualBytes)); } @Test public void shouldNotCreateResource() throws Exception { CreateResourceDTO createResourceDTO = new CreateResourceDTO(); try { resourceService.createResource(createResourceDTO); fail("Expected ContentValidationException exception"); } catch (ContentValidationException e) { assertTrue(e.getMessage().contains("Field errors: resourceBinary OR resourceExternalURI may not be null")); } } @Test public void shouldNotLockResource() throws Exception { ResourceDTO resourceDTO = new ResourceDTO(); try { resourceService.lockResource(resourceDTO); fail("Expected ResourceNotFound exception");
} catch (ResourceNotFound e) {
sastix/cms
server/src/test/java/com/sastix/cms/server/services/content/ResourceServiceTest.java
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ContentValidationException.java // @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = Constants.VALIDATION_ERROR) // public class ContentValidationException extends GeneralResourceException { // // private static final long serialVersionUID = -1431873343798668900L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ContentValidationException(String message) { // super(message); // } // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ResourceAccessError.java // @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = Constants.RESOURCE_ACCESS_ERROR) // public class ResourceAccessError extends GeneralResourceException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 7739893346328334895L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ResourceAccessError(String message) { // super(message); // } // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ResourceNotFound.java // @ResponseStatus(value = HttpStatus.NOT_FOUND, reason = Constants.RESOURCE_NOT_FOUND) // public class ResourceNotFound extends GeneralResourceException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 6032702930609853039L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ResourceNotFound(String message) { // super(message); // } // // } // // Path: server/src/main/java/com/sastix/cms/server/CmsServer.java // @Slf4j // @EnableTransactionManagement // @ComponentScan("com.sastix.cms") // @SpringBootApplication(exclude = { SecurityAutoConfiguration.class }) // public class CmsServer { // // public static final String CONTEXT = "cms"; // // public static void main(String[] args) { // log.info("**** Starting Sastix CMS server ****"); // SpringApplication.run(CmsServer.class, args); // } // }
import com.sastix.cms.common.content.*; import com.sastix.cms.common.content.exceptions.ContentValidationException; import com.sastix.cms.common.content.exceptions.ResourceAccessError; import com.sastix.cms.common.content.exceptions.ResourceNotFound; import com.sastix.cms.server.CmsServer; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.TestInstance.Lifecycle; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; import java.io.File; import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Arrays; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail;
} @Test public void shouldNotRenewResourceLock() throws Exception { LockedResourceDTO lockedResourceDTO = new LockedResourceDTO(); try { resourceService.renewResourceLock(lockedResourceDTO); fail("Expected ResourceNotFound exception"); } catch (ResourceNotFound e) { assertTrue(e.getMessage().contains("The supplied resource UID[null] does not exist.")); } } @Test public void shouldNotUpdateResource() throws Exception { UpdateResourceDTO updateResourceDTO = new UpdateResourceDTO(); try { resourceService.updateResource(updateResourceDTO); fail("Expected ResourceNotFound exception"); } catch (ResourceNotFound e) { assertTrue(e.getMessage().contains("The supplied resource UID[null] does not exist.")); } } @Test public void shouldNotQueryResource() throws Exception { ResourceQueryDTO resourceQueryDTO = new ResourceQueryDTO(); try { resourceService.queryResource(resourceQueryDTO); fail("Expected ResourceAccessError exception");
// Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ContentValidationException.java // @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = Constants.VALIDATION_ERROR) // public class ContentValidationException extends GeneralResourceException { // // private static final long serialVersionUID = -1431873343798668900L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ContentValidationException(String message) { // super(message); // } // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ResourceAccessError.java // @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = Constants.RESOURCE_ACCESS_ERROR) // public class ResourceAccessError extends GeneralResourceException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 7739893346328334895L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ResourceAccessError(String message) { // super(message); // } // } // // Path: common/dataobjects/src/main/java/com/sastix/cms/common/content/exceptions/ResourceNotFound.java // @ResponseStatus(value = HttpStatus.NOT_FOUND, reason = Constants.RESOURCE_NOT_FOUND) // public class ResourceNotFound extends GeneralResourceException { // // /** // * Serial Version UID. // */ // private static final long serialVersionUID = 6032702930609853039L; // // /** // * Constructor that allows a specific error message to be specified. // * // * @param message detail message. // */ // public ResourceNotFound(String message) { // super(message); // } // // } // // Path: server/src/main/java/com/sastix/cms/server/CmsServer.java // @Slf4j // @EnableTransactionManagement // @ComponentScan("com.sastix.cms") // @SpringBootApplication(exclude = { SecurityAutoConfiguration.class }) // public class CmsServer { // // public static final String CONTEXT = "cms"; // // public static void main(String[] args) { // log.info("**** Starting Sastix CMS server ****"); // SpringApplication.run(CmsServer.class, args); // } // } // Path: server/src/test/java/com/sastix/cms/server/services/content/ResourceServiceTest.java import com.sastix.cms.common.content.*; import com.sastix.cms.common.content.exceptions.ContentValidationException; import com.sastix.cms.common.content.exceptions.ResourceAccessError; import com.sastix.cms.common.content.exceptions.ResourceNotFound; import com.sastix.cms.server.CmsServer; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.TestInstance.Lifecycle; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; import java.io.File; import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Arrays; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; } @Test public void shouldNotRenewResourceLock() throws Exception { LockedResourceDTO lockedResourceDTO = new LockedResourceDTO(); try { resourceService.renewResourceLock(lockedResourceDTO); fail("Expected ResourceNotFound exception"); } catch (ResourceNotFound e) { assertTrue(e.getMessage().contains("The supplied resource UID[null] does not exist.")); } } @Test public void shouldNotUpdateResource() throws Exception { UpdateResourceDTO updateResourceDTO = new UpdateResourceDTO(); try { resourceService.updateResource(updateResourceDTO); fail("Expected ResourceNotFound exception"); } catch (ResourceNotFound e) { assertTrue(e.getMessage().contains("The supplied resource UID[null] does not exist.")); } } @Test public void shouldNotQueryResource() throws Exception { ResourceQueryDTO resourceQueryDTO = new ResourceQueryDTO(); try { resourceService.queryResource(resourceQueryDTO); fail("Expected ResourceAccessError exception");
} catch (ResourceAccessError e) {
GWTReact/gwt-react
src/gwt/react/client/proptypes/html/FormProps.java
// Path: src/gwt/react/client/api/ReactRef.java // @JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object") // public class ReactRef<T> { // @JsProperty // public T current; // } // // Path: src/gwt/react/client/proptypes/ReactRefCallback.java // @JsFunction // public interface ReactRefCallback { // void passRef(Object refElement); // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/FormMethod.java // public enum FormMethod { // get, post // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/OnOff.java // public enum OnOff { // on, off // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/Target.java // public enum Target { // blank("_blank"), // self("_self"), // parent("_parent"), // top("_top"); // // private String val; // // Target(String val) { // this.val = val; // } // // String getVal() { // return val; // } // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/YesNo.java // public enum YesNo { // yes, no // }
import elemental2.dom.HTMLFormElement; import gwt.react.client.api.ReactRef; import gwt.react.client.events.*; import gwt.react.client.proptypes.ReactRefCallback; import gwt.react.client.proptypes.html.attributeTypes.FormMethod; import gwt.react.client.proptypes.html.attributeTypes.OnOff; import gwt.react.client.proptypes.html.attributeTypes.Target; import gwt.react.client.proptypes.html.attributeTypes.YesNo; import jsinterop.annotations.JsOverlay; import jsinterop.annotations.JsPackage; import jsinterop.annotations.JsType;
package gwt.react.client.proptypes.html; /** * Props for form elements. Refer to http://www.w3schools.com/tags/tag_form.asp */ @JsType(isNative=true, namespace=JsPackage.GLOBAL, name="Object") public class FormProps extends HtmlGlobalFields { @JsOverlay public final FormProps acceptCharset(String s) { acceptCharset = s; return this; } @JsOverlay public final FormProps action(String s) { action = s; return this; }
// Path: src/gwt/react/client/api/ReactRef.java // @JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object") // public class ReactRef<T> { // @JsProperty // public T current; // } // // Path: src/gwt/react/client/proptypes/ReactRefCallback.java // @JsFunction // public interface ReactRefCallback { // void passRef(Object refElement); // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/FormMethod.java // public enum FormMethod { // get, post // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/OnOff.java // public enum OnOff { // on, off // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/Target.java // public enum Target { // blank("_blank"), // self("_self"), // parent("_parent"), // top("_top"); // // private String val; // // Target(String val) { // this.val = val; // } // // String getVal() { // return val; // } // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/YesNo.java // public enum YesNo { // yes, no // } // Path: src/gwt/react/client/proptypes/html/FormProps.java import elemental2.dom.HTMLFormElement; import gwt.react.client.api.ReactRef; import gwt.react.client.events.*; import gwt.react.client.proptypes.ReactRefCallback; import gwt.react.client.proptypes.html.attributeTypes.FormMethod; import gwt.react.client.proptypes.html.attributeTypes.OnOff; import gwt.react.client.proptypes.html.attributeTypes.Target; import gwt.react.client.proptypes.html.attributeTypes.YesNo; import jsinterop.annotations.JsOverlay; import jsinterop.annotations.JsPackage; import jsinterop.annotations.JsType; package gwt.react.client.proptypes.html; /** * Props for form elements. Refer to http://www.w3schools.com/tags/tag_form.asp */ @JsType(isNative=true, namespace=JsPackage.GLOBAL, name="Object") public class FormProps extends HtmlGlobalFields { @JsOverlay public final FormProps acceptCharset(String s) { acceptCharset = s; return this; } @JsOverlay public final FormProps action(String s) { action = s; return this; }
@JsOverlay public final FormProps autoComplete(OnOff s) { autoComplete = s.name(); return this; }
GWTReact/gwt-react
src/gwt/react/client/proptypes/html/FormProps.java
// Path: src/gwt/react/client/api/ReactRef.java // @JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object") // public class ReactRef<T> { // @JsProperty // public T current; // } // // Path: src/gwt/react/client/proptypes/ReactRefCallback.java // @JsFunction // public interface ReactRefCallback { // void passRef(Object refElement); // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/FormMethod.java // public enum FormMethod { // get, post // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/OnOff.java // public enum OnOff { // on, off // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/Target.java // public enum Target { // blank("_blank"), // self("_self"), // parent("_parent"), // top("_top"); // // private String val; // // Target(String val) { // this.val = val; // } // // String getVal() { // return val; // } // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/YesNo.java // public enum YesNo { // yes, no // }
import elemental2.dom.HTMLFormElement; import gwt.react.client.api.ReactRef; import gwt.react.client.events.*; import gwt.react.client.proptypes.ReactRefCallback; import gwt.react.client.proptypes.html.attributeTypes.FormMethod; import gwt.react.client.proptypes.html.attributeTypes.OnOff; import gwt.react.client.proptypes.html.attributeTypes.Target; import gwt.react.client.proptypes.html.attributeTypes.YesNo; import jsinterop.annotations.JsOverlay; import jsinterop.annotations.JsPackage; import jsinterop.annotations.JsType;
package gwt.react.client.proptypes.html; /** * Props for form elements. Refer to http://www.w3schools.com/tags/tag_form.asp */ @JsType(isNative=true, namespace=JsPackage.GLOBAL, name="Object") public class FormProps extends HtmlGlobalFields { @JsOverlay public final FormProps acceptCharset(String s) { acceptCharset = s; return this; } @JsOverlay public final FormProps action(String s) { action = s; return this; } @JsOverlay public final FormProps autoComplete(OnOff s) { autoComplete = s.name(); return this; } @JsOverlay public final FormProps formEncType(String s) { formEncType = s; return this; }
// Path: src/gwt/react/client/api/ReactRef.java // @JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object") // public class ReactRef<T> { // @JsProperty // public T current; // } // // Path: src/gwt/react/client/proptypes/ReactRefCallback.java // @JsFunction // public interface ReactRefCallback { // void passRef(Object refElement); // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/FormMethod.java // public enum FormMethod { // get, post // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/OnOff.java // public enum OnOff { // on, off // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/Target.java // public enum Target { // blank("_blank"), // self("_self"), // parent("_parent"), // top("_top"); // // private String val; // // Target(String val) { // this.val = val; // } // // String getVal() { // return val; // } // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/YesNo.java // public enum YesNo { // yes, no // } // Path: src/gwt/react/client/proptypes/html/FormProps.java import elemental2.dom.HTMLFormElement; import gwt.react.client.api.ReactRef; import gwt.react.client.events.*; import gwt.react.client.proptypes.ReactRefCallback; import gwt.react.client.proptypes.html.attributeTypes.FormMethod; import gwt.react.client.proptypes.html.attributeTypes.OnOff; import gwt.react.client.proptypes.html.attributeTypes.Target; import gwt.react.client.proptypes.html.attributeTypes.YesNo; import jsinterop.annotations.JsOverlay; import jsinterop.annotations.JsPackage; import jsinterop.annotations.JsType; package gwt.react.client.proptypes.html; /** * Props for form elements. Refer to http://www.w3schools.com/tags/tag_form.asp */ @JsType(isNative=true, namespace=JsPackage.GLOBAL, name="Object") public class FormProps extends HtmlGlobalFields { @JsOverlay public final FormProps acceptCharset(String s) { acceptCharset = s; return this; } @JsOverlay public final FormProps action(String s) { action = s; return this; } @JsOverlay public final FormProps autoComplete(OnOff s) { autoComplete = s.name(); return this; } @JsOverlay public final FormProps formEncType(String s) { formEncType = s; return this; }
@JsOverlay public final FormProps formMethod(FormMethod s) { formMethod = s.name(); return this; }
GWTReact/gwt-react
src/gwt/react/client/proptypes/html/FormProps.java
// Path: src/gwt/react/client/api/ReactRef.java // @JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object") // public class ReactRef<T> { // @JsProperty // public T current; // } // // Path: src/gwt/react/client/proptypes/ReactRefCallback.java // @JsFunction // public interface ReactRefCallback { // void passRef(Object refElement); // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/FormMethod.java // public enum FormMethod { // get, post // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/OnOff.java // public enum OnOff { // on, off // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/Target.java // public enum Target { // blank("_blank"), // self("_self"), // parent("_parent"), // top("_top"); // // private String val; // // Target(String val) { // this.val = val; // } // // String getVal() { // return val; // } // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/YesNo.java // public enum YesNo { // yes, no // }
import elemental2.dom.HTMLFormElement; import gwt.react.client.api.ReactRef; import gwt.react.client.events.*; import gwt.react.client.proptypes.ReactRefCallback; import gwt.react.client.proptypes.html.attributeTypes.FormMethod; import gwt.react.client.proptypes.html.attributeTypes.OnOff; import gwt.react.client.proptypes.html.attributeTypes.Target; import gwt.react.client.proptypes.html.attributeTypes.YesNo; import jsinterop.annotations.JsOverlay; import jsinterop.annotations.JsPackage; import jsinterop.annotations.JsType;
package gwt.react.client.proptypes.html; /** * Props for form elements. Refer to http://www.w3schools.com/tags/tag_form.asp */ @JsType(isNative=true, namespace=JsPackage.GLOBAL, name="Object") public class FormProps extends HtmlGlobalFields { @JsOverlay public final FormProps acceptCharset(String s) { acceptCharset = s; return this; } @JsOverlay public final FormProps action(String s) { action = s; return this; } @JsOverlay public final FormProps autoComplete(OnOff s) { autoComplete = s.name(); return this; } @JsOverlay public final FormProps formEncType(String s) { formEncType = s; return this; } @JsOverlay public final FormProps formMethod(FormMethod s) { formMethod = s.name(); return this; } @JsOverlay public final FormProps name(String s) { name = s; return this; } @JsOverlay public final FormProps formNoValidate(boolean b) { formNoValidate = b; return this; }
// Path: src/gwt/react/client/api/ReactRef.java // @JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object") // public class ReactRef<T> { // @JsProperty // public T current; // } // // Path: src/gwt/react/client/proptypes/ReactRefCallback.java // @JsFunction // public interface ReactRefCallback { // void passRef(Object refElement); // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/FormMethod.java // public enum FormMethod { // get, post // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/OnOff.java // public enum OnOff { // on, off // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/Target.java // public enum Target { // blank("_blank"), // self("_self"), // parent("_parent"), // top("_top"); // // private String val; // // Target(String val) { // this.val = val; // } // // String getVal() { // return val; // } // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/YesNo.java // public enum YesNo { // yes, no // } // Path: src/gwt/react/client/proptypes/html/FormProps.java import elemental2.dom.HTMLFormElement; import gwt.react.client.api.ReactRef; import gwt.react.client.events.*; import gwt.react.client.proptypes.ReactRefCallback; import gwt.react.client.proptypes.html.attributeTypes.FormMethod; import gwt.react.client.proptypes.html.attributeTypes.OnOff; import gwt.react.client.proptypes.html.attributeTypes.Target; import gwt.react.client.proptypes.html.attributeTypes.YesNo; import jsinterop.annotations.JsOverlay; import jsinterop.annotations.JsPackage; import jsinterop.annotations.JsType; package gwt.react.client.proptypes.html; /** * Props for form elements. Refer to http://www.w3schools.com/tags/tag_form.asp */ @JsType(isNative=true, namespace=JsPackage.GLOBAL, name="Object") public class FormProps extends HtmlGlobalFields { @JsOverlay public final FormProps acceptCharset(String s) { acceptCharset = s; return this; } @JsOverlay public final FormProps action(String s) { action = s; return this; } @JsOverlay public final FormProps autoComplete(OnOff s) { autoComplete = s.name(); return this; } @JsOverlay public final FormProps formEncType(String s) { formEncType = s; return this; } @JsOverlay public final FormProps formMethod(FormMethod s) { formMethod = s.name(); return this; } @JsOverlay public final FormProps name(String s) { name = s; return this; } @JsOverlay public final FormProps formNoValidate(boolean b) { formNoValidate = b; return this; }
@JsOverlay public final FormProps formTarget(Target t) { formTarget = t.name(); return this; }
GWTReact/gwt-react
src/gwt/react/client/proptypes/html/FormProps.java
// Path: src/gwt/react/client/api/ReactRef.java // @JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object") // public class ReactRef<T> { // @JsProperty // public T current; // } // // Path: src/gwt/react/client/proptypes/ReactRefCallback.java // @JsFunction // public interface ReactRefCallback { // void passRef(Object refElement); // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/FormMethod.java // public enum FormMethod { // get, post // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/OnOff.java // public enum OnOff { // on, off // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/Target.java // public enum Target { // blank("_blank"), // self("_self"), // parent("_parent"), // top("_top"); // // private String val; // // Target(String val) { // this.val = val; // } // // String getVal() { // return val; // } // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/YesNo.java // public enum YesNo { // yes, no // }
import elemental2.dom.HTMLFormElement; import gwt.react.client.api.ReactRef; import gwt.react.client.events.*; import gwt.react.client.proptypes.ReactRefCallback; import gwt.react.client.proptypes.html.attributeTypes.FormMethod; import gwt.react.client.proptypes.html.attributeTypes.OnOff; import gwt.react.client.proptypes.html.attributeTypes.Target; import gwt.react.client.proptypes.html.attributeTypes.YesNo; import jsinterop.annotations.JsOverlay; import jsinterop.annotations.JsPackage; import jsinterop.annotations.JsType;
package gwt.react.client.proptypes.html; /** * Props for form elements. Refer to http://www.w3schools.com/tags/tag_form.asp */ @JsType(isNative=true, namespace=JsPackage.GLOBAL, name="Object") public class FormProps extends HtmlGlobalFields { @JsOverlay public final FormProps acceptCharset(String s) { acceptCharset = s; return this; } @JsOverlay public final FormProps action(String s) { action = s; return this; } @JsOverlay public final FormProps autoComplete(OnOff s) { autoComplete = s.name(); return this; } @JsOverlay public final FormProps formEncType(String s) { formEncType = s; return this; } @JsOverlay public final FormProps formMethod(FormMethod s) { formMethod = s.name(); return this; } @JsOverlay public final FormProps name(String s) { name = s; return this; } @JsOverlay public final FormProps formNoValidate(boolean b) { formNoValidate = b; return this; } @JsOverlay public final FormProps formTarget(Target t) { formTarget = t.name(); return this; } @JsOverlay public final FormProps formTarget(String s) { formTarget = s; return this; } //React Specific @Deprecated @JsOverlay public final FormProps ref(String s) { ref = s; return this; }
// Path: src/gwt/react/client/api/ReactRef.java // @JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object") // public class ReactRef<T> { // @JsProperty // public T current; // } // // Path: src/gwt/react/client/proptypes/ReactRefCallback.java // @JsFunction // public interface ReactRefCallback { // void passRef(Object refElement); // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/FormMethod.java // public enum FormMethod { // get, post // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/OnOff.java // public enum OnOff { // on, off // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/Target.java // public enum Target { // blank("_blank"), // self("_self"), // parent("_parent"), // top("_top"); // // private String val; // // Target(String val) { // this.val = val; // } // // String getVal() { // return val; // } // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/YesNo.java // public enum YesNo { // yes, no // } // Path: src/gwt/react/client/proptypes/html/FormProps.java import elemental2.dom.HTMLFormElement; import gwt.react.client.api.ReactRef; import gwt.react.client.events.*; import gwt.react.client.proptypes.ReactRefCallback; import gwt.react.client.proptypes.html.attributeTypes.FormMethod; import gwt.react.client.proptypes.html.attributeTypes.OnOff; import gwt.react.client.proptypes.html.attributeTypes.Target; import gwt.react.client.proptypes.html.attributeTypes.YesNo; import jsinterop.annotations.JsOverlay; import jsinterop.annotations.JsPackage; import jsinterop.annotations.JsType; package gwt.react.client.proptypes.html; /** * Props for form elements. Refer to http://www.w3schools.com/tags/tag_form.asp */ @JsType(isNative=true, namespace=JsPackage.GLOBAL, name="Object") public class FormProps extends HtmlGlobalFields { @JsOverlay public final FormProps acceptCharset(String s) { acceptCharset = s; return this; } @JsOverlay public final FormProps action(String s) { action = s; return this; } @JsOverlay public final FormProps autoComplete(OnOff s) { autoComplete = s.name(); return this; } @JsOverlay public final FormProps formEncType(String s) { formEncType = s; return this; } @JsOverlay public final FormProps formMethod(FormMethod s) { formMethod = s.name(); return this; } @JsOverlay public final FormProps name(String s) { name = s; return this; } @JsOverlay public final FormProps formNoValidate(boolean b) { formNoValidate = b; return this; } @JsOverlay public final FormProps formTarget(Target t) { formTarget = t.name(); return this; } @JsOverlay public final FormProps formTarget(String s) { formTarget = s; return this; } //React Specific @Deprecated @JsOverlay public final FormProps ref(String s) { ref = s; return this; }
@JsOverlay public final FormProps ref(ReactRefCallback callback) { ref = callback; return this; }
GWTReact/gwt-react
src/gwt/react/client/proptypes/html/FormProps.java
// Path: src/gwt/react/client/api/ReactRef.java // @JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object") // public class ReactRef<T> { // @JsProperty // public T current; // } // // Path: src/gwt/react/client/proptypes/ReactRefCallback.java // @JsFunction // public interface ReactRefCallback { // void passRef(Object refElement); // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/FormMethod.java // public enum FormMethod { // get, post // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/OnOff.java // public enum OnOff { // on, off // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/Target.java // public enum Target { // blank("_blank"), // self("_self"), // parent("_parent"), // top("_top"); // // private String val; // // Target(String val) { // this.val = val; // } // // String getVal() { // return val; // } // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/YesNo.java // public enum YesNo { // yes, no // }
import elemental2.dom.HTMLFormElement; import gwt.react.client.api.ReactRef; import gwt.react.client.events.*; import gwt.react.client.proptypes.ReactRefCallback; import gwt.react.client.proptypes.html.attributeTypes.FormMethod; import gwt.react.client.proptypes.html.attributeTypes.OnOff; import gwt.react.client.proptypes.html.attributeTypes.Target; import gwt.react.client.proptypes.html.attributeTypes.YesNo; import jsinterop.annotations.JsOverlay; import jsinterop.annotations.JsPackage; import jsinterop.annotations.JsType;
package gwt.react.client.proptypes.html; /** * Props for form elements. Refer to http://www.w3schools.com/tags/tag_form.asp */ @JsType(isNative=true, namespace=JsPackage.GLOBAL, name="Object") public class FormProps extends HtmlGlobalFields { @JsOverlay public final FormProps acceptCharset(String s) { acceptCharset = s; return this; } @JsOverlay public final FormProps action(String s) { action = s; return this; } @JsOverlay public final FormProps autoComplete(OnOff s) { autoComplete = s.name(); return this; } @JsOverlay public final FormProps formEncType(String s) { formEncType = s; return this; } @JsOverlay public final FormProps formMethod(FormMethod s) { formMethod = s.name(); return this; } @JsOverlay public final FormProps name(String s) { name = s; return this; } @JsOverlay public final FormProps formNoValidate(boolean b) { formNoValidate = b; return this; } @JsOverlay public final FormProps formTarget(Target t) { formTarget = t.name(); return this; } @JsOverlay public final FormProps formTarget(String s) { formTarget = s; return this; } //React Specific @Deprecated @JsOverlay public final FormProps ref(String s) { ref = s; return this; } @JsOverlay public final FormProps ref(ReactRefCallback callback) { ref = callback; return this; }
// Path: src/gwt/react/client/api/ReactRef.java // @JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object") // public class ReactRef<T> { // @JsProperty // public T current; // } // // Path: src/gwt/react/client/proptypes/ReactRefCallback.java // @JsFunction // public interface ReactRefCallback { // void passRef(Object refElement); // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/FormMethod.java // public enum FormMethod { // get, post // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/OnOff.java // public enum OnOff { // on, off // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/Target.java // public enum Target { // blank("_blank"), // self("_self"), // parent("_parent"), // top("_top"); // // private String val; // // Target(String val) { // this.val = val; // } // // String getVal() { // return val; // } // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/YesNo.java // public enum YesNo { // yes, no // } // Path: src/gwt/react/client/proptypes/html/FormProps.java import elemental2.dom.HTMLFormElement; import gwt.react.client.api.ReactRef; import gwt.react.client.events.*; import gwt.react.client.proptypes.ReactRefCallback; import gwt.react.client.proptypes.html.attributeTypes.FormMethod; import gwt.react.client.proptypes.html.attributeTypes.OnOff; import gwt.react.client.proptypes.html.attributeTypes.Target; import gwt.react.client.proptypes.html.attributeTypes.YesNo; import jsinterop.annotations.JsOverlay; import jsinterop.annotations.JsPackage; import jsinterop.annotations.JsType; package gwt.react.client.proptypes.html; /** * Props for form elements. Refer to http://www.w3schools.com/tags/tag_form.asp */ @JsType(isNative=true, namespace=JsPackage.GLOBAL, name="Object") public class FormProps extends HtmlGlobalFields { @JsOverlay public final FormProps acceptCharset(String s) { acceptCharset = s; return this; } @JsOverlay public final FormProps action(String s) { action = s; return this; } @JsOverlay public final FormProps autoComplete(OnOff s) { autoComplete = s.name(); return this; } @JsOverlay public final FormProps formEncType(String s) { formEncType = s; return this; } @JsOverlay public final FormProps formMethod(FormMethod s) { formMethod = s.name(); return this; } @JsOverlay public final FormProps name(String s) { name = s; return this; } @JsOverlay public final FormProps formNoValidate(boolean b) { formNoValidate = b; return this; } @JsOverlay public final FormProps formTarget(Target t) { formTarget = t.name(); return this; } @JsOverlay public final FormProps formTarget(String s) { formTarget = s; return this; } //React Specific @Deprecated @JsOverlay public final FormProps ref(String s) { ref = s; return this; } @JsOverlay public final FormProps ref(ReactRefCallback callback) { ref = callback; return this; }
@JsOverlay public final FormProps ref(ReactRef<HTMLFormElement> reactRef) { ref = reactRef; return this; }
GWTReact/gwt-react
src/gwt/react/client/proptypes/html/FormProps.java
// Path: src/gwt/react/client/api/ReactRef.java // @JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object") // public class ReactRef<T> { // @JsProperty // public T current; // } // // Path: src/gwt/react/client/proptypes/ReactRefCallback.java // @JsFunction // public interface ReactRefCallback { // void passRef(Object refElement); // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/FormMethod.java // public enum FormMethod { // get, post // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/OnOff.java // public enum OnOff { // on, off // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/Target.java // public enum Target { // blank("_blank"), // self("_self"), // parent("_parent"), // top("_top"); // // private String val; // // Target(String val) { // this.val = val; // } // // String getVal() { // return val; // } // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/YesNo.java // public enum YesNo { // yes, no // }
import elemental2.dom.HTMLFormElement; import gwt.react.client.api.ReactRef; import gwt.react.client.events.*; import gwt.react.client.proptypes.ReactRefCallback; import gwt.react.client.proptypes.html.attributeTypes.FormMethod; import gwt.react.client.proptypes.html.attributeTypes.OnOff; import gwt.react.client.proptypes.html.attributeTypes.Target; import gwt.react.client.proptypes.html.attributeTypes.YesNo; import jsinterop.annotations.JsOverlay; import jsinterop.annotations.JsPackage; import jsinterop.annotations.JsType;
package gwt.react.client.proptypes.html; /** * Props for form elements. Refer to http://www.w3schools.com/tags/tag_form.asp */ @JsType(isNative=true, namespace=JsPackage.GLOBAL, name="Object") public class FormProps extends HtmlGlobalFields { @JsOverlay public final FormProps acceptCharset(String s) { acceptCharset = s; return this; } @JsOverlay public final FormProps action(String s) { action = s; return this; } @JsOverlay public final FormProps autoComplete(OnOff s) { autoComplete = s.name(); return this; } @JsOverlay public final FormProps formEncType(String s) { formEncType = s; return this; } @JsOverlay public final FormProps formMethod(FormMethod s) { formMethod = s.name(); return this; } @JsOverlay public final FormProps name(String s) { name = s; return this; } @JsOverlay public final FormProps formNoValidate(boolean b) { formNoValidate = b; return this; } @JsOverlay public final FormProps formTarget(Target t) { formTarget = t.name(); return this; } @JsOverlay public final FormProps formTarget(String s) { formTarget = s; return this; } //React Specific @Deprecated @JsOverlay public final FormProps ref(String s) { ref = s; return this; } @JsOverlay public final FormProps ref(ReactRefCallback callback) { ref = callback; return this; } @JsOverlay public final FormProps ref(ReactRef<HTMLFormElement> reactRef) { ref = reactRef; return this; } @JsOverlay public final FormProps key(String s) { key = s; return this; } //Global HTML props @JsOverlay public final FormProps accessKey(String s) { accessKey = s;return this;} @JsOverlay public final FormProps className(String s) { className = s; return this; } @JsOverlay public final FormProps contentEditable(boolean b) { contentEditable = b; return this; } @JsOverlay public final FormProps contextMenu(String s) { contextMenu = s; return this; } @JsOverlay public final FormProps dir(String s) { dir = s; return this; } @JsOverlay public final FormProps draggable(boolean b) { draggable = b; return this; } @JsOverlay public final FormProps hidden(boolean b) { hidden = b; return this; } @JsOverlay public final FormProps id(String s) { id = s; return this; } @JsOverlay public final FormProps lang(String s) { lang = s; return this; } @JsOverlay public final FormProps spellcheck(boolean b) { spellCheck = b; return this; } @JsOverlay public final FormProps style(CssProps s) { style = s; return this; } @JsOverlay public final FormProps tabIndex(int i) { tabIndex = i; return this; } @JsOverlay public final FormProps title(String s) { title = s; return this; }
// Path: src/gwt/react/client/api/ReactRef.java // @JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object") // public class ReactRef<T> { // @JsProperty // public T current; // } // // Path: src/gwt/react/client/proptypes/ReactRefCallback.java // @JsFunction // public interface ReactRefCallback { // void passRef(Object refElement); // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/FormMethod.java // public enum FormMethod { // get, post // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/OnOff.java // public enum OnOff { // on, off // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/Target.java // public enum Target { // blank("_blank"), // self("_self"), // parent("_parent"), // top("_top"); // // private String val; // // Target(String val) { // this.val = val; // } // // String getVal() { // return val; // } // } // // Path: src/gwt/react/client/proptypes/html/attributeTypes/YesNo.java // public enum YesNo { // yes, no // } // Path: src/gwt/react/client/proptypes/html/FormProps.java import elemental2.dom.HTMLFormElement; import gwt.react.client.api.ReactRef; import gwt.react.client.events.*; import gwt.react.client.proptypes.ReactRefCallback; import gwt.react.client.proptypes.html.attributeTypes.FormMethod; import gwt.react.client.proptypes.html.attributeTypes.OnOff; import gwt.react.client.proptypes.html.attributeTypes.Target; import gwt.react.client.proptypes.html.attributeTypes.YesNo; import jsinterop.annotations.JsOverlay; import jsinterop.annotations.JsPackage; import jsinterop.annotations.JsType; package gwt.react.client.proptypes.html; /** * Props for form elements. Refer to http://www.w3schools.com/tags/tag_form.asp */ @JsType(isNative=true, namespace=JsPackage.GLOBAL, name="Object") public class FormProps extends HtmlGlobalFields { @JsOverlay public final FormProps acceptCharset(String s) { acceptCharset = s; return this; } @JsOverlay public final FormProps action(String s) { action = s; return this; } @JsOverlay public final FormProps autoComplete(OnOff s) { autoComplete = s.name(); return this; } @JsOverlay public final FormProps formEncType(String s) { formEncType = s; return this; } @JsOverlay public final FormProps formMethod(FormMethod s) { formMethod = s.name(); return this; } @JsOverlay public final FormProps name(String s) { name = s; return this; } @JsOverlay public final FormProps formNoValidate(boolean b) { formNoValidate = b; return this; } @JsOverlay public final FormProps formTarget(Target t) { formTarget = t.name(); return this; } @JsOverlay public final FormProps formTarget(String s) { formTarget = s; return this; } //React Specific @Deprecated @JsOverlay public final FormProps ref(String s) { ref = s; return this; } @JsOverlay public final FormProps ref(ReactRefCallback callback) { ref = callback; return this; } @JsOverlay public final FormProps ref(ReactRef<HTMLFormElement> reactRef) { ref = reactRef; return this; } @JsOverlay public final FormProps key(String s) { key = s; return this; } //Global HTML props @JsOverlay public final FormProps accessKey(String s) { accessKey = s;return this;} @JsOverlay public final FormProps className(String s) { className = s; return this; } @JsOverlay public final FormProps contentEditable(boolean b) { contentEditable = b; return this; } @JsOverlay public final FormProps contextMenu(String s) { contextMenu = s; return this; } @JsOverlay public final FormProps dir(String s) { dir = s; return this; } @JsOverlay public final FormProps draggable(boolean b) { draggable = b; return this; } @JsOverlay public final FormProps hidden(boolean b) { hidden = b; return this; } @JsOverlay public final FormProps id(String s) { id = s; return this; } @JsOverlay public final FormProps lang(String s) { lang = s; return this; } @JsOverlay public final FormProps spellcheck(boolean b) { spellCheck = b; return this; } @JsOverlay public final FormProps style(CssProps s) { style = s; return this; } @JsOverlay public final FormProps tabIndex(int i) { tabIndex = i; return this; } @JsOverlay public final FormProps title(String s) { title = s; return this; }
@JsOverlay public final FormProps translate(YesNo s) { translate = s.name(); return this; }
GWTReact/gwt-react
src/gwt/react/client/api/ChildrenMapFn.java
// Path: src/gwt/react/client/elements/ReactElement.java // @JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object") // public class ReactElement { // public Object type; // public BaseProps props; // public String key; // // /** // * Objects of this class cannot be directly instantiated by the user. // */ // protected ReactElement() { // } // }
import jsinterop.annotations.JsFunction; import gwt.react.client.elements.ReactElement;
package gwt.react.client.api; /* The MIT License (MIT) Copyright (c) 2016 GWT React Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ @JsFunction public interface ChildrenMapFn {
// Path: src/gwt/react/client/elements/ReactElement.java // @JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object") // public class ReactElement { // public Object type; // public BaseProps props; // public String key; // // /** // * Objects of this class cannot be directly instantiated by the user. // */ // protected ReactElement() { // } // } // Path: src/gwt/react/client/api/ChildrenMapFn.java import jsinterop.annotations.JsFunction; import gwt.react.client.elements.ReactElement; package gwt.react.client.api; /* The MIT License (MIT) Copyright (c) 2016 GWT React Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ @JsFunction public interface ChildrenMapFn {
ReactElement mapChild(ReactElement childElement);
GWTReact/gwt-react
src/gwt/react/client/components/ComponentUtils.java
// Path: src/gwt/react/client/proptypes/BaseProps.java // @JsType(isNative = true, namespace = JsPackage.GLOBAL, name="Object") // public class BaseProps extends JsPlainObj { // public ReactElementChildren children; // public String key; // public Object ref; //Either a String Id or RefCallback // }
import gwt.interop.utils.client.plainobjects.JsPlainObj; import gwt.react.client.proptypes.BaseProps;
package gwt.react.client.components; /** * Utility functions for working with ES6 style React.Components */ public class ComponentUtils { private ComponentUtils() { } /** * Given the Class of a JsType annotated {@link Component} class, return the constructor function to use in Javascript * @param cls The Class * @param <P> The type of props the {@link Component} supports * @param <S> The type of state the {@link Component} supports * @param <T> The type of {@link Component} * @return The constructor function */
// Path: src/gwt/react/client/proptypes/BaseProps.java // @JsType(isNative = true, namespace = JsPackage.GLOBAL, name="Object") // public class BaseProps extends JsPlainObj { // public ReactElementChildren children; // public String key; // public Object ref; //Either a String Id or RefCallback // } // Path: src/gwt/react/client/components/ComponentUtils.java import gwt.interop.utils.client.plainobjects.JsPlainObj; import gwt.react.client.proptypes.BaseProps; package gwt.react.client.components; /** * Utility functions for working with ES6 style React.Components */ public class ComponentUtils { private ComponentUtils() { } /** * Given the Class of a JsType annotated {@link Component} class, return the constructor function to use in Javascript * @param cls The Class * @param <P> The type of props the {@link Component} supports * @param <S> The type of state the {@link Component} supports * @param <T> The type of {@link Component} * @return The constructor function */
public static native <P extends BaseProps, S extends JsPlainObj, T extends Component<P, S>> ComponentConstructorFn<P> getCtorFn(Class<T> cls) /*-{